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

Side by Side 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: Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <script src="../../resources/js-test.js"></script>
2 <script>
3 description("This test checks if accessing navigator.serviceWorker doesn't fail with invalid frame");
4
5 if (window.testRunner) {
6 testRunner.dumpAsText();
dominicc (has gone to gerrit) 2014/03/31 04:52:09 I could be wrong, but isn't dumpAsText the default
kinuko 2014/03/31 12:33:05 I removed this as I've converted it to use w3c tes
7 testRunner.setCanOpenWindows();
dominicc (has gone to gerrit) 2014/03/31 04:52:09 Do you need separate windows? Why not just use an
kinuko 2014/03/31 12:33:05 Hmm, on my local env I keep failing to repro the c
8 testRunner.waitUntilDone();
9 }
10
11 var callbackCount = 0;
12 function callback() {
13 ++callbackCount;
14 if (callbackCount == 100) {
15 debug("DONE");
16 testRunner.notifyDone();
17 return;
18 }
19 try {
20 // window.navigator is replaced with a new window's one, which could
21 // be now invalid.
22 var sw = navigator.serviceWorker;
23 } catch (error) {}
24 var w = window.open("x", "y");
25 window.navigator = w.navigator;
26 setTimeout(callback, 1);
27 }
28
29 setTimeout(callback, 1);
dominicc (has gone to gerrit) 2014/03/31 04:52:09 Why do it 100 times? Do you just need a strategic
kinuko 2014/03/31 12:33:05 Either with gc() or not I can't seem to reliably r
30 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698