зеркало из https://github.com/mozilla/gecko-dev.git
Bug 755062 - Make sure there are no visible plugins on the page before deciding to show the plugin doorhanger. r=mfinkle
This commit is contained in:
Родитель
34309ca065
Коммит
05d45355ad
|
@ -1510,7 +1510,8 @@ function Tab(aURL, aParams) {
|
|||
this._drawZoom = 1.0;
|
||||
this.userScrollPos = { x: 0, y: 0 };
|
||||
this.contentDocumentIsDisplayed = true;
|
||||
this.clickToPlayPluginDoorhangerShown = false;
|
||||
this.pluginDoorhangerTimeout = null;
|
||||
this.shouldShowPluginDoorhanger = true;
|
||||
this.clickToPlayPluginsActivated = false;
|
||||
}
|
||||
|
||||
|
@ -2111,11 +2112,22 @@ Tab.prototype = {
|
|||
// If the plugin is hidden, or if the overlay is too small, show a doorhanger notification
|
||||
let overlay = plugin.ownerDocument.getAnonymousElementByAttribute(plugin, "class", "mainBox");
|
||||
if (!overlay || PluginHelper.isTooSmall(plugin, overlay)) {
|
||||
if (!this.clickToPlayPluginDoorhangerShown)
|
||||
PluginHelper.showDoorHanger(this);
|
||||
// To avoid showing the doorhanger if there are also visible plugin overlays on the page,
|
||||
// delay showing the doorhanger to check if visible plugins get added in the near future.
|
||||
if (!this.pluginDoorhangerTimeout) {
|
||||
this.pluginDoorhangerTimeout = setTimeout(function() {
|
||||
if (this.shouldShowPluginDoorhanger)
|
||||
PluginHelper.showDoorHanger(this);
|
||||
}.bind(this), 500);
|
||||
}
|
||||
|
||||
// No overlay? We're done here.
|
||||
if (!overlay)
|
||||
return;
|
||||
|
||||
} else {
|
||||
// There's a large enough visible overlay that we don't need to show the doorhanger.
|
||||
this.shouldShowPluginDoorhanger = false;
|
||||
}
|
||||
|
||||
// Add click to play listener to the overlay
|
||||
|
@ -2130,8 +2142,7 @@ Tab.prototype = {
|
|||
tab.clickToPlayPluginsActivated = true;
|
||||
PluginHelper.playAllPlugins(win);
|
||||
|
||||
if (tab.clickToPlayPluginDoorhangerShown)
|
||||
NativeWindow.doorhanger.hide("ask-to-play-plugins", tab.id);
|
||||
NativeWindow.doorhanger.hide("ask-to-play-plugins", tab.id);
|
||||
}, true);
|
||||
break;
|
||||
}
|
||||
|
@ -2209,7 +2220,9 @@ Tab.prototype = {
|
|||
let sameDocument = (aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT) != 0;
|
||||
|
||||
// Reset state of click-to-play plugin notifications.
|
||||
this.clickToPlayPluginDoorhangerShown = false;
|
||||
clearTimeout(this.pluginDoorhangerTimeout);
|
||||
this.pluginDoorhangerTimeout = null;
|
||||
this.shouldShowPluginDoorhanger = true;
|
||||
this.clickToPlayPluginsActivated = false;
|
||||
|
||||
let message = {
|
||||
|
@ -4215,7 +4228,7 @@ var PluginHelper = {
|
|||
|
||||
// Even though we may not end up showing a doorhanger, this flag
|
||||
// lets us know that we've tried to show a doorhanger.
|
||||
aTab.clickToPlayPluginDoorhangerShown = true;
|
||||
aTab.shouldShowPluginDoorhanger = false;
|
||||
|
||||
let uri = aTab.browser.currentURI;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче