toolkit/content/tests/chrome/window_chromemargin.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 <!-- This Source Code Form is subject to the terms of the Mozilla Public
     3    - License, v. 2.0. If a copy of the MPL was not distributed with this
     4    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
     5 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     7 <window id="window" title="Subframe Origin Tests"
     8         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
     9 <script type="application/javascript"
    10         src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
    11 chrome margins rock!
    12 <script>
    14 // Tests parsing of the chrome margin attrib on a window.
    16 function ok(condition, message) {
    17   window.opener.wrappedJSObject.SimpleTest.ok(condition, message);
    18 }
    20 function doSingleTest(param, shouldSucceed)
    21 {
    22   var exception = null;
    23   try {
    24     document.documentElement.removeAttribute("chromemargin");
    25     document.documentElement.setAttribute("chromemargin", param);
    26     ok(document.
    27        documentElement.
    28        getAttribute("chromemargin") == param, "couldn't set/get chromemargin?");
    29   } catch (ex) {
    30     exception = ex;
    31   }
    32   if (shouldSucceed)
    33     ok(!exception, "failed for param:'" + param + "'");
    34   else
    35     ok(exception, "did not fail for invalid param:'" + param + "'");
    36   return true;
    37 }
    39 function runTests()
    40 {
    41   var doc = document.documentElement;
    43   // make sure we can set and get
    44   doc.setAttribute("chromemargin", "0,0,0,0");
    45   ok(doc.getAttribute("chromemargin") == "0,0,0,0", "couldn't set/get chromemargin?");
    46   doc.setAttribute("chromemargin", "-1,-1,-1,-1");
    47   ok(doc.getAttribute("chromemargin") == "-1,-1,-1,-1", "couldn't set/get chromemargin?");
    49   // test remove
    50   doc.removeAttribute("chromemargin");
    51   ok(doc.getAttribute("chromemargin") == "", "couldn't remove chromemargin?");
    53   // we already test these really well in a c++ test in widget
    54   doSingleTest("1,2,3,4", true);
    55   doSingleTest("-2,-2,-2,-2", true);
    56   doSingleTest("1,1,1,1", true);
    57   doSingleTest("", false);
    58   doSingleTest("12123123", false);
    59   doSingleTest("0,-1,-1,-1", true);
    60   doSingleTest("-1,0,-1,-1", true);
    61   doSingleTest("-1,-1,0,-1", true);
    62   doSingleTest("-1,-1,-1,0", true);
    63   doSingleTest("1234567890,1234567890,1234567890,1234567890", true);
    64   doSingleTest("-1,-1,-1,-1", true);
    66   window.opener.wrappedJSObject.SimpleTest.finish();
    67   window.close();
    68 }
    70 window.opener.wrappedJSObject.SimpleTest.waitForFocus(runTests, window);
    72 </script>
    73 </window>

mercurial