diff --git a/mozilla/caps/src/nsCodebasePrincipal.cpp b/mozilla/caps/src/nsCodebasePrincipal.cpp index 74d49a875b7..195aa7814ca 100644 --- a/mozilla/caps/src/nsCodebasePrincipal.cpp +++ b/mozilla/caps/src/nsCodebasePrincipal.cpp @@ -46,7 +46,13 @@ nsCodebasePrincipal::Release(void) NS_PRECONDITION(0 != mJSPrincipals.refcount, "dup release"); --mJSPrincipals.refcount; NS_LOG_RELEASE(this, mJSPrincipals.refcount, "nsCodebasePrincipal"); - if (mJSPrincipals.refcount == 0) { + if (mJSPrincipals.refcount == 0) { +#ifdef DEBUG_norris + char *spec; + mURI->GetSpec(&spec); + fprintf(stderr, "Releasing principal for %s\n", spec); + delete spec; +#endif NS_DELETEXPCOM(this); return 0; } diff --git a/mozilla/caps/src/nsJSPrincipals.cpp b/mozilla/caps/src/nsJSPrincipals.cpp index 5f99b7cb8d9..81e0c21e5eb 100644 --- a/mozilla/caps/src/nsJSPrincipals.cpp +++ b/mozilla/caps/src/nsJSPrincipals.cpp @@ -35,6 +35,9 @@ nsGlobalPrivilegesEnabled(JSContext *cx , struct JSPrincipals *jsprin) PR_STATIC_CALLBACK(void) nsDestroyJSPrincipals(JSContext *cx, struct JSPrincipals *jsprin) { nsJSPrincipals *nsjsprin = (nsJSPrincipals *)jsprin; + // We need to destroy the nsIPrincipal. We'll do this by adding + // to the refcount and calling release + nsjsprin->refcount++; NS_IF_RELEASE(nsjsprin->nsIPrincipalPtr); // The nsIPrincipal that we release owns the JSPrincipal struct, // so we don't need to worry about "codebase"