1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/content/tests/chrome/bug331215_window.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,73 @@ 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 id="331215test" 1.13 + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 1.14 + width="600" 1.15 + height="600" 1.16 + onload="SimpleTest.executeSoon(startTest);" 1.17 + title="331215 test"> 1.18 + 1.19 + <script type="application/javascript"><![CDATA[ 1.20 + const Ci = Components.interfaces; 1.21 + const Cc = Components.classes; 1.22 + const Cr = Components.results; 1.23 + 1.24 + var gFindBar = null; 1.25 + var gBrowser; 1.26 + 1.27 + var imports = ["SimpleTest", "ok"]; 1.28 + for each (var name in imports) { 1.29 + window[name] = window.opener.wrappedJSObject[name]; 1.30 + } 1.31 + 1.32 + function finish() { 1.33 + window.close(); 1.34 + SimpleTest.finish(); 1.35 + } 1.36 + 1.37 + function startTest() { 1.38 + gFindBar = document.getElementById("FindToolbar"); 1.39 + gBrowser = document.getElementById("content"); 1.40 + gBrowser.addEventListener("pageshow", onPageShow, false); 1.41 + gBrowser.loadURI("data:text/plain,latest"); 1.42 + } 1.43 + 1.44 + function onPageShow() { 1.45 + document.getElementById("cmd_find").doCommand(); 1.46 + enterStringIntoFindField("test"); 1.47 + document.commandDispatcher 1.48 + .getControllerForCommand("cmd_moveTop") 1.49 + .doCommand("cmd_moveTop"); 1.50 + enterStringIntoFindField("l"); 1.51 + ok(gFindBar._findField.getAttribute("status") == "notfound", 1.52 + "Findfield status attribute should have been 'notfound'" + 1.53 + " after entering ltest"); 1.54 + enterStringIntoFindField("a"); 1.55 + ok(gFindBar._findField.getAttribute("status") != "notfound", 1.56 + "Findfield status attribute should not have been 'notfound'" + 1.57 + " after entering latest"); 1.58 + finish(); 1.59 + } 1.60 + 1.61 + function enterStringIntoFindField(aString) { 1.62 + for (var i=0; i < aString.length; i++) { 1.63 + var event = document.createEvent("KeyEvents"); 1.64 + event.initKeyEvent("keypress", true, true, null, false, false, 1.65 + false, false, 0, aString.charCodeAt(i)); 1.66 + gFindBar._findField.inputField.dispatchEvent(event); 1.67 + } 1.68 + } 1.69 + ]]></script> 1.70 + 1.71 + <commandset> 1.72 + <command id="cmd_find" oncommand="document.getElementById('FindToolbar').onFindCommand();"/> 1.73 + </commandset> 1.74 + <browser type="content-primary" flex="1" id="content" src="about:blank"/> 1.75 + <findbar id="FindToolbar" browserid="content"/> 1.76 +</window>