Bug 945416 part 5. Implement nsGlobalWindow::GetOwnPropertyNames and flag the interface as NeedNewResolve. r=peterv

This commit is contained in:
Boris Zbarsky 2014-01-29 22:33:27 -08:00
parent 43c7d1c9d4
commit f2da4794d9
3 changed files with 23 additions and 1 deletions

View File

@ -34,6 +34,7 @@
#include "nsIScriptContext.h"
#include "nsIScriptTimeoutHandler.h"
#include "nsIController.h"
#include "nsScriptNameSpaceManager.h"
// Helper Classes
#include "nsJSUtils.h"
@ -4071,6 +4072,24 @@ nsGlobalWindow::DoNewResolve(JSContext* aCx, JS::Handle<JSObject*> aObj,
return true;
}
static PLDHashOperator
EnumerateGlobalName(const nsAString& aName, void* aClosure)
{
nsTArray<nsString>* arr = static_cast<nsTArray<nsString>*>(aClosure);
arr->AppendElement(aName);
return PL_DHASH_NEXT;
}
void
nsGlobalWindow::GetOwnPropertyNames(JSContext* aCx, nsTArray<nsString>& aNames,
ErrorResult& aRv)
{
nsScriptNameSpaceManager* nameSpaceManager = GetNameSpaceManager();
if (nameSpaceManager) {
nameSpaceManager->EnumerateGlobalNames(EnumerateGlobalName, &aNames);
}
}
nsIDOMOfflineResourceList*
nsGlobalWindow::GetApplicationCache(ErrorResult& aError)
{

View File

@ -479,6 +479,9 @@ public:
JS::Handle<jsid> aId,
JS::MutableHandle<JSPropertyDescriptor> aDesc);
void GetOwnPropertyNames(JSContext* aCx, nsTArray<nsString>& aNames,
mozilla::ErrorResult& aRv);
// Object Management
nsGlobalWindow(nsGlobalWindow *aOuterWindow);

View File

@ -22,7 +22,7 @@ interface Pkcs11;
typedef any Transferable;
// http://www.whatwg.org/specs/web-apps/current-work/
[Global]
[Global, NeedNewResolve]
/*sealed*/ interface Window : EventTarget {
// the current browsing context
[Unforgeable, Throws,