Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
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 id="FindbarTest" |
michael@0 | 10 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
michael@0 | 11 | width="600" |
michael@0 | 12 | height="600" |
michael@0 | 13 | onload="onLoad();" |
michael@0 | 14 | title="findbar test"> |
michael@0 | 15 | |
michael@0 | 16 | <script type="application/javascript" |
michael@0 | 17 | src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> |
michael@0 | 18 | <script type="application/javascript" |
michael@0 | 19 | src="chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js"/> |
michael@0 | 20 | |
michael@0 | 21 | <script type="application/javascript"><![CDATA[ |
michael@0 | 22 | const Ci = Components.interfaces; |
michael@0 | 23 | const Cc = Components.classes; |
michael@0 | 24 | const Cr = Components.results; |
michael@0 | 25 | |
michael@0 | 26 | const SAMPLE_URL = "http://www.mozilla.org/"; |
michael@0 | 27 | const SAMPLE_TEXT = "Some text in a text field."; |
michael@0 | 28 | const SEARCH_TEXT = "Text Test"; |
michael@0 | 29 | |
michael@0 | 30 | var gFindBar = null; |
michael@0 | 31 | var gBrowser; |
michael@0 | 32 | |
michael@0 | 33 | var gClipboard = Cc["@mozilla.org/widget/clipboard;1"].getService(Ci.nsIClipboard); |
michael@0 | 34 | var gHasFindClipboard = gClipboard.supportsFindClipboard(); |
michael@0 | 35 | |
michael@0 | 36 | var gStatusText; |
michael@0 | 37 | var gXULBrowserWindow = { |
michael@0 | 38 | QueryInterface: function(aIID) { |
michael@0 | 39 | if (aIID.Equals(Ci.nsIXULBrowserWindow) || |
michael@0 | 40 | aIID.Equals(Ci.nsISupports)) |
michael@0 | 41 | return this; |
michael@0 | 42 | |
michael@0 | 43 | throw Cr.NS_NOINTERFACE; |
michael@0 | 44 | }, |
michael@0 | 45 | |
michael@0 | 46 | setJSStatus: function() { }, |
michael@0 | 47 | |
michael@0 | 48 | setOverLink: function(aStatusText, aLink) { |
michael@0 | 49 | gStatusText = aStatusText; |
michael@0 | 50 | }, |
michael@0 | 51 | |
michael@0 | 52 | onBeforeLinkTraversal: function() { } |
michael@0 | 53 | }; |
michael@0 | 54 | |
michael@0 | 55 | function ok(condition, message) { |
michael@0 | 56 | window.opener.wrappedJSObject.SimpleTest.ok(condition, message); |
michael@0 | 57 | } |
michael@0 | 58 | function finish() { |
michael@0 | 59 | window.close(); |
michael@0 | 60 | window.opener.wrappedJSObject.SimpleTest.finish(); |
michael@0 | 61 | } |
michael@0 | 62 | |
michael@0 | 63 | function onLoad() { |
michael@0 | 64 | window.QueryInterface(Ci.nsIInterfaceRequestor) |
michael@0 | 65 | .getInterface(Ci.nsIWebNavigation) |
michael@0 | 66 | .QueryInterface(Ci.nsIDocShellTreeItem) |
michael@0 | 67 | .treeOwner |
michael@0 | 68 | .QueryInterface(Ci.nsIInterfaceRequestor) |
michael@0 | 69 | .getInterface(Ci.nsIXULWindow) |
michael@0 | 70 | .XULBrowserWindow = gXULBrowserWindow; |
michael@0 | 71 | |
michael@0 | 72 | var _delayedOnLoad = function() { |
michael@0 | 73 | gFindBar = document.getElementById("FindToolbar"); |
michael@0 | 74 | gBrowser = document.getElementById("content"); |
michael@0 | 75 | gBrowser.addEventListener("pageshow", _delayedOnPageShow, false); |
michael@0 | 76 | gBrowser.loadURI("data:text/html,<h2 id='h2'>" + SEARCH_TEXT + "</h2><h2><a href='" + SAMPLE_URL + "'>Link Test</a></h2><input id='text' type='text' value='" + SAMPLE_TEXT + "'></input><input id='button' type='button'></input><img id='img' width='50' height='50'/>"); |
michael@0 | 77 | } |
michael@0 | 78 | setTimeout(_delayedOnLoad, 1000); |
michael@0 | 79 | } |
michael@0 | 80 | |
michael@0 | 81 | function _delayedOnPageShow() { |
michael@0 | 82 | // setTimeout to the test runs after painting suppression ends |
michael@0 | 83 | setTimeout(onPageShow, 0); |
michael@0 | 84 | } |
michael@0 | 85 | |
michael@0 | 86 | function onPageShow() { |
michael@0 | 87 | testNormalFind(); |
michael@0 | 88 | gFindBar.close(); |
michael@0 | 89 | ok(gFindBar.hidden, "Failed to close findbar after testNormalFind"); |
michael@0 | 90 | testNormalFindWithComposition(); |
michael@0 | 91 | gFindBar.close(); |
michael@0 | 92 | ok(gFindBar.hidden, "findbar should be hidden after testNormalFindWithComposition"); |
michael@0 | 93 | testAutoCaseSensitivityUI(); |
michael@0 | 94 | testQuickFindText(); |
michael@0 | 95 | gFindBar.close(); |
michael@0 | 96 | ok(gFindBar.hidden, "Failed to close findbar after testQuickFindText"); |
michael@0 | 97 | testFindWithHighlight(); |
michael@0 | 98 | gFindBar.close(); |
michael@0 | 99 | ok(gFindBar.hidden, "Failed to close findbar after testFindWithHighlight"); |
michael@0 | 100 | testFindbarSelection(); |
michael@0 | 101 | testDrop(); |
michael@0 | 102 | testQuickFindLink(); |
michael@0 | 103 | if (gHasFindClipboard) |
michael@0 | 104 | testStatusText(); |
michael@0 | 105 | testQuickFindClose(); |
michael@0 | 106 | } |
michael@0 | 107 | |
michael@0 | 108 | function testFindbarSelection() { |
michael@0 | 109 | function checkFindbarState(aTestName, aExpSelection) { |
michael@0 | 110 | document.getElementById("cmd_find").doCommand(); |
michael@0 | 111 | ok(!gFindBar.hidden, "testFindbarSelection: failed to open findbar: " + aTestName); |
michael@0 | 112 | ok(document.commandDispatcher.focusedElement == gFindBar._findField.inputField, |
michael@0 | 113 | "testFindbarSelection: find field is not focused: " + aTestName); |
michael@0 | 114 | if (!gHasFindClipboard) { |
michael@0 | 115 | ok(gFindBar._findField.value == aExpSelection, |
michael@0 | 116 | "Incorrect selection in testFindbarSelection: " + aTestName + |
michael@0 | 117 | ". Selection: " + gFindBar._findField.value); |
michael@0 | 118 | } |
michael@0 | 119 | |
michael@0 | 120 | // Clear the value, close the findbar |
michael@0 | 121 | gFindBar._findField.value = ""; |
michael@0 | 122 | gFindBar.close(); |
michael@0 | 123 | } |
michael@0 | 124 | |
michael@0 | 125 | // test normal selected text |
michael@0 | 126 | var cH2 = gBrowser.contentDocument.getElementById("h2"); |
michael@0 | 127 | var cSelection = gBrowser.contentDocument.defaultView.getSelection(); |
michael@0 | 128 | var cRange = gBrowser.contentDocument.createRange(); |
michael@0 | 129 | cRange.setStart(cH2, 0); |
michael@0 | 130 | cRange.setEnd(cH2, 1); |
michael@0 | 131 | cSelection.removeAllRanges(); |
michael@0 | 132 | cSelection.addRange(cRange); |
michael@0 | 133 | checkFindbarState("plain text", SEARCH_TEXT); |
michael@0 | 134 | |
michael@0 | 135 | // test nsIDOMNSEditableElement with selection |
michael@0 | 136 | var textInput = gBrowser.contentDocument.getElementById("text"); |
michael@0 | 137 | textInput.focus(); |
michael@0 | 138 | textInput.select(); |
michael@0 | 139 | checkFindbarState("text input", SAMPLE_TEXT); |
michael@0 | 140 | |
michael@0 | 141 | // test non-editable nsIDOMNSEditableElement (button) |
michael@0 | 142 | gBrowser.contentDocument.getElementById("button").focus(); |
michael@0 | 143 | checkFindbarState("button", ""); |
michael@0 | 144 | } |
michael@0 | 145 | |
michael@0 | 146 | function testDrop() |
michael@0 | 147 | { |
michael@0 | 148 | gFindBar.open(); |
michael@0 | 149 | // use an dummy image to start the drag so it doesn't get interrupted by a selection |
michael@0 | 150 | var img = gBrowser.contentDocument.getElementById("img"); |
michael@0 | 151 | synthesizeDrop(img, gFindBar._findField, [[ {type: "text/plain", data: "Rabbits" } ]], "copy", window); |
michael@0 | 152 | window.opener.wrappedJSObject.SimpleTest.is(gFindBar._findField.inputField.value, "Rabbits", "drop on findbar"); |
michael@0 | 153 | gFindBar.close(); |
michael@0 | 154 | } |
michael@0 | 155 | |
michael@0 | 156 | function testQuickFindClose() { |
michael@0 | 157 | var _isClosedCallback = function() { |
michael@0 | 158 | ok(gFindBar.hidden, |
michael@0 | 159 | "_isClosedCallback: Failed to auto-close quick find bar after " + |
michael@0 | 160 | gFindBar._quickFindTimeoutLength + "ms"); |
michael@0 | 161 | finish(); |
michael@0 | 162 | }; |
michael@0 | 163 | setTimeout(_isClosedCallback, gFindBar._quickFindTimeoutLength + 100); |
michael@0 | 164 | } |
michael@0 | 165 | |
michael@0 | 166 | function testStatusText() { |
michael@0 | 167 | var _delayedCheckStatusText = function() { |
michael@0 | 168 | ok(gStatusText == SAMPLE_URL, "testStatusText: Failed to set status text of found link"); |
michael@0 | 169 | }; |
michael@0 | 170 | setTimeout(_delayedCheckStatusText, 100); |
michael@0 | 171 | } |
michael@0 | 172 | |
michael@0 | 173 | function enterStringIntoFindField(aString) { |
michael@0 | 174 | for (var i=0; i < aString.length; i++) { |
michael@0 | 175 | var event = document.createEvent("KeyEvents"); |
michael@0 | 176 | event.initKeyEvent("keypress", true, true, null, false, false, |
michael@0 | 177 | false, false, 0, aString.charCodeAt(i)); |
michael@0 | 178 | gFindBar._findField.inputField.dispatchEvent(event); |
michael@0 | 179 | } |
michael@0 | 180 | } |
michael@0 | 181 | |
michael@0 | 182 | // also test match-case |
michael@0 | 183 | function testNormalFind() { |
michael@0 | 184 | document.getElementById("cmd_find").doCommand(); |
michael@0 | 185 | |
michael@0 | 186 | ok(!gFindBar.hidden, "testNormalFind: failed to open findbar"); |
michael@0 | 187 | ok(document.commandDispatcher.focusedElement == gFindBar._findField.inputField, |
michael@0 | 188 | "testNormalFind: find field is not focused"); |
michael@0 | 189 | |
michael@0 | 190 | var matchCaseCheckbox = gFindBar.getElement("find-case-sensitive"); |
michael@0 | 191 | if (!matchCaseCheckbox.hidden & matchCaseCheckbox.checked) |
michael@0 | 192 | matchCaseCheckbox.click(); |
michael@0 | 193 | |
michael@0 | 194 | var searchStr = "text tes"; |
michael@0 | 195 | enterStringIntoFindField(searchStr); |
michael@0 | 196 | ok(gBrowser.contentWindow.getSelection().toString().toLowerCase() == searchStr, |
michael@0 | 197 | "testNormalFind: failed to find '" + searchStr + "'"); |
michael@0 | 198 | testClipboardSearchString(gBrowser.contentWindow.getSelection().toString()); |
michael@0 | 199 | |
michael@0 | 200 | if (!matchCaseCheckbox.hidden) { |
michael@0 | 201 | matchCaseCheckbox.click(); |
michael@0 | 202 | enterStringIntoFindField("t"); |
michael@0 | 203 | ok(gBrowser.contentWindow.getSelection() != searchStr, |
michael@0 | 204 | "testNormalFind: Case-sensitivy is broken '" + searchStr + "'"); |
michael@0 | 205 | matchCaseCheckbox.click(); |
michael@0 | 206 | } |
michael@0 | 207 | } |
michael@0 | 208 | |
michael@0 | 209 | function testNormalFindWithComposition() { |
michael@0 | 210 | document.getElementById("cmd_find").doCommand(); |
michael@0 | 211 | |
michael@0 | 212 | ok(!gFindBar.hidden, "testNormalFindWithComposition: findbar should be open"); |
michael@0 | 213 | ok(document.commandDispatcher.focusedElement == gFindBar._findField.inputField, |
michael@0 | 214 | "testNormalFindWithComposition: find field should be focused"); |
michael@0 | 215 | |
michael@0 | 216 | var matchCaseCheckbox = gFindBar.getElement("find-case-sensitive"); |
michael@0 | 217 | var clicked = false; |
michael@0 | 218 | if (!matchCaseCheckbox.hidden & matchCaseCheckbox.checked) { |
michael@0 | 219 | matchCaseCheckbox.click(); |
michael@0 | 220 | clicked = true; |
michael@0 | 221 | } |
michael@0 | 222 | |
michael@0 | 223 | gFindBar._findField.inputField.focus(); |
michael@0 | 224 | |
michael@0 | 225 | var searchStr = "text"; |
michael@0 | 226 | |
michael@0 | 227 | synthesizeComposition({ type: "compositionstart" }); |
michael@0 | 228 | synthesizeComposition({ type: "compositionupdate", data: searchStr }); |
michael@0 | 229 | synthesizeText( |
michael@0 | 230 | { "composition": |
michael@0 | 231 | { "string": searchStr, |
michael@0 | 232 | "clauses": |
michael@0 | 233 | [ |
michael@0 | 234 | { "length": searchStr.length, "attr": COMPOSITION_ATTR_RAWINPUT } |
michael@0 | 235 | ] |
michael@0 | 236 | }, |
michael@0 | 237 | "caret": { "start": searchStr.length, "length": 0 } |
michael@0 | 238 | }); |
michael@0 | 239 | |
michael@0 | 240 | ok(gBrowser.contentWindow.getSelection().toString().toLowerCase() != searchStr, |
michael@0 | 241 | "testNormalFindWithComposition: text shouldn't be found during composition"); |
michael@0 | 242 | |
michael@0 | 243 | synthesizeText( |
michael@0 | 244 | { "composition": |
michael@0 | 245 | { "string": searchStr, |
michael@0 | 246 | "clauses": |
michael@0 | 247 | [ |
michael@0 | 248 | { "length": 0, "attr": 0 } |
michael@0 | 249 | ] |
michael@0 | 250 | }, |
michael@0 | 251 | "caret": { "start": searchStr.length, "length": 0 } |
michael@0 | 252 | }); |
michael@0 | 253 | synthesizeComposition({ type: "compositionend", data: searchStr }); |
michael@0 | 254 | |
michael@0 | 255 | ok(gBrowser.contentWindow.getSelection().toString().toLowerCase() == searchStr, |
michael@0 | 256 | "testNormalFindWithComposition: text should be found after committing composition"); |
michael@0 | 257 | testClipboardSearchString(gBrowser.contentWindow.getSelection().toString()); |
michael@0 | 258 | |
michael@0 | 259 | if (clicked) { |
michael@0 | 260 | matchCaseCheckbox.click(); |
michael@0 | 261 | } |
michael@0 | 262 | } |
michael@0 | 263 | |
michael@0 | 264 | function testAutoCaseSensitivityUI() { |
michael@0 | 265 | var matchCaseCheckbox = gFindBar.getElement("find-case-sensitive"); |
michael@0 | 266 | var matchCaseLabel = gFindBar.getElement("match-case-status"); |
michael@0 | 267 | document.getElementById("cmd_find").doCommand(); |
michael@0 | 268 | ok(!matchCaseCheckbox.hidden, "match case box is hidden in manual mode"); |
michael@0 | 269 | ok(matchCaseLabel.hidden, "match case label is visible in manual mode"); |
michael@0 | 270 | |
michael@0 | 271 | var prefsvc = Cc["@mozilla.org/preferences-service;1"]. |
michael@0 | 272 | getService(Components.interfaces.nsIPrefBranch); |
michael@0 | 273 | prefsvc.setIntPref("accessibility.typeaheadfind.casesensitive", 2); |
michael@0 | 274 | |
michael@0 | 275 | ok(matchCaseCheckbox.hidden, |
michael@0 | 276 | "match case box is visible in automatic mode"); |
michael@0 | 277 | ok(!matchCaseLabel.hidden, |
michael@0 | 278 | "match case label is hidden in automatic mode"); |
michael@0 | 279 | |
michael@0 | 280 | enterStringIntoFindField("a"); |
michael@0 | 281 | var insensitiveLabel = matchCaseLabel.value; |
michael@0 | 282 | enterStringIntoFindField("A"); |
michael@0 | 283 | var sensitiveLabel = matchCaseLabel.value; |
michael@0 | 284 | ok(insensitiveLabel != sensitiveLabel, |
michael@0 | 285 | "Case Sensitive label was not correctly updated"); |
michael@0 | 286 | |
michael@0 | 287 | // bug 365551 |
michael@0 | 288 | gFindBar.onFindAgainCommand(); |
michael@0 | 289 | ok(matchCaseCheckbox.hidden && !matchCaseLabel.hidden, |
michael@0 | 290 | "bug 365551: case sensitivity UI is broken after find-again"); |
michael@0 | 291 | prefsvc.setIntPref("accessibility.typeaheadfind.casesensitive", 0); |
michael@0 | 292 | gFindBar.close(); |
michael@0 | 293 | } |
michael@0 | 294 | |
michael@0 | 295 | function clearFocus() { |
michael@0 | 296 | document.commandDispatcher.focusedElement = null; |
michael@0 | 297 | document.commandDispatcher.focusedWindow = null; |
michael@0 | 298 | gBrowser.contentWindow.focus(); |
michael@0 | 299 | } |
michael@0 | 300 | |
michael@0 | 301 | function testQuickFindLink() { |
michael@0 | 302 | clearFocus(); |
michael@0 | 303 | |
michael@0 | 304 | var event = document.createEvent("KeyEvents"); |
michael@0 | 305 | event.initKeyEvent("keypress", true, true, null, false, false, |
michael@0 | 306 | false, false, 0, "'".charCodeAt(0)); |
michael@0 | 307 | gBrowser.contentDocument.documentElement.dispatchEvent(event); |
michael@0 | 308 | |
michael@0 | 309 | ok(!gFindBar.hidden, "testQuickFindLink: failed to open findbar"); |
michael@0 | 310 | ok(document.commandDispatcher.focusedElement == gFindBar._findField.inputField, |
michael@0 | 311 | "testQuickFindLink: find field is not focused"); |
michael@0 | 312 | |
michael@0 | 313 | var searchStr = "Link Test"; |
michael@0 | 314 | enterStringIntoFindField(searchStr); |
michael@0 | 315 | ok(gBrowser.contentWindow.getSelection() == searchStr, |
michael@0 | 316 | "testQuickFindLink: failed to find sample link"); |
michael@0 | 317 | testClipboardSearchString(searchStr); |
michael@0 | 318 | } |
michael@0 | 319 | |
michael@0 | 320 | // See bug 963925 for more details on this test. |
michael@0 | 321 | function testFindWithHighlight() { |
michael@0 | 322 | //clearFocus(); |
michael@0 | 323 | gFindBar._findField.value = ""; |
michael@0 | 324 | |
michael@0 | 325 | let findCommand = document.getElementById("cmd_find"); |
michael@0 | 326 | findCommand.doCommand(); |
michael@0 | 327 | |
michael@0 | 328 | let searchStr = "e"; |
michael@0 | 329 | enterStringIntoFindField(searchStr); |
michael@0 | 330 | |
michael@0 | 331 | let a = gFindBar._findField.value; |
michael@0 | 332 | let b = gFindBar._browser.finder._fastFind.searchString; |
michael@0 | 333 | let c = gFindBar._browser.finder.searchString; |
michael@0 | 334 | ok(a == b && b == c, "testFindWithHighlight 1: " + a + ", " + b + ", " + c + "."); |
michael@0 | 335 | |
michael@0 | 336 | let oldGetInitialSelection = gFindBar._getInitialSelection; |
michael@0 | 337 | let searchStr = "t"; |
michael@0 | 338 | gFindBar._getInitialSelection = () => searchStr; |
michael@0 | 339 | findCommand.doCommand(); |
michael@0 | 340 | gFindBar._getInitialSelection = oldGetInitialSelection; |
michael@0 | 341 | |
michael@0 | 342 | a = gFindBar._findField.value; |
michael@0 | 343 | b = gFindBar._browser.finder._fastFind.searchString; |
michael@0 | 344 | c = gFindBar._browser.finder.searchString; |
michael@0 | 345 | ok(a == searchStr && b == c, "testFindWithHighlight 2: " + searchStr + |
michael@0 | 346 | ", " + a + ", " + b + ", " + c + "."); |
michael@0 | 347 | |
michael@0 | 348 | let highlightButton = gFindBar.getElement("highlight"); |
michael@0 | 349 | highlightButton.click(); |
michael@0 | 350 | ok(highlightButton.checked, "testFindWithHighlight 3: Highlight All should be checked."); |
michael@0 | 351 | |
michael@0 | 352 | a = gFindBar._findField.value; |
michael@0 | 353 | b = gFindBar._browser.finder._fastFind.searchString; |
michael@0 | 354 | c = gFindBar._browser.finder.searchString; |
michael@0 | 355 | ok(a == searchStr && b == c, "testFindWithHighlight 4: " + a + ", " + b + ", " + c + "."); |
michael@0 | 356 | |
michael@0 | 357 | gFindBar.onFindAgainCommand(); |
michael@0 | 358 | a = gFindBar._findField.value; |
michael@0 | 359 | b = gFindBar._browser.finder._fastFind.searchString; |
michael@0 | 360 | c = gFindBar._browser.finder.searchString; |
michael@0 | 361 | ok(a == b && b == c, "testFindWithHighlight 5: " + a + ", " + b + ", " + c + "."); |
michael@0 | 362 | |
michael@0 | 363 | highlightButton.click(); |
michael@0 | 364 | ok(!highlightButton.checked, "testFindWithHighlight: Highlight All should be unchecked."); |
michael@0 | 365 | } |
michael@0 | 366 | |
michael@0 | 367 | function testQuickFindText() { |
michael@0 | 368 | clearFocus(); |
michael@0 | 369 | |
michael@0 | 370 | var event = document.createEvent("KeyEvents"); |
michael@0 | 371 | event.initKeyEvent("keypress", true, true, null, false, false, |
michael@0 | 372 | false, false, 0, "/".charCodeAt(0)); |
michael@0 | 373 | gBrowser.contentDocument.documentElement.dispatchEvent(event); |
michael@0 | 374 | |
michael@0 | 375 | ok(!gFindBar.hidden, "testQuickFindText: failed to open findbar"); |
michael@0 | 376 | ok(document.commandDispatcher.focusedElement == gFindBar._findField.inputField, |
michael@0 | 377 | "testQuickFindText: find field is not focused"); |
michael@0 | 378 | |
michael@0 | 379 | enterStringIntoFindField(SEARCH_TEXT); |
michael@0 | 380 | ok(gBrowser.contentWindow.getSelection() == SEARCH_TEXT, |
michael@0 | 381 | "testQuickFindText: failed to find '" + SEARCH_TEXT + "'"); |
michael@0 | 382 | testClipboardSearchString(SEARCH_TEXT); |
michael@0 | 383 | } |
michael@0 | 384 | |
michael@0 | 385 | function testClipboardSearchString(aExpected) { |
michael@0 | 386 | if (!gHasFindClipboard) |
michael@0 | 387 | return; |
michael@0 | 388 | |
michael@0 | 389 | if (!aExpected) |
michael@0 | 390 | aExpected = ""; |
michael@0 | 391 | var searchStr = gFindBar.browser.finder.clipboardSearchString; |
michael@0 | 392 | ok(searchStr.toLowerCase() == aExpected.toLowerCase(), |
michael@0 | 393 | "testClipboardSearchString: search string not set to '" + aExpected + |
michael@0 | 394 | "', instead found '" + searchStr + "'"); |
michael@0 | 395 | } |
michael@0 | 396 | ]]></script> |
michael@0 | 397 | |
michael@0 | 398 | <commandset> |
michael@0 | 399 | <command id="cmd_find" oncommand="document.getElementById('FindToolbar').onFindCommand();"/> |
michael@0 | 400 | </commandset> |
michael@0 | 401 | <browser type="content-primary" flex="1" id="content" src="about:blank"/> |
michael@0 | 402 | <findbar id="FindToolbar" browserid="content"/> |
michael@0 | 403 | </window> |