MutationObserver reacts to changes that are not in the DOM

RESOLVED INVALID

Status

()

Core
DOM
RESOLVED INVALID
5 years ago
5 years ago

People

(Reporter: karlsfriend, Unassigned)

Tracking

25 Branch
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

5 years ago
Created attachment 833357 [details]
mutations.html - demonstrates the behaviour. Must be on webserver for bug to appear.

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:25.0) Gecko/20100101 Firefox/25.0 (Beta/Release)
Build ID: 20131028113246

Steps to reproduce:

I set up a MutationObserver to listen to all changes.
Changes were shown as expected when used from the filesystem
Then i tried using it from a webserver on  localhost.


Actual results:

There were many more Mutations than i expected. Whithin one mutation-block they always follow the pattern addNode, change some attribute of that node, delete that node. Such that those elements would not be visible in the DOM. None of the changes were caused by my HTML/JS-Code

Example of the added Elements as generated by my example-file:

added: <div style="visibility: hidden; border: 0px none; width: 0px; height: 0px; position: static; top: 0px; margin-top: 1px;"><div style="padding: 0px; margin: 0px; border: 0px none; display: block; overflow: hidden; width: 1px;"><div style="padding: 0px; margin: 0px; border: 0px none; display: block; overflow: hidden; width: 0px;"></div></div></div>
mutations.html (line 24)
added: <div style="padding: 0px; margin: 0px; border: 0px none; display: block; overflow: hidden; width: 1px;"><div style="padding: 0px; margin: 0px; border: 0px none; display: block; overflow: hidden; width: 0px;"></div></div>
mutations.html (line 24)
added: <table><tbody><tr><td style="padding: 0px; margin: 0px; border: 0px none;"></td><td style="display: none;">t</td></tr></tbody></table>
mutations.html (line 24)
removed: <table><tbody><tr><td style="padding: 0px; margin: 0px; border: 0px none;"></td><td style="display: none;">t</td></tr></tbody></table>
mutations.html (line 27)
added: <div style="padding: 0px; margin: 0px; border: 0px none; display: block; overflow: hidden; width: 0px;"></div>
mutations.html (line 24)
removed: <div style="visibility: hidden; border: 0px none; width: 0px; height: 0px; position: static; top: 0px; margin-top: 1px;"><div style="padding: 0px; margin: 0px; border: 0px none; display: block; overflow: hidden; width: 1px;"><div style="padding: 0px; margin: 0px; border: 0px none; display: block; overflow: hidden; width: 0px;"></div></div></div>




Expected results:

I didn't expect those changes. Only those caused by my own code. Such as the behaviour seems to be with chrome and when i open the file from the file-system.

Updated

5 years ago
Component: Untriaged → DOM
Product: Firefox → Core
When I load the testcase, I only see the expected mutations.

Do you see the unexpected mutation when you load https://bugzilla.mozilla.org/attachment.cgi?id=833357 ?

If not, can you link to the web server that _does_ show the unexpected mutation for you?

Do you see the unexpected mutation in safe mode?  See https://support.mozilla.org/en-US/kb/troubleshoot-firefox-issues-using-safe-mode#w_how-to-start-firefox-in-safe-mode
Flags: needinfo?(karlsfriend)

Comment 2

5 years ago
I don't see anything unexpected either
(but I do see some missing records in Chrome)
(Reporter)

Comment 3

5 years ago
@Boris: 

Yes. I see the same behaviour on https://bugzilla.mozilla.org/attachment.cgi?id=833357.

Changing to safe-mode seems to solve the problem. The event count was One then.
Flags: needinfo?(karlsfriend)
> Changing to safe-mode seems to solve the problem.

Sounds like one of your extensions is mutating the DOM, then.  Find which one?
(Reporter)

Comment 5

5 years ago
(In reply to Boris Zbarsky [:bz] from comment #4)
> > Changing to safe-mode seems to solve the problem.
> 
> Sounds like one of your extensions is mutating the DOM, then.  Find which
> one?

I did that and it turns out the modifications were caused by the addons Youtube Unblocker and Wunderlist. I will contact them about this. The modifications are probably intended tough. 

Issue can be closed. Thanks for helping me figure this out. :-)
No problem.  Thank you for reporting the issue!
Status: UNCONFIRMED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.