diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /browser/base/content/test/plugins/browser_bug812562.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'browser/base/content/test/plugins/browser_bug812562.js')
-rw-r--r-- | browser/base/content/test/plugins/browser_bug812562.js | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/browser/base/content/test/plugins/browser_bug812562.js b/browser/base/content/test/plugins/browser_bug812562.js new file mode 100644 index 000000000..be7b00b22 --- /dev/null +++ b/browser/base/content/test/plugins/browser_bug812562.js @@ -0,0 +1,80 @@ +var gTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/"); +var gTestBrowser = null; + +add_task(function* () { + registerCleanupFunction(Task.async(function*() { + clearAllPluginPermissions(); + setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in"); + setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in"); + yield asyncSetAndUpdateBlocklist(gTestRoot + "blockNoPlugins.xml", gTestBrowser); + resetBlocklist(); + Services.prefs.clearUserPref("plugins.click_to_play"); + gBrowser.removeCurrentTab(); + window.focus(); + gTestBrowser = null; + })); + gBrowser.selectedTab = gBrowser.addTab(); + gTestBrowser = gBrowser.selectedBrowser; + + Services.prefs.setBoolPref("plugins.click_to_play", true); + setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in"); + + // Prime the blocklist service, the remote service doesn't launch on startup. + yield promiseTabLoadEvent(gBrowser.selectedTab, "data:text/html,<html></html>"); + let exmsg = yield promiseInitContentBlocklistSvc(gBrowser.selectedBrowser); + ok(!exmsg, "exception: " + exmsg); +}); + +// Tests that the going back will reshow the notification for click-to-play +// blocklisted plugins +add_task(function* () { + yield asyncSetAndUpdateBlocklist(gTestRoot + "blockPluginVulnerableUpdatable.xml", gTestBrowser); + + yield promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html"); + + // Work around for delayed PluginBindingAttached + yield promiseUpdatePluginBindings(gTestBrowser); + + let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser); + ok(popupNotification, "test part 1: Should have a click-to-play notification"); + + let pluginInfo = yield promiseForPluginInfo("test"); + is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE, "plugin should be marked as VULNERABLE"); + + yield ContentTask.spawn(gTestBrowser, null, function* () { + Assert.ok(!!content.document.getElementById("test"), + "test part 1: plugin should not be activated"); + }); + + yield promiseTabLoadEvent(gBrowser.selectedTab, "data:text/html,<html></html>"); +}); + +add_task(function* () { + let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser); + ok(!popupNotification, "test part 2: Should not have a click-to-play notification"); + yield ContentTask.spawn(gTestBrowser, null, function* () { + Assert.ok(!content.document.getElementById("test"), + "test part 2: plugin should not be activated"); + }); + + let obsPromise = TestUtils.topicObserved("PopupNotifications-updateNotShowing"); + let overlayPromise = promisePopupNotification("click-to-play-plugins"); + gTestBrowser.goBack(); + yield obsPromise; + yield overlayPromise; +}); + +add_task(function* () { + yield promiseUpdatePluginBindings(gTestBrowser); + + let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser); + ok(popupNotification, "test part 3: Should have a click-to-play notification"); + + let pluginInfo = yield promiseForPluginInfo("test"); + is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE, "plugin should be marked as VULNERABLE"); + + yield ContentTask.spawn(gTestBrowser, null, function* () { + Assert.ok(!!content.document.getElementById("test"), + "test part 3: plugin should not be activated"); + }); +}); |