toolkit/content/tests/chrome/bug304188_window.xul

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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