Closed
Bug 1224186
Opened 10 years ago
Closed 10 years ago
Implement DOMTokenList's new replace() method
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla49
| Tracking | Status | |
|---|---|---|
| firefox49 | --- | fixed |
People
(Reporter: annevk, Assigned: emilio)
References
Details
(Keywords: dev-doc-complete, Whiteboard: dom-triaged btpp-active)
Attachments
(1 file, 7 obsolete files)
https://dom.spec.whatwg.org/#dom-domtokenlist-replace
We should probably leave the validation logic until there's a feature that actually makes use of that.
| Assignee | ||
Comment 1•10 years ago
|
||
Anne, are there existing tests for this? Do you know who should I ask for review?
Flags: needinfo?(annevk)
| Reporter | ||
Comment 2•10 years ago
|
||
You could ask :baku or :smaug maybe. Not aware of any tests. Perhaps you can update https://github.com/w3c/web-platform-tests/blob/master/dom/nodes/Element-classlist.html. Ms2ger might have ideas.
Flags: needinfo?(annevk)
We have some tests in this open PR: https://github.com/servo/servo/pull/9353
| Assignee | ||
Comment 4•10 years ago
|
||
| Assignee | ||
Comment 5•10 years ago
|
||
nox, added a simple test, since that servo PR is covering most cases.
This one also includes the `replace(string_with_spaces, empty_string)` case.
Let me know if you think the test shouldn't be included.
Attachment #8724384 -
Attachment is obsolete: true
Attachment #8724414 -
Attachment is obsolete: true
Attachment #8724415 -
Flags: review?(Ms2ger)
Updated•10 years ago
|
Keywords: dev-doc-needed
Comment 6•10 years ago
|
||
Comment on attachment 8724415 [details] [diff] [review]
Proposed patch with tests (pressed intro too early)
Review of attachment 8724415 [details] [diff] [review]:
-----------------------------------------------------------------
Note that your test change was bitrotted in https://hg.mozilla.org/integration/mozilla-inbound/rev/3da6faf2cd54
Deferring to baku to see if code/tests are correct per spec.
Attachment #8724415 -
Flags: review?(amarchesini)
Attachment #8724415 -
Flags: review?(Ms2ger)
Attachment #8724415 -
Flags: feedback+
Updated•10 years ago
|
Assignee: nobody → ecoal95
Whiteboard: dom-triaged btpp-active
Comment 7•10 years ago
|
||
Comment on attachment 8724415 [details] [diff] [review]
Proposed patch with tests (pressed intro too early)
Review of attachment 8724415 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/base/nsDOMTokenList.cpp
@@ +315,5 @@
> +{
> + // Doing this here instead of using `CheckToken` because if aToken had invalid
> + // characters, and aNewToken is empty, the returned error should be a
> + // SyntaxError, not an InvalidCharacterError.
> + if (aNewToken.IsEmpty()) {
NS_WARN_IF
@@ +321,5 @@
> + return;
> + }
> +
> + aError = CheckToken(aToken);
> + if (aError.Failed()) {
NS_WARN_IF
@@ +326,5 @@
> + return;
> + }
> +
> + aError = CheckToken(aNewToken);
> + if (aError.Failed()) {
NS_WARN_IF
Attachment #8724415 -
Flags: review?(amarchesini) → review+
Comment 8•10 years ago
|
||
Comment on attachment 8724415 [details] [diff] [review]
Proposed patch with tests (pressed intro too early)
Review of attachment 8724415 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/base/nsDOMTokenList.cpp
@@ +317,5 @@
> + // characters, and aNewToken is empty, the returned error should be a
> + // SyntaxError, not an InvalidCharacterError.
> + if (aNewToken.IsEmpty()) {
> + aError = NS_ERROR_DOM_SYNTAX_ERR;
> + return;
you should throw SyntaxError also if atoken is empty.
| Assignee | ||
Comment 9•10 years ago
|
||
(In reply to Andrea Marchesini (:baku) from comment #8)
> you should throw SyntaxError also if atoken is empty.
That's implicitly done in the next CheckToken call.
The explicit check for `aNewToken` is necessary because in the case string_with_whitespace, empty_string, the invalid character error would be thrown instead if it's omitted.
Re. the NS_WARN_IF, I didn't add them because they're not anywhere else in the fail (I guess because the thrown error is considered enough?).
If you want I can add it everywhere else in the file though :)
Flags: needinfo?(amarchesini)
Updated•10 years ago
|
Keywords: checkin-needed
Comment 11•10 years ago
|
||
has problems to apply:
renamed 1224186 -> 0001-Implement-DOMTokenList.replace.patch
applying 0001-Implement-DOMTokenList.replace.patch
patching file testing/web-platform/tests/dom/nodes/Element-classlist.html
Hunk #1 FAILED at 298
1 out of 1 hunks FAILED -- saving rejects to file testing/web-platform/tests/dom/nodes/Element-classlist.html.rej
patch failed, unable to continue (try -v)
patch failed, rejects left in working directory
errors during apply, please fix and qrefresh 0001-Implement-DOMTokenList.replace.patch
Flags: needinfo?(ecoal95)
Keywords: checkin-needed
| Assignee | ||
Comment 12•10 years ago
|
||
Flags: needinfo?(ecoal95)
| Assignee | ||
Comment 13•10 years ago
|
||
Sorry, got distracted and didn't took the time to unbitrot it.
There it goes again :)
Attachment #8724415 -
Attachment is obsolete: true
Attachment #8731484 -
Attachment is obsolete: true
Attachment #8731485 -
Flags: review?(amarchesini)
Comment 14•10 years ago
|
||
Comment on attachment 8731485 [details] [diff] [review]
Unbitrotted version of the patch
Review of attachment 8731485 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/base/nsDOMTokenList.cpp
@@ +316,5 @@
> + // Doing this here instead of using `CheckToken` because if aToken had invalid
> + // characters, and aNewToken is empty, the returned error should be a
> + // SyntaxError, not an InvalidCharacterError.
> + if (aNewToken.IsEmpty()) {
> + aError = NS_ERROR_DOM_SYNTAX_ERR;
aError.Thorws(NS_ERROR_DOM_SYNTAX_ERR);
Attachment #8731485 -
Flags: review?(amarchesini) → review+
| Assignee | ||
Comment 15•10 years ago
|
||
Attachment #8731485 -
Attachment is obsolete: true
Attachment #8732826 -
Flags: review?(amarchesini)
Updated•10 years ago
|
Attachment #8732826 -
Flags: review?(amarchesini) → review+
Updated•10 years ago
|
Keywords: checkin-needed
Comment 16•10 years ago
|
||
Keywords: checkin-needed
Comment 17•10 years ago
|
||
Hi, had to back this out - could you take a look at https://treeherder.mozilla.org/logviewer.html#?job_id=25702974&repo=mozilla-inbound
Flags: needinfo?(ecoal95)
Comment 18•10 years ago
|
||
| Assignee | ||
Comment 19•10 years ago
|
||
Ohh cool, unexpected test passes!
Will update the test expectations :)
Flags: needinfo?(ecoal95)
| Assignee | ||
Comment 20•10 years ago
|
||
Attachment #8740983 -
Flags: review?(amarchesini)
| Assignee | ||
Updated•10 years ago
|
Attachment #8732826 -
Attachment is obsolete: true
Updated•10 years ago
|
Attachment #8740983 -
Flags: review?(amarchesini) → review+
Comment 21•10 years ago
|
||
Wait, so that last patch still has some wpt failure annotations around classList.replace. Are those tests wrong, or is this implementation wrong or incomplete?
Flags: needinfo?(ecoal95)
| Assignee | ||
Comment 22•10 years ago
|
||
The failure is due to other more general DOMTokenList problems, not inherent to the replace() implementatoon: We don't treat \n, \t, ... as space, and we don't deduplicate tokens when they are added.
I don't know if there is any bug filled for that, but I can certainly fix it. Even though is maybe worth fixing it as a follow-up, since this patch has been lying around for a while.
Flags: needinfo?(ecoal95)
Comment 23•10 years ago
|
||
Yeah, if they're general issues not specific to replace() followup is definitely better.
Updated•10 years ago
|
Keywords: checkin-needed
Comment 24•10 years ago
|
||
Keywords: checkin-needed
Comment 25•10 years ago
|
||
backed out seems there are still issues like https://treeherder.mozilla.org/logviewer.html#?job_id=25810767&repo=mozilla-inbound
Flags: needinfo?(ecoal95)
Comment 26•10 years ago
|
||
| Assignee | ||
Comment 27•10 years ago
|
||
Flags: needinfo?(ecoal95)
| Assignee | ||
Updated•10 years ago
|
Attachment #8740983 -
Attachment is obsolete: true
| Assignee | ||
Comment 28•10 years ago
|
||
So sorry! I forgot to re-run the interfaces test again :(
There it is with the expectations updated.
Comment 29•10 years ago
|
||
Comment 30•10 years ago
|
||
| bugherder | ||
Status: NEW → RESOLVED
Closed: 10 years ago
status-firefox49:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
Comment 31•9 years ago
|
||
Created: https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/replace
Updated: https://developer.mozilla.org/en-US/Firefox/Releases/49#DOM_HTML_DOM
Keywords: dev-doc-needed → dev-doc-complete
Comment 32•9 years ago
|
||
In Example: document.documentElement.replas << not "replas" but "replace"
Updated•9 years ago
|
Updated•7 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•