Bug 571882 - Use messages for handling offscreen browser property [r=vingtetun]
--- 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();
},