diff --git a/content/xul/document/src/nsXULCommandDispatcher.cpp b/content/xul/document/src/nsXULCommandDispatcher.cpp index 82f5310500e6..946764cb896b 100644 --- a/content/xul/document/src/nsXULCommandDispatcher.cpp +++ b/content/xul/document/src/nsXULCommandDispatcher.cpp @@ -404,6 +404,8 @@ nsXULCommandDispatcher::UpdateCommands(const nsAString& aEventName) if (NS_FAILED(rv)) return rv; } + nsCOMArray updaters; + for (Updater* updater = mUpdaters; updater != nsnull; updater = updater->mNext) { // Skip any nodes that don't match our 'events' or 'targets' // filters. @@ -418,6 +420,12 @@ nsXULCommandDispatcher::UpdateCommands(const nsAString& aEventName) if (! content) return NS_ERROR_UNEXPECTED; + updaters.AppendObject(content); + } + + for (PRUint32 u = 0; u < updaters.Count(); u++) { + nsIContent* content = updaters[u]; + nsCOMPtr document = content->GetDocument(); NS_ASSERTION(document != nsnull, "element has no document"); @@ -430,7 +438,7 @@ nsXULCommandDispatcher::UpdateCommands(const nsAString& aEventName) CopyUTF16toUTF8(aEventName, aeventnameC); PR_LOG(gLog, PR_LOG_NOTICE, ("xulcmd[%p] update %p event=%s", - this, updater->mElement.get(), + this, content, aeventnameC.get())); } #endif diff --git a/content/xul/document/test/Makefile.in b/content/xul/document/test/Makefile.in index 9712e9031adb..d1751b3c3aab 100644 --- a/content/xul/document/test/Makefile.in +++ b/content/xul/document/test/Makefile.in @@ -57,6 +57,8 @@ _TEST_FILES = \ $(NULL) _CHROME_FILES = \ + test_bug583948.xul \ + window_bug583948.xul \ test_bug497875.xul \ bug497875-iframe.xul \ $(NULL) diff --git a/content/xul/document/test/test_bug583948.xul b/content/xul/document/test/test_bug583948.xul new file mode 100644 index 000000000000..630eb0e5f4dd --- /dev/null +++ b/content/xul/document/test/test_bug583948.xul @@ -0,0 +1,41 @@ + + + + + + + + + + diff --git a/content/xul/document/test/window_bug583948.xul b/content/xul/document/test/window_bug583948.xul new file mode 100644 index 000000000000..332496d0bc9a --- /dev/null +++ b/content/xul/document/test/window_bug583948.xul @@ -0,0 +1,8 @@ + + + + + +