diff --git a/browser/base/content/browser-plugins.js b/browser/base/content/browser-plugins.js index 3ce2e5d877c..44933eca9f5 100644 --- a/browser/base/content/browser-plugins.js +++ b/browser/base/content/browser-plugins.js @@ -217,21 +217,14 @@ var gPluginHandler = { }, handleEvent : function(event) { - let plugin; - let doc; + let plugin = event.target; + let doc = plugin.ownerDocument; + + // We're expecting the target to be a plugin. + if (!(plugin instanceof Ci.nsIObjectLoadingContent)) + return; let eventType = event.type; - if (eventType === "PluginRemoved") { - doc = event.target; - } - else { - plugin = event.target; - doc = plugin.ownerDocument; - - if (!(plugin instanceof Ci.nsIObjectLoadingContent)) - return; - } - if (eventType == "PluginBindingAttached") { // The plugin binding fires this event when it is created. // As an untrusted event, ensure that this object actually has a binding @@ -311,7 +304,6 @@ var gPluginHandler = { break; case "PluginInstantiated": - case "PluginRemoved": this._showClickToPlayNotification(browser); break; } @@ -694,12 +686,18 @@ var gPluginHandler = { switch (aNewState) { case "allownow": + if (aPluginInfo.fallbackType == Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE) { + return; + } permission = Ci.nsIPermissionManager.ALLOW_ACTION; expireType = Ci.nsIPermissionManager.EXPIRE_SESSION; expireTime = Date.now() + Services.prefs.getIntPref(this.PREF_SESSION_PERSIST_MINUTES) * 60 * 1000; break; case "allowalways": + if (aPluginInfo.fallbackType == Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE) { + return; + } permission = Ci.nsIPermissionManager.ALLOW_ACTION; expireType = Ci.nsIPermissionManager.EXPIRE_TIME; expireTime = Date.now() + @@ -707,28 +705,25 @@ var gPluginHandler = { break; case "block": + if (aPluginInfo.fallbackType != Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE) { + return; + } permission = Ci.nsIPermissionManager.PROMPT_ACTION; expireType = Ci.nsIPermissionManager.EXPIRE_NEVER; expireTime = 0; break; - // In case a plugin has already been allowed in another tab, the "continue allowing" button - // shouldn't change any permissions but should run the plugin-enablement code below. - case "continue": - break; default: Cu.reportError(Error("Unexpected plugin state: " + aNewState)); return; } let browser = aNotification.browser; - if (aNewState != "continue") { - Services.perms.add(browser.currentURI, aPluginInfo.permissionString, - permission, expireType, expireTime); + Services.perms.add(browser.currentURI, aPluginInfo.permissionString, + permission, expireType, expireTime); - if (aNewState == "block") { - return; - } + if (aNewState == "block") { + return; } // Manually activate the plugins that would have been automatically @@ -771,7 +766,8 @@ var gPluginHandler = { fallbackType == plugin.PLUGIN_BLOCKLISTED; }); let dismissed = notification ? notification.dismissed : true; - if (aPrimaryPlugin) + // Always show the doorhanger if the anchor is not available. + if (!isElementVisible(gURLBar) || aPrimaryPlugin) dismissed = false; let primaryPluginPermission = null; diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 3aa3771711c..39c0761ff50 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -755,7 +755,6 @@ var gBrowserInit = { gBrowser.addEventListener("PluginCrashed", gPluginHandler, true); gBrowser.addEventListener("PluginOutdated", gPluginHandler, true); gBrowser.addEventListener("PluginInstantiated", gPluginHandler, true); - gBrowser.addEventListener("PluginRemoved", gPluginHandler, true); gBrowser.addEventListener("NewPluginInstalled", gPluginHandler.newPluginInstalled, true); diff --git a/browser/base/content/urlbarBindings.xml b/browser/base/content/urlbarBindings.xml index 8414b3ac0db..060a9aaabd2 100644 --- a/browser/base/content/urlbarBindings.xml +++ b/browser/base/content/urlbarBindings.xml @@ -1574,19 +1574,12 @@ this.appendChild(item); this._items.push(item); } - switch (this.notification.options.centerActions.length) { - case 0: - PopupNotifications._dismiss(); - break; - case 1: - this._setState(this._states.SINGLE); - break; - default: - if (this.notification.options.primaryPlugin) { - this._setState(this._states.MULTI_COLLAPSED); - } else { - this._setState(this._states.MULTI_EXPANDED); - } + if (this.notification.options.centerActions.length == 1) { + this._setState(this._states.SINGLE); + } else if (this.notification.options.primaryPlugin) { + this._setState(this._states.MULTI_COLLAPSED); + } else { + this._setState(this._states.MULTI_EXPANDED); } ]]> @@ -1652,7 +1645,7 @@ button2 = { label: "pluginContinue.label", accesskey: "pluginContinue.accesskey", - action: "_singleContinue", + action: "_cancel", default: true }; switch (action.blocklistState) { @@ -1826,14 +1819,6 @@ this._cancel(); ]]> - - - GetCurrentDoc()) - , mEvent(aEvent) - { - } - - nsSimplePluginEvent(nsIDocument* aTarget, const nsAString& aEvent) - : mTarget(aTarget) - , mDocument(aTarget) - , mEvent(aEvent) - { - } + nsSimplePluginEvent(nsIContent* aContent, const nsAString &aEvent) + : mContent(aContent), + mEvent(aEvent) + {} ~nsSimplePluginEvent() {} NS_IMETHOD Run(); private: - nsCOMPtr mTarget; - nsCOMPtr mDocument; + nsCOMPtr mContent; nsString mEvent; }; NS_IMETHODIMP nsSimplePluginEvent::Run() { - LOG(("OBJLC [%p]: nsSimplePluginEvent firing event \"%s\"", mTarget.get(), + LOG(("OBJLC [%p]: nsSimplePluginEvent firing event \"%s\"", mContent.get(), mEvent.get())); - nsContentUtils::DispatchTrustedEvent(mDocument, mTarget, + nsContentUtils::DispatchTrustedEvent(mContent->GetDocument(), mContent, mEvent, true, true); return NS_OK; } @@ -684,9 +674,7 @@ nsObjectLoadingContent::UnbindFromTree(bool aDeep, bool aNullParent) /// would keep the docshell around, but trash the frameloader UnloadObject(); } - nsCOMPtr ev = new nsSimplePluginEvent(thisContent->GetCurrentDoc(), - NS_LITERAL_STRING("PluginRemoved")); - NS_DispatchToCurrentThread(ev); + } nsObjectLoadingContent::nsObjectLoadingContent() diff --git a/dom/plugins/ipc/PluginModuleParent.cpp b/dom/plugins/ipc/PluginModuleParent.cpp index 91548a8ddc1..075679cb7a2 100755 --- a/dom/plugins/ipc/PluginModuleParent.cpp +++ b/dom/plugins/ipc/PluginModuleParent.cpp @@ -1192,11 +1192,9 @@ PluginModuleParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs uint32_t flags = 0; if (!CallNP_Initialize(flags, error)) { - mShutdown = true; return NS_ERROR_FAILURE; } else if (*error != NPERR_NO_ERROR) { - mShutdown = true; return NS_OK; } @@ -1222,14 +1220,8 @@ PluginModuleParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error) flags |= kAllowAsyncDrawing; #endif - if (!CallNP_Initialize(flags, error)) { - mShutdown = true; + if (!CallNP_Initialize(flags, error)) return NS_ERROR_FAILURE; - } - if (*error != NPERR_NO_ERROR) { - mShutdown = true; - return NS_OK; - } #if defined XP_WIN // Send the info needed to join the chrome process's audio session to the