Bug 913734 - Stop storing security policies on XPCWrappedNativeProtos. r=mrbkap
authorBobby Holley <bobbyholley@gmail.com>
Fri, 13 Dec 2013 19:15:43 -0800
changeset 176503 22929b380e8458c9bc2816eef1bbfbf14e84472e
parent 176502 26190b7a0b355ccb90e5acf3e85754b4c84873db
child 176504 6c4dd8d796c672109929405770246a8acb40188f
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs913734
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 913734 - Stop storing security policies on XPCWrappedNativeProtos. r=mrbkap This is just a cache, so we can safely remove it without impacting correctness. The rest of this mechanism goes away in subsequent patches.
caps/include/nsScriptSecurityManager.h
caps/src/nsScriptSecurityManager.cpp
js/xpconnect/idl/nsIXPCSecurityManager.idl
js/xpconnect/idl/nsIXPConnect.idl
js/xpconnect/src/XPCWrappedNative.cpp
js/xpconnect/src/XPCWrappedNativeJSOps.cpp
js/xpconnect/src/XPCWrappedNativeProto.cpp
js/xpconnect/src/XPCWrappedNativeScope.cpp
js/xpconnect/src/nsXPConnect.cpp
js/xpconnect/src/xpcprivate.h
--- a/caps/include/nsScriptSecurityManager.h
+++ b/caps/include/nsScriptSecurityManager.h
@@ -391,30 +391,28 @@ private:
     doGetSubjectPrincipal(nsresult* rv);
     
     nsresult
     CheckPropertyAccessImpl(uint32_t aAction,
                             nsAXPCNativeCallContext* aCallContext,
                             JSContext* cx, JSObject* aJSObject,
                             nsISupports* aObj,
                             nsIClassInfo* aClassInfo,
-                            const char* aClassName, jsid aProperty,
-                            void** aCachedClassPolicy);
+                            const char* aClassName, jsid aProperty);
 
     nsresult
     CheckSameOriginDOMProp(nsIPrincipal* aSubject, 
                            nsIPrincipal* aObject,
                            uint32_t aAction);
 
     nsresult
     LookupPolicy(nsIPrincipal* principal,
                  ClassInfoData& aClassData,
                  JS::Handle<jsid> aProperty,
                  uint32_t aAction,
-                 ClassPolicy** aCachedClassPolicy,
                  SecurityLevel* result);
 
     nsresult
     GetCodebasePrincipalInternal(nsIURI* aURI, uint32_t aAppId,
                                  bool aInMozBrowser,
                                  nsIPrincipal** result);
 
     nsresult
--- a/caps/src/nsScriptSecurityManager.cpp
+++ b/caps/src/nsScriptSecurityManager.cpp
@@ -534,17 +534,17 @@ NS_IMETHODIMP
 nsScriptSecurityManager::CheckPropertyAccess(JSContext* cx,
                                              JSObject* aJSObject,
                                              const char* aClassName,
                                              jsid aProperty,
                                              uint32_t aAction)
 {
     return CheckPropertyAccessImpl(aAction, nullptr, cx, aJSObject,
                                    nullptr, nullptr,
-                                   aClassName, aProperty, nullptr);
+                                   aClassName, aProperty);
 }
 
 NS_IMETHODIMP
 nsScriptSecurityManager::CheckSameOrigin(JSContext* cx,
                                          nsIURI* aTargetURI)
 {
     nsresult rv;
 
@@ -609,18 +609,17 @@ nsScriptSecurityManager::CheckSameOrigin
 }
 
 nsresult
 nsScriptSecurityManager::CheckPropertyAccessImpl(uint32_t aAction,
                                                  nsAXPCNativeCallContext* aCallContext,
                                                  JSContext* cx, JSObject* aJSObject,
                                                  nsISupports* aObj,
                                                  nsIClassInfo* aClassInfo,
-                                                 const char* aClassName, jsid aProperty,
-                                                 void** aCachedClassPolicy)
+                                                 const char* aClassName, jsid aProperty)
 {
     nsresult rv;
     JS::RootedObject jsObject(cx, aJSObject);
     JS::RootedId property(cx, aProperty);
     nsIPrincipal* subjectPrincipal = GetSubjectPrincipal(cx, &rv);
     if (NS_FAILED(rv))
         return rv;
 
@@ -632,17 +631,17 @@ nsScriptSecurityManager::CheckPropertyAc
 
     // Hold the class info data here so we don't have to go back to virtual
     // methods all the time
     ClassInfoData classInfoData(aClassInfo, aClassName);
 
     //-- Look up the security policy for this class and subject domain
     SecurityLevel securityLevel;
     rv = LookupPolicy(subjectPrincipal, classInfoData, property, aAction,
-                      (ClassPolicy**)aCachedClassPolicy, &securityLevel);
+                      &securityLevel);
     if (NS_FAILED(rv))
         return rv;
 
     if (securityLevel.level == SCRIPT_SECURITY_UNDEFINED_ACCESS)
     {
         // No policy found for this property so use the default of last resort.
         // If we were called from somewhere other than XPConnect
         // (no XPC call context), assume this is a DOM class. Otherwise,
@@ -978,17 +977,16 @@ nsScriptSecurityManager::CheckSameOrigin
     return NS_ERROR_DOM_PROP_ACCESS_DENIED;
 }
 
 nsresult
 nsScriptSecurityManager::LookupPolicy(nsIPrincipal* aPrincipal,
                                       ClassInfoData& aClassData,
                                       JS::Handle<jsid> aProperty,
                                       uint32_t aAction,
-                                      ClassPolicy** aCachedClassPolicy,
                                       SecurityLevel* result)
 {
     AutoJSContext cx;
     nsresult rv;
     JS::RootedId property(cx, aProperty);
     result->level = SCRIPT_SECURITY_UNDEFINED_ACCESS;
 
     DomainPolicy* dpolicy = nullptr;
@@ -1067,38 +1065,23 @@ nsScriptSecurityManager::LookupPolicy(ns
 
             if (!dpolicy)
                 dpolicy = mDefaultPolicy;
         }
 
         aPrincipal->SetSecurityPolicy((void*)dpolicy);
     }
 
-    ClassPolicy* cpolicy = nullptr;
-
-    if ((dpolicy == mDefaultPolicy) && aCachedClassPolicy)
-    {
-        // No per-domain policy for this principal (the more common case)
-        // so look for a cached class policy from the object wrapper
-        cpolicy = *aCachedClassPolicy;
-    }
-
-    if (!cpolicy)
-    { //-- No cached policy for this class, need to look it up
-        cpolicy = static_cast<ClassPolicy*>
+    ClassPolicy* cpolicy = static_cast<ClassPolicy*>
                              (PL_DHashTableOperate(dpolicy,
                                                       aClassData.GetName(),
                                                       PL_DHASH_LOOKUP));
 
-        if (PL_DHASH_ENTRY_IS_FREE(cpolicy))
-            cpolicy = NO_POLICY_FOR_CLASS;
-
-        if ((dpolicy == mDefaultPolicy) && aCachedClassPolicy)
-            *aCachedClassPolicy = cpolicy;
-    }
+    if (PL_DHASH_ENTRY_IS_FREE(cpolicy))
+        cpolicy = NO_POLICY_FOR_CLASS;
 
     NS_ASSERTION(JSID_IS_INT(property) || JSID_IS_OBJECT(property) ||
                  JSID_IS_STRING(property), "Property must be a valid id");
 
     // Only atomized strings are stored in the policies' hash tables.
     if (!JSID_IS_STRING(property))
         return NS_OK;
 
@@ -1451,18 +1434,17 @@ nsScriptSecurityManager::CheckLoadURIWit
         }
 
         // Now check capability policies
         static const char loadURIPrefGroup[] = "checkloaduri";
         ClassInfoData nameData(nullptr, loadURIPrefGroup);
 
         SecurityLevel secLevel;
         rv = LookupPolicy(aPrincipal, nameData, EnabledID(),
-                          nsIXPCSecurityManager::ACCESS_GET_PROPERTY,
-                          nullptr, &secLevel);
+                          nsIXPCSecurityManager::ACCESS_GET_PROPERTY, &secLevel);
         if (NS_SUCCEEDED(rv) && secLevel.level == SCRIPT_SECURITY_ALL_ACCESS)
         {
             // OK for this site!
             return NS_OK;
         }
 
         if (reportErrors) {
             ReportError(nullptr, errorTag, sourceURI, aTargetURI);
@@ -1618,17 +1600,17 @@ nsScriptSecurityManager::ScriptAllowed(J
 
     // Check for a per-site policy.
     static const char jsPrefGroupName[] = "javascript";
     ClassInfoData nameData(nullptr, jsPrefGroupName);
     SecurityLevel secLevel;
     nsresult rv = LookupPolicy(doGetObjectPrincipal(global), nameData,
                                EnabledID(),
                                nsIXPCSecurityManager::ACCESS_GET_PROPERTY,
-                               nullptr, &secLevel);
+                               &secLevel);
     if (NS_FAILED(rv) || secLevel.level == SCRIPT_SECURITY_NO_ACCESS) {
         return false;
     }
 
     return true;
 }
 
 ///////////////// Principals ///////////////////////
@@ -1835,18 +1817,17 @@ nsScriptSecurityManager::doGetObjectPrin
 ////////////////////////////////////////////////
 // Methods implementing nsIXPCSecurityManager //
 ////////////////////////////////////////////////
 
 NS_IMETHODIMP
 nsScriptSecurityManager::CanCreateWrapper(JSContext *cx,
                                           const nsIID &aIID,
                                           nsISupports *aObj,
-                                          nsIClassInfo *aClassInfo,
-                                          void **aPolicy)
+                                          nsIClassInfo *aClassInfo)
 {
 // XXX Special case for nsIXPCException ?
     ClassInfoData objClassInfo = ClassInfoData(aClassInfo, nullptr);
     if (objClassInfo.IsDOMClass())
     {
         return NS_OK;
     }
 
@@ -1942,22 +1923,21 @@ nsScriptSecurityManager::CanGetService(J
 
 NS_IMETHODIMP
 nsScriptSecurityManager::CanAccess(uint32_t aAction,
                                    nsAXPCNativeCallContext* aCallContext,
                                    JSContext* cx,
                                    JSObject* aJSObject,
                                    nsISupports* aObj,
                                    nsIClassInfo* aClassInfo,
-                                   jsid aPropertyName,
-                                   void** aPolicy)
+                                   jsid aPropertyName)
 {
     return CheckPropertyAccessImpl(aAction, aCallContext, cx,
                                    aJSObject, aObj, aClassInfo,
-                                   nullptr, aPropertyName, aPolicy);
+                                   nullptr, aPropertyName);
 }
 
 nsresult
 nsScriptSecurityManager::CheckXPCPermissions(JSContext* cx,
                                              nsISupports* aObj, JSObject* aJSObject,
                                              nsIPrincipal* aSubjectPrincipal,
                                              const char* aObjectSecurityLevel)
 {
@@ -2213,21 +2193,16 @@ nsScriptSecurityManager::SystemPrincipal
     if (gScriptSecMan)
         NS_ADDREF(sysprin = gScriptSecMan->mSystemPrincipal);
     return static_cast<nsSystemPrincipal*>(sysprin);
 }
 
 nsresult
 nsScriptSecurityManager::InitPolicies()
 {
-    // Clear any policies cached on XPConnect wrappers
-    nsresult rv =
-        nsXPConnect::XPConnect()->ClearAllWrappedNativeSecurityPolicies();
-    if (NS_FAILED(rv)) return rv;
-
     //-- Clear mOriginToPolicyMap: delete mapped DomainEntry items,
     //-- whose dtor decrements refcount of stored DomainPolicy object
     delete mOriginToPolicyMap;
     
     //-- Marks all the survivor DomainPolicy objects (those cached
     //-- by nsPrincipal objects) as invalid: they will be released
     //-- on first nsPrincipal::GetSecurityPolicy() attempt.
     DomainPolicy::InvalidateAll();
@@ -2259,17 +2234,17 @@ nsScriptSecurityManager::InitPolicies()
         mCapabilities = 
           new nsObjectHashtable(nullptr, nullptr, DeleteCapability, nullptr);
         if (!mCapabilities)
             return NS_ERROR_OUT_OF_MEMORY;
     }
 
     // Get a JS context - we need it to create internalized strings later.
     AutoSafeJSContext cx;
-    rv = InitDomainPolicy(cx, "default", mDefaultPolicy);
+    nsresult rv = InitDomainPolicy(cx, "default", mDefaultPolicy);
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsAdoptingCString policyNames =
         Preferences::GetCString("capability.policy.policynames");
 
     nsAdoptingCString defaultPolicyNames =
         Preferences::GetCString("capability.policy.default_policynames");
     policyNames += NS_LITERAL_CSTRING(" ") + defaultPolicyNames;
--- a/js/xpconnect/idl/nsIXPCSecurityManager.idl
+++ b/js/xpconnect/idl/nsIXPCSecurityManager.idl
@@ -15,32 +15,31 @@ class nsAXPCNativeCallContext;
 %}
 
 interface nsIClassInfo;
 
 [ptr] native JSContextPtr(JSContext);
 [ptr] native JSObjectPtr(JSObject);
 [ptr] native JSStackFramePtr(JSStackFrame);
 
-[uuid(31431440-f1ce-11d2-985a-006008962422)]
+[uuid(852e1ea8-1c3f-49e1-b57c-c0f525a167d3)]
 interface nsIXPCSecurityManager : nsISupports
 {
     /**
     * For each of these hooks returning NS_OK means 'let the action continue'.
     * Returning an error code means 'veto the action'. XPConnect will return
     * false to the js engine if the action is vetoed. The implementor of this
     * interface is responsible for setting a JS exception into the JSContext
     * if that is appropriate.
     */
 
     void CanCreateWrapper(in JSContextPtr aJSContext,
                           in nsIIDRef aIID,
                           in nsISupports aObj,
-                          in nsIClassInfo aClassInfo,
-                          inout voidPtr aPolicy);
+                          in nsIClassInfo aClassInfo);
 
     void CanCreateInstance(in JSContextPtr aJSContext,
                            in nsCIDRef aCID);
 
     void CanGetService(in JSContextPtr aJSContext,
                        in nsCIDRef aCID);
 
     /*
@@ -51,11 +50,10 @@ interface nsIXPCSecurityManager : nsISup
     const uint32_t ACCESS_SET_PROPERTY = 2;
 
     void CanAccess(in uint32_t aAction,
                    in nsAXPCNativeCallContextPtr aCallContext,
                    in JSContextPtr aJSContext,
                    in JSObjectPtr aJSObject,
                    in nsISupports aObj,
                    in nsIClassInfo aClassInfo,
-                   in jsid aName,
-                   inout voidPtr aPolicy);
+                   in jsid aName);
 };
--- a/js/xpconnect/idl/nsIXPConnect.idl
+++ b/js/xpconnect/idl/nsIXPConnect.idl
@@ -55,17 +55,17 @@ interface nsIObjectOutputStream;
 
 /***************************************************************************/
 [uuid(909e8641-7c54-4dff-9b94-ba631f057b33)]
 interface nsIXPConnectJSObjectHolder : nsISupports
 {
     [notxpcom, nostdcall] JSObjectPtr GetJSObject();
 };
 
-[uuid(2d08015d-7556-4f12-9e89-4c756d129310)]
+[uuid(675b01ba-397b-472a-9b80-5716376a2ec6)]
 interface nsIXPConnectWrappedNative : nsIXPConnectJSObjectHolder
 {
     /* attribute 'JSObject' inherited from nsIXPConnectJSObjectHolder */
     readonly attribute nsISupports      Native;
     readonly attribute JSObjectPtr      JSObjectPrototype;
 
     /**
      * These are here as an aid to nsIXPCScriptable implementors
@@ -80,23 +80,16 @@ interface nsIXPConnectWrappedNative : ns
     /*
      * This finishes initializing a wrapped global, doing the parts that we
      * couldn't do while the global and window were being simultaneously
      * bootstrapped. This should be called exactly once, and only for wrapped
      * globals.
      */
     void finishInitForWrappedGlobal();
 
-    /* 
-     * This returns a pointer into the instance and care should be taken
-     * to make sure the pointer is not kept past the life time of the
-     * object it points into.
-     */
-    voidPtrPtr GetSecurityInfoAddress();
-
     /*
      * NOTE: Add new IDL methods _before_ the C++ block below if you
      * add them.  Otherwise the vtable won't be what xpidl thinks it
      * is, since GetObjectPrincipal() is virtual.
      */
 
 %{C++
     /**
@@ -277,17 +270,17 @@ interface nsIXPCFunctionThisTranslator :
 %{ C++
 // For use with the service manager
 // {CB6593E0-F9B2-11d2-BDD6-000064657374}
 #define NS_XPCONNECT_CID \
 { 0xcb6593e0, 0xf9b2, 0x11d2, \
     { 0xbd, 0xd6, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74 } }
 %}
 
-[uuid(880be309-88a1-4e98-8621-7f7e42681b20)]
+[uuid(74109b69-de2f-4296-9e08-2a233eafa8f9)]
 interface nsIXPConnect : nsISupports
 {
 %{ C++
   NS_DEFINE_STATIC_CID_ACCESSOR(NS_XPCONNECT_CID)
 %}
 
     /**
      * Initializes classes on a global object that has already been created.
@@ -501,18 +494,16 @@ interface nsIXPConnect : nsISupports
     void
     reparentWrappedNativeIfFound(in JSContextPtr aJSContext,
                                  in JSObjectPtr  aScope,
                                  in JSObjectPtr  aNewParent,
                                  in nsISupports  aCOMObj);
     void
     rescueOrphansInScope(in JSContextPtr aJSContext, in JSObjectPtr  aScope);
 
-    void clearAllWrappedNativeSecurityPolicies();
-
     nsIXPConnectJSObjectHolder
     getWrappedNativePrototype(in JSContextPtr aJSContext,
                               in JSObjectPtr  aScope,
                               in nsIClassInfo aClassInfo);
 
     jsval variantToJS(in JSContextPtr ctx, in JSObjectPtr scope, in nsIVariant value);
     nsIVariant JSToVariant(in JSContextPtr ctx, in jsval value);
 
--- a/js/xpconnect/src/XPCWrappedNative.cpp
+++ b/js/xpconnect/src/XPCWrappedNative.cpp
@@ -1638,17 +1638,17 @@ XPCWrappedNative::InitTearOff(XPCWrapped
                 return NS_ERROR_NO_INTERFACE;
             }
         }
     }
 
     nsIXPCSecurityManager* sm = nsXPConnect::XPConnect()->GetDefaultSecurityManager();
     if (sm && NS_FAILED(sm->
                         CanCreateWrapper(cx, *iid, identity,
-                                         GetClassInfo(), GetSecurityInfoAddr()))) {
+                                         GetClassInfo()))) {
         // the security manager vetoed. It should have set an exception.
         NS_RELEASE(obj);
         aTearOff->SetInterface(nullptr);
         return NS_ERROR_XPC_SECURITY_MANAGER_VETO;
     }
 
     // If this is not already in our set we need to extend our set.
     // Note: we do not cache the result of the previous call to HasInterface()
@@ -1859,18 +1859,17 @@ XPCWrappedNative::CallMethod(XPCCallCont
             return false;
     }
 
     nsIXPCSecurityManager* sm = nsXPConnect::XPConnect()->GetDefaultSecurityManager();
     if (sm && NS_FAILED(sm->CanAccess(secAction, &ccx, ccx,
                                       ccx.GetFlattenedJSObject(),
                                       ccx.GetWrapper()->GetIdentityObject(),
                                       ccx.GetWrapper()->GetClassInfo(),
-                                      ccx.GetMember()->GetName(),
-                                      ccx.GetWrapper()->GetSecurityInfoAddr()))) {
+                                      ccx.GetMember()->GetName()))) {
         // the security manager vetoed. It should have set an exception.
         return false;
     }
 
     return CallMethodHelper(ccx).Call();
 }
 
 bool
@@ -2666,23 +2665,16 @@ NS_IMETHODIMP XPCWrappedNative::FinishIn
     // Call PostCreateProrotype.
     bool success = GetProto()->CallPostCreatePrototype();
     if (!success)
         return NS_ERROR_FAILURE;
 
     return NS_OK;
 }
 
-NS_IMETHODIMP XPCWrappedNative::GetSecurityInfoAddress(void*** securityInfoAddrPtr)
-{
-    NS_ENSURE_ARG_POINTER(securityInfoAddrPtr);
-    *securityInfoAddrPtr = GetSecurityInfoAddr();
-    return NS_OK;
-}
-
 /* void debugDump (in short depth); */
 NS_IMETHODIMP XPCWrappedNative::DebugDump(int16_t depth)
 {
 #ifdef DEBUG
     depth-- ;
     XPC_LOG_ALWAYS(("XPCWrappedNative @ %x with mRefCnt = %d", this, mRefCnt.get()));
     XPC_LOG_INDENT();
 
--- a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
@@ -168,18 +168,17 @@ XPC_WN_DoubleWrappedGetter(JSContext *cx
                         GetStringID(XPCJSRuntime::IDX_WRAPPED_JSOBJECT);
 
             ccx.SetCallInfo(iface, iface->GetMemberAt(1), false);
             if (NS_FAILED(sm->
                           CanAccess(nsIXPCSecurityManager::ACCESS_GET_PROPERTY,
                                     &ccx, ccx,
                                     ccx.GetFlattenedJSObject(),
                                     wrapper->GetIdentityObject(),
-                                    wrapper->GetClassInfo(), id,
-                                    wrapper->GetSecurityInfoAddr()))) {
+                                    wrapper->GetClassInfo(), id))) {
                 // The SecurityManager should have set an exception.
                 return false;
             }
         }
     }
 
     args.rval().setObject(*realObject);
     return JS_WrapValue(cx, args.rval());
--- a/js/xpconnect/src/XPCWrappedNativeProto.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeProto.cpp
@@ -20,17 +20,16 @@ XPCWrappedNativeProto::XPCWrappedNativeP
                                              nsIClassInfo* ClassInfo,
                                              uint32_t ClassInfoFlags,
                                              XPCNativeSet* Set)
     : mScope(Scope),
       mJSProtoObject(nullptr),
       mClassInfo(ClassInfo),
       mClassInfoFlags(ClassInfoFlags),
       mSet(Set),
-      mSecurityInfo(nullptr),
       mScriptableInfo(nullptr)
 {
     // This native object lives as long as its associated JSObject - killed
     // by finalization of the JSObject (or explicitly if Init fails).
 
     MOZ_COUNT_CTOR(XPCWrappedNativeProto);
     MOZ_ASSERT(mScope);
 
@@ -203,17 +202,16 @@ XPCWrappedNativeProto::DebugDump(int16_t
 #ifdef DEBUG
     depth-- ;
     XPC_LOG_ALWAYS(("XPCWrappedNativeProto @ %x", this));
     XPC_LOG_INDENT();
         XPC_LOG_ALWAYS(("gDEBUG_LiveProtoCount is %d", gDEBUG_LiveProtoCount));
         XPC_LOG_ALWAYS(("mScope @ %x", mScope));
         XPC_LOG_ALWAYS(("mJSProtoObject @ %x", mJSProtoObject.get()));
         XPC_LOG_ALWAYS(("mSet @ %x", mSet));
-        XPC_LOG_ALWAYS(("mSecurityInfo of %x", mSecurityInfo));
         XPC_LOG_ALWAYS(("mScriptableInfo @ %x", mScriptableInfo));
         if (depth && mScriptableInfo) {
             XPC_LOG_INDENT();
             XPC_LOG_ALWAYS(("mScriptable @ %x", mScriptableInfo->GetCallback()));
             XPC_LOG_ALWAYS(("mFlags of %x", (uint32_t)mScriptableInfo->GetFlags()));
             XPC_LOG_ALWAYS(("mJSClass @ %x", mScriptableInfo->GetJSClass()));
             XPC_LOG_OUTDENT();
         }
--- a/js/xpconnect/src/XPCWrappedNativeScope.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeScope.cpp
@@ -541,37 +541,16 @@ XPCWrappedNativeScope::SystemIsBeingShut
     // Now it is safe to kill all the scopes.
     KillDyingScopes();
 }
 
 
 /***************************************************************************/
 
 static PLDHashOperator
-WNProtoSecPolicyClearer(PLDHashTable *table, PLDHashEntryHdr *hdr,
-                        uint32_t number, void *arg)
-{
-    XPCWrappedNativeProto* proto =
-        ((ClassInfo2WrappedNativeProtoMap::Entry*)hdr)->value;
-    *(proto->GetSecurityInfoAddr()) = nullptr;
-    return PL_DHASH_NEXT;
-}
-
-// static
-nsresult
-XPCWrappedNativeScope::ClearAllWrappedNativeSecurityPolicies()
-{
-    for (XPCWrappedNativeScope* cur = gScopes; cur; cur = cur->mNext) {
-        cur->mWrappedNativeProtoMap->Enumerate(WNProtoSecPolicyClearer, nullptr);
-    }
-
-    return NS_OK;
-}
-
-static PLDHashOperator
 WNProtoRemover(PLDHashTable *table, PLDHashEntryHdr *hdr,
                uint32_t number, void *arg)
 {
     XPCWrappedNativeProtoMap* detachedMap = (XPCWrappedNativeProtoMap*)arg;
 
     XPCWrappedNativeProto* proto = (XPCWrappedNativeProto*)
         ((ClassInfo2WrappedNativeProtoMap::Entry*)hdr)->value;
 
--- a/js/xpconnect/src/nsXPConnect.cpp
+++ b/js/xpconnect/src/nsXPConnect.cpp
@@ -871,23 +871,16 @@ nsXPConnect::SetFunctionThisTranslator(c
                                        nsIXPCFunctionThisTranslator *aTranslator)
 {
     XPCJSRuntime* rt = GetRuntime();
     IID2ThisTranslatorMap* map = rt->GetThisTranslatorMap();
     map->Add(aIID, aTranslator);
     return NS_OK;
 }
 
-/* void clearAllWrappedNativeSecurityPolicies (); */
-NS_IMETHODIMP
-nsXPConnect::ClearAllWrappedNativeSecurityPolicies()
-{
-    return XPCWrappedNativeScope::ClearAllWrappedNativeSecurityPolicies();
-}
-
 NS_IMETHODIMP
 nsXPConnect::CreateSandbox(JSContext *cx, nsIPrincipal *principal,
                            nsIXPConnectJSObjectHolder **_retval)
 {
     *_retval = nullptr;
 
     RootedValue rval(cx);
     SandboxOptions options;
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -1115,19 +1115,16 @@ public:
     StartFinalizationPhaseOfGC(JSFreeOp *fop, XPCJSRuntime* rt);
 
     static void
     FinishedFinalizationPhaseOfGC();
 
     static void
     MarkAllWrappedNativesAndProtos();
 
-    static nsresult
-    ClearAllWrappedNativeSecurityPolicies();
-
 #ifdef DEBUG
     static void
     ASSERT_NoInterfaceSetsAreMarked();
 #endif
 
     static void
     SweepAllWrappedNativeTearOffs();
 
@@ -1831,19 +1828,16 @@ public:
     GetClassInfo()     const {return mClassInfo;}
 
     XPCNativeSet*
     GetSet()           const {return mSet;}
 
     XPCNativeScriptableInfo*
     GetScriptableInfo()   {return mScriptableInfo;}
 
-    void**
-    GetSecurityInfoAddr() {return &mSecurityInfo;}
-
     uint32_t
     GetClassInfoFlags() const {return mClassInfoFlags;}
 
 #ifdef GET_IT
 #undef GET_IT
 #endif
 #define GET_IT(f_) const {return !!(mClassInfoFlags & nsIClassInfo:: f_ );}
 
@@ -1924,17 +1918,16 @@ private:
 #endif
 
 private:
     XPCWrappedNativeScope*   mScope;
     JS::ObjectPtr            mJSProtoObject;
     nsCOMPtr<nsIClassInfo>   mClassInfo;
     uint32_t                 mClassInfoFlags;
     XPCNativeSet*            mSet;
-    void*                    mSecurityInfo;
     XPCNativeScriptableInfo* mScriptableInfo;
 };
 
 /***********************************************/
 // XPCWrappedNativeTearOff represents the info needed to make calls to one
 // interface on the underlying native object of a XPCWrappedNative.
 
 class XPCWrappedNativeTearOff
@@ -2108,20 +2101,16 @@ private:
 public:
 
     XPCNativeScriptableInfo*
     GetScriptableInfo() const {return mScriptableInfo;}
 
     nsIXPCScriptable*      // call this wrong and you deserve to crash
     GetScriptableCallback() const  {return mScriptableInfo->GetCallback();}
 
-    void**
-    GetSecurityInfoAddr() {return HasProto() ?
-                                   GetProto()->GetSecurityInfoAddr() : nullptr;}
-
     nsIClassInfo*
     GetClassInfo() const {return IsValid() && HasProto() ?
                             GetProto()->GetClassInfo() : nullptr;}
 
     bool
     HasMutatedSet() const {return IsValid() &&
                                   (!HasProto() ||
                                    GetSet() != GetProto()->GetSet());}