Closed
Bug 1139099
Opened 11 years ago
Closed 11 years ago
Dispatch a DOMDocElementInserted event to match document-element-inserted
Categories
(Core :: DOM: Navigation, defect)
Core
DOM: Navigation
Tracking
()
RESOLVED
FIXED
mozilla39
| Tracking | Status | |
|---|---|---|
| firefox39 | --- | fixed |
People
(Reporter: mossop, Assigned: mossop)
References
Details
Attachments
(1 file, 1 obsolete file)
|
3.08 KB,
patch
|
mrbkap
:
review+
|
Details | Diff | Splinter Review |
In the add-on SDK we use the document-element-inserted to tell us when a new document is being created letting us access things like readyState and add event listeners to wait for the document to finish loading etc.
The downside is that this is process-wide and sometimes we only care about documents in a given frame. It is also shimmed by the add-on compatibility code so we end up causing CPOW traffic that we can't avoid until the entire SDK is e10s compliant.
For similar reasons bug 567357 added a DOMWindowCreated event to match (chrome|content)-document-global-created. I tried switching to that but at that point various properties we use (inner window ID, document) aren't available. Strangely even adding a load event listener to the window we're given by this event doesn't work properly.
I'd like to see a DOMDocumentCreated event or similar to match document-element-inserted.
| Assignee | ||
Comment 1•11 years ago
|
||
This seems to work, I have no idea if it is safe but I guess if an observer niotification is then so is event dispatch. Open to alternative naming for the event.
Comment 2•11 years ago
|
||
Comment on attachment 8572195 [details] [diff] [review]
patch
Review of attachment 8572195 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/base/nsContentSink.cpp
@@ +1550,5 @@
> NotifyObservers(domDoc, "document-element-inserted",
> EmptyString().get());
> }
> +
> + nsContentUtils::DispatchTrustedEvent(aDoc, aDoc,
This should use nsContentUtils::DispatchChromeEvent so that content pages can't observe the new event. It'd also be good to modify <http://mxr.mozilla.org/mozilla-central/source/dom/tests/mochitest/bugs/test_DOMWindowCreated_chromeonly.html?force=1> to ensure that content pages can't see this event either.
Attachment #8572195 -
Flags: review?(mrbkap)
| Assignee | ||
Updated•11 years ago
|
Summary: Dispatch a DOMDocumentCreated event to match document-element-inserted → Dispatch a DOMDocElementInserted event to match document-element-inserted
| Assignee | ||
Comment 3•11 years ago
|
||
I made those changes
Attachment #8572195 -
Attachment is obsolete: true
Attachment #8573332 -
Flags: review?(mrbkap)
Updated•11 years ago
|
Attachment #8573332 -
Flags: review?(mrbkap) → review+
| Assignee | ||
Comment 4•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
status-firefox39:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
You need to log in
before you can comment on or make changes to this bug.
Description
•