Bug 1069075 - Fix race condition in flushing pluginData cache in PluginContent.jsm. r=gfritzsche.

--HG--
extra : rebase_source : 0a0c801e0a8802e0a8ae04ac34e9977576f64e1e
extra : histedit_source : 03138083b2ac0892c2d66898db918528dda01fe0
This commit is contained in:
Mike Conley 2014-09-26 17:17:36 -04:00
parent 1090f50427
commit c4006a26e4
2 changed files with 22 additions and 12 deletions

View File

@ -139,11 +139,6 @@ var gPluginHandler = {
// list again
this.options.primaryPlugin = null;
}
else if (event == "removed") {
// Once the notification is removed, let the content script clear any
// caches it may have populated.
this.browser.messageManager.sendAsyncMessage("BrowserPlugins:NotificationRemoved");
}
},
/**

View File

@ -38,12 +38,11 @@ PluginContent.prototype = {
global.addEventListener("PluginOutdated", this, true);
global.addEventListener("PluginInstantiated", this, true);
global.addEventListener("PluginRemoved", this, true);
global.addEventListener("pagehide", this, true);
global.addEventListener("pageshow", this, true);
global.addEventListener("unload", this);
global.addEventListener("pageshow", (event) => this.onPageShow(event), true);
global.addMessageListener("BrowserPlugins:ActivatePlugins", this);
global.addMessageListener("BrowserPlugins:NotificationRemoved", this);
global.addMessageListener("BrowserPlugins:NotificationShown", this);
global.addMessageListener("BrowserPlugins:ContextMenuCommand", this);
},
@ -58,9 +57,6 @@ PluginContent.prototype = {
case "BrowserPlugins:ActivatePlugins":
this.activatePlugins(msg.data.pluginInfo, msg.data.newState);
break;
case "BrowserPlugins:NotificationRemoved":
this.clearPluginDataCache();
break;
case "BrowserPlugins:NotificationShown":
setTimeout(() => this.updateNotificationUI(), 0);
break;
@ -79,7 +75,7 @@ PluginContent.prototype = {
onPageShow: function (event) {
// Ignore events that aren't from the main document.
if (this.global.content && event.target != this.global.content.document) {
if (!this.content || event.target != this.content.document) {
return;
}
@ -91,6 +87,15 @@ PluginContent.prototype = {
}
},
onPageHide: function (event) {
// Ignore events that aren't from the main document.
if (!this.content || event.target != this.content.document) {
return;
}
this.clearPluginDataCache();
},
getPluginUI: function (plugin, anonid) {
return plugin.ownerDocument.
getAnonymousElementByAttribute(plugin, "anonid", anonid);
@ -284,6 +289,16 @@ PluginContent.prototype = {
return;
}
if (eventType == "pagehide") {
this.onPageHide(event);
return;
}
if (eventType == "pageshow") {
this.onPageShow(event);
return;
}
if (eventType == "PluginRemoved") {
this.updateNotificationUI(event.target);
return;