Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: LayoutTests/fast/serviceworker/access-container-with-invalid-context.html

Issue 217023003: Add null checks in navigator.serviceWorker access to fix possible crash (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: reverted iframe change Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/serviceworker/access-container-with-invalid-context-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/serviceworker/access-container-with-invalid-context.html
diff --git a/LayoutTests/fast/serviceworker/access-container-with-invalid-context.html b/LayoutTests/fast/serviceworker/access-container-with-invalid-context.html
new file mode 100644
index 0000000000000000000000000000000000000000..12d9d284e864c05080f8b6183c2b73996f8fc9c1
--- /dev/null
+++ b/LayoutTests/fast/serviceworker/access-container-with-invalid-context.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<div id="container"></div>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+var test = async_test("This test checks if accessing navigator.serviceWorker doesn't crash with invalid frame");
+
+if (testRunner)
+ testRunner.setCanOpenWindows();
+
+function callback() {
+ // At this time window.navigator may be replaced with a new iframe's one,
+ // which could be now invalid.
+ var sw = navigator.serviceWorker;
+ test.done();
+}
+
+test.step(function() {
+ var w = window.open("x", "y");
+ window.navigator = w.navigator;
+ setTimeout(callback, 1);
+});
+</script>
« no previous file with comments | « no previous file | LayoutTests/fast/serviceworker/access-container-with-invalid-context-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698