diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index f5692e100f6d..784b092ff59e 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -1452,8 +1452,7 @@ Navigator::DoNewResolve(JSContext* aCx, JS::Handle aObject, return true; } - nsScriptNameSpaceManager* nameSpaceManager = - nsJSRuntime::GetNameSpaceManager(); + nsScriptNameSpaceManager* nameSpaceManager = GetNameSpaceManager(); if (!nameSpaceManager) { return Throw(aCx, NS_ERROR_NOT_INITIALIZED); } @@ -1567,8 +1566,7 @@ void Navigator::GetOwnPropertyNames(JSContext* aCx, nsTArray& aNames, ErrorResult& aRv) { - nsScriptNameSpaceManager *nameSpaceManager = - nsJSRuntime::GetNameSpaceManager(); + nsScriptNameSpaceManager *nameSpaceManager = GetNameSpaceManager(); if (!nameSpaceManager) { NS_ERROR("Can't get namespace manager."); aRv.Throw(NS_ERROR_UNEXPECTED); diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index afe13845ce60..392df1c053c9 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -911,8 +911,7 @@ CutPrefix(const char *aName) { nsresult nsDOMClassInfo::RegisterClassProtos(int32_t aClassInfoID) { - nsScriptNameSpaceManager *nameSpaceManager = - nsJSRuntime::GetNameSpaceManager(); + nsScriptNameSpaceManager *nameSpaceManager = GetNameSpaceManager(); NS_ENSURE_TRUE(nameSpaceManager, NS_ERROR_NOT_INITIALIZED); bool found_old; @@ -964,8 +963,7 @@ nsDOMClassInfo::RegisterClassProtos(int32_t aClassInfoID) nsresult nsDOMClassInfo::RegisterExternalClasses() { - nsScriptNameSpaceManager *nameSpaceManager = - nsJSRuntime::GetNameSpaceManager(); + nsScriptNameSpaceManager *nameSpaceManager = GetNameSpaceManager(); NS_ENSURE_TRUE(nameSpaceManager, NS_ERROR_NOT_INITIALIZED); nsCOMPtr registrar; @@ -1097,7 +1095,7 @@ nsDOMClassInfo::Init() NS_ENSURE_TRUE(!sIsInitialized, NS_ERROR_ALREADY_INITIALIZED); - nsScriptNameSpaceManager *nameSpaceManager = nsJSRuntime::GetNameSpaceManager(); + nsScriptNameSpaceManager *nameSpaceManager = GetNameSpaceManager(); NS_ENSURE_TRUE(nameSpaceManager, NS_ERROR_NOT_INITIALIZED); nsresult rv = CallGetService(nsIXPConnect::GetCID(), &sXPConnect); @@ -2072,8 +2070,7 @@ nsDOMClassInfo::PostCreatePrototype(JSContext * cx, JSObject * aProto) return NS_ERROR_FAILURE; } - nsScriptNameSpaceManager *nameSpaceManager = - nsJSRuntime::GetNameSpaceManager(); + nsScriptNameSpaceManager *nameSpaceManager = GetNameSpaceManager(); NS_ENSURE_TRUE(nameSpaceManager, NS_OK); bool unused; @@ -2271,8 +2268,7 @@ nsWindowSH::Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx, } // Now resolve everything from the namespace manager - nsScriptNameSpaceManager *nameSpaceManager = - nsJSRuntime::GetNameSpaceManager(); + nsScriptNameSpaceManager *nameSpaceManager = GetNameSpaceManager(); if (!nameSpaceManager) { NS_ERROR("Can't get namespace manager."); return NS_ERROR_UNEXPECTED; @@ -2556,8 +2552,7 @@ private: { *aNameStruct = nullptr; - nsScriptNameSpaceManager *nameSpaceManager = - nsJSRuntime::GetNameSpaceManager(); + nsScriptNameSpaceManager *nameSpaceManager = GetNameSpaceManager(); if (!nameSpaceManager) { NS_ERROR("Can't get namespace manager."); return NS_ERROR_UNEXPECTED; @@ -2764,8 +2759,7 @@ nsDOMConstructor::HasInstance(nsIXPConnectWrappedNative *wrapper, return NS_OK; } - nsScriptNameSpaceManager *nameSpaceManager = - nsJSRuntime::GetNameSpaceManager(); + nsScriptNameSpaceManager *nameSpaceManager = GetNameSpaceManager(); NS_ASSERTION(nameSpaceManager, "Can't get namespace manager?"); const nsIID *class_iid; @@ -3158,8 +3152,7 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx, { *did_resolve = false; - nsScriptNameSpaceManager *nameSpaceManager = - nsJSRuntime::GetNameSpaceManager(); + nsScriptNameSpaceManager *nameSpaceManager = GetNameSpaceManager(); NS_ENSURE_TRUE(nameSpaceManager, NS_ERROR_NOT_INITIALIZED); nsDependentJSString name(id); diff --git a/dom/base/nsDOMScriptObjectFactory.cpp b/dom/base/nsDOMScriptObjectFactory.cpp index 2ff783c925b5..c73f476f2bf4 100644 --- a/dom/base/nsDOMScriptObjectFactory.cpp +++ b/dom/base/nsDOMScriptObjectFactory.cpp @@ -31,6 +31,8 @@ #endif #include "nsThreadUtils.h" +using mozilla::dom::GetNameSpaceManager; + nsIExceptionProvider* gExceptionProvider = nullptr; nsDOMScriptObjectFactory::nsDOMScriptObjectFactory() @@ -76,7 +78,7 @@ nsDOMScriptObjectFactory::GetClassInfoInstance(nsDOMClassInfoID aID) NS_IMETHODIMP_(nsISupports *) nsDOMScriptObjectFactory::GetExternalClassInfoInstance(const nsAString& aName) { - nsScriptNameSpaceManager *nameSpaceManager = nsJSRuntime::GetNameSpaceManager(); + nsScriptNameSpaceManager *nameSpaceManager = GetNameSpaceManager(); NS_ENSURE_TRUE(nameSpaceManager, nullptr); const nsGlobalNameStruct *globalStruct = nameSpaceManager->LookupName(aName); @@ -153,7 +155,7 @@ nsDOMScriptObjectFactory::RegisterDOMClassInfo(const char *aName, bool aHasClassInterface, const nsCID *aConstructorCID) { - nsScriptNameSpaceManager *nameSpaceManager = nsJSRuntime::GetNameSpaceManager(); + nsScriptNameSpaceManager *nameSpaceManager = GetNameSpaceManager(); NS_ENSURE_TRUE(nameSpaceManager, NS_ERROR_NOT_INITIALIZED); return nameSpaceManager->RegisterDOMCIData(aName, diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index 04ecfb609f84..9691d128e22c 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -135,7 +135,7 @@ static PRLogModuleInfo* gJSDiagnostics; #define NS_MAJOR_FORGET_SKIPPABLE_CALLS 2 -// if you add statics here, add them to the list in nsJSRuntime::Startup +// if you add statics here, add them to the list in StartupJSEnvironment static nsITimer *sGCTimer; static nsITimer *sShrinkGCBuffersTimer; @@ -1153,7 +1153,7 @@ nsJSContext::InitContext() nsresult nsJSContext::InitializeExternalClasses() { - nsScriptNameSpaceManager *nameSpaceManager = nsJSRuntime::GetNameSpaceManager(); + nsScriptNameSpaceManager *nameSpaceManager = GetNameSpaceManager(); NS_ENSURE_TRUE(nameSpaceManager, NS_ERROR_NOT_INITIALIZED); return nameSpaceManager->InitForContext(this); @@ -2565,7 +2565,7 @@ nsJSContext::LikelyShortLivingObjectCreated() } void -nsJSRuntime::Startup() +mozilla::dom::StartupJSEnvironment() { // initialize all our statics, so that we can restart XPCOM sGCTimer = sFullGCTimer = sCCTimer = nullptr; @@ -2866,7 +2866,7 @@ nsJSContext::EnsureStatics() } nsScriptNameSpaceManager* -nsJSRuntime::GetNameSpaceManager() +mozilla::dom::GetNameSpaceManager() { if (sDidShutdown) return nullptr; @@ -2883,7 +2883,7 @@ nsJSRuntime::GetNameSpaceManager() } void -nsJSRuntime::Shutdown() +mozilla::dom::ShutdownJSEnvironment() { KillTimers(); diff --git a/dom/base/nsJSEnvironment.h b/dom/base/nsJSEnvironment.h index b2a046aabf81..c54e0e07e228 100644 --- a/dom/base/nsJSEnvironment.h +++ b/dom/base/nsJSEnvironment.h @@ -184,14 +184,17 @@ private: class nsIJSRuntimeService; -namespace nsJSRuntime -{ - void Startup(); - void Shutdown(); - // Get the NameSpaceManager, creating if necessary - nsScriptNameSpaceManager* GetNameSpaceManager(); +namespace mozilla { +namespace dom { -}; +void StartupJSEnvironment(); +void ShutdownJSEnvironment(); + +// Get the NameSpaceManager, creating if necessary +nsScriptNameSpaceManager* GetNameSpaceManager(); + +} // namespace dom +} // namespace mozilla // An interface for fast and native conversion to/from nsIArray. If an object // supports this interface, JS can reach directly in for the argv, and avoid diff --git a/layout/build/nsLayoutStatics.cpp b/layout/build/nsLayoutStatics.cpp index 6be376b3ddf9..2df135b62ab7 100644 --- a/layout/build/nsLayoutStatics.cpp +++ b/layout/build/nsLayoutStatics.cpp @@ -149,7 +149,7 @@ nsLayoutStatics::Initialize() nsColorNames::AddRefTable(); nsGkAtoms::AddRefAtoms(); - nsJSRuntime::Startup(); + StartupJSEnvironment(); rv = nsRegion::InitStatic(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsRegion"); @@ -334,7 +334,7 @@ nsLayoutStatics::Shutdown() nsLayoutStylesheetCache::Shutdown(); NS_NameSpaceManagerShutdown(); - nsJSRuntime::Shutdown(); + ShutdownJSEnvironment(); nsGlobalWindow::ShutDown(); nsDOMClassInfo::ShutDown(); nsListControlFrame::Shutdown();