Bug 1235154 - Port Bug 869086 to fix right click urlbar error [TypeError this.parentNode.firstChild.focus is not a function] r=Ratty a=IanN for comm-aurora and comm-beta
authorFrank-Rainer Grahl <frgrahl@gmx.net>
Tue, 29 Dec 2015 19:09:34 +0800
changeset 26608 d3e81ff2cf54912dc002a13fc45555cd187bdcca
parent 26607 8056593ec381659f18eafc8b3ac857fbbe9608b2
child 26609 c494ca9c666cfb80a2fa2b5a747ecfe7c49d8b0c
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersRatty, IanN
bugs1235154, 869086, 653881
Bug 1235154 - Port Bug 869086 to fix right click urlbar error [TypeError this.parentNode.firstChild.focus is not a function] r=Ratty a=IanN for comm-aurora and comm-beta References: Bug 869086 - Make textbox.xml resilient against the changes in bug 653881 Bug 653881 - Fix up our XBL1 shadow tree implementation so that we can reuse it for XBL2
suite/browser/urlbarBindings.xml
--- a/suite/browser/urlbarBindings.xml
+++ b/suite/browser/urlbarBindings.xml
@@ -656,18 +656,20 @@
     </handlers>
   </binding>
 
   <binding id="input-box-paste" extends="chrome://global/content/bindings/textbox.xml#input-box">
     <content context="_child">
       <children/>
       <xul:menupopup anonid="input-box-contextmenu"
                      class="textbox-contextmenu"
-                     onpopupshowing="if (document.commandDispatcher.focusedElement != this.parentNode.firstChild)
-                                       this.parentNode.firstChild.focus();
+                     onpopupshowing="var input =
+                                       this.parentNode.getElementsByAttribute('anonid', 'input')[0];
+                                     if (document.commandDispatcher.focusedElement != input)
+                                       input.focus();
                                      this.parentNode._doPopupItemEnabling(this);"
                      oncommand="var cmd = event.originalTarget.getAttribute('cmd'); if(cmd) { this.parentNode.doCommand(cmd); event.stopPropagation(); }">
         <xul:menuitem label="&undoCmd.label;" accesskey="&undoCmd.accesskey;" cmd="cmd_undo"/>
         <xul:menuseparator/>
         <xul:menuitem label="&cutCmd.label;" accesskey="&cutCmd.accesskey;" cmd="cmd_cut"/>
         <xul:menuitem label="&copyCmd.label;" accesskey="&copyCmd.accesskey;" cmd="cmd_copy"/>
         <xul:menuitem label="&pasteCmd.label;" accesskey="&pasteCmd.accesskey;" cmd="cmd_paste"/>
         <xul:menuitem label="&pasteGoCmd.label;" accesskey="&pasteGoCmd.accesskey;" cmd="cmd_pasteAndGo"/>