Bug 1178896 - Add support for determining if a plugin is OOP to nsIPluginHost. r=aklotz

This commit is contained in:
Andrew Comminos 2015-07-11 19:08:00 +02:00
parent 2beff55d6f
commit 1739a935db
3 changed files with 21 additions and 22 deletions

View File

@ -36,7 +36,7 @@ interface nsIClearSiteDataCallback : nsISupports
void callback(in nsresult rv);
};
[scriptable, uuid(a884e736-5396-4400-bc82-9a23d871d12c)]
[scriptable, uuid(2bed7533-50e3-45dd-9e47-102e2c6f5ea8)]
interface nsIPluginHost : nsISupports
{
/**
@ -154,5 +154,10 @@ interface nsIPluginHost : nsISupports
*/
uint32_t getBlocklistStateForType(in AUTF8String aMimeType,
[optional] in uint32_t excludeFlags);
/**
* Returns true if plugins with the given mimetype will run out of process.
*/
boolean isPluginOOP(in AUTF8String aMimeType);
};

View File

@ -1064,6 +1064,18 @@ nsPluginHost::GetBlocklistStateForType(const nsACString &aMimeType,
return tag->GetBlocklistState(aState);
}
NS_IMETHODIMP
nsPluginHost::IsPluginOOP(const nsACString& aMimeType,
bool* aResult)
{
nsPluginTag* tag = FindNativePluginForType(aMimeType, true);
if (!tag) {
return NS_ERROR_NOT_AVAILABLE;
}
*aResult = nsNPAPIPlugin::RunPluginOOP(tag);
return NS_OK;
}
NS_IMETHODIMP
nsPluginHost::GetPermissionStringForType(const nsACString &aMimeType,
uint32_t aExcludeFlags,

View File

@ -219,27 +219,9 @@ if (typeof(computedStyle) == 'undefined') {
**/
SimpleTest.testPluginIsOOP = function () {
var testPluginIsOOP = false;
if (navigator.platform.indexOf("Mac") == 0) {
if (SpecialPowers.XPCOMABI.match(/x86-/)) {
try {
testPluginIsOOP = SpecialPowers.getBoolPref("dom.ipc.plugins.enabled.i386.test.plugin");
} catch (e) {
testPluginIsOOP = SpecialPowers.getBoolPref("dom.ipc.plugins.enabled.i386");
}
}
else if (SpecialPowers.XPCOMABI.match(/x86_64-/)) {
try {
testPluginIsOOP = SpecialPowers.getBoolPref("dom.ipc.plugins.enabled.x86_64.test.plugin");
} catch (e) {
testPluginIsOOP = SpecialPowers.getBoolPref("dom.ipc.plugins.enabled.x86_64");
}
}
}
else {
testPluginIsOOP = SpecialPowers.getBoolPref("dom.ipc.plugins.enabled");
}
return testPluginIsOOP;
var ph = SpecialPowers.Cc["@mozilla.org/plugin/host;1"]
.getService(SpecialPowers.Ci.nsIPluginHost);
return ph.isPluginOOP("application/x-test");
};
SimpleTest._tests = [];