toolkit/content/tests/chrome/bug366992_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 <?xul-overlay href="chrome://global/content/editMenuOverlay.xul"?>
michael@0 9
michael@0 10 <window id="366992 test"
michael@0 11 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
michael@0 12 onload="onLoad();"
michael@0 13 width="600"
michael@0 14 height="600"
michael@0 15 title="366992 test">
michael@0 16
michael@0 17 <commandset id="editMenuCommands"/>
michael@0 18
michael@0 19 <script type="application/javascript"
michael@0 20 src="chrome://global/content/globalOverlay.js"/>
michael@0 21 <script type="application/javascript"><![CDATA[
michael@0 22 // Without the fix for bug 366992, the copy command would be enabled
michael@0 23 // for the textbox even though the textbox's controller for this command
michael@0 24 // disables it.
michael@0 25 var gShouldNotBeReachedController = {
michael@0 26 supportsCommand: function(aCommand) {
michael@0 27 return aCommand == "cmd_copy";
michael@0 28 },
michael@0 29 isCommandEnabled: function(aCommand) {
michael@0 30 return aCommand == "cmd_copy";
michael@0 31 },
michael@0 32 doCommand: function(aCommand) { }
michael@0 33 }
michael@0 34
michael@0 35 function ok(condition, message) {
michael@0 36 window.opener.wrappedJSObject.SimpleTest.ok(condition, message);
michael@0 37 }
michael@0 38 function finish() {
michael@0 39 window.controllers.removeController(gShouldNotBeReachedController);
michael@0 40 window.close();
michael@0 41 window.opener.wrappedJSObject.SimpleTest.finish();
michael@0 42 }
michael@0 43
michael@0 44 function onLoad() {
michael@0 45 document.getElementById("textbox").focus();
michael@0 46 var copyDisabled = document.getElementById("cmd_copy")
michael@0 47 .getAttribute("disabled") == "true";
michael@0 48 ok(copyDisabled,
michael@0 49 "cmd_copy should be disabled when the empty textbox is focused");
michael@0 50 finish();
michael@0 51 }
michael@0 52
michael@0 53 window.controllers.appendController(gShouldNotBeReachedController);
michael@0 54 ]]></script>
michael@0 55
michael@0 56 <textbox id="textbox"/>
michael@0 57 </window>

mercurial