Bug 817276 - Part b: Return the pointer directly from nsScriptNameSpaceManager::LookupNavigatorName; r=jst

This commit is contained in:
Ms2ger 2012-12-02 09:59:51 +01:00
parent 28b59cc1af
commit 87a980808c
3 changed files with 9 additions and 15 deletions

View File

@ -7652,10 +7652,8 @@ nsNavigatorSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
nsDependentJSString name(id);
const nsGlobalNameStruct *name_struct = nullptr;
nameSpaceManager->LookupNavigatorName(name, &name_struct);
const nsGlobalNameStruct* name_struct =
nameSpaceManager->LookupNavigatorName(name);
if (!name_struct) {
return NS_OK;
}

View File

@ -499,23 +499,20 @@ nsScriptNameSpaceManager::LookupNameInternal(const nsAString& aName,
return nullptr;
}
nsresult
nsScriptNameSpaceManager::LookupNavigatorName(const nsAString& aName,
const nsGlobalNameStruct **aNameStruct)
const nsGlobalNameStruct*
nsScriptNameSpaceManager::LookupNavigatorName(const nsAString& aName)
{
GlobalNameMapEntry *entry =
static_cast<GlobalNameMapEntry *>
(PL_DHashTableOperate(&mNavigatorNames, &aName,
PL_DHASH_LOOKUP));
if (PL_DHASH_ENTRY_IS_BUSY(entry) &&
!((&entry->mGlobalName)->mDisabled)) {
*aNameStruct = &entry->mGlobalName;
} else {
*aNameStruct = nullptr;
if (!PL_DHASH_ENTRY_IS_BUSY(entry) ||
entry->mGlobalName.mDisabled) {
return nullptr;
}
return NS_OK;
return &entry->mGlobalName;
}
nsresult

View File

@ -109,8 +109,7 @@ public:
// null if one is not found. The returned nsGlobalNameStruct is only
// guaranteed to be valid until the next call to any of the methods
// in this class.
nsresult LookupNavigatorName(const nsAString& aName,
const nsGlobalNameStruct **aNameStruct);
const nsGlobalNameStruct* LookupNavigatorName(const nsAString& aName);
nsresult RegisterClassName(const char *aClassName,
int32_t aDOMClassInfoID,