dom/events/test/test_bug602962.xul

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 <?xml version="1.0"?>
     2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
     4 <!--
     5 https://bugzilla.mozilla.org/show_bug.cgi?id=602962
     6 -->
     7 <window title="Mozilla Bug 602962" onload="openWindow()"
     8   xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    10   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
    12 <body  xmlns="http://www.w3.org/1999/xhtml">
    13   <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=602962">Mozilla Bug 602962</a>
    14   <p id="display"></p>
    15 <div id="content" style="display: none">
    16 </div>
    17 </body>
    19 <script class="testbody" type="application/javascript;version=1.8"><![CDATA[
    20 /** Test for Bug 602962 **/
    21 var scrollbox, sbo, content;
    22 var scrollX = 0, scrollY = 0;
    24 var oldWidth = 0, oldHeight = 0;
    25 var win = null;
    27 function openWindow() {
    28   win = window.open("chrome://mochitests/content/chrome/dom/events/test/bug602962.xul", "_blank", "width=600,height=600");
    29 }
    31 function doTest() {
    32   scrollbox = win.document.getElementById("page-scrollbox");
    33   sbo = scrollbox.boxObject.QueryInterface(Components.interfaces.nsIScrollBoxObject);
    34   content = win.document.getElementById("page-box");
    35   content.style.width = 400 + "px";
    37   win.addEventListener("resize", function() {
    38     win.removeEventListener("resize", arguments.callee, false);
    40     sbo.scrollBy(200, 0);
    41     setTimeout(function() { resize(); }, 0);
    42   }, false);
    44   oldWidth = win.outerWidth;
    45   oldHeight = win.outerHeight;
    46   win.resizeTo(200, 400);
    47 }
    49 function resize() {
    50   let x = {}, y = {};
    51   sbo.getPosition(x, y);
    52   scrollX = x.value, scrollY = y.value;
    54   win.addEventListener("resize", function() {
    55     content.style.width = (oldWidth + 400) + "px";
    56     win.removeEventListener("resize", arguments.callee, true);
    58     setTimeout(function() {
    59       finish();
    60     }, 0);
    61   }, true);
    63   win.resizeTo(oldWidth, oldHeight);
    64 }
    66 function finish() {
    67   if (win.outerWidth != oldWidth ||
    68       win.outerHeight != oldHeight) {
    69     // We should eventually get back to the original size.
    70     setTimeout(finish, 0);
    71     return;
    72   }
    73   sbo.scrollBy(scrollX, scrollY);
    75   let x = {}, y = {};
    76   sbo.getPosition(x, y);
    77   is(x.value, 200, "Scroll X should have been restored to the value before the resize");
    78   is(y.value, 0, "Scroll Y should have been restored to the value before the resize");
    80   is(win.outerWidth, oldWidth, "Width should be resized");
    81   is(win.outerHeight, oldHeight, "Height should be resized");
    82   win.close();
    83   SimpleTest.finish();
    84 }
    86 SimpleTest.waitForExplicitFinish();
    87 ]]></script>
    89 </window>

mercurial