Closed
Bug 642153
Opened 15 years ago
Closed 15 years ago
Validator: Flag DOM mutation events as warnings for their extreme inefficiency
Categories
(addons.mozilla.org Graveyard :: Admin/Editor Tools, defect, P3)
addons.mozilla.org Graveyard
Admin/Editor Tools
Tracking
(Not tracked)
RESOLVED
FIXED
6.0.8
People
(Reporter: kmag, Assigned: basta)
Details
(Whiteboard: [ReviewTeam])
Attachments
(1 file)
|
1.69 KB,
application/zip
|
Details |
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:2.0b13pre) Gecko/20110310 Firefox/4.0b13pre
Build Identifier:
I think it would be a good idea to warn unwary developers that using DOM Mutation events are extremely inefficient. They have some uses, but some developers see no issue with inserting them into every page for trivial purposes, which is an extremely bad idea.
Reproducible: Always
Comment 1•15 years ago
|
||
Agreed. Kris, can you list the events that should be flagged?
Assignee: nobody → mbasta
Severity: normal → minor
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3
Whiteboard: [required amo-editors]
Target Milestone: --- → 6.0.3
| Reporter | ||
Comment 2•15 years ago
|
||
Sure, I just didn't want to go to the trouble if we weren't going to do this.
Any of the events marked deprecated here would be a candidate: http://www.w3.org/TR/DOM-Level-3-Events/
But in particular: DOMAttrModified, DOMAttributeNameChanged, DOMCharacterDataModified, DOMElementNameChanged, DOMNodeInserted, DOMNodeInsertedIntoDocument, DOMNodeRemoved, DOMNodeRemovedFromDocument, DOMSubtreeModified
I'm not sure whether we should flag calls to addEventListener or just the presence of those strings.
| Assignee | ||
Comment 3•15 years ago
|
||
I can mark these as flagged identifiers. If these are pretty uncommon anyway (or shouldn't be used), then there likely won't be too much noise.
| Assignee | ||
Comment 4•15 years ago
|
||
Check it out:
https://github.com/mattbasta/amo-validator/commit/4e2839d861bcbf8d5b7f8aadfb2dbcdce0cbcbf6
Will create a pull request as soon as the innerHTML stuff goes through.
| Reporter | ||
Comment 5•15 years ago
|
||
Sorry, I missed comment 3. I don't think adding these to the banned identifier list because they're strings passed to addEventListener rather than strings. They also apparently work as on* attributes (but not on* properties, as far as I can tell).
| Assignee | ||
Comment 6•15 years ago
|
||
> strings passed to addEventListener rather than strings.
Come again?
| Reporter | ||
Comment 7•15 years ago
|
||
Heh...
elem.addEventListener("DOMSubtreeModified", onDOMSubtreeModified, false);
elem.setAttribute("onDOMSubtreeModified", "doStuff(event)")
<elem onDOMSubtreeModified="doStuff(event)"/>
Sorry for the typo. I meant "rather than identifiers".
| Assignee | ||
Comment 8•15 years ago
|
||
Ah, then this is going to end up as a lovely regex test. Will do soon.
Updated•15 years ago
|
Target Milestone: 6.0.3 → 6.0.4
| Assignee | ||
Comment 9•15 years ago
|
||
Updated•15 years ago
|
Target Milestone: 6.0.4 → 6.0.6
| Assignee | ||
Comment 10•15 years ago
|
||
Pushed to mozilla/amo-validator
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Comment 11•15 years ago
|
||
Kris/ Jorgev, can you verify? Thanks!
Comment 12•15 years ago
|
||
It doesn't work on preview.
https://addons.allizom.org/en-US/developers/addon/the-official-diego-torres-add-/file/114505/validation
In overlay.js:
cl.addEventListener('DOMSubtreeModified', function (e) {
| Reporter | ||
Comment 13•15 years ago
|
||
Agreed, this doesn't seem to work on allizom or from git. overlay.js and overlay.xul should trigger warnings in the attached XPI.
Updated•15 years ago
|
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Updated•15 years ago
|
Target Milestone: 6.0.6 → 6.0.7
| Assignee | ||
Comment 14•15 years ago
|
||
I'm seeing the errors being reported:
Warning: DOM Mutation Events Prohibited
DOM mutation events are flagged because of their deprecated status, as well as their extreme inefficiency. Consider using a different event.
Tier: 3
File: content/overlay.js
Line: 10
Context:
> document.addEventListener('DOMNodeRemovedFromDocument', function () {}, false);
> document.addEventListener('DOMSubtreeModified', function () {}, false);
>
Can you confirm that you have the latest version from git? Also, make sure you're using the --determined flag.
| Reporter | ||
Comment 15•15 years ago
|
||
The JS errors are showing up for me with the latest pull now (they weren't at the time of my last comment), but still not the on* attributes.
Updated•15 years ago
|
Target Milestone: 6.0.7 → 6.0.8
| Assignee | ||
Comment 16•15 years ago
|
||
Ah, didn't realize that those existed. They're added now, if someone could look over the code:
https://github.com/mozilla/amo-validator/pull/23
| Assignee | ||
Comment 17•15 years ago
|
||
Status: REOPENED → RESOLVED
Closed: 15 years ago → 15 years ago
Resolution: --- → FIXED
Comment 18•14 years ago
|
||
Reclassifying editor bugs and changing to a new whiteboard flag. Spam, spam, spam, spam...
Whiteboard: [required amo-editors] → [ReviewTeam]
Updated•10 years ago
|
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•