mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 820497 - update popup notification for click-to-play more often r=jaws
This commit is contained in:
parent
4aca71290f
commit
b884265122
@ -336,7 +336,6 @@ var gPluginHandler = {
|
||||
let browser = gBrowser.getBrowserForDocument(aContentWindow.document);
|
||||
let notification = PopupNotifications.getNotification("click-to-play-plugins", browser);
|
||||
if (notification) {
|
||||
browser._clickToPlayDoorhangerShown = false;
|
||||
notification.remove();
|
||||
}
|
||||
if (pluginNeedsActivation) {
|
||||
@ -452,8 +451,7 @@ var gPluginHandler = {
|
||||
}, true);
|
||||
}
|
||||
|
||||
if (!browser._clickToPlayDoorhangerShown)
|
||||
gPluginHandler._showClickToPlayNotification(browser);
|
||||
gPluginHandler._showClickToPlayNotification(browser);
|
||||
},
|
||||
|
||||
_handlePlayPreviewEvent: function PH_handlePlayPreviewEvent(aPlugin) {
|
||||
@ -601,9 +599,7 @@ var gPluginHandler = {
|
||||
},
|
||||
|
||||
_showClickToPlayNotification: function PH_showClickToPlayNotification(aBrowser) {
|
||||
aBrowser._clickToPlayDoorhangerShown = true;
|
||||
let contentWindow = aBrowser.contentWindow;
|
||||
|
||||
let messageString = gNavigatorBundle.getString("activatePluginsMessage.message");
|
||||
let mainAction = {
|
||||
label: gNavigatorBundle.getString("activateAllPluginsMessage.label"),
|
||||
|
@ -4518,7 +4518,6 @@ var TabsProgressListener = {
|
||||
// or history.push/pop/replaceState.
|
||||
if (aRequest) {
|
||||
// Initialize the click-to-play state.
|
||||
aBrowser._clickToPlayDoorhangerShown = false;
|
||||
aBrowser._clickToPlayPluginsActivated = false;
|
||||
aBrowser._pluginScriptedState = gPluginHandler.PLUGIN_SCRIPTED_STATE_NONE;
|
||||
}
|
||||
|
@ -255,6 +255,7 @@ _BROWSER_FILES = \
|
||||
plugin_bug749455.html \
|
||||
plugin_bug797677.html \
|
||||
plugin_bug818009.html \
|
||||
plugin_bug820497.html \
|
||||
plugin_hidden_to_visible.html \
|
||||
plugin_two_types.html \
|
||||
alltabslistener.html \
|
||||
@ -283,6 +284,7 @@ _BROWSER_FILES = \
|
||||
browser_bug812562.js \
|
||||
browser_bug818009.js \
|
||||
browser_bug818118.js \
|
||||
browser_bug820497.js \
|
||||
blockPluginVulnerableUpdatable.xml \
|
||||
blockPluginVulnerableNoUpdate.xml \
|
||||
blockNoPlugins.xml \
|
||||
|
53
browser/base/content/test/browser_bug820497.js
Normal file
53
browser/base/content/test/browser_bug820497.js
Normal file
@ -0,0 +1,53 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var gTestBrowser = null;
|
||||
var gNumPluginBindingsAttached = 0;
|
||||
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
registerCleanupFunction(function() {
|
||||
Services.prefs.clearUserPref("plugins.click_to_play");
|
||||
gTestBrowser.removeEventListener("PluginBindingAttached", pluginBindingAttached, true, true);
|
||||
gBrowser.removeCurrentTab();
|
||||
window.focus();
|
||||
});
|
||||
|
||||
Services.prefs.setBoolPref("plugins.click_to_play", true);
|
||||
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gTestBrowser = gBrowser.selectedBrowser;
|
||||
gTestBrowser.addEventListener("PluginBindingAttached", pluginBindingAttached, true, true);
|
||||
var gHttpTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
|
||||
gTestBrowser.contentWindow.location = gHttpTestRoot + "plugin_bug820497.html";
|
||||
}
|
||||
|
||||
function pluginBindingAttached() {
|
||||
gNumPluginBindingsAttached++;
|
||||
|
||||
if (gNumPluginBindingsAttached == 1) {
|
||||
var doc = gTestBrowser.contentDocument;
|
||||
var testplugin = doc.getElementById("test");
|
||||
ok(testplugin, "should have test plugin");
|
||||
var secondtestplugin = doc.getElementById("secondtest");
|
||||
ok(!secondtestplugin, "should not yet have second test plugin");
|
||||
var notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
|
||||
ok(notification, "should have popup notification");
|
||||
is(notification.options.centerActions.length, 1, "should be 1 type of plugin in the popup notification");
|
||||
} else if (gNumPluginBindingsAttached == 2) {
|
||||
var doc = gTestBrowser.contentDocument;
|
||||
var testplugin = doc.getElementById("test");
|
||||
ok(testplugin, "should have test plugin");
|
||||
var secondtestplugin = doc.getElementById("secondtest");
|
||||
ok(secondtestplugin, "should have second test plugin");
|
||||
var notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
|
||||
ok(notification, "should have popup notification");
|
||||
is(notification.options.centerActions.length, 2, "should be 2 types of plugin in the popup notification");
|
||||
finish();
|
||||
} else {
|
||||
ok(false, "if we've gotten here, something is quite wrong");
|
||||
}
|
||||
}
|
17
browser/base/content/test/plugin_bug820497.html
Normal file
17
browser/base/content/test/plugin_bug820497.html
Normal file
@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head><meta charset="utf-8"/></head>
|
||||
<body onload="addSecondPlugin()">
|
||||
<object id="test" type="application/x-test" width=200 height=200></object>
|
||||
<script>
|
||||
function addSecondPlugin() {
|
||||
var object = document.createElement("object");
|
||||
object.type = "application/x-second-test";
|
||||
object.width = 200;
|
||||
object.height = 200;
|
||||
object.id = "secondtest";
|
||||
document.body.appendChild(object);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user