From 16b717897979070b87bd243b9261f43172c5d31e Mon Sep 17 00:00:00 2001 From: Jared Wein Date: Fri, 23 Mar 2012 11:45:51 -0700 Subject: [PATCH] Backed out changeset c120dd831b3f (bug 734323) r=bustage --- mobile/android/chrome/content/browser.js | 41 ++++++------------------ 1 file changed, 10 insertions(+), 31 deletions(-) diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index 766e1239b57d..0ee222c862eb 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -1456,9 +1456,6 @@ function Tab(aURL, aParams) { this._zoom = 1.0; this.userScrollPos = { x: 0, y: 0 }; this.contentDocumentIsDisplayed = true; - this.clickToPlayPluginDoorhangerShown = false; - this.clickToPlayPluginsActivated = false; - this.loadEventProcessed = false; } Tab.prototype = { @@ -1766,7 +1763,6 @@ Tab.prototype = { } case "load": { - this.loadEventProcessed = true; // Show a plugin doorhanger if there are no clickable overlays showing let contentWindow = this.browser.contentWindow; let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor) @@ -1889,20 +1885,14 @@ Tab.prototype = { case "PluginClickToPlay": { let plugin = aEvent.target; - - if (this.clickToPlayPluginsActivated) { - PluginHelper.playPlugin(plugin); + let overlay = plugin.ownerDocument.getAnonymousElementByAttribute(plugin, "class", "mainBox"); + if (!overlay) return; - } // If the overlay is too small, hide the overlay and act like this // is a hidden plugin object - let overlay = plugin.ownerDocument.getAnonymousElementByAttribute(plugin, "class", "mainBox"); - if (!overlay || PluginHelper.isTooSmall(plugin, overlay)) { - if (overlay) - overlay.style.visibility = "hidden"; - if (this.loadEventProcessed && !this.clickToPlayPluginDoorhangerShown) - PluginHelper.showDoorHanger(this); + if (PluginHelper.isTooSmall(plugin, overlay)) { + overlay.style.visibility = "hidden"; return; } @@ -1913,10 +1903,7 @@ Tab.prototype = { return; e.preventDefault(); } - let win = e.target.ownerDocument.defaultView.top; - let tab = BrowserApp.getTabForWindow(win); - tab.clickToPlayPluginsActivated = true; - PluginHelper.playAllPlugins(win); + PluginHelper.playAllPlugins(e.target.ownerDocument.defaultView); }, true); break; } @@ -1977,11 +1964,6 @@ Tab.prototype = { contentType = browser.contentDocument.contentType; } - // Reset state of click-to-play plugin notifications. - this.clickToPlayPluginDoorhangerShown = false; - this.clickToPlayPluginsActivated = false; - this.loadEventProcessed = false; - let message = { gecko: { type: "Content:LocationChange", @@ -3867,7 +3849,6 @@ var ClipboardHelper = { var PluginHelper = { showDoorHanger: function(aTab) { - aTab.clickToPlayPluginDoorhangerShown = true; let message = Strings.browser.GetStringFromName("clickToPlayPlugins.message"); let buttons = [ { @@ -3894,13 +3875,11 @@ var PluginHelper = { if (!plugins || !plugins.length) return; - plugins.forEach(this.playPlugin); - }, - - playPlugin: function(plugin) { - let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent); - if (!objLoadingContent.activated) - objLoadingContent.playPlugin(); + for (let plugin of plugins) { + let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent); + if (!objLoadingContent.activated) + objLoadingContent.playPlugin(); + } }, getPluginPreference: function getPluginPreference() {