toolkit/content/tests/chrome/bug304188_window.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/content/tests/chrome/bug304188_window.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +<?xml version="1.0"?>
     1.5 +
     1.6 +<!-- This Source Code Form is subject to the terms of the Mozilla Public
     1.7 +   - License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 +   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
     1.9 +
    1.10 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
    1.11 +
    1.12 +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    1.13 +        width="600"
    1.14 +        height="600"
    1.15 +        onload="onLoad();"
    1.16 +        title="FindbarTest for bug 304188 - 
    1.17 +find-menu appears in editor element which has had makeEditable() called but designMode not set">
    1.18 +
    1.19 +  <script type="application/javascript"><![CDATA[
    1.20 +    var gFindBar = null;
    1.21 +    var gBrowser;
    1.22 +
    1.23 +    function ok(condition, message) {
    1.24 +      window.opener.wrappedJSObject.SimpleTest.ok(condition, message);
    1.25 +    }
    1.26 +    function finish() {
    1.27 +      window.close();
    1.28 +      window.opener.wrappedJSObject.SimpleTest.finish();
    1.29 +    }
    1.30 +
    1.31 +    function onLoad() {
    1.32 +      gFindBar = document.getElementById("FindToolbar");
    1.33 +      gBrowser = document.getElementById("content");
    1.34 +      var webnav = gBrowser.webNavigation;
    1.35 +      var edsession = webnav.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
    1.36 +                            .getInterface(Components.interfaces.nsIEditingSession);
    1.37 +      edsession.makeWindowEditable(gBrowser.contentWindow, "html", false, true, false);
    1.38 +      gBrowser.contentWindow.focus();
    1.39 +      enterStringIntoEditor("'");
    1.40 +      enterStringIntoEditor("/");
    1.41 +      ok(gFindBar.hidden,
    1.42 +         "Findfield should have stayed hidden after entering editor test");
    1.43 +      finish();
    1.44 +    }
    1.45 +
    1.46 +    function enterStringIntoEditor(aString) {
    1.47 +      for (var i=0; i < aString.length; i++) {
    1.48 +        var event = gBrowser.contentDocument.createEvent("KeyEvents");
    1.49 +        event.initKeyEvent("keypress", true, true, null, false, false,
    1.50 +                           false, false, 0, aString.charCodeAt(i));
    1.51 +        gBrowser.contentDocument.body.dispatchEvent(event);
    1.52 +      }
    1.53 +    }
    1.54 +  ]]></script>
    1.55 +
    1.56 +  <browser id="content" flex="1" src="data:text/html;charset=utf-8,some%20random%20text" type="content-primary"/>
    1.57 +  <findbar id="FindToolbar" browserid="content"/>
    1.58 +</window>

mercurial