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.

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

mercurial