Bug 769594: Make nsObjectLoadingContent use TestPermissionFromPrincipal. r=mounir

This commit is contained in:
Jonas Sicking 2012-07-18 14:18:46 -07:00
parent 3e4b30be56
commit 5845c4644a

View File

@ -496,19 +496,24 @@ nsresult nsObjectLoadingContent::IsPluginEnabledForType(const nsCString& aMIMETy
rv = topWindow->GetDocument(getter_AddRefs(topDocument));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDocument> topDoc = do_QueryInterface(topDocument);
nsIURI* topUri = topDoc->GetDocumentURI();
nsCOMPtr<nsIPermissionManager> permissionManager = do_GetService(NS_PERMISSIONMANAGER_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
PRUint32 permission;
rv = permissionManager->TestPermission(topUri, "plugins", &permission);
NS_ENSURE_SUCCESS(rv, rv);
bool allowPerm = false;
if (!nsContentUtils::IsSystemPrincipal(topDoc->NodePrincipal())) {
PRUint32 permission;
rv = permissionManager->TestPermissionFromPrincipal(topDoc->NodePrincipal(),
"plugins",
&permission);
NS_ENSURE_SUCCESS(rv, rv);
allowPerm = permission == nsIPermissionManager::ALLOW_ACTION;
}
PRUint32 state;
rv = pluginHost->GetBlocklistStateForType(aMIMEType.get(), &state);
NS_ENSURE_SUCCESS(rv, rv);
if (permission == nsIPermissionManager::ALLOW_ACTION &&
if (allowPerm &&
state != nsIBlocklistService::STATE_VULNERABLE_UPDATE_AVAILABLE &&
state != nsIBlocklistService::STATE_VULNERABLE_NO_UPDATE) {
mCTPPlayable = true;