diff --git a/mozilla/accessible/src/base/Makefile.in b/mozilla/accessible/src/base/Makefile.in index ca17082389b..c694d54dc78 100644 --- a/mozilla/accessible/src/base/Makefile.in +++ b/mozilla/accessible/src/base/Makefile.in @@ -32,6 +32,7 @@ REQUIRES = commandhandler \ content \ docshell \ dom \ + js \ editor \ gfx \ htmlparser \ diff --git a/mozilla/caps/src/nsScriptSecurityManager.cpp b/mozilla/caps/src/nsScriptSecurityManager.cpp index 728b5708ee3..2c5d2e34bf9 100644 --- a/mozilla/caps/src/nsScriptSecurityManager.cpp +++ b/mozilla/caps/src/nsScriptSecurityManager.cpp @@ -93,13 +93,23 @@ static NS_DEFINE_IID(kObserverServiceIID, NS_IOBSERVERSERVICE_IID); /////////////////////////// // Result of this function should not be freed. static inline const PRUnichar * -JSValIDToString(JSContext *cx, const jsval idval) { +JSValIDToString(JSContext *cx, const jsval idval) +{ JSString *str = JS_ValueToString(cx, idval); if(!str) return nsnull; return NS_REINTERPRET_CAST(PRUnichar*, JS_GetStringChars(str)); } +already_AddRefed +GetScriptContext(JSContext *cx) +{ + nsIScriptContext *scriptContext; + GetScriptContextFromJSContext(cx, &scriptContext); + + return scriptContext; +} + // Helper class to get stuff from the ClassInfo and not waste extra time with // virtual method calls for things it has already gotten class ClassInfoData @@ -1497,7 +1507,7 @@ nsScriptSecurityManager::GetRootDocShell(JSContext *cx, nsIDocShell **result) nsresult rv; *result = nsnull; nsCOMPtr docshell; - nsCOMPtr scriptContext = (nsIScriptContext*)JS_GetContextPrivate(cx); + nsCOMPtr scriptContext = GetScriptContext(cx); if (!scriptContext) return NS_ERROR_FAILURE; nsCOMPtr globalObject; scriptContext->GetGlobalObject(getter_AddRefs(globalObject)); @@ -1549,7 +1559,7 @@ nsScriptSecurityManager::CanExecuteScripts(JSContext* cx, } //-- See if the current window allows JS execution - nsCOMPtr scriptContext = (nsIScriptContext*)JS_GetContextPrivate(cx); + nsCOMPtr scriptContext = GetScriptContext(cx); if (!scriptContext) return NS_ERROR_FAILURE; nsCOMPtr globalObject; scriptContext->GetGlobalObject(getter_AddRefs(globalObject)); @@ -1808,20 +1818,20 @@ nsScriptSecurityManager::GetPrincipalFromContext(JSContext *cx, nsIPrincipal **result) { *result = nsnull; - NS_ENSURE_TRUE(::JS_GetOptions(cx) & JSOPTION_PRIVATE_IS_NSISUPPORTS, - NS_ERROR_FAILURE); - nsISupports* scriptContextSupports = - NS_STATIC_CAST(nsISupports*, JS_GetContextPrivate(cx)); - nsCOMPtr scriptContext(do_QueryInterface(scriptContextSupports)); - if (scriptContext) + nsCOMPtr scriptContext = GetScriptContext(cx); + + if (!scriptContext) { - nsCOMPtr global; - scriptContext->GetGlobalObject(getter_AddRefs(global)); - nsCOMPtr globalData(do_QueryInterface(global)); - if (globalData) - globalData->GetPrincipal(result); + return NS_ERROR_FAILURE; } + + nsCOMPtr global; + scriptContext->GetGlobalObject(getter_AddRefs(global)); + nsCOMPtr globalData(do_QueryInterface(global)); + if (globalData) + globalData->GetPrincipal(result); + return NS_OK; } @@ -1930,8 +1940,7 @@ nsScriptSecurityManager::GetPrincipalAndFrame(JSContext *cx, // and return the innermost frame for annotations. if (cx) { - nsCOMPtr scriptContext = - NS_REINTERPRET_CAST(nsIScriptContext*,JS_GetContextPrivate(cx)); + nsCOMPtr scriptContext = GetScriptContext(cx); if (scriptContext) { nsCOMPtr global; @@ -2153,7 +2162,7 @@ nsScriptSecurityManager::CheckConfirmDialog(JSContext* cx, nsIPrincipal* aPrinci nsCOMPtr prompter; if (cx) { - nsCOMPtr scriptContext = (nsIScriptContext*)JS_GetContextPrivate(cx); + nsCOMPtr scriptContext = GetScriptContext(cx); if (scriptContext) { nsCOMPtr globalObject; diff --git a/mozilla/content/base/src/nsContentUtils.cpp b/mozilla/content/base/src/nsContentUtils.cpp index 9d33ca0e255..40b2951a892 100644 --- a/mozilla/content/base/src/nsContentUtils.cpp +++ b/mozilla/content/base/src/nsContentUtils.cpp @@ -209,16 +209,7 @@ nsresult nsContentUtils::GetDynamicScriptContext(JSContext *aContext, nsIScriptContext** aScriptContext) { - *aScriptContext = nsnull; - - // XXX We rely on the rule that if any JSContext in our JSRuntime has a - // private set then that private *must* be a pointer to an nsISupports. - nsISupports *supports = (nsIScriptContext*)JS_GetContextPrivate(aContext); - if (!supports) { - return NS_OK; - } - - return CallQueryInterface(supports, aScriptContext); + return GetScriptContextFromJSContext(aContext, aScriptContext); } template @@ -1360,7 +1351,7 @@ static inline void KeyAppendString(const nsAString& aString, nsACString& aKey) // Could escape separator here if collisions happen. > is not a legal char // for a name or type attribute, so we should be safe avoiding that extra work. - aKey.Append(NS_ConvertUCS2toUTF8(aString)); + AppendUTF16toUTF8(aString, aKey); } static inline void KeyAppendString(const nsACString& aString, nsACString& aKey) diff --git a/mozilla/content/events/src/nsEventListenerManager.cpp b/mozilla/content/events/src/nsEventListenerManager.cpp index c9d94a0e8f2..17b9d31a86a 100644 --- a/mozilla/content/events/src/nsEventListenerManager.cpp +++ b/mozilla/content/events/src/nsEventListenerManager.cpp @@ -2364,7 +2364,9 @@ nsEventListenerManager::ReleaseEvent(PRInt32 aEventTypes) return FlipCaptureBit(aEventTypes, PR_FALSE); } -nsresult nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes, PRBool aInitCapture) +nsresult +nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes, + PRBool aInitCapture) { EventArrayType arrayType; nsListenerStruct *ls; diff --git a/mozilla/content/html/content/src/nsHTMLScriptElement.cpp b/mozilla/content/html/content/src/nsHTMLScriptElement.cpp index 0663b9d8902..0afa6938d68 100644 --- a/mozilla/content/html/content/src/nsHTMLScriptElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLScriptElement.cpp @@ -591,11 +591,10 @@ nsHTMLScriptElement::ScriptAvailable(nsresult aResult, aURI->GetSpec(spec); NS_ConvertUTF8toUCS2 fileName(spec); - event.fileName = fileName.get(); HandleDOMEvent(presContext, &event, nsnull, NS_EVENT_FLAG_INIT, - &status); + &status); } return NS_OK; diff --git a/mozilla/docshell/build/Makefile.in b/mozilla/docshell/build/Makefile.in index 67baebd4c9f..c48dfd4b78c 100644 --- a/mozilla/docshell/build/Makefile.in +++ b/mozilla/docshell/build/Makefile.in @@ -36,6 +36,7 @@ GRE_MODULE = 1 REQUIRES = xpcom \ string \ dom \ + js \ shistory \ necko \ gfx \ diff --git a/mozilla/dom/public/nsIScriptContext.h b/mozilla/dom/public/nsIScriptContext.h index a82edcbdd04..9f90df4d057 100644 --- a/mozilla/dom/public/nsIScriptContext.h +++ b/mozilla/dom/public/nsIScriptContext.h @@ -42,6 +42,8 @@ #include "nscore.h" #include "nsString.h" #include "nsISupports.h" +#include "nsCOMPtr.h" +#include "jsapi.h" class nsIScriptGlobalObject; class nsIScriptSecurityManager; @@ -333,5 +335,26 @@ public: NS_IMETHOD SetGCOnDestruction(PRBool aGCOnDestruction) = 0; }; +inline nsresult +GetScriptContextFromJSContext(JSContext *cx, nsIScriptContext **result) +{ + *result = nsnull; + + if (!(::JS_GetOptions(cx) & JSOPTION_PRIVATE_IS_NSISUPPORTS)) { + return NS_ERROR_INVALID_ARG; + } + + nsresult rv = NS_OK; + + nsISupports *supports = + NS_STATIC_CAST(nsISupports *, ::JS_GetContextPrivate(cx)); + + if (supports) { + rv = CallQueryInterface(supports, result); + } + + return rv; +} + #endif // nsIScriptContext_h__ diff --git a/mozilla/dom/src/base/nsGlobalWindow.cpp b/mozilla/dom/src/base/nsGlobalWindow.cpp index 1d344bf1d45..39a7aaa3eca 100644 --- a/mozilla/dom/src/base/nsGlobalWindow.cpp +++ b/mozilla/dom/src/base/nsGlobalWindow.cpp @@ -3387,8 +3387,8 @@ GlobalWindowImpl::Close() } if (cx) { - nsCOMPtr currentCX = - NS_STATIC_CAST(nsIScriptContext *, ::JS_GetContextPrivate(cx)); + nsCOMPtr currentCX; + nsJSUtils::GetDynamicScriptContext(cx, getter_AddRefs(currentCX)); if (currentCX && currentCX == mContext) { return currentCX->SetTerminationFunction(CloseWindow, @@ -5479,8 +5479,9 @@ GlobalWindowImpl::SecurityCheckURL(const char *aURL) nsCOMPtr baseURI; nsCOMPtr uriToLoad; - nsCOMPtr scriptcx = - NS_STATIC_CAST(nsIScriptContext *, ::JS_GetContextPrivate(cx)); + nsCOMPtr scriptcx; + nsJSUtils::GetDynamicScriptContext(cx, getter_AddRefs(scriptcx)); + if (scriptcx) { nsCOMPtr gobj; scriptcx->GetGlobalObject(getter_AddRefs(gobj)); diff --git a/mozilla/dom/src/base/nsJSEnvironment.cpp b/mozilla/dom/src/base/nsJSEnvironment.cpp index d8e43089040..7f41ad74c17 100644 --- a/mozilla/dom/src/base/nsJSEnvironment.cpp +++ b/mozilla/dom/src/base/nsJSEnvironment.cpp @@ -507,7 +507,7 @@ nsJSContext::nsJSContext(JSRuntime *aRuntime) : mGCOnDestruction(PR_TRUE) mContext = ::JS_NewContext(aRuntime, gStackSize); if (mContext) { - ::JS_SetContextPrivate(mContext, (void *)this); + ::JS_SetContextPrivate(mContext, NS_STATIC_CAST(nsIScriptContext *, this)); // Make sure the new context gets the default context options ::JS_SetOptions(mContext, mDefaultJSOptions); diff --git a/mozilla/dom/src/base/nsJSUtils.cpp b/mozilla/dom/src/base/nsJSUtils.cpp index ab219142f3c..b0c54e466d2 100644 --- a/mozilla/dom/src/base/nsJSUtils.cpp +++ b/mozilla/dom/src/base/nsJSUtils.cpp @@ -69,7 +69,7 @@ nsJSUtils::GetCallingLocation(JSContext* aContext, const char* *aFilename, if (frame) { script = ::JS_GetFrameScript(aContext, frame); } - } while ((nsnull != frame) && (nsnull == script)); + } while (frame && !script); if (script) { const char* filename = ::JS_GetScriptFilename(aContext, script); @@ -132,8 +132,8 @@ nsJSUtils::ConvertJSValToXPCObject(nsISupports** aSupports, REFNSIID aIID, } void -nsJSUtils::ConvertJSValToString(nsAString& aString, - JSContext* aContext, jsval aValue) +nsJSUtils::ConvertJSValToString(nsAString& aString, JSContext* aContext, + jsval aValue) { JSString *jsstring; if ((jsstring = ::JS_ValueToString(aContext, aValue)) != nsnull) { @@ -224,13 +224,6 @@ nsresult nsJSUtils::GetDynamicScriptContext(JSContext *aContext, nsIScriptContext** aScriptContext) { - nsISupports *supports = - (::JS_GetOptions(aContext) & JSOPTION_PRIVATE_IS_NSISUPPORTS) - ? NS_STATIC_CAST(nsISupports*, ::JS_GetContextPrivate(aContext)) - : nsnull; - if (!supports) - return nsnull; - return supports->QueryInterface(NS_GET_IID(nsIScriptContext), - (void**)aScriptContext); + return GetScriptContextFromJSContext(aContext, aScriptContext); } diff --git a/mozilla/dom/src/base/nsLocation.cpp b/mozilla/dom/src/base/nsLocation.cpp index f8fbab39c91..485a87dc1d9 100644 --- a/mozilla/dom/src/base/nsLocation.cpp +++ b/mozilla/dom/src/base/nsLocation.cpp @@ -570,10 +570,11 @@ LocationImpl::SetHrefWithBase(const nsAString& aHref, result = stack->Peek(&cx); if (cx) { - nsIScriptContext* scriptCX = (nsIScriptContext*)JS_GetContextPrivate(cx); - - if (scriptCX) { - scriptCX->GetProcessingScriptTag(&inScriptTag); + nsCOMPtr scriptContext; + nsJSUtils::GetDynamicScriptContext(cx, getter_AddRefs(scriptContext)); + + if (scriptContext) { + scriptContext->GetProcessingScriptTag(&inScriptTag); } } //cx } // stack diff --git a/mozilla/editor/composer/src/Makefile.in b/mozilla/editor/composer/src/Makefile.in index 89a5f0992d6..6b27dbcd307 100644 --- a/mozilla/editor/composer/src/Makefile.in +++ b/mozilla/editor/composer/src/Makefile.in @@ -34,6 +34,7 @@ MODULE_NAME = nsComposerModule REQUIRES = xpcom \ string \ dom \ + js \ layout \ content \ uriloader \ diff --git a/mozilla/embedding/browser/gtk/src/Makefile.in b/mozilla/embedding/browser/gtk/src/Makefile.in index 8ea60a3b5cf..33ba12c09df 100644 --- a/mozilla/embedding/browser/gtk/src/Makefile.in +++ b/mozilla/embedding/browser/gtk/src/Makefile.in @@ -34,6 +34,7 @@ REQUIRES = xpcom \ necko \ widget \ dom \ + js \ gfx \ layout \ content \ diff --git a/mozilla/embedding/components/windowwatcher/src/nsWWJSUtils.cpp b/mozilla/embedding/components/windowwatcher/src/nsWWJSUtils.cpp index a769bdaf335..6773fac3345 100644 --- a/mozilla/embedding/components/windowwatcher/src/nsWWJSUtils.cpp +++ b/mozilla/embedding/components/windowwatcher/src/nsWWJSUtils.cpp @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: NPL 1.1/GPL 2.0/LGPL 2.1 * @@ -88,13 +88,7 @@ nsresult nsWWJSUtils::nsGetDynamicScriptContext(JSContext *aContext, nsIScriptContext** aScriptContext) { - // XXX We rely on the rule that if any JSContext in our JSRuntime has a - // private set then that private *must* be a pointer to an nsISupports. - nsISupports *supports = (nsIScriptContext*) JS_GetContextPrivate(aContext); - if (!supports) - return nsnull; - return supports->QueryInterface(NS_GET_IID(nsIScriptContext), - (void**)aScriptContext); + return GetScriptContextFromJSContext(aContext, aScriptContext); } nsresult diff --git a/mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp b/mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp index aee795985c0..298a4ed3800 100644 --- a/mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp +++ b/mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp @@ -1114,8 +1114,8 @@ nsWindowWatcher::URIfromURL(const char *aURL, in nsGlobalWindow.cpp.) */ JSContext *cx = GetJSContextFromCallStack(); if (cx) { - nsISupports *cxsup = (nsISupports *) JS_GetContextPrivate(cx); - nsCOMPtr scriptcx(do_QueryInterface(cxsup)); + nsCOMPtr scriptcx; + nsWWJSUtils::nsGetDynamicScriptContext(cx, getter_AddRefs(scriptcx)); if (scriptcx) { nsCOMPtr gobj; scriptcx->GetGlobalObject(getter_AddRefs(gobj)); diff --git a/mozilla/embedding/tests/mfcembed/components/nsPrintDialogUtil.cpp b/mozilla/embedding/tests/mfcembed/components/nsPrintDialogUtil.cpp index 41581291f6b..e8efb4a3bc0 100644 --- a/mozilla/embedding/tests/mfcembed/components/nsPrintDialogUtil.cpp +++ b/mozilla/embedding/tests/mfcembed/components/nsPrintDialogUtil.cpp @@ -535,10 +535,10 @@ static HWND CreateControl(LPCTSTR aType, aRect.x, aRect.y, aRect.width, aRect.height, (HWND)aHdlg, (HMENU)aId, aHInst, NULL); - if (hWnd == NULL) return NULL; - delete [] pStr; + if (hWnd == NULL) return NULL; + // get the native font for the dialog and // set it into the new control HFONT hFont = (HFONT)::SendMessage(aHdlg, WM_GETFONT, (WPARAM)0, (LPARAM)0); diff --git a/mozilla/extensions/typeaheadfind/src/Makefile.in b/mozilla/extensions/typeaheadfind/src/Makefile.in index 70ef4584575..29d84ff9ed0 100644 --- a/mozilla/extensions/typeaheadfind/src/Makefile.in +++ b/mozilla/extensions/typeaheadfind/src/Makefile.in @@ -43,6 +43,7 @@ REQUIRES = appcomps \ content \ docshell \ dom \ + js \ find \ intl \ gfx \ diff --git a/mozilla/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp b/mozilla/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp index c5c55dd81cc..c721102b363 100644 --- a/mozilla/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp +++ b/mozilla/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp @@ -131,21 +131,10 @@ GetCurrentContext(nsIScriptContext **aScriptContext) return; } - if (!cx) { - return; + if (cx) { + GetScriptContextFromJSContext(cx, aScriptContext); } - nsISupports *priv = - (::JS_GetOptions(cx) & JSOPTION_PRIVATE_IS_NSISUPPORTS) - ? NS_STATIC_CAST(nsISupports*, ::JS_GetContextPrivate(cx)) - : nsnull; - - if (!priv) { - return; - } - - CallQueryInterface(priv, aScriptContext); - return; } diff --git a/mozilla/layout/html/style/src/Makefile.in b/mozilla/layout/html/style/src/Makefile.in index cc0b372c3a6..f8f8d9ef2df 100644 --- a/mozilla/layout/html/style/src/Makefile.in +++ b/mozilla/layout/html/style/src/Makefile.in @@ -31,6 +31,7 @@ LIBRARY_NAME = gkhtmlstyle_s REQUIRES = xpcom \ string \ dom \ + js \ content \ gfx \ widget \ diff --git a/mozilla/mailnews/base/src/Makefile.in b/mozilla/mailnews/base/src/Makefile.in index 0e9bf49ae7c..6dc0c28bfad 100644 --- a/mozilla/mailnews/base/src/Makefile.in +++ b/mozilla/mailnews/base/src/Makefile.in @@ -34,6 +34,7 @@ REQUIRES = xpcom \ string \ necko \ dom \ + js \ appshell \ appcomps \ uconv \ @@ -123,7 +124,7 @@ CPPSRCS += nsMessengerOS2Integration.cpp endif EXPORTS = \ - nsMsgBaseCID.h \ + nsMsgBaseCID.h \ nsMessenger.h \ nsMessengerBootstrap.h \ nsUrlListenerManager.h \ diff --git a/mozilla/mailnews/compose/src/Makefile.in b/mozilla/mailnews/compose/src/Makefile.in index 1fd79b98580..b76f7d10105 100644 --- a/mozilla/mailnews/compose/src/Makefile.in +++ b/mozilla/mailnews/compose/src/Makefile.in @@ -33,6 +33,7 @@ REQUIRES = xpcom \ xpcom_obsolete \ string \ dom \ + js \ editor \ uriloader \ msgbase \ diff --git a/mozilla/mailnews/imap/src/Makefile.in b/mozilla/mailnews/imap/src/Makefile.in index b669d949c01..25823cbe049 100644 --- a/mozilla/mailnews/imap/src/Makefile.in +++ b/mozilla/mailnews/imap/src/Makefile.in @@ -40,7 +40,7 @@ REQUIRES = xpcom \ necko \ appshell \ msgdb \ - dom \ + dom \ uconv \ unicharutil \ mime \ diff --git a/mozilla/modules/oji/src/ProxyClassLoader.cpp b/mozilla/modules/oji/src/ProxyClassLoader.cpp index 723fdd44313..4f82ea23f30 100644 --- a/mozilla/modules/oji/src/ProxyClassLoader.cpp +++ b/mozilla/modules/oji/src/ProxyClassLoader.cpp @@ -59,7 +59,9 @@ */ static nsresult getScriptCodebase(JSContext* cx, nsIURI* *result) { - nsIScriptContext* scriptContext = NS_REINTERPRET_CAST(nsIScriptContext*, JS_GetContextPrivate(cx)); + nsCOMPtr scriptContext; + GetScriptContextFromJSContext(cx, getter_AddRefs(scriptContext)); + if (scriptContext) { nsCOMPtr scriptGlobal; scriptContext->GetGlobalObject(getter_AddRefs(scriptGlobal)); diff --git a/mozilla/modules/oji/src/lcglue.cpp b/mozilla/modules/oji/src/lcglue.cpp index a25999df329..bf98f5b967d 100644 --- a/mozilla/modules/oji/src/lcglue.cpp +++ b/mozilla/modules/oji/src/lcglue.cpp @@ -430,7 +430,10 @@ enter_js_from_java_impl(JNIEnv *jEnv, char **errp, nsCOMPtr javaSecurityContext = do_QueryInterface(credentials); if (javaSecurityContext) { if (pJSCX) { - nsCOMPtr scriptContext = NS_REINTERPRET_CAST(nsIScriptContext*, JS_GetContextPrivate(pJSCX)); + nsCOMPtr scriptContext; + GetScriptContextFromJSContext(pJSCX, + getter_AddRefs(scriptContext)); + if (scriptContext) { nsCOMPtr global; scriptContext->GetGlobalObject(getter_AddRefs(global)); @@ -522,9 +525,8 @@ exit_js_impl(JNIEnv *jEnv, JSContext *cx) // The main idea is to execute terminate function if have any; if (cx) { - nsISupports* supports = NS_REINTERPRET_CAST(nsIScriptContext*, - JS_GetContextPrivate(cx)); - nsCOMPtr scriptContext = do_QueryInterface(supports); + nsCOMPtr scriptContext; + GetScriptContextFromJSContext(cx, getter_AddRefs(scriptContext)); if (scriptContext) { diff --git a/mozilla/modules/oji/src/nsCSecurityContext.cpp b/mozilla/modules/oji/src/nsCSecurityContext.cpp index e40c51c7993..80a652a68f6 100644 --- a/mozilla/modules/oji/src/nsCSecurityContext.cpp +++ b/mozilla/modules/oji/src/nsCSecurityContext.cpp @@ -140,7 +140,10 @@ nsCSecurityContext::GetOrigin(char* buf, int buflen) // that case we are not done. if (!m_pPrincipal && m_pJSCX ) { - nsCOMPtr scriptContext = (nsIScriptContext*)JS_GetContextPrivate(m_pJSCX); + nsCOMPtr scriptContext; + GetScriptContextFromJSContext(m_pJSCX, + getter_AddRefs(scriptContext)); + if (scriptContext) { nsCOMPtr global; scriptContext->GetGlobalObject(getter_AddRefs(global)); diff --git a/mozilla/profile/pref-migrator/src/Makefile.in b/mozilla/profile/pref-migrator/src/Makefile.in index 7cda2163dd1..a15f3b6e346 100644 --- a/mozilla/profile/pref-migrator/src/Makefile.in +++ b/mozilla/profile/pref-migrator/src/Makefile.in @@ -38,6 +38,7 @@ REQUIRES = xpcom \ intl \ docshell \ dom \ + js \ necko \ widget \ webbrwsr \ diff --git a/mozilla/security/manager/ssl/src/nsCrypto.cpp b/mozilla/security/manager/ssl/src/nsCrypto.cpp index 767873210a9..770f2be4e97 100644 --- a/mozilla/security/manager/ssl/src/nsCrypto.cpp +++ b/mozilla/security/manager/ssl/src/nsCrypto.cpp @@ -374,20 +374,19 @@ nsCrypto::GetScriptPrincipal(JSContext *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; - scriptContext->GetGlobalObject(getter_AddRefs(global)); - NS_ENSURE_TRUE(global, nsnull); - nsCOMPtr globalData = do_QueryInterface(global); - NS_ENSURE_TRUE(globalData, nsnull); - globalData->GetPrincipal(&principal); - } + nsCOMPtr scriptContext; + GetScriptContextFromJSContext(cx, getter_AddRefs(scriptContext)); + + if (scriptContext) + { + nsCOMPtr global; + scriptContext->GetGlobalObject(getter_AddRefs(global)); + NS_ENSURE_TRUE(global, nsnull); + nsCOMPtr globalData = do_QueryInterface(global); + NS_ENSURE_TRUE(globalData, nsnull); + globalData->GetPrincipal(&principal); } + return principal; } diff --git a/mozilla/xpfe/browser/src/Makefile.in b/mozilla/xpfe/browser/src/Makefile.in index 54bb4b9bd60..d719f1fc81a 100644 --- a/mozilla/xpfe/browser/src/Makefile.in +++ b/mozilla/xpfe/browser/src/Makefile.in @@ -41,6 +41,7 @@ REQUIRES = xpcom \ docshell \ appshell \ dom \ + js \ uriloader \ pref \ appcomps \ diff --git a/mozilla/xpfe/components/urlwidget/Makefile.in b/mozilla/xpfe/components/urlwidget/Makefile.in index c545b7382bb..f3761c4ff64 100644 --- a/mozilla/xpfe/components/urlwidget/Makefile.in +++ b/mozilla/xpfe/components/urlwidget/Makefile.in @@ -39,6 +39,7 @@ REQUIRES = \ string \ docshell \ dom \ + js \ widget \ gfx \ $(NULL) diff --git a/mozilla/xpinstall/src/nsJSInstallTriggerGlobal.cpp b/mozilla/xpinstall/src/nsJSInstallTriggerGlobal.cpp index baa135e9713..43001054d1e 100644 --- a/mozilla/xpinstall/src/nsJSInstallTriggerGlobal.cpp +++ b/mozilla/xpinstall/src/nsJSInstallTriggerGlobal.cpp @@ -237,7 +237,8 @@ InstallTriggerGlobalInstall(JSContext *cx, JSObject *obj, uintN argc, jsval *arg { PRBool result; - nsCOMPtr scriptContext = (nsIScriptContext*) JS_GetContextPrivate(cx); + nsCOMPtr scriptContext; + GetScriptContextFromJSContext(cx, getter_AddRefs(scriptContext)); if (scriptContext) { nsCOMPtr globalObject; @@ -318,7 +319,9 @@ InstallTriggerGlobalInstallChrome(JSContext *cx, JSObject *obj, uintN argc, jsva if (item && item->IsRelativeURL()) item->mURL.Insert( baseURL, 0 ); - nsCOMPtr scriptContext = (nsIScriptContext*) JS_GetContextPrivate(cx); + nsCOMPtr scriptContext; + GetScriptContextFromJSContext(cx, getter_AddRefs(scriptContext)); + if (scriptContext) { nsCOMPtr globalObject; @@ -368,7 +371,9 @@ InstallTriggerGlobalStartSoftwareUpdate(JSContext *cx, JSObject *obj, uintN argc return JS_FALSE; } - nsCOMPtr scriptContext = (nsIScriptContext*) JS_GetContextPrivate(cx); + nsCOMPtr scriptContext; + GetScriptContextFromJSContext(cx, getter_AddRefs(scriptContext)); + if (scriptContext) { nsCOMPtr globalObject;