From ba7459df048f9cc7bd5181dd5b66804076e55c4c Mon Sep 17 00:00:00 2001 From: "peterv%propagandism.org" Date: Wed, 5 Oct 2005 14:47:16 +0000 Subject: [PATCH] Fix for bug 311006 (Events don't fire after importNode/appendChild from a XUL document into HTML document). r/sr=bz. git-svn-id: svn://10.0.0.236/trunk@181653 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/xul/content/src/nsXULElement.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mozilla/content/xul/content/src/nsXULElement.cpp b/mozilla/content/xul/content/src/nsXULElement.cpp index 9cfa7075f54..778d91ff628 100644 --- a/mozilla/content/xul/content/src/nsXULElement.cpp +++ b/mozilla/content/xul/content/src/nsXULElement.cpp @@ -679,8 +679,11 @@ nsXULElement::CompileEventHandler(nsIScriptContext* aContext, XUL_PROTOTYPE_ATTRIBUTE_METER(gNumCacheSets); + // XXX sXBL/XBL2 issue! Owner or current document? + nsCOMPtr xuldoc = do_QueryInterface(GetOwnerDoc()); + nsIScriptContext *context; - if (mPrototype) { + if (mPrototype && xuldoc) { // It'll be shared among the instances of the prototype. // Use null for the scope object when precompiling shared // prototype scripts. @@ -693,10 +696,6 @@ nsXULElement::CompileEventHandler(nsIScriptContext* aContext, // keeps the global object alive, so if we use this document's // global object, we'll be putting something in the prototype // that protects this document's global object from GC. - // XXX sXBL/XBL2 issue! Owner or current document? - nsCOMPtr xuldoc = do_QueryInterface(GetOwnerDoc()); - NS_ENSURE_TRUE(xuldoc, NS_ERROR_UNEXPECTED); - nsCOMPtr protodoc; rv = xuldoc->GetMasterPrototype(getter_AddRefs(protodoc)); NS_ENSURE_SUCCESS(rv, rv);