--- a/toolkit/components/url-classifier/tests/browser/browser_flash_block_lists.js
+++ b/toolkit/components/url-classifier/tests/browser/browser_flash_block_lists.js
@@ -70,126 +70,143 @@ registerCleanupFunction(unsetDBPrefs);
// domain in the list is the domain of the most deeply nested iframe.
// Only the plugin in the most deeply nested document will be checked.
var testCases = [
{
name: "Unknown domain",
domains: ["http://example.com"],
expectedPluginFallbackType: Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY,
expectedActivated: false,
- expectedHasRunningPlugin: false
+ expectedHasRunningPlugin: false,
+ pluginListed: true
},
{
name: "Nested unknown domains",
domains: ["http://example.com", "http://example.org"],
expectedPluginFallbackType: Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY,
expectedActivated: false,
- expectedHasRunningPlugin: false
+ expectedHasRunningPlugin: false,
+ pluginListed: true
},
{
name: "Allowed domain",
domains: ["http://flashallow.example.com"],
expectedActivated: true,
- expectedHasRunningPlugin: true
+ expectedHasRunningPlugin: true,
+ pluginListed: true
},
{
name: "Allowed nested domain",
domains: ["http://example.com", "http://flashallow.example.com"],
expectedActivated: true,
- expectedHasRunningPlugin: true
+ expectedHasRunningPlugin: true,
+ pluginListed: true
},
{
name: "Subdocument of allowed domain",
domains: ["http://flashallow.example.com", "http://example.com"],
expectedActivated: true,
- expectedHasRunningPlugin: true
+ expectedHasRunningPlugin: true,
+ pluginListed: true
},
{
name: "Exception to allowed domain",
domains: ["http://exception.flashallow.example.com"],
expectedPluginFallbackType: Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY,
expectedActivated: false,
- expectedHasRunningPlugin: false
+ expectedHasRunningPlugin: false,
+ pluginListed: true
},
{
name: "Blocked domain",
domains: ["http://flashblock.example.com"],
- expectedPluginFallbackType: Ci.nsIObjectLoadingContent.PLUGIN_SUPPRESSED,
+ expectedPluginFallbackType: Ci.nsIObjectLoadingContent.PLUGIN_USER_DISABLED,
expectedActivated: false,
- expectedHasRunningPlugin: false
+ expectedHasRunningPlugin: false,
+ pluginListed: false
},
{
name: "Nested blocked domain",
domains: ["http://example.com", "http://flashblock.example.com"],
- expectedPluginFallbackType: Ci.nsIObjectLoadingContent.PLUGIN_SUPPRESSED,
+ expectedPluginFallbackType: Ci.nsIObjectLoadingContent.PLUGIN_USER_DISABLED,
expectedActivated: false,
- expectedHasRunningPlugin: false
+ expectedHasRunningPlugin: false,
+ pluginListed: false
},
{
name: "Subdocument of blocked subdocument",
domains: ["http://example.com", "http://flashblock.example.com", "http://example.com"],
- expectedPluginFallbackType: Ci.nsIObjectLoadingContent.PLUGIN_SUPPRESSED,
+ expectedPluginFallbackType: Ci.nsIObjectLoadingContent.PLUGIN_USER_DISABLED,
expectedActivated: false,
- expectedHasRunningPlugin: false
+ expectedHasRunningPlugin: false,
+ pluginListed: false
},
{
name: "Blocked subdocument nested among in allowed documents",
domains: ["http://flashallow.example.com", "http://flashblock.example.com", "http://flashallow.example.com"],
- expectedPluginFallbackType: Ci.nsIObjectLoadingContent.PLUGIN_SUPPRESSED,
+ expectedPluginFallbackType: Ci.nsIObjectLoadingContent.PLUGIN_USER_DISABLED,
expectedActivated: false,
- expectedHasRunningPlugin: false
+ expectedHasRunningPlugin: false,
+ pluginListed: false
},
{
name: "Exception to blocked domain",
domains: ["http://exception.flashblock.example.com"],
expectedPluginFallbackType: Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY,
expectedActivated: false,
- expectedHasRunningPlugin: false
+ expectedHasRunningPlugin: false,
+ pluginListed: true
},
{
name: "Sub-document blocked domain in top-level context",
domains: ["http://subdocument.example.com"],
expectedPluginFallbackType: Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY,
expectedActivated: false,
- expectedHasRunningPlugin: false
+ expectedHasRunningPlugin: false,
+ pluginListed: true
},
{
name: "Sub-document blocked domain",
domains: ["http://example.com", "http://subdocument.example.com"],
- expectedPluginFallbackType: Ci.nsIObjectLoadingContent.PLUGIN_SUPPRESSED,
+ expectedPluginFallbackType: Ci.nsIObjectLoadingContent.PLUGIN_USER_DISABLED,
expectedActivated: false,
- expectedHasRunningPlugin: false
+ expectedHasRunningPlugin: false,
+ pluginListed: false
},
{
name: "Sub-document blocked subdocument of an allowed domain",
domains: ["http://flashallow.example.com", "http://subdocument.example.com"],
- expectedPluginFallbackType: Ci.nsIObjectLoadingContent.PLUGIN_SUPPRESSED,
+ expectedPluginFallbackType: Ci.nsIObjectLoadingContent.PLUGIN_USER_DISABLED,
expectedActivated: false,
- expectedHasRunningPlugin: false
+ expectedHasRunningPlugin: false,
+ pluginListed: false
},
{
name: "Subdocument of Sub-document blocked domain",
domains: ["http://example.com", "http://subdocument.example.com", "http://example.com"],
- expectedPluginFallbackType: Ci.nsIObjectLoadingContent.PLUGIN_SUPPRESSED,
+ expectedPluginFallbackType: Ci.nsIObjectLoadingContent.PLUGIN_USER_DISABLED,
expectedActivated: false,
- expectedHasRunningPlugin: false
+ expectedHasRunningPlugin: false,
+ pluginListed: false
},
{
name: "Sub-document exception in top-level context",
domains: ["http://exception.subdocument.example.com"],
expectedPluginFallbackType: Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY,
expectedActivated: false,
- expectedHasRunningPlugin: false
+ expectedHasRunningPlugin: false,
+ pluginListed: true
},
{
name: "Sub-document blocked domain exception",
domains: ["http://example.com", "http://exception.subdocument.example.com"],
expectedPluginFallbackType: Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY,
expectedActivated: false,
- expectedHasRunningPlugin: false
+ expectedHasRunningPlugin: false,
+ pluginListed: true
}
];
function buildDocumentStructure(browser, iframeDomains) {
return Task.spawn(function* () {
let depth = 0;
for (let domain of iframeDomains) {
// Firefox does not like to load the same page in its own iframe. Put some
@@ -207,33 +224,37 @@ function buildDocumentStructure(browser,
});
yield domainLoaded;
++depth;
}
});
}
-function getPlugin(browser, depth) {
+function getPluginInfo(browser, depth) {
return ContentTask.spawn(browser,
{iframeId: IFRAME_ID, depth: depth},
function* ({iframeId, depth}) {
let doc = content.document;
+ let win = content.window;
for (let i = 0; i < depth; ++i) {
- doc = doc.getElementById(iframeId).contentDocument;
+ let frame = doc.getElementById(iframeId);
+ doc = frame.contentDocument;
+ win = frame.contentWindow;
}
let pluginObj = doc.getElementById("testObject");
if (!(pluginObj instanceof Ci.nsIObjectLoadingContent)) {
throw new Error("Unable to find plugin!");
}
return {
pluginFallbackType: pluginObj.pluginFallbackType,
activated: pluginObj.activated,
- hasRunningPlugin: pluginObj.hasRunningPlugin
+ hasRunningPlugin: pluginObj.hasRunningPlugin,
+ listed: ("Shockwave Flash" in win.navigator.plugins)
};
});
}
add_task(function* checkFlashBlockLists() {
setDBPrefs();
yield classifierHelper.waitForInit();
@@ -244,30 +265,34 @@ add_task(function* checkFlashBlockLists(
let iframeDomains = testCase.domains.slice();
let pageDomain = iframeDomains.shift();
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser,
pageDomain + URL_PATH);
yield buildDocumentStructure(tab.linkedBrowser, iframeDomains);
- let plugin = yield getPlugin(tab.linkedBrowser, iframeDomains.length);
+ let pluginInfo = yield getPluginInfo(tab.linkedBrowser, iframeDomains.length);
if ("expectedPluginFallbackType" in testCase) {
- is(plugin.pluginFallbackType, testCase.expectedPluginFallbackType,
+ is(pluginInfo.pluginFallbackType, testCase.expectedPluginFallbackType,
"Plugin should have the correct fallback type");
}
if ("expectedActivated" in testCase) {
- is(plugin.activated, testCase.expectedActivated,
+ is(pluginInfo.activated, testCase.expectedActivated,
"Plugin should have the correct activation");
}
if ("expectedHasRunningPlugin" in testCase) {
- is(plugin.hasRunningPlugin, testCase.expectedHasRunningPlugin,
+ is(pluginInfo.hasRunningPlugin, testCase.expectedHasRunningPlugin,
"Plugin should have the correct 'plugin running' state");
}
+ if ("pluginListed" in testCase) {
+ is(pluginInfo.listed, testCase.pluginListed,
+ "Plugin's existance in navigator.plugins should match expected")
+ }
yield BrowserTestUtils.removeTab(tab);
}
});
add_task(function* checkFlashBlockDisabled() {
setDBPrefs();
Services.prefs.setBoolPref(FLASHBLOCK_ENABLE_PREF, false);
@@ -280,17 +305,18 @@ add_task(function* checkFlashBlockDisabl
let iframeDomains = testCase.domains.slice();
let pageDomain = iframeDomains.shift();
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser,
pageDomain + URL_PATH);
yield buildDocumentStructure(tab.linkedBrowser, iframeDomains);
- let plugin = yield getPlugin(tab.linkedBrowser, iframeDomains.length);
+ let pluginInfo = yield getPluginInfo(tab.linkedBrowser, iframeDomains.length);
// With flashblock disabled, all plugins should be activated.
- ok(plugin.activated, "Plugin should be activated");
- ok(plugin.hasRunningPlugin, "Plugin should be running");
+ ok(pluginInfo.activated, "Plugin should be activated");
+ ok(pluginInfo.hasRunningPlugin, "Plugin should be running");
+ ok(pluginInfo.listed, "Flash should be listed in navigator.plugins");
yield BrowserTestUtils.removeTab(tab);
}
});