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/ipc/tests/test_cpow_cookies.html | |
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/ipc/tests/test_cpow_cookies.html')
-rw-r--r-- | dom/ipc/tests/test_cpow_cookies.html | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/dom/ipc/tests/test_cpow_cookies.html b/dom/ipc/tests/test_cpow_cookies.html new file mode 100644 index 000000000..1e55d3878 --- /dev/null +++ b/dom/ipc/tests/test_cpow_cookies.html @@ -0,0 +1,90 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Test for recursive CPOW-getting-cookie bug</title> + <script type="application/javascript" + src="/tests/SimpleTest/SimpleTest.js"> + </script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> +</head> +<body> + + <script type="application/javascript;version=1.8"> + "use strict"; + + SimpleTest.waitForExplicitFinish(); + + const childFrameURL = + "data:text/html,<!DOCTYPE HTML><html><body></body></html>"; + + function childFrameScript() { + "use strict"; + + const Ci = Components.interfaces; + + function test1(message) { + // NB: This is a no-op because we're a data: document with a null + // principal. + content.document.cookie = "a=b"; + message.target.sendAsyncMessage("testCPOWCookies:test1Finished", { pass: true }); + } + + addMessageListener("testCPOWCookies:test1", function(message) { + test1(message); + }); + } + + let test; + function* testStructure(mm) { + let lastResult; + + function testDone(msg) { + test.next(msg.data); + } + + mm.addMessageListener("testCPOWCookies:test1Finished", testDone); + + mm.sendAsyncMessage("testCPOWCookies:test1", {}); + lastResult = yield; + ok(lastResult.pass, "got the right answer and didn't crash"); + + SimpleTest.finish(); + } + + function runTests() { + info("Browser prefs set."); + + let iframe = document.createElement("iframe"); + SpecialPowers.wrap(iframe).mozbrowser = true; + iframe.id = "iframe"; + iframe.src = childFrameURL; + + iframe.addEventListener("mozbrowserloadend", function() { + info("Got iframe load event."); + let mm = SpecialPowers.getBrowserFrameMessageManager(iframe); + mm.loadFrameScript("data:,(" + encodeURI(childFrameScript.toString()) + ")();", + false); + + test = testStructure(mm); + test.next(); + }); + + document.body.appendChild(iframe); + } + + addEventListener("load", function() { + info("Got load event."); + + SpecialPowers.addPermission("browser", true, document); + SpecialPowers.pushPrefEnv({ + "set": [ + ["dom.ipc.browser_frames.oop_by_default", true], + ["dom.mozBrowserFramesEnabled", true], + ["network.disable.ipc.security", true], + ["browser.pagethumbnails.capturing_disabled", true] + ] + }, runTests); + }); + </script> +</body> +</html> |