Bug 823325 - Use timeout before calling browser.focus(). r=mfinkle
☠☠ backed out by 34f4d5d47cae ☠ ☠
authorBrian Nicholson <bnicholson@mozilla.com>
Wed, 02 Jan 2013 15:05:21 -0800
changeset 126499 17b390f86130614161a84d3d1ca6aecd55c972a5
parent 126498 c42fa8f9377e693b8caa35b68df89d2dc8bbcf9b
child 126500 fcab6193a0fabbf59e74f76004e70db9b8e69809
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs823325
milestone20.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
Bug 823325 - Use timeout before calling browser.focus(). r=mfinkle
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -2803,18 +2803,23 @@ Tab.prototype = {
 
   // This should be called to update the browser when the tab gets selected/unselected
   setActive: function setActive(aActive) {
     if (!this.browser || !this.browser.docShell)
       return;
 
     if (aActive) {
       this.browser.setAttribute("type", "content-primary");
-      this.browser.focus();
       this.browser.docShellIsActive = true;
+
+      // setTimeout() is needed to make sure the browser is visible before it
+      // is focused (see bug 823325).
+      setTimeout(function () {
+        this.browser.focus();
+      }.bind(this), 0);
     } else {
       this.browser.setAttribute("type", "content-targetable");
       this.browser.docShellIsActive = false;
     }
   },
 
   getActive: function getActive() {
       return this.browser.docShellIsActive;