toolkit/content/tests/chrome/bug366992_window.xul

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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