toolkit/components/prompts/test/test_bug619644.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=619644
     5 -->
     6 <head>
     7   <title>Test for Bug 619644</title>
     8   <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
     9   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    10   <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    11   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    12 </head>
    13 <body>
    14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=619644">Mozilla Bug 619644</a>
    15 <pre id="test">
    16 <script class="testbody" type="text/javascript">
    17 function hasTabModalPrompts() {
    18   var prefName = "prompts.tab_modal.enabled";
    19   Services = SpecialPowers.Services;
    20   return Services.prefs.getPrefType(prefName) == Services.prefs.PREF_BOOL &&
    21          Services.prefs.getBoolPref(prefName);
    22 }
    24 if (!hasTabModalPrompts()) {
    25   todo(false, "Test disabled when tab modal prompts are not enabled.");
    26 } else {
    27 SimpleTest.waitForExplicitFinish();
    29 // This is a little yucky, but it works
    30 // The contents of bug619644_inner.html
    31 const expectedFinalDoc = 
    32 "<head><\/head><body><p>Original content<\/p>\n<script>\n    window.opener.postMessage(\"\", \"*\");\n    confirm (\"Message\");\n    document.write (\"Extra content\");\n    window.opener.postMessage(document.documentElement.innerHTML, \"*\");\n<\/script>Extra content<\/body>";
    34 function runtest(e)
    35 {
    36   window.removeEventListener("message", runtest, false);
    37   window.addEventListener("message", checktest, false);
    38   synthesizeKey("VK_ESCAPE", {}, e.source);
    39 }
    41 function checktest(e) {
    42   is(e.data, expectedFinalDoc, "ESC press should not abort document load");
    43   e.source.close();
    44   SimpleTest.finish();
    45 }
    47 window.addEventListener("message", runtest, false);
    48 window.open("bug619644_inner.html", "619644");
    49 }
    50 </script>
    51 </pre>
    52 </body>
    53 </html>

mercurial