зеркало из https://github.com/mozilla/gecko-dev.git
bug 832481 - require doorhanger to activate vulnerable click-to-play plugins r=jaws
This commit is contained in:
Родитель
315fbb7ed9
Коммит
e515e8c98c
|
@ -470,7 +470,13 @@ var gPluginHandler = {
|
|||
if (!(aEvent.originalTarget instanceof HTMLAnchorElement) &&
|
||||
(aEvent.originalTarget.getAttribute('anonid') != 'closeIcon') &&
|
||||
aEvent.button == 0 && aEvent.isTrusted) {
|
||||
gPluginHandler.activateSinglePlugin(aEvent.target.ownerDocument.defaultView.top, aPlugin);
|
||||
if (objLoadingContent.pluginFallbackType ==
|
||||
Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE ||
|
||||
objLoadingContent.pluginFallbackType ==
|
||||
Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_NO_UPDATE)
|
||||
gPluginHandler._showClickToPlayNotification(browser, true);
|
||||
else
|
||||
gPluginHandler.activateSinglePlugin(aEvent.target.ownerDocument.defaultView.top, aPlugin);
|
||||
aEvent.stopPropagation();
|
||||
aEvent.preventDefault();
|
||||
}
|
||||
|
@ -648,7 +654,7 @@ var gPluginHandler = {
|
|||
}
|
||||
},
|
||||
|
||||
_showClickToPlayNotification: function PH_showClickToPlayNotification(aBrowser) {
|
||||
_showClickToPlayNotification: function PH_showClickToPlayNotification(aBrowser, aForceOpenNotification) {
|
||||
let contentWindow = aBrowser.contentWindow;
|
||||
let messageString = gNavigatorBundle.getString("activatePluginsMessage.message");
|
||||
let mainAction = {
|
||||
|
@ -689,7 +695,7 @@ var gPluginHandler = {
|
|||
let notification = PopupNotifications.getNotification("click-to-play-plugins", aBrowser);
|
||||
let dismissed = notification ? notification.dismissed : true;
|
||||
// Always show the doorhanger if the anchor is not available.
|
||||
if (!isElementVisible(gURLBar))
|
||||
if (!isElementVisible(gURLBar) || aForceOpenNotification)
|
||||
dismissed = false;
|
||||
let options = { dismissed: dismissed, centerActions: centerActions };
|
||||
let icon = haveVulnerablePlugin ? "blocked-plugins-notification-icon" : "plugins-notification-icon"
|
||||
|
|
|
@ -683,6 +683,32 @@ function test18e() {
|
|||
ok(objLoadingContent.activated, "Test 18e, Plugin should be activated");
|
||||
|
||||
Services.perms.remove("127.0.0.1:8888", gPluginHost.getPermissionStringForType("application/x-test"));
|
||||
prepareTest(test18f, gHttpTestRoot + "plugin_test.html");
|
||||
}
|
||||
|
||||
// clicking the in-content overlay of a vulnerable plugin should bring
|
||||
// up the notification and not directly activate the plugin
|
||||
function test18f() {
|
||||
var notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
|
||||
ok(notification, "Test 18f, Should have a click-to-play notification");
|
||||
ok(notification.dismissed, "Test 18f, notification should start dismissed");
|
||||
var plugin = gTestBrowser.contentDocument.getElementById("test");
|
||||
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(!objLoadingContent.activated, "Test 18f, Plugin should not be activated");
|
||||
|
||||
notification.options.eventCallback = function() { executeSoon(test18g); };
|
||||
EventUtils.synthesizeMouseAtCenter(plugin, {}, gTestBrowser.contentWindow);
|
||||
}
|
||||
|
||||
function test18g() {
|
||||
var notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
|
||||
ok(notification, "Test 18g, Should have a click-to-play notification");
|
||||
ok(!notification.dismissed, "Test 18g, notification should be open");
|
||||
notification.options.eventCallback = null;
|
||||
var plugin = gTestBrowser.contentDocument.getElementById("test");
|
||||
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(!objLoadingContent.activated, "Test 18g, Plugin should not be activated");
|
||||
|
||||
setAndUpdateBlocklist(gHttpTestRoot + "blockNoPlugins.xml",
|
||||
function() {
|
||||
resetBlocklist();
|
||||
|
|
Загрузка…
Ссылка в новой задаче