fune/browser/base/content/test/plugins/browser_bug818118.js
Kris Maglione 94e3b0bd8d Bug 1596918: Part 3a - Scripted rewrite of most ContentTask.spawn calls to SpecialPowers.spawn calls. r=mccr8,remote-protocol-reviewers,ato
This is generally pretty straightforward, and rewrites nearly all calls. It
skips the ones that it can detect using frame script globals like
`sendAsyncMessage`, though.

Differential Revision: https://phabricator.services.mozilla.com/D53740

--HG--
extra : moz-landing-system : lando
2019-12-13 20:36:16 +00:00

53 lines
1.5 KiB
JavaScript

var gTestRoot = getRootDirectory(gTestPath).replace(
"chrome://mochitests/content/",
"http://127.0.0.1:8888/"
);
var gTestBrowser = null;
add_task(async function() {
registerCleanupFunction(function() {
clearAllPluginPermissions();
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
setTestPluginEnabledState(
Ci.nsIPluginTag.STATE_ENABLED,
"Second Test Plug-in"
);
gBrowser.removeCurrentTab();
window.focus();
gTestBrowser = null;
});
});
add_task(async function() {
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
gTestBrowser = gBrowser.selectedBrowser;
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
await promiseTabLoadEvent(
gBrowser.selectedTab,
gTestRoot + "plugin_both.html"
);
// Work around for delayed PluginBindingAttached
await promiseUpdatePluginBindings(gTestBrowser);
let popupNotification = PopupNotifications.getNotification(
"click-to-play-plugins",
gTestBrowser
);
ok(popupNotification, "should have a click-to-play notification");
let pluginInfo = await promiseForPluginInfo("test");
is(
pluginInfo.pluginFallbackType,
Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY,
"plugin should be click to play"
);
ok(!pluginInfo.activated, "plugin should not be activated");
await SpecialPowers.spawn(gTestBrowser, [], () => {
let unknown = content.document.getElementById("unknown");
ok(unknown, "should have unknown plugin in page");
});
});