forked from mirrors/gecko-dev
This patch creates a pluginProblem UA Widget and constructs it (instead of the XBL pluginProblem binding) when UA Widget is enabled. Tests in browser/base/content/test/plugins/ are duplicated so that we could test both versions. Depends on D11702 Differential Revision: https://phabricator.services.mozilla.com/D11703 --HG-- rename : browser/base/content/test/plugins/.eslintrc.js => browser/base/content/test/plugins/xbl/.eslintrc.js rename : browser/base/content/test/plugins/blockNoPlugins.xml => browser/base/content/test/plugins/xbl/blockNoPlugins.xml rename : browser/base/content/test/plugins/blockPluginHard.xml => browser/base/content/test/plugins/xbl/blockPluginHard.xml rename : browser/base/content/test/plugins/blockPluginInfoURL.xml => browser/base/content/test/plugins/xbl/blockPluginInfoURL.xml rename : browser/base/content/test/plugins/blockPluginVulnerableNoUpdate.xml => browser/base/content/test/plugins/xbl/blockPluginVulnerableNoUpdate.xml rename : browser/base/content/test/plugins/blockPluginVulnerableUpdatable.xml => browser/base/content/test/plugins/xbl/blockPluginVulnerableUpdatable.xml rename : browser/base/content/test/plugins/blocklist_proxy.js => browser/base/content/test/plugins/xbl/blocklist_proxy.js rename : browser/base/content/test/plugins/browser.ini => browser/base/content/test/plugins/xbl/browser.ini rename : browser/base/content/test/plugins/browser_CTP_context_menu.js => browser/base/content/test/plugins/xbl/browser_CTP_context_menu.js rename : browser/base/content/test/plugins/browser_CTP_crashreporting.js => browser/base/content/test/plugins/xbl/browser_CTP_crashreporting.js rename : browser/base/content/test/plugins/browser_CTP_drag_drop.js => browser/base/content/test/plugins/xbl/browser_CTP_drag_drop.js rename : browser/base/content/test/plugins/browser_CTP_favorfallback.js => browser/base/content/test/plugins/xbl/browser_CTP_favorfallback.js rename : browser/base/content/test/plugins/browser_CTP_hide_overlay.js => browser/base/content/test/plugins/xbl/browser_CTP_hide_overlay.js rename : browser/base/content/test/plugins/browser_CTP_iframe.js => browser/base/content/test/plugins/xbl/browser_CTP_iframe.js rename : browser/base/content/test/plugins/browser_CTP_nonplugins.js => browser/base/content/test/plugins/xbl/browser_CTP_nonplugins.js rename : browser/base/content/test/plugins/browser_CTP_outsideScrollArea.js => browser/base/content/test/plugins/xbl/browser_CTP_outsideScrollArea.js rename : browser/base/content/test/plugins/browser_CTP_overlay_styles.js => browser/base/content/test/plugins/xbl/browser_CTP_overlay_styles.js rename : browser/base/content/test/plugins/browser_CTP_resize.js => browser/base/content/test/plugins/xbl/browser_CTP_resize.js rename : browser/base/content/test/plugins/browser_CTP_shouldShowOverlay.js => browser/base/content/test/plugins/xbl/browser_CTP_shouldShowOverlay.js rename : browser/base/content/test/plugins/browser_CTP_zoom.js => browser/base/content/test/plugins/xbl/browser_CTP_zoom.js rename : browser/base/content/test/plugins/browser_blocking.js => browser/base/content/test/plugins/xbl/browser_blocking.js rename : browser/base/content/test/plugins/browser_blocklist_content.js => browser/base/content/test/plugins/xbl/browser_blocklist_content.js rename : browser/base/content/test/plugins/browser_bug743421.js => browser/base/content/test/plugins/xbl/browser_bug743421.js rename : browser/base/content/test/plugins/browser_bug744745.js => browser/base/content/test/plugins/xbl/browser_bug744745.js rename : browser/base/content/test/plugins/browser_bug787619.js => browser/base/content/test/plugins/xbl/browser_bug787619.js rename : browser/base/content/test/plugins/browser_bug797677.js => browser/base/content/test/plugins/xbl/browser_bug797677.js rename : browser/base/content/test/plugins/browser_bug812562.js => browser/base/content/test/plugins/xbl/browser_bug812562.js rename : browser/base/content/test/plugins/browser_bug818118.js => browser/base/content/test/plugins/xbl/browser_bug818118.js rename : browser/base/content/test/plugins/browser_bug820497.js => browser/base/content/test/plugins/xbl/browser_bug820497.js rename : browser/base/content/test/plugins/browser_clearplugindata.html => browser/base/content/test/plugins/xbl/browser_clearplugindata.html rename : browser/base/content/test/plugins/browser_clearplugindata.js => browser/base/content/test/plugins/xbl/browser_clearplugindata.js rename : browser/base/content/test/plugins/browser_clearplugindata_noage.html => browser/base/content/test/plugins/xbl/browser_clearplugindata_noage.html rename : browser/base/content/test/plugins/browser_enable_DRM_prompt.js => browser/base/content/test/plugins/xbl/browser_enable_DRM_prompt.js rename : browser/base/content/test/plugins/browser_globalplugin_crashinfobar.js => browser/base/content/test/plugins/xbl/browser_globalplugin_crashinfobar.js rename : browser/base/content/test/plugins/browser_iterate_hidden_plugins.js => browser/base/content/test/plugins/xbl/browser_iterate_hidden_plugins.js rename : browser/base/content/test/plugins/browser_pluginCrashCommentAndURL.js => browser/base/content/test/plugins/xbl/browser_pluginCrashCommentAndURL.js rename : browser/base/content/test/plugins/browser_pluginCrashReportNonDeterminism.js => browser/base/content/test/plugins/xbl/browser_pluginCrashReportNonDeterminism.js rename : browser/base/content/test/plugins/browser_plugin_reloading.js => browser/base/content/test/plugins/xbl/browser_plugin_reloading.js rename : browser/base/content/test/plugins/browser_pluginnotification.js => browser/base/content/test/plugins/xbl/browser_pluginnotification.js rename : browser/base/content/test/plugins/browser_private_browsing_eme_persistent_state.js => browser/base/content/test/plugins/xbl/browser_private_browsing_eme_persistent_state.js rename : browser/base/content/test/plugins/browser_private_clicktoplay.js => browser/base/content/test/plugins/xbl/browser_private_clicktoplay.js rename : browser/base/content/test/plugins/browser_subframe_access_hidden_plugins.js => browser/base/content/test/plugins/xbl/browser_subframe_access_hidden_plugins.js rename : browser/base/content/test/plugins/empty_file.html => browser/base/content/test/plugins/xbl/empty_file.html rename : browser/base/content/test/plugins/plugin_add_dynamically.html => browser/base/content/test/plugins/xbl/plugin_add_dynamically.html rename : browser/base/content/test/plugins/plugin_alternate_content.html => browser/base/content/test/plugins/xbl/plugin_alternate_content.html rename : browser/base/content/test/plugins/plugin_big.html => browser/base/content/test/plugins/xbl/plugin_big.html rename : browser/base/content/test/plugins/plugin_both.html => browser/base/content/test/plugins/xbl/plugin_both.html rename : browser/base/content/test/plugins/plugin_both2.html => browser/base/content/test/plugins/xbl/plugin_both2.html rename : browser/base/content/test/plugins/plugin_bug744745.html => browser/base/content/test/plugins/xbl/plugin_bug744745.html rename : browser/base/content/test/plugins/plugin_bug749455.html => browser/base/content/test/plugins/xbl/plugin_bug749455.html rename : browser/base/content/test/plugins/plugin_bug787619.html => browser/base/content/test/plugins/xbl/plugin_bug787619.html rename : browser/base/content/test/plugins/plugin_bug797677.html => browser/base/content/test/plugins/xbl/plugin_bug797677.html rename : browser/base/content/test/plugins/plugin_bug820497.html => browser/base/content/test/plugins/xbl/plugin_bug820497.html rename : browser/base/content/test/plugins/plugin_clickToPlayAllow.html => browser/base/content/test/plugins/xbl/plugin_clickToPlayAllow.html rename : browser/base/content/test/plugins/plugin_clickToPlayDeny.html => browser/base/content/test/plugins/xbl/plugin_clickToPlayDeny.html rename : browser/base/content/test/plugins/plugin_crashCommentAndURL.html => browser/base/content/test/plugins/xbl/plugin_crashCommentAndURL.html rename : browser/base/content/test/plugins/plugin_favorfallback.html => browser/base/content/test/plugins/xbl/plugin_favorfallback.html rename : browser/base/content/test/plugins/plugin_hidden_to_visible.html => browser/base/content/test/plugins/xbl/plugin_hidden_to_visible.html rename : browser/base/content/test/plugins/plugin_iframe.html => browser/base/content/test/plugins/xbl/plugin_iframe.html rename : browser/base/content/test/plugins/plugin_outsideScrollArea.html => browser/base/content/test/plugins/xbl/plugin_outsideScrollArea.html rename : browser/base/content/test/plugins/plugin_overlay_styles.html => browser/base/content/test/plugins/xbl/plugin_overlay_styles.html rename : browser/base/content/test/plugins/plugin_shouldShowOverlay.html => browser/base/content/test/plugins/xbl/plugin_shouldShowOverlay.html rename : browser/base/content/test/plugins/plugin_simple_blank.swf => browser/base/content/test/plugins/xbl/plugin_simple_blank.swf rename : browser/base/content/test/plugins/plugin_small.html => browser/base/content/test/plugins/xbl/plugin_small.html rename : browser/base/content/test/plugins/plugin_small_2.html => browser/base/content/test/plugins/xbl/plugin_small_2.html rename : browser/base/content/test/plugins/plugin_syncRemoved.html => browser/base/content/test/plugins/xbl/plugin_syncRemoved.html rename : browser/base/content/test/plugins/plugin_test.html => browser/base/content/test/plugins/xbl/plugin_test.html rename : browser/base/content/test/plugins/plugin_test2.html => browser/base/content/test/plugins/xbl/plugin_test2.html rename : browser/base/content/test/plugins/plugin_test3.html => browser/base/content/test/plugins/xbl/plugin_test3.html rename : browser/base/content/test/plugins/plugin_two_types.html => browser/base/content/test/plugins/xbl/plugin_two_types.html rename : browser/base/content/test/plugins/plugin_unknown.html => browser/base/content/test/plugins/xbl/plugin_unknown.html rename : browser/base/content/test/plugins/plugin_zoom.html => browser/base/content/test/plugins/xbl/plugin_zoom.html rename : toolkit/pluginproblem/content/pluginProblem.xml => toolkit/content/widgets/pluginProblem.js extra : moz-landing-system : lando
307 lines
12 KiB
JavaScript
307 lines
12 KiB
JavaScript
var gTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
|
|
var gTestBrowser = null;
|
|
var gPluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
|
|
|
|
function updateAllTestPlugins(aState) {
|
|
setTestPluginEnabledState(aState, "Test Plug-in");
|
|
setTestPluginEnabledState(aState, "Second Test Plug-in");
|
|
}
|
|
|
|
add_task(async function() {
|
|
registerCleanupFunction(async function() {
|
|
clearAllPluginPermissions();
|
|
updateAllTestPlugins(Ci.nsIPluginTag.STATE_ENABLED);
|
|
Services.prefs.clearUserPref("plugins.click_to_play");
|
|
Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
|
|
await asyncSetAndUpdateBlocklist(gTestRoot + "blockNoPlugins.xml", gTestBrowser);
|
|
resetBlocklist();
|
|
gBrowser.removeCurrentTab();
|
|
window.focus();
|
|
gTestBrowser = null;
|
|
});
|
|
});
|
|
|
|
add_task(async function() {
|
|
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
|
|
gTestBrowser = gBrowser.selectedBrowser;
|
|
|
|
updateAllTestPlugins(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
|
|
|
|
Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
|
|
Services.prefs.setBoolPref("plugins.click_to_play", true);
|
|
|
|
// Prime the content process
|
|
await promiseTabLoadEvent(gBrowser.selectedTab, "data:text/html,<html>hi</html>");
|
|
});
|
|
|
|
// Tests a vulnerable, updatable plugin
|
|
|
|
add_task(async function() {
|
|
// enable hard blocklisting of test
|
|
await asyncSetAndUpdateBlocklist(gTestRoot + "blockPluginVulnerableUpdatable.xml", gTestBrowser);
|
|
|
|
await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
|
|
|
|
// Work around for delayed PluginBindingAttached
|
|
await promiseUpdatePluginBindings(gTestBrowser);
|
|
|
|
await promisePopupNotification("click-to-play-plugins");
|
|
|
|
let pluginInfo = await promiseForPluginInfo("test");
|
|
is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE,
|
|
"Test 18a, plugin fallback type should be PLUGIN_VULNERABLE_UPDATABLE");
|
|
ok(!pluginInfo.activated, "Test 18a, Plugin should not be activated");
|
|
|
|
await ContentTask.spawn(gTestBrowser, null, async function() {
|
|
let doc = content.document;
|
|
let plugin = doc.getElementById("test");
|
|
let overlay = plugin.openOrClosedShadowRoot.getElementById("main");
|
|
Assert.ok(overlay && overlay.classList.contains("visible"),
|
|
"Test 18a, Plugin overlay should exist, not be hidden");
|
|
|
|
let updateLink = plugin.openOrClosedShadowRoot.getElementById("checkForUpdatesLink");
|
|
Assert.ok(updateLink.style.visibility != "hidden",
|
|
"Test 18a, Plugin should have an update link");
|
|
});
|
|
|
|
let promise = BrowserTestUtils.waitForEvent(gBrowser.tabContainer, "TabOpen", true);
|
|
|
|
await ContentTask.spawn(gTestBrowser, {}, async function() {
|
|
let doc = content.document;
|
|
let plugin = doc.getElementById("test");
|
|
let updateLink = plugin.openOrClosedShadowRoot.getElementById("checkForUpdatesLink");
|
|
let bounds = updateLink.getBoundingClientRect();
|
|
let left = (bounds.left + bounds.right) / 2;
|
|
let top = (bounds.top + bounds.bottom) / 2;
|
|
let utils = content.windowUtils;
|
|
utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
|
|
utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
|
|
});
|
|
await promise;
|
|
|
|
promise = BrowserTestUtils.waitForEvent(gBrowser.tabContainer, "TabClose", true);
|
|
gBrowser.removeCurrentTab();
|
|
await promise;
|
|
});
|
|
|
|
add_task(async function() {
|
|
// clicking the update link should not activate the plugin
|
|
let pluginInfo = await promiseForPluginInfo("test");
|
|
is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE,
|
|
"Test 18a, plugin fallback type should be PLUGIN_VULNERABLE_UPDATABLE");
|
|
ok(!pluginInfo.activated, "Test 18b, Plugin should not be activated");
|
|
|
|
await ContentTask.spawn(gTestBrowser, null, async function() {
|
|
let doc = content.document;
|
|
let plugin = doc.getElementById("test");
|
|
let overlay = plugin.openOrClosedShadowRoot.getElementById("main");
|
|
Assert.ok(overlay && overlay.classList.contains("visible"),
|
|
"Test 18b, Plugin overlay should exist, not be hidden");
|
|
});
|
|
});
|
|
|
|
// Tests a vulnerable plugin with no update
|
|
add_task(async function() {
|
|
updateAllTestPlugins(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
|
|
|
|
await asyncSetAndUpdateBlocklist(gTestRoot + "blockPluginVulnerableNoUpdate.xml", gTestBrowser);
|
|
|
|
await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
|
|
|
|
// Work around for delayed PluginBindingAttached
|
|
await promiseUpdatePluginBindings(gTestBrowser);
|
|
|
|
let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
|
|
ok(notification, "Test 18c, Should have a click-to-play notification");
|
|
|
|
let pluginInfo = await promiseForPluginInfo("test");
|
|
is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_NO_UPDATE,
|
|
"Test 18c, plugin fallback type should be PLUGIN_VULNERABLE_NO_UPDATE");
|
|
ok(!pluginInfo.activated, "Test 18c, Plugin should not be activated");
|
|
|
|
await ContentTask.spawn(gTestBrowser, null, async function() {
|
|
let doc = content.document;
|
|
let plugin = doc.getElementById("test");
|
|
let overlay = plugin.openOrClosedShadowRoot.getElementById("main");
|
|
Assert.ok(overlay && overlay.classList.contains("visible"),
|
|
"Test 18c, Plugin overlay should exist, not be hidden");
|
|
|
|
let updateLink = plugin.openOrClosedShadowRoot.getElementById("checkForUpdatesLink");
|
|
Assert.ok(updateLink && updateLink.style.display != "block",
|
|
"Test 18c, Plugin should not have an update link");
|
|
});
|
|
|
|
// check that click "Allow" works with blocked plugins
|
|
await promiseForNotificationShown(notification);
|
|
|
|
PopupNotifications.panel.firstElementChild.button.click();
|
|
|
|
pluginInfo = await promiseForPluginInfo("test");
|
|
is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_NO_UPDATE,
|
|
"Test 18c, plugin fallback type should be PLUGIN_VULNERABLE_NO_UPDATE");
|
|
ok(pluginInfo.activated, "Test 18c, Plugin should be activated");
|
|
let enabledState = getTestPluginEnabledState();
|
|
ok(enabledState, "Test 18c, Plugin enabled state should be STATE_CLICKTOPLAY");
|
|
});
|
|
|
|
// continue testing "Always allow", make sure it sticks.
|
|
add_task(async function() {
|
|
await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
|
|
|
|
// Work around for delayed PluginBindingAttached
|
|
await promiseUpdatePluginBindings(gTestBrowser);
|
|
|
|
let pluginInfo = await promiseForPluginInfo("test");
|
|
ok(pluginInfo.activated, "Test 18d, Waited too long for plugin to activate");
|
|
|
|
clearAllPluginPermissions();
|
|
});
|
|
|
|
// clicking the in-content overlay of a vulnerable plugin should bring
|
|
// up the notification and not directly activate the plugin
|
|
add_task(async function() {
|
|
await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
|
|
|
|
// Work around for delayed PluginBindingAttached
|
|
await promiseUpdatePluginBindings(gTestBrowser);
|
|
|
|
let 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");
|
|
|
|
let pluginInfo = await promiseForPluginInfo("test");
|
|
ok(!pluginInfo.activated, "Test 18f, Waited too long for plugin to activate");
|
|
|
|
var oldEventCallback = notification.options.eventCallback;
|
|
let promise = promiseForCondition(() => oldEventCallback == null);
|
|
notification.options.eventCallback = function() {
|
|
if (oldEventCallback) {
|
|
oldEventCallback();
|
|
}
|
|
oldEventCallback = null;
|
|
};
|
|
|
|
await ContentTask.spawn(gTestBrowser, {}, async function() {
|
|
let doc = content.document;
|
|
let plugin = doc.getElementById("test");
|
|
let bounds = plugin.getBoundingClientRect();
|
|
let left = (bounds.left + bounds.right) / 2;
|
|
let top = (bounds.top + bounds.bottom) / 2;
|
|
let utils = content.windowUtils;
|
|
utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
|
|
utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
|
|
});
|
|
await promise;
|
|
|
|
ok(notification, "Test 18g, Should have a click-to-play notification");
|
|
ok(!notification.dismissed, "Test 18g, notification should be open");
|
|
|
|
pluginInfo = await promiseForPluginInfo("test");
|
|
ok(!pluginInfo.activated, "Test 18g, Plugin should not be activated");
|
|
});
|
|
|
|
// Test that "always allow"-ing a plugin will not allow it when it becomes
|
|
// blocklisted.
|
|
add_task(async function() {
|
|
await asyncSetAndUpdateBlocklist(gTestRoot + "blockNoPlugins.xml", gTestBrowser);
|
|
|
|
updateAllTestPlugins(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
|
|
|
|
await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
|
|
|
|
// Work around for delayed PluginBindingAttached
|
|
await promiseUpdatePluginBindings(gTestBrowser);
|
|
|
|
let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
|
|
ok(notification, "Test 24a, Should have a click-to-play notification");
|
|
|
|
// Plugin should start as CTP
|
|
let pluginInfo = await promiseForPluginInfo("test");
|
|
is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY,
|
|
"Test 24a, plugin fallback type should be PLUGIN_CLICK_TO_PLAY");
|
|
ok(!pluginInfo.activated, "Test 24a, Plugin should not be active.");
|
|
|
|
// simulate "allow"
|
|
await promiseForNotificationShown(notification);
|
|
|
|
PopupNotifications.panel.firstElementChild.button.click();
|
|
|
|
pluginInfo = await promiseForPluginInfo("test");
|
|
ok(pluginInfo.activated, "Test 24a, Plugin should be active.");
|
|
|
|
await asyncSetAndUpdateBlocklist(gTestRoot + "blockPluginVulnerableUpdatable.xml", gTestBrowser);
|
|
});
|
|
|
|
// the plugin is now blocklisted, so it should not automatically load
|
|
add_task(async function() {
|
|
await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
|
|
|
|
// Work around for delayed PluginBindingAttached
|
|
await promiseUpdatePluginBindings(gTestBrowser);
|
|
|
|
let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
|
|
ok(notification, "Test 24b, Should have a click-to-play notification");
|
|
|
|
let pluginInfo = await promiseForPluginInfo("test");
|
|
is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE,
|
|
"Test 24b, plugin fallback type should be PLUGIN_VULNERABLE_UPDATABLE");
|
|
ok(!pluginInfo.activated, "Test 24b, Plugin should not be active.");
|
|
|
|
// simulate "allow"
|
|
await promiseForNotificationShown(notification);
|
|
|
|
PopupNotifications.panel.firstElementChild.button.click();
|
|
|
|
pluginInfo = await promiseForPluginInfo("test");
|
|
ok(pluginInfo.activated, "Test 24b, Plugin should be active.");
|
|
|
|
clearAllPluginPermissions();
|
|
|
|
await asyncSetAndUpdateBlocklist(gTestRoot + "blockNoPlugins.xml", gTestBrowser);
|
|
});
|
|
|
|
// Plugin sync removal test. Note this test produces a notification drop down since
|
|
// the plugin we add has zero dims.
|
|
add_task(async function() {
|
|
updateAllTestPlugins(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
|
|
|
|
await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_syncRemoved.html");
|
|
|
|
// Maybe there some better trick here, we need to wait for the page load, then
|
|
// wait for the js to execute in the page.
|
|
await waitForMs(500);
|
|
|
|
let notification = PopupNotifications.getNotification("click-to-play-plugins");
|
|
ok(notification, "Test 25: There should be a plugin notification even if the plugin was immediately removed");
|
|
ok(notification.dismissed, "Test 25: The notification should be dismissed by default");
|
|
|
|
await promiseTabLoadEvent(gBrowser.selectedTab, "data:text/html,<html>hi</html>");
|
|
});
|
|
|
|
// Tests a page with a blocked plugin in it and make sure the infoURL property
|
|
// the blocklist file gets used.
|
|
add_task(async function() {
|
|
clearAllPluginPermissions();
|
|
|
|
await asyncSetAndUpdateBlocklist(gTestRoot + "blockPluginInfoURL.xml", gTestBrowser);
|
|
|
|
await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
|
|
|
|
// Work around for delayed PluginBindingAttached
|
|
await promiseUpdatePluginBindings(gTestBrowser);
|
|
|
|
let notification = PopupNotifications.getNotification("click-to-play-plugins");
|
|
|
|
// Since the plugin notification is dismissed by default, reshow it.
|
|
await promiseForNotificationShown(notification);
|
|
|
|
let pluginInfo = await promiseForPluginInfo("test");
|
|
is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_BLOCKLISTED,
|
|
"Test 26, plugin fallback type should be PLUGIN_BLOCKLISTED");
|
|
|
|
await ContentTask.spawn(gTestBrowser, null, async function() {
|
|
let plugin = content.document.getElementById("test");
|
|
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
|
Assert.ok(!objLoadingContent.activated, "Plugin should not be activated.");
|
|
});
|
|
});
|