Re-focus browser elements after changing their remote attribute (bug 925058, r=felipe).
authorDavid Anderson <danderson@mozilla.com>
Wed, 09 Oct 2013 15:50:46 -0700
changeset 164094 bb73bada10dead35c89e01c7d34a5be9ecc4940a
parent 164093 7a7b028f0a023198f94ac8aaf42b3edbc0e2e636
child 164095 31014a7ee3ab194ac840311b20c3929c93918b15
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfelipe
bugs925058
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Re-focus browser elements after changing their remote attribute (bug 925058, r=felipe).
browser/base/content/tabbrowser.xml
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -1336,16 +1336,18 @@
         <parameter name="aBrowser"/>
         <parameter name="aRemote"/>
         <body>
           <![CDATA[
             let isRemote = aBrowser.getAttribute("remote") == "true";
             if (isRemote == aRemote)
               return false;
 
+            let wasActive = document.activeElement == aBrowser;
+
             // Unhook our progress listener.
             let tab = this._getTabForBrowser(aBrowser);
             let index = tab._tPos;
             let filter = this.mTabFilters[index];
             aBrowser.webProgress.removeProgressListener(filter);
 
             // Change the "remote" attribute.
             let parent = aBrowser.parentNode;
@@ -1356,16 +1358,19 @@
             // Restore the progress listener.
             aBrowser.webProgress.addProgressListener(filter, Ci.nsIWebProgress.NOTIFY_ALL);
 
             if (aRemote)
               tab.setAttribute("remote", "true");
             else
               tab.removeAttribute("remote");
 
+            if (wasActive)
+              aBrowser.focus();
+
             return true;
           ]]>
         </body>
       </method>
 
       <!--
         Returns true if we want to load the content for this URL in a
         remote process. Eventually this should just check whether aURL