mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 711552 - Click to play plugins for desktop Firefox. r=felipe
This commit is contained in:
parent
4a620ca6b0
commit
af74761426
@ -612,6 +612,8 @@ pref("plugins.hide_infobar_for_carbon_failure_plugin", false);
|
||||
pref("plugins.update.url", "https://www.mozilla.com/%LOCALE%/plugincheck/");
|
||||
pref("plugins.update.notifyUser", false);
|
||||
|
||||
pref("plugins.click_to_play", false);
|
||||
|
||||
#ifdef XP_WIN
|
||||
pref("browser.preferences.instantApply", false);
|
||||
#else
|
||||
|
@ -1428,6 +1428,7 @@ function prepareForStartup() {
|
||||
gBrowser.addEventListener("PluginBlocklisted", gPluginHandler, true);
|
||||
gBrowser.addEventListener("PluginOutdated", gPluginHandler, true);
|
||||
gBrowser.addEventListener("PluginDisabled", gPluginHandler, true);
|
||||
gBrowser.addEventListener("PluginClickToPlay", gPluginHandler, true);
|
||||
gBrowser.addEventListener("NewPluginInstalled", gPluginHandler.newPluginInstalled, true);
|
||||
#ifdef XP_MACOSX
|
||||
gBrowser.addEventListener("npapi-carbon-event-model-failure", gPluginHandler, true);
|
||||
@ -5175,24 +5176,34 @@ var TabsProgressListener = {
|
||||
// document URI is not yet the about:-uri of the error page.
|
||||
|
||||
if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
|
||||
Components.isSuccessCode(aStatus) &&
|
||||
/^about:/.test(aWebProgress.DOMWindow.document.documentURI)) {
|
||||
aBrowser.addEventListener("click", BrowserOnClick, false);
|
||||
aBrowser.addEventListener("pagehide", function () {
|
||||
aBrowser.removeEventListener("click", BrowserOnClick, false);
|
||||
aBrowser.removeEventListener("pagehide", arguments.callee, true);
|
||||
}, true);
|
||||
Components.isSuccessCode(aStatus)) {
|
||||
setTimeout(function() {
|
||||
gPluginHandler.showPluginClickToPlayDoorhanger(aBrowser);
|
||||
}, 0);
|
||||
|
||||
// We also want to make changes to page UI for unprivileged about pages.
|
||||
BrowserOnAboutPageLoad(aWebProgress.DOMWindow.document);
|
||||
if (/^about:/.test(aWebProgress.DOMWindow.document.documentURI)) {
|
||||
aBrowser.addEventListener("click", BrowserOnClick, false);
|
||||
aBrowser.addEventListener("pagehide", function () {
|
||||
aBrowser.removeEventListener("click", BrowserOnClick, false);
|
||||
aBrowser.removeEventListener("pagehide", arguments.callee, true);
|
||||
}, true);
|
||||
|
||||
// We also want to make changes to page UI for unprivileged about pages.
|
||||
BrowserOnAboutPageLoad(aWebProgress.DOMWindow.document);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onLocationChange: function (aBrowser, aWebProgress, aRequest, aLocationURI,
|
||||
aFlags) {
|
||||
// Filter out any sub-frame loads
|
||||
if (aBrowser.contentWindow == aWebProgress.DOMWindow)
|
||||
if (aBrowser.contentWindow == aWebProgress.DOMWindow) {
|
||||
// initialize the click-to-play state
|
||||
aBrowser._loadEventHandled = false;
|
||||
aBrowser._clickToPlayDoorhangerShown = false;
|
||||
|
||||
FullZoom.onLocationChange(aLocationURI, false, aBrowser);
|
||||
}
|
||||
},
|
||||
|
||||
onRefreshAttempted: function (aBrowser, aWebProgress, aURI, aDelay, aSameURI) {
|
||||
@ -7145,6 +7156,10 @@ var gPluginHandler = {
|
||||
self.pluginUnavailable(plugin, event.type);
|
||||
break;
|
||||
|
||||
case "PluginClickToPlay":
|
||||
self.handleClickToPlayEvent(plugin);
|
||||
break;
|
||||
|
||||
case "PluginDisabled":
|
||||
let manageLink = doc.getAnonymousElementByAttribute(plugin, "class", "managePluginsLink");
|
||||
self.addLinkClickCallback(manageLink, "managePlugins");
|
||||
@ -7159,6 +7174,18 @@ var gPluginHandler = {
|
||||
}
|
||||
},
|
||||
|
||||
activatePlugins: function(aContentWindow) {
|
||||
let cwu = aContentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let plugins = cwu.plugins;
|
||||
for (let plugin of plugins) {
|
||||
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
if (!objLoadingContent.activated)
|
||||
objLoadingContent.playPlugin();
|
||||
plugin.removeEventListener("click", plugin.clickHandler, true);
|
||||
}
|
||||
},
|
||||
|
||||
newPluginInstalled : function(event) {
|
||||
// browser elements are anonymous so we can't just use target.
|
||||
var browser = event.originalTarget;
|
||||
@ -7212,6 +7239,54 @@ var gPluginHandler = {
|
||||
openHelpLink("plugin-crashed", false);
|
||||
},
|
||||
|
||||
// Event listener for click-to-play plugins.
|
||||
handleClickToPlayEvent: function(aPlugin) {
|
||||
let browser = gBrowser.getBrowserForDocument(aPlugin.ownerDocument.defaultView.top.document);
|
||||
let notificationBox = gBrowser.getNotificationBox(browser);
|
||||
|
||||
let doc = aPlugin.ownerDocument;
|
||||
let overlay = doc.getAnonymousElementByAttribute(aPlugin, "class", "mainBox");
|
||||
let contentWindow = browser.contentWindow;
|
||||
overlay.addEventListener("click", function(aEvent) {
|
||||
if (aEvent.button == 0 && aEvent.isTrusted)
|
||||
gPluginHandler.activatePlugins(aEvent.target.ownerDocument.defaultView.top);
|
||||
}, true);
|
||||
|
||||
if (browser._loadEventHandled && !browser._clickToPlayDoorhangerShown &&
|
||||
gPluginHandler.isTooSmall(aPlugin, overlay))
|
||||
gPluginHandler.showPluginClickToPlayDoorhanger(browser);
|
||||
},
|
||||
|
||||
showPluginClickToPlayDoorhanger: function(aBrowser) {
|
||||
aBrowser._loadEventHandled = true;
|
||||
// Show a plugin doorhanger if there are no clickable overlays showing
|
||||
let contentWindow = aBrowser.contentWindow;
|
||||
let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let plugins = cwu.plugins;
|
||||
let isAnyPluginVisible = false;
|
||||
for (let plugin of plugins) {
|
||||
let overlay = plugin.ownerDocument.getAnonymousElementByAttribute(plugin, "class", "mainBox");
|
||||
if (overlay && !gPluginHandler.isTooSmall(plugin, overlay)) {
|
||||
isAnyPluginVisible = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (plugins && plugins.length && !isAnyPluginVisible) {
|
||||
aBrowser._clickToPlayDoorhangerShown = true;
|
||||
let messageString = gNavigatorBundle.getString("activatePluginsMessage.message");
|
||||
let action = {
|
||||
label: gNavigatorBundle.getString("activatePluginsMessage.label"),
|
||||
accessKey: gNavigatorBundle.getString("activatePluginsMessage.accesskey"),
|
||||
callback: function() { gPluginHandler.activatePlugins(contentWindow); }
|
||||
};
|
||||
let options = { timeout: Date.now() + 30000 };
|
||||
PopupNotifications.show(aBrowser, "click-to-play-plugins",
|
||||
messageString, "addons-notification-icon",
|
||||
action, null, options);
|
||||
}
|
||||
},
|
||||
|
||||
// event listener for missing/blocklisted/outdated/carbonFailure plugins.
|
||||
pluginUnavailable: function (plugin, eventType) {
|
||||
let browser = gBrowser.getBrowserForDocument(plugin.ownerDocument
|
||||
|
@ -115,6 +115,9 @@ crashedpluginsMessage.learnMore=Learn More…
|
||||
carbonFailurePluginsMessage.message=This page asks to use a plugin that can only run in 32-bit mode
|
||||
carbonFailurePluginsMessage.restartButton.label=Restart in 32-bit mode
|
||||
carbonFailurePluginsMessage.restartButton.accesskey=R
|
||||
activatePluginsMessage.message=Would you like to activate the plugins on this page?
|
||||
activatePluginsMessage.label=Activate plugins
|
||||
activatePluginsMessage.accesskey=A
|
||||
|
||||
# Sanitize
|
||||
# LOCALIZATION NOTE (sanitizeDialog2.everything.title): When "Time range to
|
||||
|
@ -2253,7 +2253,8 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
|
||||
.popup-notification-icon[popupid="addon-install-cancelled"],
|
||||
.popup-notification-icon[popupid="addon-install-blocked"],
|
||||
.popup-notification-icon[popupid="addon-install-failed"],
|
||||
.popup-notification-icon[popupid="addon-install-complete"] {
|
||||
.popup-notification-icon[popupid="addon-install-complete"],
|
||||
.popup-notification-icon[popupid="click-to-play-plugins"] {
|
||||
list-style-image: url(chrome://mozapps/skin/extensions/extensionGeneric.png);
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
|
@ -21,7 +21,9 @@
|
||||
<!ENTITY pluginWizard.finalPage.restart.label "&brandShortName; needs to be restarted for the plugin(s) to work.">
|
||||
|
||||
<!ENTITY missingPlugin "A plugin is needed to display this content.">
|
||||
<!ENTITY clickToPlayPlugin "Tap here to activate plugin.">
|
||||
<!-- LOCALIZATION NOTE (tapToPlayPlugin): Mobile (used for touch interfaces) only has one type of plugin possible. -->
|
||||
<!ENTITY tapToPlayPlugin "Tap here to activate plugin.">
|
||||
<!ENTITY clickToPlayPlugins "Click here to activate plugins.">
|
||||
<!ENTITY disabledPlugin "This plugin is disabled.">
|
||||
<!ENTITY blockedPlugin.label "This plugin has been blocked for your protection.">
|
||||
|
||||
|
@ -49,8 +49,8 @@
|
||||
xmlns:html="http://www.w3.org/1999/xhtml">
|
||||
<binding id="pluginProblem" inheritstyle="false">
|
||||
<resources>
|
||||
<stylesheet src="chrome://mozapps/skin/plugins/pluginProblem.css"/>
|
||||
<stylesheet src="chrome://mozapps/content/plugins/pluginProblemContent.css"/>
|
||||
<stylesheet src="chrome://mozapps/skin/plugins/pluginProblem.css"/>
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
@ -58,7 +58,8 @@
|
||||
<xul:spacer flex="1"/>
|
||||
<xul:box class="icon"/>
|
||||
<html:div class="msg msgUnsupported">&missingPlugin;</html:div>
|
||||
<html:div class="msg msgClickToPlay">&clickToPlayPlugin;</html:div>
|
||||
<html:div class="msg msgTapToPlay">&tapToPlayPlugin;</html:div>
|
||||
<html:div class="msg msgClickToPlay">&clickToPlayPlugins;</html:div>
|
||||
<html:div class="msg msgDisabled">&disabledPlugin;</html:div>
|
||||
<html:div class="msg msgBlocked">&blockedPlugin.label;</html:div>
|
||||
<html:div class="msg msgCrashed"><!-- set at runtime --></html:div>
|
||||
|
@ -43,6 +43,7 @@ html|applet:not([height]), html|applet[height=""] {
|
||||
|
||||
:-moz-type-unsupported .msgUnsupported,
|
||||
:-moz-handler-clicktoplay .msgClickToPlay,
|
||||
:-moz-handler-clicktoplay .msgTapToPlay,
|
||||
:-moz-handler-disabled .msgDisabled,
|
||||
:-moz-handler-disabled .msgManagePlugins,
|
||||
:-moz-handler-blocked .msgBlocked,
|
||||
|
@ -60,6 +60,15 @@ html|a {
|
||||
text-shadow: rgba(0,0,0,0.8) 0 0 3.5px;
|
||||
}
|
||||
|
||||
:-moz-handler-clicktoplay,
|
||||
.msgClickToPlay {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
:-moz-handler-clicktoplay .msgTapToPlay {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.submitStatus div {
|
||||
min-height: 19px; /* height of biggest line (with throbber) */
|
||||
}
|
||||
|
@ -60,6 +60,23 @@ html|a {
|
||||
text-shadow: rgba(0,0,0,0.8) 0 0 3.5px;
|
||||
}
|
||||
|
||||
:-moz-handler-clicktoplay,
|
||||
.msgClickToPlay {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@media not all and (-moz-touch-enabled) {
|
||||
:-moz-handler-clicktoplay .msgTapToPlay {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (-moz-touch-enabled) {
|
||||
:-moz-handler-clicktoplay .msgClickToPlay {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.submitStatus div {
|
||||
min-height: 19px; /* height of biggest line (with throbber) */
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user