diff --git a/mobile/chrome/content/browser.js b/mobile/chrome/content/browser.js index fc026483b5a..26773f810fa 100644 --- a/mobile/chrome/content/browser.js +++ b/mobile/chrome/content/browser.js @@ -362,6 +362,7 @@ var Browser = { } messageManager.addMessageListener("Browser:ViewportMetadata", this); + messageManager.addMessageListener("Browser:CanCaptureMouse:Return", this); messageManager.addMessageListener("Browser:FormSubmit", this); messageManager.addMessageListener("Browser:KeyPress", this); messageManager.addMessageListener("Browser:ZoomToPoint:Return", this); @@ -1133,14 +1134,19 @@ var Browser = { let browser = aMessage.target; switch (aMessage.name) { - case "Browser:ViewportMetadata": + case "Browser:ViewportMetadata": { let tab = this.getTabForBrowser(browser); // Some browser such as iframes loaded dynamically into the chrome UI // does not have any assigned tab if (tab) tab.updateViewportMetadata(json); break; - + } + case "Browser:CanCaptureMouse:Return": { + let tab = this.getTabForBrowser(browser); + tab.contentMightCaptureMouse = json.contentMightCaptureMouse; + break; + } case "Browser:FormSubmit": browser.lastLocation = null; break; @@ -1541,7 +1547,7 @@ Browser.WebProgress.prototype = { aTab.updateThumbnail(); browser.messageManager.addMessageListener("MozScrolledAreaChanged", aTab.scrolledAreaChanged); - ContentTouchHandler.updateContentCapture(); + aTab.updateContentCapture(); }); } }; @@ -1657,7 +1663,6 @@ const ContentTouchHandler = { messageManager.addMessageListener("Browser:ContextMenu", this); messageManager.addMessageListener("Browser:Highlight", this); messageManager.addMessageListener("Browser:CaptureEvents", this); - messageManager.addMessageListener("Browser:CanCaptureMouse:Return", this); }, handleEvent: function handleEvent(aEvent) { @@ -1721,11 +1726,6 @@ const ContentTouchHandler = { } }, - updateContentCapture: function() { - this._messageId++; - messageManager.sendAsyncMessage("Browser:CanCaptureMouse", { messageId: this._messageId }); - }, - receiveMessage: function receiveMessage(aMessage) { let json = aMessage.json; if (json.messageId != this._messageId) @@ -1760,11 +1760,6 @@ const ContentTouchHandler = { Elements.browsers.customDragger.contentMouseCapture = this.panningPrevented; break; } - case "Browser:CanCaptureMouse:Return": { - let tab = Browser.getTabForBrowser(aMessage.target); - tab.contentMightCaptureMouse = json.contentMightCaptureMouse; - break; - } } }, @@ -2961,6 +2956,10 @@ Tab.prototype = { return this._browser.getAttribute("type") == "content-primary"; }, + updateContentCapture: function() { + this._browser.messageManager.sendAsyncMessage("Browser:CanCaptureMouse", {}); + }, + toString: function() { return "[Tab " + (this._browser ? this._browser.currentURI.spec : "(no browser)") + "]"; } diff --git a/mobile/chrome/content/content.js b/mobile/chrome/content/content.js index 10e5cc3dc4a..6d6379cb2da 100644 --- a/mobile/chrome/content/content.js +++ b/mobile/chrome/content/content.js @@ -597,8 +597,7 @@ let Content = { case "Browser:CanCaptureMouse": { sendAsyncMessage("Browser:CanCaptureMouse:Return", { - contentMightCaptureMouse: content.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).mayHaveTouchEventListeners, - messageId: json.messageId + contentMightCaptureMouse: content.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).mayHaveTouchEventListeners }); break; }