From 663581cf1d009ddaf6efcfecd01a6eb5ac4508e2 Mon Sep 17 00:00:00 2001 From: "timeless%mozdev.org" Date: Tue, 25 Mar 2003 02:30:22 +0000 Subject: [PATCH] Bug 196352 JS_GetContextPrivate isn't used correctly r=javi sr=heikki --- security/manager/ssl/src/nsCrypto.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/security/manager/ssl/src/nsCrypto.cpp b/security/manager/ssl/src/nsCrypto.cpp index f36f1138ca9..caae70dfb78 100644 --- a/security/manager/ssl/src/nsCrypto.cpp +++ b/security/manager/ssl/src/nsCrypto.cpp @@ -373,9 +373,13 @@ nsCrypto::GetScriptPrincipal(JSContext *cx) } } - if (!principal) { - nsCOMPtr scriptContext = - NS_REINTERPRET_CAST(nsIScriptContext*,JS_GetContextPrivate(cx)); + if (principal) + return principal; + + if (JS_GetOptions(cx) & JSOPTION_PRIVATE_IS_NSISUPPORTS) { + nsISupports* scriptContextSupports = + NS_STATIC_CAST(nsISupports*, JS_GetContextPrivate(cx)); + nsCOMPtr scriptContext(do_QueryInterface(scriptContextSupports)); if (scriptContext) { nsCOMPtr global;