dom/bindings/test/test_barewordGetsWindow.html

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=936056
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <meta charset="utf-8">
michael@0 8 <title>Test for Bug 936056</title>
michael@0 9 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 11 <script type="application/javascript">
michael@0 12
michael@0 13 /** Test for Bug 936056 **/
michael@0 14 SimpleTest.waitForExplicitFinish();
michael@0 15 window.onload = function() {
michael@0 16 var desc = Object.getOwnPropertyDescriptor(frames[0], "document");
michael@0 17 if (!desc || !desc.get) {
michael@0 18 todo(false, "This test does nothing so far, but will once Window is on WebIDL bindings");
michael@0 19 SimpleTest.finish();
michael@0 20 return;
michael@0 21 }
michael@0 22 get = desc.get;
michael@0 23 ok(get, "Couldn't find document getter");
michael@0 24 Object.defineProperty(frames[0], "foo", { get: get });
michael@0 25
michael@0 26 var barewordFunc = frames[0].eval("(function (count) { var doc; for (var i = 0; i < count; ++i) doc = foo; return doc.documentElement; })");
michael@0 27 var qualifiedFunc = frames[0].eval("(function (count) { var doc; for (var i = 0; i < count; ++i) doc = window.document; return doc.documentElement; })");
michael@0 28 document.querySelector("iframe").onload = function () {
michael@0 29 // interp
michael@0 30 is(barewordFunc(1).textContent, "OLD", "Bareword should see own inner 1");
michael@0 31 is(qualifiedFunc(1).textContent, "NEW",
michael@0 32 "Qualified should see current inner 1");
michael@0 33 // baseline
michael@0 34 is(barewordFunc(100).textContent, "OLD", "Bareword should see own inner 2");
michael@0 35 is(qualifiedFunc(100).textContent, "NEW",
michael@0 36 "Qualified should see current inner 2");
michael@0 37 // ion
michael@0 38 is(barewordFunc(10000).textContent, "OLD", "Bareword should see own inner 3");
michael@0 39 is(qualifiedFunc(10000).textContent, "NEW",
michael@0 40 "Qualified should see current inner 2");
michael@0 41 SimpleTest.finish();
michael@0 42 }
michael@0 43 frames[0].location = "data:text/plain,NEW";
michael@0 44 }
michael@0 45
michael@0 46
michael@0 47
michael@0 48
michael@0 49 </script>
michael@0 50 </head>
michael@0 51 <body>
michael@0 52 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=936056">Mozilla Bug 936056</a>
michael@0 53 <p id="display"></p>
michael@0 54 <div id="content" style="display: none">
michael@0 55 <iframe src="data:text/plain,OLD"></iframe>
michael@0 56 </div>
michael@0 57 <pre id="test">
michael@0 58 </pre>
michael@0 59 </body>
michael@0 60 </html>

mercurial