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
This commit is contained in:
peterv%propagandism.org 2005-10-05 14:47:16 +00:00
parent d95fb7c3e0
commit ba7459df04

View File

@ -679,8 +679,11 @@ nsXULElement::CompileEventHandler(nsIScriptContext* aContext,
XUL_PROTOTYPE_ATTRIBUTE_METER(gNumCacheSets);
// XXX sXBL/XBL2 issue! Owner or current document?
nsCOMPtr<nsIXULDocument> 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<nsIXULDocument> xuldoc = do_QueryInterface(GetOwnerDoc());
NS_ENSURE_TRUE(xuldoc, NS_ERROR_UNEXPECTED);
nsCOMPtr<nsIXULPrototypeDocument> protodoc;
rv = xuldoc->GetMasterPrototype(getter_AddRefs(protodoc));
NS_ENSURE_SUCCESS(rv, rv);