From 5ce52faad03f82e68780e04241f186407002d5c9 Mon Sep 17 00:00:00 2001 From: "bent.mozilla%gmail.com" Date: Sat, 7 Jun 2008 03:17:26 +0000 Subject: [PATCH] Relanding fix for bug 390788. git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@252172 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/js/src/xpconnect/src/XPCNativeWrapper.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/mozilla/js/src/xpconnect/src/XPCNativeWrapper.cpp b/mozilla/js/src/xpconnect/src/XPCNativeWrapper.cpp index 2e9c4de8879..2d70e763305 100644 --- a/mozilla/js/src/xpconnect/src/XPCNativeWrapper.cpp +++ b/mozilla/js/src/xpconnect/src/XPCNativeWrapper.cpp @@ -249,13 +249,11 @@ EnsureLegalActivity(JSContext *cx, JSObject *obj) GetAppropriateSecurityManager(nsIXPCSecurityManager::HOOK_CALL_METHOD); nsCOMPtr ssm(do_QueryInterface(sm)); - // A last ditch effort to allow access: if the subject principal is - // the system principal, then some XPCNativeWrapper-using code has - // passed one into other code. If that other code is chrome, then - // allow access. - PRBool isSystem; - nsresult rv = ssm->SubjectPrincipalIsSystem(&isSystem); - if (NS_SUCCEEDED(rv) && isSystem) { + // A last ditch effort to allow access: if the currently-running code + // has UniversalXPConnect privileges, then allow access. + PRBool isPrivileged; + nsresult rv = ssm->IsCapabilityEnabled("UniversalXPConnect", &isPrivileged); + if (NS_SUCCEEDED(rv) && isPrivileged) { return JS_TRUE; }