Fix for bug 500349 (DOMParser no longer available in Greasemonkey scripts). r/sr=jst.
authorPeter Van der Beken <peterv@propagandism.org>
Wed, 22 Jul 2009 20:50:24 +0200
changeset 31429 c2cc58728c8bcd0820e360ec99c075d37c791346
parent 31428 ffc0bbb9ccb474e97ef6e348e65e0ab4640211a7
child 31430 707834b4b7def619d9acbdd611d3241df1ace0fc
push id1
push usersledru@mozilla.com
push dateThu, 04 Dec 2014 17:57:20 +0000
bugs500349
milestone1.9.2a2pre
Fix for bug 500349 (DOMParser no longer available in Greasemonkey scripts). r/sr=jst.
dom/base/nsDOMClassInfo.cpp
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -5877,16 +5877,33 @@ nsWindowSH::GlobalResolve(nsGlobalWindow
   if (name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor ||
       name_struct->mType == nsGlobalNameStruct::eTypeExternalClassInfo) {
     // Create the XPConnect prototype for our classinfo, PostCreateProto will
     // set up the prototype chain.
     nsCOMPtr<nsIXPConnectJSObjectHolder> proto_holder;
     rv = GetXPCProto(sXPConnect, cx, aWin, name_struct,
                      getter_AddRefs(proto_holder));
 
+    if (NS_SUCCEEDED(rv) && obj != aWin->GetGlobalJSObject()) {
+      JSObject* dot_prototype;
+      rv = proto_holder->GetJSObject(&dot_prototype);
+      NS_ENSURE_SUCCESS(rv, rv);
+
+      const nsDOMClassInfoData *ci_data;
+      if (name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor) {
+        ci_data = &sClassInfoData[name_struct->mDOMClassInfoID];
+      } else {
+        ci_data = name_struct->mData;
+      }
+
+      return ResolvePrototype(sXPConnect, aWin, cx, obj, class_name, ci_data,
+                              name_struct, nameSpaceManager, dot_prototype,
+                              PR_TRUE, did_resolve);
+    }
+
     *did_resolve = NS_SUCCEEDED(rv);
 
     return rv;
   }
 
   if (name_struct->mType == nsGlobalNameStruct::eTypeClassProto) {
     // We don't have a XPConnect prototype object, let ResolvePrototype create
     // one.