Bug 571882 - Use messages for handling offscreen browser property [r=vingtetun]
authorMark Finkle <mfinkle@mozilla.com>
Mon, 14 Jun 2010 12:59:08 -0400
changeset 66284 4d0e90b743161f0a47a3425d33ce9de3fa6ddefb
parent 66283 f67966867bccdab6e02fda73cfcb27a6a3ab03d1
child 66285 319f17290cd59cb58b53418396aca17036f31b4b
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvingtetun
bugs571882
Bug 571882 - Use messages for handling offscreen browser property [r=vingtetun]
mobile/chrome/content/BrowserView.js
mobile/chrome/content/browser.js
mobile/chrome/content/content.js
--- a/mobile/chrome/content/BrowserView.js
+++ b/mobile/chrome/content/BrowserView.js
@@ -471,29 +471,29 @@ BrowserView.prototype = {
       throw "Cannot set non-null browser with null BrowserViewportState";
     }
 
     let oldBrowser = this._browser;
     let browserChanged = (oldBrowser !== browser);
 
     if (oldBrowser) {
       oldBrowser.setAttribute("type", "content");
-      oldBrowser.docShell.isOffScreenBrowser = false;
+      oldBrowser.messageManager.sendAsyncMessage("Browser:Blur", {});
     }
 
     this._browser = browser;
     this._contentWindow = (browser) ? browser.contentWindow : null;
     this._browserViewportState = browserViewportState;
 
     if (browser) {
       browser.setAttribute("type", "content-primary");
+      browser.messageManager.sendAsyncMessage("Browser:Focus", {});
 
       this.beginBatchOperation();
 
-      browser.docShell.isOffScreenBrowser = true;
       if (browserChanged)
         this._viewportChanged(true, true);
 
       this.commitBatchOperation();
     }
   },
 
   getBrowser: function getBrowser() {
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -2859,20 +2859,18 @@ ProgressController.prototype = {
     let event = document.createEvent("Events");
     event.initEvent("URLChanged", true, false);
     this.browser.dispatchEvent(event);
   },
 
   _networkStop: function _networkStop() {
     this._tab.endLoading();
 
-    if (this._tab == Browser.selectedTab) {
+    if (this._tab == Browser.selectedTab)
       BrowserUI.update(TOOLBARSTATE_LOADED);
-      this.browser.docShell.isOffScreenBrowser = true;
-    }
 
     if (this.browser.currentURI.spec != "about:blank")
       this._tab.updateThumbnail();
   },
 
   _documentStop: function _documentStop() {
     if (this._tab == Browser.selectedTab) {
       // XXX Sometimes MozScrollSizeChange has not occurred, so the scroll pane will not
--- a/mobile/chrome/content/content.js
+++ b/mobile/chrome/content/content.js
@@ -136,16 +136,17 @@ const ElementTouchHelper = {
   _clickableEvents: ["mousedown", "mouseup", "click"],
   _hasMouseListener: function _hasMouseListener(aElement) {
     let els = this._els;
     let listeners = els.getListenerInfoFor(aElement, {});
     for (let i = 0; i < listeners.length; i++) {
       if (this._clickableEvents.indexOf(listeners[i].type) != -1)
         return true;
     }
+    return false;
   }
 };
 
 /**
  * @param x,y Browser coordinates
  * @return Element at position, null if no active browser or no element found
  */
 function elementFromPoint(x, y) {
@@ -671,18 +672,16 @@ FormNavigator.prototype = {
       return false;
     }
   }
 };
 
 
 /** Can't think of a good description of this class.  It probably does too much? */
 function Content() {
-  this._iconURI = null;
-
   addMessageListener("Browser:Blur", this);
   addMessageListener("Browser:Focus", this);
   addMessageListener("Browser:Mousedown", this);
   addMessageListener("Browser:Mouseup", this);
   addMessageListener("Browser:CancelMouse", this);
   addMessageListener("Browser:SaveAs", this);
 
   this._coalescer = new Coalescer();
@@ -799,17 +798,16 @@ Content.prototype = {
       y = point.y;
     }
 
     windowUtils.sendMouseEvent(name, x - scrollOffset.x, y - scrollOffset.y, 0, 1, 0, true);
   },
 
   startLoading: function startLoading() {
     this._loading = true;
-    this._iconURI = null;
     this._coalescer.emptyPage();
     this._coalescer.startCoalescing();
   },
 
   stopLoading: function stopLoading() {
     this._loading = false;
     this._coalescer.stopCoalescing();
   },