Bug 623624 - Content elements don't get focus when the focus method is set on them [r=mfinkle]
authorVivien Nicolas <21@vingtetun.org>
Fri, 25 Mar 2011 18:39:22 +0100
changeset 2941 5d77401196ed642b1abc80a03be31e42cada935f
parent 2940 63d00153d34791b8b6b47d8359a8a621ac2c99c2
child 2942 c358e083b0ad1424bad1f17320c3b964cab569f3
push id2481
push uservnicolas@mozilla.com
push dateFri, 25 Mar 2011 17:43:45 +0000
reviewersmfinkle
bugs623624
Bug 623624 - Content elements don't get focus when the focus method is set on them [r=mfinkle]
chrome/content/browser.js
--- a/chrome/content/browser.js
+++ b/chrome/content/browser.js
@@ -2741,18 +2741,23 @@ Tab.prototype = {
     let notification = this._notification;
     let browser = this._browser;
 
     if (aActive) {
       browser.setAttribute("type", "content-primary");
       Elements.browsers.selectedPanel = notification;
       browser.active = true;
       document.getElementById("tabs").selectedTab = this._chromeTab;
-    }
-    else {
+
+      // Ensure that the content process has gets an activate event
+      try {
+        let fl = browser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader;
+        fl.activateRemoteFrame();
+      } catch (e) {}
+    } else {
       browser.messageManager.sendAsyncMessage("Browser:Blur", { });
       browser.setAttribute("type", "content");
       browser.active = false;
     }
   },
 
   get active() {
     if (!this._browser)