diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/workers/test/test_WorkerDebugger_frozen.xul | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/workers/test/test_WorkerDebugger_frozen.xul')
-rw-r--r-- | dom/workers/test/test_WorkerDebugger_frozen.xul | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/dom/workers/test/test_WorkerDebugger_frozen.xul b/dom/workers/test/test_WorkerDebugger_frozen.xul new file mode 100644 index 000000000..6b22e7702 --- /dev/null +++ b/dom/workers/test/test_WorkerDebugger_frozen.xul @@ -0,0 +1,90 @@ +<?xml version="1.0"?> +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<window title="Test for WorkerDebugger with frozen workers" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + onload="test();"> + + <script type="application/javascript" + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> + <script type="application/javascript" + src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> + <script type="application/javascript" src="dom_worker_helper.js"/> + + <script type="application/javascript"> + <![CDATA[ + + const CACHE_SUBFRAMES = "browser.sessionhistory.cache_subframes"; + const MAX_TOTAL_VIEWERS = "browser.sessionhistory.max_total_viewers"; + + const IFRAME1_URL = "WorkerDebugger_frozen_iframe1.html"; + const IFRAME2_URL = "WorkerDebugger_frozen_iframe2.html"; + + const WORKER1_URL = "WorkerDebugger_frozen_worker1.js"; + const WORKER2_URL = "WorkerDebugger_frozen_worker2.js"; + + function test() { + Task.spawn(function* () { + SimpleTest.waitForExplicitFinish(); + + var oldMaxTotalViewers = SpecialPowers.getIntPref(MAX_TOTAL_VIEWERS); + + SpecialPowers.setBoolPref(CACHE_SUBFRAMES, true); + SpecialPowers.setIntPref(MAX_TOTAL_VIEWERS, 10); + + let iframe = $("iframe"); + + let promise = waitForMultiple([ + waitForRegister(WORKER1_URL), + waitForWindowMessage(window, "ready"), + ]); + iframe.src = IFRAME1_URL; + let [dbg1] = yield promise; + is(dbg1.isClosed, false, + "debugger for worker on page 1 should not be closed"); + + promise = waitForMultiple([ + waitForUnregister(WORKER1_URL), + waitForDebuggerClose(dbg1), + waitForRegister(WORKER2_URL), + waitForWindowMessage(window, "ready"), + ]); + iframe.src = IFRAME2_URL; + let [,, dbg2] = yield promise; + is(dbg1.isClosed, true, + "debugger for worker on page 1 should be closed"); + is(dbg2.isClosed, false, + "debugger for worker on page 2 should not be closed"); + + promise = Promise.all([ + waitForUnregister(WORKER2_URL), + waitForDebuggerClose(dbg2), + waitForRegister(WORKER1_URL) + ]); + iframe.contentWindow.history.back(); + [,, dbg1] = yield promise; + is(dbg1.isClosed, false, + "debugger for worker on page 1 should not be closed"); + is(dbg2.isClosed, true, + "debugger for worker on page 2 should be closed"); + + SpecialPowers.clearUserPref(CACHE_SUBFRAMES); + SpecialPowers.setIntPref(MAX_TOTAL_VIEWERS, oldMaxTotalViewers); + + SimpleTest.finish(); + }); + } + + ]]> + </script> + + <body xmlns="http://www.w3.org/1999/xhtml"> + <p id="display"></p> + <div id="content" style="display:none;"></div> + <pre id="test"></pre> + <iframe id="iframe"></iframe> + </body> + <label id="test-result"/> +</window> |