Backed out 3 changesets (bug 889480, bug 889788, bug 888908) for mochitest-bc orange.

Backed out changeset d1c616745325 (bug 889788)
Backed out changeset 6fe281a19554 (bug 888908)
Backed out changeset 9b855bab8073 (bug 889480)
This commit is contained in:
Ryan VanderMeulen 2013-07-17 11:34:25 -04:00
parent 75373a534a
commit c11458053c
5 changed files with 37 additions and 77 deletions

View File

@ -217,21 +217,14 @@ var gPluginHandler = {
}, },
handleEvent : function(event) { handleEvent : function(event) {
let plugin; let plugin = event.target;
let doc; let doc = plugin.ownerDocument;
// We're expecting the target to be a plugin.
if (!(plugin instanceof Ci.nsIObjectLoadingContent))
return;
let eventType = event.type; 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") { if (eventType == "PluginBindingAttached") {
// The plugin binding fires this event when it is created. // The plugin binding fires this event when it is created.
// As an untrusted event, ensure that this object actually has a binding // As an untrusted event, ensure that this object actually has a binding
@ -311,7 +304,6 @@ var gPluginHandler = {
break; break;
case "PluginInstantiated": case "PluginInstantiated":
case "PluginRemoved":
this._showClickToPlayNotification(browser); this._showClickToPlayNotification(browser);
break; break;
} }
@ -694,12 +686,18 @@ var gPluginHandler = {
switch (aNewState) { switch (aNewState) {
case "allownow": case "allownow":
if (aPluginInfo.fallbackType == Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE) {
return;
}
permission = Ci.nsIPermissionManager.ALLOW_ACTION; permission = Ci.nsIPermissionManager.ALLOW_ACTION;
expireType = Ci.nsIPermissionManager.EXPIRE_SESSION; expireType = Ci.nsIPermissionManager.EXPIRE_SESSION;
expireTime = Date.now() + Services.prefs.getIntPref(this.PREF_SESSION_PERSIST_MINUTES) * 60 * 1000; expireTime = Date.now() + Services.prefs.getIntPref(this.PREF_SESSION_PERSIST_MINUTES) * 60 * 1000;
break; break;
case "allowalways": case "allowalways":
if (aPluginInfo.fallbackType == Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE) {
return;
}
permission = Ci.nsIPermissionManager.ALLOW_ACTION; permission = Ci.nsIPermissionManager.ALLOW_ACTION;
expireType = Ci.nsIPermissionManager.EXPIRE_TIME; expireType = Ci.nsIPermissionManager.EXPIRE_TIME;
expireTime = Date.now() + expireTime = Date.now() +
@ -707,28 +705,25 @@ var gPluginHandler = {
break; break;
case "block": case "block":
if (aPluginInfo.fallbackType != Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE) {
return;
}
permission = Ci.nsIPermissionManager.PROMPT_ACTION; permission = Ci.nsIPermissionManager.PROMPT_ACTION;
expireType = Ci.nsIPermissionManager.EXPIRE_NEVER; expireType = Ci.nsIPermissionManager.EXPIRE_NEVER;
expireTime = 0; expireTime = 0;
break; 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: default:
Cu.reportError(Error("Unexpected plugin state: " + aNewState)); Cu.reportError(Error("Unexpected plugin state: " + aNewState));
return; return;
} }
let browser = aNotification.browser; let browser = aNotification.browser;
if (aNewState != "continue") { Services.perms.add(browser.currentURI, aPluginInfo.permissionString,
Services.perms.add(browser.currentURI, aPluginInfo.permissionString, permission, expireType, expireTime);
permission, expireType, expireTime);
if (aNewState == "block") { if (aNewState == "block") {
return; return;
}
} }
// Manually activate the plugins that would have been automatically // Manually activate the plugins that would have been automatically
@ -771,7 +766,8 @@ var gPluginHandler = {
fallbackType == plugin.PLUGIN_BLOCKLISTED; fallbackType == plugin.PLUGIN_BLOCKLISTED;
}); });
let dismissed = notification ? notification.dismissed : true; let dismissed = notification ? notification.dismissed : true;
if (aPrimaryPlugin) // Always show the doorhanger if the anchor is not available.
if (!isElementVisible(gURLBar) || aPrimaryPlugin)
dismissed = false; dismissed = false;
let primaryPluginPermission = null; let primaryPluginPermission = null;

View File

@ -755,7 +755,6 @@ var gBrowserInit = {
gBrowser.addEventListener("PluginCrashed", gPluginHandler, true); gBrowser.addEventListener("PluginCrashed", gPluginHandler, true);
gBrowser.addEventListener("PluginOutdated", gPluginHandler, true); gBrowser.addEventListener("PluginOutdated", gPluginHandler, true);
gBrowser.addEventListener("PluginInstantiated", gPluginHandler, true); gBrowser.addEventListener("PluginInstantiated", gPluginHandler, true);
gBrowser.addEventListener("PluginRemoved", gPluginHandler, true);
gBrowser.addEventListener("NewPluginInstalled", gPluginHandler.newPluginInstalled, true); gBrowser.addEventListener("NewPluginInstalled", gPluginHandler.newPluginInstalled, true);

View File

@ -1574,19 +1574,12 @@
this.appendChild(item); this.appendChild(item);
this._items.push(item); this._items.push(item);
} }
switch (this.notification.options.centerActions.length) { if (this.notification.options.centerActions.length == 1) {
case 0: this._setState(this._states.SINGLE);
PopupNotifications._dismiss(); } else if (this.notification.options.primaryPlugin) {
break; this._setState(this._states.MULTI_COLLAPSED);
case 1: } else {
this._setState(this._states.SINGLE); this._setState(this._states.MULTI_EXPANDED);
break;
default:
if (this.notification.options.primaryPlugin) {
this._setState(this._states.MULTI_COLLAPSED);
} else {
this._setState(this._states.MULTI_EXPANDED);
}
} }
]]></constructor> ]]></constructor>
<method name="_setState"> <method name="_setState">
@ -1652,7 +1645,7 @@
button2 = { button2 = {
label: "pluginContinue.label", label: "pluginContinue.label",
accesskey: "pluginContinue.accesskey", accesskey: "pluginContinue.accesskey",
action: "_singleContinue", action: "_cancel",
default: true default: true
}; };
switch (action.blocklistState) { switch (action.blocklistState) {
@ -1826,14 +1819,6 @@
this._cancel(); this._cancel();
]]></body> ]]></body>
</method> </method>
<method name="_singleContinue">
<body><![CDATA[
gPluginHandler._updatePluginPermission(this.notification,
this.notification.options.centerActions[0],
"continue");
this._cancel();
]]></body>
</method>
<method name="_multiAccept"> <method name="_multiAccept">
<body><![CDATA[ <body><![CDATA[
for (let item of this._items) { for (let item of this._items) {

View File

@ -196,36 +196,26 @@ CheckPluginStopEvent::Run()
*/ */
class nsSimplePluginEvent : public nsRunnable { class nsSimplePluginEvent : public nsRunnable {
public: public:
nsSimplePluginEvent(nsIContent* aTarget, const nsAString &aEvent) nsSimplePluginEvent(nsIContent* aContent, const nsAString &aEvent)
: mTarget(aTarget) : mContent(aContent),
, mDocument(aTarget->GetCurrentDoc()) mEvent(aEvent)
, mEvent(aEvent) {}
{
}
nsSimplePluginEvent(nsIDocument* aTarget, const nsAString& aEvent)
: mTarget(aTarget)
, mDocument(aTarget)
, mEvent(aEvent)
{
}
~nsSimplePluginEvent() {} ~nsSimplePluginEvent() {}
NS_IMETHOD Run(); NS_IMETHOD Run();
private: private:
nsCOMPtr<nsISupports> mTarget; nsCOMPtr<nsIContent> mContent;
nsCOMPtr<nsIDocument> mDocument;
nsString mEvent; nsString mEvent;
}; };
NS_IMETHODIMP NS_IMETHODIMP
nsSimplePluginEvent::Run() nsSimplePluginEvent::Run()
{ {
LOG(("OBJLC [%p]: nsSimplePluginEvent firing event \"%s\"", mTarget.get(), LOG(("OBJLC [%p]: nsSimplePluginEvent firing event \"%s\"", mContent.get(),
mEvent.get())); mEvent.get()));
nsContentUtils::DispatchTrustedEvent(mDocument, mTarget, nsContentUtils::DispatchTrustedEvent(mContent->GetDocument(), mContent,
mEvent, true, true); mEvent, true, true);
return NS_OK; return NS_OK;
} }
@ -684,9 +674,7 @@ nsObjectLoadingContent::UnbindFromTree(bool aDeep, bool aNullParent)
/// would keep the docshell around, but trash the frameloader /// would keep the docshell around, but trash the frameloader
UnloadObject(); UnloadObject();
} }
nsCOMPtr<nsIRunnable> ev = new nsSimplePluginEvent(thisContent->GetCurrentDoc(),
NS_LITERAL_STRING("PluginRemoved"));
NS_DispatchToCurrentThread(ev);
} }
nsObjectLoadingContent::nsObjectLoadingContent() nsObjectLoadingContent::nsObjectLoadingContent()

View File

@ -1192,11 +1192,9 @@ PluginModuleParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs
uint32_t flags = 0; uint32_t flags = 0;
if (!CallNP_Initialize(flags, error)) { if (!CallNP_Initialize(flags, error)) {
mShutdown = true;
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
else if (*error != NPERR_NO_ERROR) { else if (*error != NPERR_NO_ERROR) {
mShutdown = true;
return NS_OK; return NS_OK;
} }
@ -1222,14 +1220,8 @@ PluginModuleParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error)
flags |= kAllowAsyncDrawing; flags |= kAllowAsyncDrawing;
#endif #endif
if (!CallNP_Initialize(flags, error)) { if (!CallNP_Initialize(flags, error))
mShutdown = true;
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
}
if (*error != NPERR_NO_ERROR) {
mShutdown = true;
return NS_OK;
}
#if defined XP_WIN #if defined XP_WIN
// Send the info needed to join the chrome process's audio session to the // Send the info needed to join the chrome process's audio session to the