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

     1 <?xml version="1.0"?>
     3 <!-- This Source Code Form is subject to the terms of the Mozilla Public
     4    - License, v. 2.0. If a copy of the MPL was not distributed with this
     5    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
     7 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     8 <?xul-overlay href="chrome://global/content/editMenuOverlay.xul"?>
    10 <window id="366992 test"
    11         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    12         onload="onLoad();"
    13         width="600"
    14         height="600"
    15         title="366992 test">
    17   <commandset id="editMenuCommands"/>
    19   <script type="application/javascript"
    20           src="chrome://global/content/globalOverlay.js"/>
    21   <script type="application/javascript"><![CDATA[
    22     // Without the fix for bug 366992, the copy command would be enabled
    23     // for the textbox even though the textbox's controller for this command
    24     // disables it.
    25     var gShouldNotBeReachedController = {
    26       supportsCommand: function(aCommand) {
    27         return aCommand == "cmd_copy";
    28       },
    29       isCommandEnabled: function(aCommand) {
    30         return aCommand == "cmd_copy";
    31       },
    32       doCommand: function(aCommand) { }
    33     }
    35     function ok(condition, message) {
    36       window.opener.wrappedJSObject.SimpleTest.ok(condition, message);
    37     }
    38     function finish() {
    39       window.controllers.removeController(gShouldNotBeReachedController);
    40       window.close();
    41       window.opener.wrappedJSObject.SimpleTest.finish();
    42     }
    44     function onLoad() {
    45       document.getElementById("textbox").focus();
    46       var copyDisabled = document.getElementById("cmd_copy")
    47                                  .getAttribute("disabled") == "true";
    48       ok(copyDisabled,
    49          "cmd_copy should be disabled when the empty textbox is focused");
    50       finish();
    51     }
    53     window.controllers.appendController(gShouldNotBeReachedController);
    54   ]]></script>
    56   <textbox id="textbox"/>
    57 </window>

mercurial