Closed Bug 1356189 Opened 7 years ago Closed 7 years ago

await not rejected as keyword in non-toplevel module context

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox55 --- wontfix
firefox56 --- fixed

People

(Reporter: anba, Assigned: anba)

Details

Attachments

(1 file, 2 obsolete files)

Test case, run as module source code:
---
function f() {
    await;
}
---

Expected: Throws SyntaxError
Actual: No SyntaxError thrown
Attached patch bug1356189.patch (obsolete) — Splinter Review
"await" is always a keyword when parsing module source code and since we don't have a "currently-parsing-module-code" flag in the parser, I've modified the existing ParserBase::awaitIsKeyword_ flag to hold the new state when "await" is a module-keyword.
Assignee: nobody → andrebargull
Status: NEW → ASSIGNED
Attachment #8874746 - Flags: review?(shu)
Comment on attachment 8874746 [details] [diff] [review]
bug1356189.patch

Review of attachment 8874746 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks!
Attachment #8874746 - Flags: review?(shu) → review+
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/47ce8dbb036e
Ensure 'await' is always a restricted identifier when parsing modules. r=shu
Keywords: checkin-needed
Backed out for no tests result for own test await-restricted-nested.js on Windows 7 VM opt and also failing it in Win XP SM plain:

https://hg.mozilla.org/integration/mozilla-inbound/rev/196bfa86b5a63c20f7f6fdf3e30d9ff3d8839de3

Push with failures: https://treeherder.mozilla.org/#/jobs?repo=mozilla-inbound&revision=47ce8dbb036e5452c0dd060c274cef056306d258&filter-resultStatus=testfailed&filter-resultStatus=busted&filter-resultStatus=exception&filter-resultStatus=retry&filter-resultStatus=usercancel&filter-resultStatus=runnable

Failure log jsreftest Windows 7 VM opt: https://treeherder.mozilla.org/logviewer.html#?job_id=105246170&repo=mozilla-inbound
10:15:10     INFO - REFTEST TEST-LOAD | file:///c:/slave/test/build/tests/jsreftest/tests/jsreftest.html?test=ecma_6/Module/await-restricted-nested.js;error=SyntaxError;module | 1825 / 16441 (11%)
10:15:10     INFO - REFTEST TEST-UNEXPECTED-FAIL | file:///c:/slave/test/build/tests/jsreftest/tests/jsreftest.html?test=ecma_6/Module/await-restricted-nested.js;error=SyntaxError;module | No test results reported. (SCRIPT)
10:15:10     INFO - 
10:15:10     INFO - REFTEST TEST-END | file:///c:/slave/test/build/tests/jsreftest/tests/jsreftest.html?test=ecma_6/Module/await-restricted-nested.js;error=SyntaxError;module

Failure log spidermonkey plain Windows XP: https://treeherder.mozilla.org/logviewer.html#?job_id=105221722&repo=mozilla-inbound
## ecma_6\Module\await-restricted-nested.js: rc = 0, run time = 0.187
TEST-UNEXPECTED-FAIL | ecma_6\Module\await-restricted-nested.js | (args: "")
## ecma_6\Module\await-restricted-nested.js: rc = 0, run time = 0.187
TEST-UNEXPECTED-FAIL | ecma_6\Module\await-restricted-nested.js | (args: "--ion-eager --ion-offthread-compile=off")
...
Flags: needinfo?(andrebargull)
Attached patch bug1356189.patch (obsolete) — Splinter Review
The enum needs to be typed as unsigned for MSVC, but that breaks GCC because of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414, so I also needed to change field type in ParserBase to use uint8_t instead of the enum type...

Try looks good so far: https://treeherder.mozilla.org/#/jobs?repo=try&revision=fae1a20f148d1d778291aeacb5bf2cc056754ce5
Attachment #8874746 - Attachment is obsolete: true
Flags: needinfo?(andrebargull)
Attachment #8875762 - Flags: review+
Attached patch bug1356189.patchSplinter Review
Updated patch to apply cleanly on inbound. Carrying r+.
Attachment #8875762 - Attachment is obsolete: true
Attachment #8881908 - Flags: review+
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/d365e0c892e3
Ensure 'await' is always a restricted identifier when parsing modules. r=shu
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/d365e0c892e3
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.