mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-14 10:43:24 +00:00
Bug 707564 part 2. Add a way to enumerate navigator names on the script namespace manager. r=smaug
This commit is contained in:
parent
3bcc77ed3a
commit
f2e67b21c9
@ -787,27 +787,34 @@ nsScriptNameSpaceManager::RegisterNavigatorDOMConstructor(
|
||||
}
|
||||
}
|
||||
|
||||
struct GlobalNameClosure
|
||||
struct NameClosure
|
||||
{
|
||||
nsScriptNameSpaceManager::GlobalNameEnumerator enumerator;
|
||||
nsScriptNameSpaceManager::NameEnumerator enumerator;
|
||||
void* closure;
|
||||
};
|
||||
|
||||
static PLDHashOperator
|
||||
EnumerateGlobalName(PLDHashTable*, PLDHashEntryHdr *hdr, uint32_t,
|
||||
void* aClosure)
|
||||
EnumerateName(PLDHashTable*, PLDHashEntryHdr *hdr, uint32_t, void* aClosure)
|
||||
{
|
||||
GlobalNameMapEntry *entry = static_cast<GlobalNameMapEntry *>(hdr);
|
||||
GlobalNameClosure* closure = static_cast<GlobalNameClosure*>(aClosure);
|
||||
NameClosure* closure = static_cast<NameClosure*>(aClosure);
|
||||
return closure->enumerator(entry->mKey, closure->closure);
|
||||
}
|
||||
|
||||
void
|
||||
nsScriptNameSpaceManager::EnumerateGlobalNames(GlobalNameEnumerator aEnumerator,
|
||||
nsScriptNameSpaceManager::EnumerateGlobalNames(NameEnumerator aEnumerator,
|
||||
void* aClosure)
|
||||
{
|
||||
GlobalNameClosure closure = { aEnumerator, aClosure };
|
||||
PL_DHashTableEnumerate(&mGlobalNames, EnumerateGlobalName, &closure);
|
||||
NameClosure closure = { aEnumerator, aClosure };
|
||||
PL_DHashTableEnumerate(&mGlobalNames, EnumerateName, &closure);
|
||||
}
|
||||
|
||||
void
|
||||
nsScriptNameSpaceManager::EnumerateNavigatorNames(NameEnumerator aEnumerator,
|
||||
void* aClosure)
|
||||
{
|
||||
NameClosure closure = { aEnumerator, aClosure };
|
||||
PL_DHashTableEnumerate(&mNavigatorNames, EnumerateName, &closure);
|
||||
}
|
||||
|
||||
static size_t
|
||||
|
@ -152,10 +152,12 @@ public:
|
||||
mozilla::dom::ConstructorEnabled* aConstructorEnabled);
|
||||
|
||||
typedef PLDHashOperator
|
||||
(* GlobalNameEnumerator)(const nsAString& aGlobalName, void* aClosure);
|
||||
(* NameEnumerator)(const nsAString& aGlobalName, void* aClosure);
|
||||
|
||||
void EnumerateGlobalNames(GlobalNameEnumerator aEnumerator,
|
||||
void EnumerateGlobalNames(NameEnumerator aEnumerator,
|
||||
void* aClosure);
|
||||
void EnumerateNavigatorNames(NameEnumerator aEnumerator,
|
||||
void* aClosure);
|
||||
|
||||
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user