1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/content/tests/chrome/bug429723_window.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,84 @@ 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="429723Test" 1.13 + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 1.14 + width="600" 1.15 + height="600" 1.16 + onload="onLoad();" 1.17 + title="429723 test"> 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 + 1.27 + function finish() { 1.28 + window.close(); 1.29 + window.opener.wrappedJSObject.SimpleTest.finish(); 1.30 + } 1.31 + 1.32 + function onLoad() { 1.33 + var _delayedOnLoad = function() { 1.34 + gFindBar = document.getElementById("FindToolbar"); 1.35 + gBrowser = document.getElementById("content"); 1.36 + gBrowser.addEventListener("pageshow", onPageShow, false); 1.37 + gBrowser.loadURI("data:text/html,<h2 id='h2'>mozilla</h2>"); 1.38 + } 1.39 + setTimeout(_delayedOnLoad, 1000); 1.40 + } 1.41 + 1.42 + function enterStringIntoFindField(aString) { 1.43 + for (var i=0; i < aString.length; i++) { 1.44 + var event = document.createEvent("KeyEvents"); 1.45 + event.initKeyEvent("keypress", true, true, null, false, false, 1.46 + false, false, 0, aString.charCodeAt(i)); 1.47 + gFindBar._findField.inputField.dispatchEvent(event); 1.48 + } 1.49 + } 1.50 + 1.51 + function onPageShow() { 1.52 + gBrowser.removeEventListener("pageshow", onPageShow, false); 1.53 + var findField = gFindBar._findField; 1.54 + document.getElementById("cmd_find").doCommand(); 1.55 + 1.56 + var matchCaseCheckbox = gFindBar.getElement("find-case-sensitive"); 1.57 + if (!matchCaseCheckbox.hidden & matchCaseCheckbox.checked) 1.58 + matchCaseCheckbox.click(); 1.59 + 1.60 + // Perform search 1.61 + var searchStr = "z"; 1.62 + enterStringIntoFindField(searchStr); 1.63 + 1.64 + // Highlight search term 1.65 + var highlight = gFindBar.getElement("highlight"); 1.66 + if (!highlight.checked) 1.67 + highlight.click(); 1.68 + 1.69 + // Delete search term 1.70 + var event = document.createEvent("KeyEvents"); 1.71 + event.initKeyEvent("keypress", true, true, null, false, false, 1.72 + false, false, KeyEvent.DOM_VK_BACK_SPACE, 0); 1.73 + gFindBar._findField.inputField.dispatchEvent(event); 1.74 + 1.75 + var notRed = !findField.hasAttribute("status") || 1.76 + (findField.getAttribute("status") != "notfound"); 1.77 + ok(notRed, "Find Bar textbox is correct colour"); 1.78 + finish(); 1.79 + } 1.80 + ]]></script> 1.81 + 1.82 + <commandset> 1.83 + <command id="cmd_find" oncommand="document.getElementById('FindToolbar').onFindCommand();"/> 1.84 + </commandset> 1.85 + <browser type="content-primary" flex="1" id="content" src="about:blank"/> 1.86 + <findbar id="FindToolbar" browserid="content"/> 1.87 +</window>