Open Bug 470372 Opened 12 years ago Updated 2 years ago

DOMNodeInserted event doesn't fire on DIV where event listener was added to a DOM element accessible via window.content

Categories

(Core :: DOM: Events, defect, P5)

1.9.1 Branch
x86
Windows XP
defect

Tracking

()

UNCONFIRMED

People

(Reporter: mort253, Unassigned)

References

()

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b2) Gecko/20081201 Firefox/3.1b2
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b2) Gecko/20081201 Firefox/3.1b2

I have developed a Firefox extension that uses window.content to access the content-primary DOM loaded in the browser.  I have attached a DOMNodeInserted event to a DIV.  I obtain a reference to this DIV via window.content.document.getElementById("MainContent") where "MainContent" is the id attribute of the DIV element in http://www.hotmail.com

Next, I call the addEventListener method and attach an anonymous function to the element.  When elements are added to the DIV in previous versions of Firefox 2.x and 3.0.x the event fires.  However, in Firefox 3.1/b1 and Firefox 3.1/b2 this event does not fire.  I have tried with the captureFlag set to true as well as false.

Below is the code from the Firefox Extension:

[CODE]
			var frame = window.content.document.getElementById("MainContent");

			if(frame != undefined && frame != null) {
				log("frame.id = " + frame.id);
frame.addEventListener('DOMNodeInserted',function (e) {
				  log('Calling DOMNodeInserted event...');
				  this.removeEventListener('DOMNodeInserted',arguments.callee,false);
				  replyforall.site.setDOMInserted();
				},true);
			}	
[CODE]

This code functions perfectly in Firefox 2 and Firefox 3.  This indicates a problem with either the DOMNodeInserted event or the addEventListener method.

There is an open bug related to other issues in Hotmail that are preventing users from being able to read their messages.  One possibility is that this bug is somehow related to that issue.

Please email bugreports@opensourceopportunities.com if you have any questions.

Thanks,
James Mortensen

Reproducible: Always

Steps to Reproduce:
1.  Place the sample code I provided in a Firefox extension JavaScript file and ensure that the window.addEventListener event fires the code.
2.  Browse to http://www.hotmail.com.  The window.addEventListener should fire and run the code.
3.  click the "New" button to create a new message, which is an AJAX operation.  This will not refresh the page but will add content to the DIV.  Observe that the DOMNodeInserted event does NOT fire in Firefox 3.1/b2 but does in Firefox 3 and 2.
Actual Results:  
The actual result is that the DOMNodeInserted event does not fire.  There are no error messages in the console.

Expected Results:  
The event did not fire.

I feel that the developers of Firefox should strive to maintain backwards compatibility as to not break existing Firefox extensions.

Again, if you need more information, please email bugreports@opensourceopportunities.com and I'd be happy to answer any further questions.

Thanks,
James Mortensen
Version: unspecified → 3.1 Branch
Component: General → DOM: Events
Product: Firefox → Core
QA Contact: general → events
Version: 3.1 Branch → 1.9.1 Branch
Could you please attach a *minimal* testcase.
Or if you could try to find the regression range using nightly builds
http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/
Attached file testcase
This is WFM for me on: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1b3pre) Gecko/20081218 Shiretoko/3.1b3pre

and 

Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5

Both with this testcase and when using similar code with window.content in the urlbar.
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.