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..1e5b48ca6578bb38de54769948988371b9c5e606 |
--- /dev/null |
+++ b/LayoutTests/fast/serviceworker/access-container-with-invalid-context.html |
@@ -0,0 +1,30 @@ |
+<script src="../../resources/js-test.js"></script> |
+<script> |
+description("This test checks if accessing navigator.serviceWorker doesn't fail with invalid frame"); |
+ |
+if (window.testRunner) { |
+ 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
|
+ 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
|
+ testRunner.waitUntilDone(); |
+} |
+ |
+var callbackCount = 0; |
+function callback() { |
+ ++callbackCount; |
+ if (callbackCount == 100) { |
+ debug("DONE"); |
+ testRunner.notifyDone(); |
+ return; |
+ } |
+ try { |
+ // window.navigator is replaced with a new window's one, which could |
+ // be now invalid. |
+ var sw = navigator.serviceWorker; |
+ } catch (error) {} |
+ var w = window.open("x", "y"); |
+ window.navigator = w.navigator; |
+ setTimeout(callback, 1); |
+} |
+ |
+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
|
+</script> |