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
86 lines
3.9 KiB
JavaScript
86 lines
3.9 KiB
JavaScript
var rootDir = getRootDirectory(gTestPath);
|
|
const gTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
|
|
var gPluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
|
|
|
|
add_task(async function() {
|
|
registerCleanupFunction(function() {
|
|
clearAllPluginPermissions();
|
|
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
|
|
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
|
|
Services.prefs.clearUserPref("plugins.click_to_play");
|
|
Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
|
|
gBrowser.removeCurrentTab();
|
|
window.focus();
|
|
});
|
|
});
|
|
|
|
add_task(async function() {
|
|
Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
|
|
|
|
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
|
|
|
|
Services.prefs.setBoolPref("plugins.click_to_play", true);
|
|
|
|
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
|
|
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Second Test Plug-in");
|
|
|
|
await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
|
|
|
|
// Work around for delayed PluginBindingAttached
|
|
await promiseUpdatePluginBindings(gBrowser.selectedBrowser);
|
|
|
|
// Tests that the overlay can be hidden for plugins using the close icon.
|
|
await ContentTask.spawn(gBrowser.selectedBrowser, null, async function() {
|
|
let doc = content.document;
|
|
let plugin = doc.getElementById("test");
|
|
let overlay = plugin.openOrClosedShadowRoot.getElementById("main");
|
|
let closeIcon = plugin.openOrClosedShadowRoot.getElementById("closeIcon");
|
|
let bounds = closeIcon.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);
|
|
|
|
Assert.ok(!overlay.classList.contains("visible"), "overlay should be hidden.");
|
|
});
|
|
});
|
|
|
|
// Test that the overlay cannot be interacted with after the user closes the overlay
|
|
add_task(async function() {
|
|
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
|
|
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Second Test Plug-in");
|
|
|
|
await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
|
|
|
|
// Work around for delayed PluginBindingAttached
|
|
await promiseUpdatePluginBindings(gBrowser.selectedBrowser);
|
|
|
|
await ContentTask.spawn(gBrowser.selectedBrowser, null, async function() {
|
|
let doc = content.document;
|
|
let plugin = doc.getElementById("test");
|
|
let overlay = plugin.openOrClosedShadowRoot.getElementById("main");
|
|
let closeIcon = plugin.openOrClosedShadowRoot.getElementById("closeIcon");
|
|
let closeIconBounds = closeIcon.getBoundingClientRect();
|
|
let overlayBounds = overlay.getBoundingClientRect();
|
|
let overlayLeft = (overlayBounds.left + overlayBounds.right) / 2;
|
|
let overlayTop = (overlayBounds.left + overlayBounds.right) / 2 ;
|
|
let closeIconLeft = (closeIconBounds.left + closeIconBounds.right) / 2;
|
|
let closeIconTop = (closeIconBounds.top + closeIconBounds.bottom) / 2;
|
|
let utils = content.windowUtils;
|
|
// Simulate clicking on the close icon.
|
|
utils.sendMouseEvent("mousedown", closeIconLeft, closeIconTop, 0, 1, 0, false, 0, 0);
|
|
utils.sendMouseEvent("mouseup", closeIconLeft, closeIconTop, 0, 1, 0, false, 0, 0);
|
|
|
|
// Simulate clicking on the overlay.
|
|
utils.sendMouseEvent("mousedown", overlayLeft, overlayTop, 0, 1, 0, false, 0, 0);
|
|
utils.sendMouseEvent("mouseup", overlayLeft, overlayTop, 0, 1, 0, false, 0, 0);
|
|
|
|
Assert.ok(overlay.hasAttribute("dismissed") && !overlay.classList.contains("visible"),
|
|
"Overlay should be hidden");
|
|
});
|
|
|
|
let notification = PopupNotifications.getNotification("click-to-play-plugins");
|
|
|
|
ok(notification.dismissed, "No notification should be shown");
|
|
});
|