зеркало из https://github.com/mozilla/gecko-dev.git
Bug 734323 - Invisible plugins added to the DOM after the 'load' event will not prompt a doorhanger to appear. r=margaret
This commit is contained in:
Родитель
c0b810eb7d
Коммит
0a07e64296
|
@ -1463,6 +1463,9 @@ 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 = {
|
||||
|
@ -1791,6 +1794,7 @@ 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)
|
||||
|
@ -1913,14 +1917,20 @@ Tab.prototype = {
|
|||
|
||||
case "PluginClickToPlay": {
|
||||
let plugin = aEvent.target;
|
||||
let overlay = plugin.ownerDocument.getAnonymousElementByAttribute(plugin, "class", "mainBox");
|
||||
if (!overlay)
|
||||
|
||||
if (this.clickToPlayPluginsActivated) {
|
||||
PluginHelper.playPlugin(plugin);
|
||||
return;
|
||||
}
|
||||
|
||||
// If the overlay is too small, hide the overlay and act like this
|
||||
// is a hidden plugin object
|
||||
if (PluginHelper.isTooSmall(plugin, overlay)) {
|
||||
overlay.style.visibility = "hidden";
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1931,7 +1941,10 @@ Tab.prototype = {
|
|||
return;
|
||||
e.preventDefault();
|
||||
}
|
||||
PluginHelper.playAllPlugins(e.target.ownerDocument.defaultView);
|
||||
let win = e.target.ownerDocument.defaultView.top;
|
||||
let tab = BrowserApp.getTabForWindow(win);
|
||||
tab.clickToPlayPluginsActivated = true;
|
||||
PluginHelper.playAllPlugins(win);
|
||||
}, true);
|
||||
break;
|
||||
}
|
||||
|
@ -1992,6 +2005,11 @@ 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",
|
||||
|
@ -3900,6 +3918,7 @@ var ClipboardHelper = {
|
|||
|
||||
var PluginHelper = {
|
||||
showDoorHanger: function(aTab) {
|
||||
aTab.clickToPlayPluginDoorhangerShown = true;
|
||||
let message = Strings.browser.GetStringFromName("clickToPlayPlugins.message");
|
||||
let buttons = [
|
||||
{
|
||||
|
@ -3926,11 +3945,13 @@ var PluginHelper = {
|
|||
if (!plugins || !plugins.length)
|
||||
return;
|
||||
|
||||
for (let plugin of plugins) {
|
||||
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
if (!objLoadingContent.activated)
|
||||
objLoadingContent.playPlugin();
|
||||
}
|
||||
plugins.forEach(this.playPlugin);
|
||||
},
|
||||
|
||||
playPlugin: function(plugin) {
|
||||
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
if (!objLoadingContent.activated)
|
||||
objLoadingContent.playPlugin();
|
||||
},
|
||||
|
||||
getPluginPreference: function getPluginPreference() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче