toolkit/content/tests/chrome/bug304188_window.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"?>
     3 <!-- This Source Code Form is subject to the terms of the Mozilla Public
     4    - License, v. 2.0. If a copy of the MPL was not distributed with this
     5    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
     7 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     9 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    10         width="600"
    11         height="600"
    12         onload="onLoad();"
    13         title="FindbarTest for bug 304188 - 
    14 find-menu appears in editor element which has had makeEditable() called but designMode not set">
    16   <script type="application/javascript"><![CDATA[
    17     var gFindBar = null;
    18     var gBrowser;
    20     function ok(condition, message) {
    21       window.opener.wrappedJSObject.SimpleTest.ok(condition, message);
    22     }
    23     function finish() {
    24       window.close();
    25       window.opener.wrappedJSObject.SimpleTest.finish();
    26     }
    28     function onLoad() {
    29       gFindBar = document.getElementById("FindToolbar");
    30       gBrowser = document.getElementById("content");
    31       var webnav = gBrowser.webNavigation;
    32       var edsession = webnav.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
    33                             .getInterface(Components.interfaces.nsIEditingSession);
    34       edsession.makeWindowEditable(gBrowser.contentWindow, "html", false, true, false);
    35       gBrowser.contentWindow.focus();
    36       enterStringIntoEditor("'");
    37       enterStringIntoEditor("/");
    38       ok(gFindBar.hidden,
    39          "Findfield should have stayed hidden after entering editor test");
    40       finish();
    41     }
    43     function enterStringIntoEditor(aString) {
    44       for (var i=0; i < aString.length; i++) {
    45         var event = gBrowser.contentDocument.createEvent("KeyEvents");
    46         event.initKeyEvent("keypress", true, true, null, false, false,
    47                            false, false, 0, aString.charCodeAt(i));
    48         gBrowser.contentDocument.body.dispatchEvent(event);
    49       }
    50     }
    51   ]]></script>
    53   <browser id="content" flex="1" src="data:text/html;charset=utf-8,some%20random%20text" type="content-primary"/>
    54   <findbar id="FindToolbar" browserid="content"/>
    55 </window>

mercurial