Closed Bug 775468 Opened 13 years ago Closed 5 years ago

Add chrome only API to get mutation records from MutationObserver asap it is safe to run scripts

Categories

(Core :: DOM: Core & HTML, defect)

x86
Windows Vista
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: Honza, Assigned: smaug)

References

Details

Attachments

(1 file)

New DOM Mutation Observers has been introduced to replace the old mutation events: New https://developer.mozilla.org/en/DOM/DOM_Mutation_Observers Firebug would like to adopt these new API, but the problem is that they are not synchronous. Firebug needs synchronous API to support features like "Break on HTML Mutation" where JS stack is climbed (at the moment when the event occurs) to find out the line of code that caused the change and break in to the debugger. See detailed explanation of the feature here: http://www.softwareishard.com/blog/firebug/firebug-tip-break-on-html-mutation/ --- One possible solution (suggested by smaug on IRC) would be utilizing an existing 'takeRecords' method that could fire additional 'chrome only' event. Honza
On forward-compatible approach is to add mozNotifyOnRecordCreation to MutationObserverInit dictionary. The default value would be false, and only chrome can set it to true. When set to true whenever relevant MutationRecords are created, "mutation-record-created" would be fired (using a script runner). Subject would be the MutationObserver object. Adding a property to the dictionary is safer than adding something to MutationObserver or to MutationObserver constructor.
Assignee: nobody → bugs
Summary: nsIMutationObserver - implement synchronous support for HTML mutation observer → Add chrome only API to get mutation records from MutationObserver asap it is safe to run scripts
Hmm, why notification... just calling the callback should be fine.
Attached patch WIPSplinter Review
I need some attribute handling changes for this.
Depends on: 775701
Hi, any update on this bug? My extension would also prefer the sync APIs (similar to Mutation Events) then the async APIs exposed by Mutation Observer. Mutation Events were lot more easier to use (I understand the reasons for deprecating them). Hopefully this FF only API is a happy middle ground.
Just curious, how are MutationEvents easier to use? Sync API should be limited to debugger like tools, since it is always quite slow (no batching of various mutations). But in any case, bug 775701 needs to be fixed, and it requires Bug 775730.
Is there any estimate for this one? Is final removing the old mutation events blocked by this report? Honza

This exists now in the form of takeRecords(), right?

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: