dom/tests/mochitest/whatwg/postMessage_userpass_helper.html

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 <!DOCTYPE html>
michael@0 2 <html>
michael@0 3 <head>
michael@0 4 <title>Username/password page for postMessage tests</title>
michael@0 5 <script type="application/javascript">
michael@0 6
michael@0 7 function sendMessage(evt)
michael@0 8 {
michael@0 9 var msg = "child-message";
michael@0 10
michael@0 11 if (evt.origin !== "http://mochi.test:8888")
michael@0 12 msg += " wrong-origin(" + evt.origin + ")";
michael@0 13 if (evt.data !== "parent-message")
michael@0 14 msg += " wrong-data(" + evt.data + ")";
michael@0 15 if (evt.lastEventId !== "")
michael@0 16 msg += " wrong-lastEventId(" + evt.lastEventId + ")";
michael@0 17 if (evt.source !== window.parent)
michael@0 18 msg += " wrong-source";
michael@0 19
michael@0 20 // It would be good to guarantee that we've been opened with a userinfo of
michael@0 21 // "bobhope:password", but Gecko elides that from the content-visible URL,
michael@0 22 // and I can't find another way to actually detect this programmatically.
michael@0 23
michael@0 24 window.parent.postMessage(msg, "http://mochi.test:8888");
michael@0 25 }
michael@0 26
michael@0 27 window.addEventListener("message", sendMessage, false);
michael@0 28 </script>
michael@0 29 </head>
michael@0 30 <body>
michael@0 31 <p>Kid iframe</p>
michael@0 32 </body>
michael@0 33 </html>
michael@0 34

mercurial