mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-10-09 16:55:15 +00:00
52 lines
1.8 KiB
JavaScript
52 lines
1.8 KiB
JavaScript
|
var gTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
|
||
|
var gTestBrowser = null;
|
||
|
var gNumPluginBindingsAttached = 0;
|
||
|
|
||
|
function pluginBindingAttached() {
|
||
|
gNumPluginBindingsAttached++;
|
||
|
if (gNumPluginBindingsAttached != 1) {
|
||
|
ok(false, "if we've gotten here, something is quite wrong");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
add_task(function* () {
|
||
|
registerCleanupFunction(function () {
|
||
|
gTestBrowser.removeEventListener("PluginBindingAttached", pluginBindingAttached, true, true);
|
||
|
clearAllPluginPermissions();
|
||
|
Services.prefs.clearUserPref("plugins.click_to_play");
|
||
|
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(function* () {
|
||
|
gBrowser.selectedTab = gBrowser.addTab();
|
||
|
gTestBrowser = gBrowser.selectedBrowser;
|
||
|
|
||
|
Services.prefs.setBoolPref("plugins.click_to_play", true);
|
||
|
|
||
|
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
|
||
|
|
||
|
gTestBrowser.addEventListener("PluginBindingAttached", pluginBindingAttached, true, true);
|
||
|
|
||
|
let testRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
|
||
|
yield promiseTabLoadEvent(gBrowser.selectedTab, testRoot + "plugin_bug744745.html");
|
||
|
|
||
|
yield promiseForCondition(function () { return gNumPluginBindingsAttached == 1; });
|
||
|
|
||
|
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||
|
let plugin = content.document.getElementById("test");
|
||
|
if (!plugin) {
|
||
|
return false;
|
||
|
}
|
||
|
// We can't use MochiKit's routine
|
||
|
let style = content.getComputedStyle(plugin);
|
||
|
return 'opacity' in style && style.opacity == 1;
|
||
|
});
|
||
|
|
||
|
ok(result, true, "plugin style properly configured.");
|
||
|
});
|