Closed
Bug 1340145
Opened 9 years ago
Closed 9 years ago
HTML-comments shouldn't be enabled for module-code
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla54
| Tracking | Status | |
|---|---|---|
| firefox54 | --- | fixed |
People
(Reporter: anba, Assigned: jonco)
References
Details
Attachments
(1 file, 1 obsolete file)
|
5.48 KB,
patch
|
anba
:
review+
|
Details | Diff | Splinter Review |
Test case:
---
print(JSON.stringify(Reflect.parse("a <!-- b", {target: "module", loc: false}), null, " "))
---
HTML-comments (https://tc39.github.io/ecma262/#sec-html-like-comments) shouldn't enabled when the parse goal is |Module|.
Expected parse tree:
---
{
"loc": null,
"type": "Program",
"body": [
{
"loc": null,
"type": "ExpressionStatement",
"expression": {
"loc": null,
"type": "BinaryExpression",
"operator": "<",
"left": {
"loc": null,
"type": "Identifier",
"name": "a"
},
"right": {
"loc": null,
"type": "UnaryExpression",
"operator": "!",
"argument": {
"loc": null,
"type": "UpdateExpression",
"operator": "--",
"argument": {
"loc": null,
"type": "Identifier",
"name": "b"
},
"prefix": true
},
"prefix": true
}
}
}
]
}
---
Actual parse tree:
---
{
"loc": null,
"type": "Program",
"body": [
{
"loc": null,
"type": "ExpressionStatement",
"expression": {
"loc": null,
"type": "Identifier",
"name": "a"
}
}
]
}
---
| Assignee | ||
Comment 1•9 years ago
|
||
Patch to make accepting HTML comments a compiler option.
Assignee: nobody → jcoppeard
Attachment #8839477 -
Flags: review?(andrebargull)
| Reporter | ||
Comment 2•9 years ago
|
||
Comment on attachment 8839477 [details] [diff] [review]
bug1340145-module-comments
Review of attachment 8839477 [details] [diff] [review]:
-----------------------------------------------------------------
We also need to disallow the html end-comment marker `-->` in https://dxr.mozilla.org/mozilla-central/rev/d0462b0948e0b1147dcce615bddcc46379bdadb2/js/src/frontend/TokenStream.cpp#1867-1874
Attachment #8839477 -
Flags: review?(andrebargull) → review-
| Assignee | ||
Comment 3•9 years ago
|
||
Fixed.
Attachment #8839477 -
Attachment is obsolete: true
Attachment #8839500 -
Flags: review?(andrebargull)
| Reporter | ||
Comment 4•9 years ago
|
||
Comment on attachment 8839500 [details] [diff] [review]
bug1340145-module-comments v2
Review of attachment 8839500 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good!
Attachment #8839500 -
Flags: review?(andrebargull) → review+
Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/c7a4c2e34e6e
Don't allow HTML comments in module scripts r=anba
Comment 6•9 years ago
|
||
| bugherder | ||
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
You need to log in
before you can comment on or make changes to this bug.
Description
•