mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 767636 - Expose plugin fallback type to extensions. r=josh
This commit is contained in:
parent
da0857020f
commit
3e8296712e
@ -112,6 +112,9 @@ function test1() {
|
||||
ok("application/x-unknown" in gTestBrowser.missingPlugins, "Test 1, Should know about application/x-unknown");
|
||||
ok(!("application/x-test" in gTestBrowser.missingPlugins), "Test 1, Should not know about application/x-test");
|
||||
|
||||
var pluginNode = gTestBrowser.contentDocument.getElementById("unknown");
|
||||
is(pluginNode.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_UNSUPPORTED, "Test 1, plugin fallback type should be PLUGIN_UNSUPPORTED");
|
||||
|
||||
var plugin = get_test_plugin();
|
||||
ok(plugin, "Should have a test plugin");
|
||||
plugin.disabled = false;
|
||||
@ -143,6 +146,7 @@ function test3() {
|
||||
|
||||
var pluginNode = gTestBrowser.contentDocument.getElementById("test");
|
||||
ok(pluginNode, "Test 3, Found plugin in page");
|
||||
is(pluginNode.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_DISABLED, "Test 3, plugin fallback type should be PLUGIN_DISABLED");
|
||||
var manageLink = gTestBrowser.contentDocument.getAnonymousElementByAttribute(pluginNode, "class", "managePluginsLink");
|
||||
ok(manageLink, "Test 3, found 'manage' link in plugin-problem binding");
|
||||
|
||||
@ -169,6 +173,8 @@ function test5() {
|
||||
ok(gTestBrowser.missingPlugins, "Test 5, Should be a missing plugin list");
|
||||
ok("application/x-test" in gTestBrowser.missingPlugins, "Test 5, Should know about application/x-test");
|
||||
ok(!("application/x-unknown" in gTestBrowser.missingPlugins), "Test 5, Should not know about application/x-unknown");
|
||||
var pluginNode = gTestBrowser.contentDocument.getElementById("test");
|
||||
is(pluginNode.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_BLOCKLISTED, "Test 5, plugin fallback type should be PLUGIN_BLOCKLISTED");
|
||||
|
||||
prepareTest(test6, gTestRoot + "plugin_both.html");
|
||||
}
|
||||
@ -210,6 +216,9 @@ function test8() {
|
||||
ok(!gTestBrowser.missingPlugins, "Test 8, Should not be a missing plugin list");
|
||||
ok(PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser), "Test 8, Should have a click-to-play notification");
|
||||
|
||||
var pluginNode = gTestBrowser.contentDocument.getElementById("test");
|
||||
is(pluginNode.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY, "Test 8, plugin fallback type should be PLUGIN_CLICK_TO_PLAY");
|
||||
|
||||
prepareTest(test9a, gTestRoot + "plugin_test2.html");
|
||||
}
|
||||
|
||||
@ -572,6 +581,7 @@ function test18a() {
|
||||
ok(clickToPlayNotification, "Test 18a, Should have a click-to-play notification");
|
||||
var doc = gTestBrowser.contentDocument;
|
||||
var plugin = doc.getElementById("test");
|
||||
is(plugin.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE, "Test 18a, plugin fallback type should be PLUGIN_VULNERABLE_UPDATABLE");
|
||||
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(!objLoadingContent.activated, "Test 18a, Plugin should not be activated");
|
||||
var overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox");
|
||||
@ -612,6 +622,7 @@ function test18c() {
|
||||
ok(clickToPlayNotification, "Test 18c, Should have a click-to-play notification");
|
||||
var doc = gTestBrowser.contentDocument;
|
||||
var plugin = doc.getElementById("test");
|
||||
is(plugin.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_NO_UPDATE, "Test 18c, plugin fallback type should be PLUGIN_VULNERABLE_NO_UPDATE");
|
||||
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(!objLoadingContent.activated, "Test 18c, Plugin should not be activated");
|
||||
var overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox");
|
||||
|
@ -21,7 +21,7 @@ interface nsIURI;
|
||||
* This interface represents a content node that loads objects.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(e3e284a3-b4a8-49ef-af6b-c8c4a158db86)]
|
||||
[scriptable, uuid(a3ca1295-362f-4094-a34f-19af5ebda98c)]
|
||||
interface nsIObjectLoadingContent : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -33,6 +33,29 @@ interface nsIObjectLoadingContent : nsISupports
|
||||
const unsigned long TYPE_DOCUMENT = 3;
|
||||
const unsigned long TYPE_NULL = 4;
|
||||
|
||||
// The content type is not supported (e.g. plugin not installed)
|
||||
const unsigned long PLUGIN_UNSUPPORTED = 0;
|
||||
// Showing alternate content
|
||||
const unsigned long PLUGIN_ALTERNATE = 1;
|
||||
// The plugin exists, but is disabled
|
||||
const unsigned long PLUGIN_DISABLED = 2;
|
||||
// The plugin is blocklisted and disabled
|
||||
const unsigned long PLUGIN_BLOCKLISTED = 3;
|
||||
// The plugin is considered outdated, but not disabled
|
||||
const unsigned long PLUGIN_OUTDATED = 4;
|
||||
// The plugin has crashed
|
||||
const unsigned long PLUGIN_CRASHED = 5;
|
||||
// Suppressed by security policy
|
||||
const unsigned long PLUGIN_SUPPRESSED = 6;
|
||||
// Blocked by content policy
|
||||
const unsigned long PLUGIN_USER_DISABLED = 7;
|
||||
// The plugin is disabled until the user clicks on it
|
||||
const unsigned long PLUGIN_CLICK_TO_PLAY = 8;
|
||||
// The plugin is vulnerable (update available)
|
||||
const unsigned long PLUGIN_VULNERABLE_UPDATABLE = 9;
|
||||
// The plugin is vulnerable (no update available)
|
||||
const unsigned long PLUGIN_VULNERABLE_NO_UPDATE = 10;
|
||||
|
||||
/**
|
||||
* The actual mime type (the one we got back from the network
|
||||
* request) for the element.
|
||||
@ -105,4 +128,6 @@ interface nsIObjectLoadingContent : nsISupports
|
||||
* an <embed> with no src).
|
||||
*/
|
||||
readonly attribute nsIURI srcURI;
|
||||
|
||||
readonly attribute unsigned long pluginFallbackType;
|
||||
};
|
||||
|
@ -2442,6 +2442,14 @@ nsObjectLoadingContent::GetActivated(bool *aActivated)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsObjectLoadingContent::GetPluginFallbackType(PRUint32* aPluginFallbackType)
|
||||
{
|
||||
NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_NOT_AVAILABLE);
|
||||
*aPluginFallbackType = mFallbackType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsObjectLoadingContent::ShouldPlay(FallbackType &aReason)
|
||||
{
|
||||
|
@ -61,20 +61,28 @@ class nsObjectLoadingContent : public nsImageLoadingContent
|
||||
eType_Null = TYPE_NULL
|
||||
};
|
||||
enum FallbackType {
|
||||
eFallbackUnsupported, // The content type is not supported (e.g. plugin
|
||||
// not installed)
|
||||
eFallbackAlternate, // Showing alternate content
|
||||
eFallbackDisabled, // The plugin exists, but is disabled
|
||||
eFallbackBlocklisted, // The plugin is blocklisted and disabled
|
||||
eFallbackOutdated, // The plugin is considered outdated, but not
|
||||
// disabled
|
||||
eFallbackCrashed, // The plugin has crashed
|
||||
eFallbackSuppressed, // Suppressed by security policy
|
||||
eFallbackUserDisabled, // Blocked by content policy
|
||||
eFallbackClickToPlay, // The plugin is disabled until the user clicks on
|
||||
// it
|
||||
eFallbackVulnerableUpdatable, // The plugin is vulnerable (update avail)
|
||||
eFallbackVulnerableNoUpdate // The plugin is vulnerable (no update avail)
|
||||
// The content type is not supported (e.g. plugin not installed)
|
||||
eFallbackUnsupported = nsIObjectLoadingContent::PLUGIN_UNSUPPORTED,
|
||||
// Showing alternate content
|
||||
eFallbackAlternate = nsIObjectLoadingContent::PLUGIN_ALTERNATE,
|
||||
// The plugin exists, but is disabled
|
||||
eFallbackDisabled = nsIObjectLoadingContent::PLUGIN_DISABLED,
|
||||
// The plugin is blocklisted and disabled
|
||||
eFallbackBlocklisted = nsIObjectLoadingContent::PLUGIN_BLOCKLISTED,
|
||||
// The plugin is considered outdated, but not disabled
|
||||
eFallbackOutdated = nsIObjectLoadingContent::PLUGIN_OUTDATED,
|
||||
// The plugin has crashed
|
||||
eFallbackCrashed = nsIObjectLoadingContent::PLUGIN_CRASHED,
|
||||
// Suppressed by security policy
|
||||
eFallbackSuppressed = nsIObjectLoadingContent::PLUGIN_SUPPRESSED,
|
||||
// Blocked by content policy
|
||||
eFallbackUserDisabled = nsIObjectLoadingContent::PLUGIN_USER_DISABLED,
|
||||
// The plugin is disabled until the user clicks on it
|
||||
eFallbackClickToPlay = nsIObjectLoadingContent::PLUGIN_CLICK_TO_PLAY,
|
||||
// The plugin is vulnerable (update available)
|
||||
eFallbackVulnerableUpdatable = nsIObjectLoadingContent::PLUGIN_VULNERABLE_UPDATABLE,
|
||||
// The plugin is vulnerable (no update available)
|
||||
eFallbackVulnerableNoUpdate = nsIObjectLoadingContent::PLUGIN_VULNERABLE_NO_UPDATE
|
||||
};
|
||||
|
||||
nsObjectLoadingContent();
|
||||
|
Loading…
Reference in New Issue
Block a user