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.

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

mercurial