mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 18:47:53 +00:00
Bug 901106 - Eliminate the nsJSRuntime namespace. r=mrbkap
This commit is contained in:
parent
b1f301a7a7
commit
9d466e12cc
@ -1452,8 +1452,7 @@ Navigator::DoNewResolve(JSContext* aCx, JS::Handle<JSObject*> aObject,
|
||||
return true;
|
||||
}
|
||||
|
||||
nsScriptNameSpaceManager* nameSpaceManager =
|
||||
nsJSRuntime::GetNameSpaceManager();
|
||||
nsScriptNameSpaceManager* nameSpaceManager = GetNameSpaceManager();
|
||||
if (!nameSpaceManager) {
|
||||
return Throw<true>(aCx, NS_ERROR_NOT_INITIALIZED);
|
||||
}
|
||||
@ -1567,8 +1566,7 @@ void
|
||||
Navigator::GetOwnPropertyNames(JSContext* aCx, nsTArray<nsString>& aNames,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsScriptNameSpaceManager *nameSpaceManager =
|
||||
nsJSRuntime::GetNameSpaceManager();
|
||||
nsScriptNameSpaceManager *nameSpaceManager = GetNameSpaceManager();
|
||||
if (!nameSpaceManager) {
|
||||
NS_ERROR("Can't get namespace manager.");
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
|
@ -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<nsIComponentRegistrar> 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);
|
||||
|
@ -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,
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user