From 3cab1f9ae4f2991c43f85b5a4c5e0e65c51abe6b Mon Sep 17 00:00:00 2001 From: Blake Kaplan Date: Wed, 24 Mar 2010 19:08:50 -0700 Subject: [PATCH] Bug 554833 - Define 'document' on XPCNativeWrapped windows properly. r=jst --HG-- extra : rebase_source : 99693fdf3dbd77039f17c31ad5b01050a5957792 --- dom/base/nsDOMClassInfo.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index 12f8ab7328e..84f8c8f334a 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -6625,6 +6625,17 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx, // property *objp = obj; + if (ObjectIsNativeWrapper(cx, obj)) { + // Unless our object is a native wrapper, in which case we have to + // define it ourselves. + + *_retval = JS_DefineProperty(cx, obj, "document", v, NULL, NULL, + JSPROP_READONLY | JSPROP_ENUMERATE); + if (!*_retval) { + return NS_ERROR_UNEXPECTED; + } + } + return NS_OK; }