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.

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

mercurial