editor/libeditor/base/tests/test_bug646194.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"
     3                  type="text/css"?>
     4 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
     5                  type="text/css"?>
     6 <!--
     7 https://bugzilla.mozilla.org/show_bug.cgi?id=646194
     8 -->
     9 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    10         title="Mozilla Bug 646194" onload="runTest();">
    11   <script type="application/javascript"
    12           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
    14   <body xmlns="http://www.w3.org/1999/xhtml">
    15   <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=646194"
    16      target="_blank">Mozilla Bug 646194</a>
    17   <p/>
    18   <iframe id="i" src="data:text/html,&lt;div contenteditable=true id=t&gt;test me now&lt;/div&gt;"/>
    19   <p/>
    20   <pre id="test">
    21   </pre>
    22   </body>
    23   <script class="testbody" type="application/javascript">
    24   <![CDATA[
    26 SimpleTest.expectAssertions(1);
    28 function runTest() {
    29   function doCommand(aCmd) {
    30     var controller = top.document.commandDispatcher
    31                      .getControllerForCommand(aCmd);
    32     ok((controller && controller.isCommandEnabled(aCmd)), "command available");
    33     controller.doCommand(aCmd);
    34   }
    36   var i = document.getElementById("i");
    37   i.focus();
    38   var win = i.contentWindow;
    39   var doc = i.contentDocument;
    40   var t = doc.getElementById("t");
    41   t.focus();
    42   // put the caret at the end
    43   win.getSelection().collapse(t.firstChild, 11);
    45   // Simulate pression Option+Delete on Mac
    46   // We do things this way because not every platform can invoke this
    47   // command using the available key bindings.
    48   doCommand("cmd_wordPrevious");
    49   doCommand("cmd_wordPrevious");
    50   doCommand("cmd_deleteWordBackward");
    51   doCommand("cmd_deleteWordBackward");
    53   // If we reach here, we haven't crashed.  Phew!
    54   // But let's check the value too, now that we're here.
    55   is(t.textContent, "me now", "The command has worked correctly");
    57   SimpleTest.finish();
    58 }
    60 SimpleTest.waitForExplicitFinish();
    61 ]]>
    62 </script>
    63 </window>

mercurial