toolkit/content/tests/chrome/bug429723_window.xul

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

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="429723Test"
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="429723 test">
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
michael@0 24 function finish() {
michael@0 25 window.close();
michael@0 26 window.opener.wrappedJSObject.SimpleTest.finish();
michael@0 27 }
michael@0 28
michael@0 29 function onLoad() {
michael@0 30 var _delayedOnLoad = function() {
michael@0 31 gFindBar = document.getElementById("FindToolbar");
michael@0 32 gBrowser = document.getElementById("content");
michael@0 33 gBrowser.addEventListener("pageshow", onPageShow, false);
michael@0 34 gBrowser.loadURI("data:text/html,<h2 id='h2'>mozilla</h2>");
michael@0 35 }
michael@0 36 setTimeout(_delayedOnLoad, 1000);
michael@0 37 }
michael@0 38
michael@0 39 function enterStringIntoFindField(aString) {
michael@0 40 for (var i=0; i < aString.length; i++) {
michael@0 41 var event = document.createEvent("KeyEvents");
michael@0 42 event.initKeyEvent("keypress", true, true, null, false, false,
michael@0 43 false, false, 0, aString.charCodeAt(i));
michael@0 44 gFindBar._findField.inputField.dispatchEvent(event);
michael@0 45 }
michael@0 46 }
michael@0 47
michael@0 48 function onPageShow() {
michael@0 49 gBrowser.removeEventListener("pageshow", onPageShow, false);
michael@0 50 var findField = gFindBar._findField;
michael@0 51 document.getElementById("cmd_find").doCommand();
michael@0 52
michael@0 53 var matchCaseCheckbox = gFindBar.getElement("find-case-sensitive");
michael@0 54 if (!matchCaseCheckbox.hidden & matchCaseCheckbox.checked)
michael@0 55 matchCaseCheckbox.click();
michael@0 56
michael@0 57 // Perform search
michael@0 58 var searchStr = "z";
michael@0 59 enterStringIntoFindField(searchStr);
michael@0 60
michael@0 61 // Highlight search term
michael@0 62 var highlight = gFindBar.getElement("highlight");
michael@0 63 if (!highlight.checked)
michael@0 64 highlight.click();
michael@0 65
michael@0 66 // Delete search term
michael@0 67 var event = document.createEvent("KeyEvents");
michael@0 68 event.initKeyEvent("keypress", true, true, null, false, false,
michael@0 69 false, false, KeyEvent.DOM_VK_BACK_SPACE, 0);
michael@0 70 gFindBar._findField.inputField.dispatchEvent(event);
michael@0 71
michael@0 72 var notRed = !findField.hasAttribute("status") ||
michael@0 73 (findField.getAttribute("status") != "notfound");
michael@0 74 ok(notRed, "Find Bar textbox is correct colour");
michael@0 75 finish();
michael@0 76 }
michael@0 77 ]]></script>
michael@0 78
michael@0 79 <commandset>
michael@0 80 <command id="cmd_find" oncommand="document.getElementById('FindToolbar').onFindCommand();"/>
michael@0 81 </commandset>
michael@0 82 <browser type="content-primary" flex="1" id="content" src="about:blank"/>
michael@0 83 <findbar id="FindToolbar" browserid="content"/>
michael@0 84 </window>

mercurial