WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
176685
Safari 10 /11 problem with if (!await get(something)).
https://bugs.webkit.org/show_bug.cgi?id=176685
Summary
Safari 10 /11 problem with if (!await get(something)).
myfele
Reported
2017-09-11 03:44:01 PDT
This code doesn't work in Safari (10 and 11, with Technology preview 39a), it blocks page rendering and says:: if(!await a(t, "myPromise").content) { console.log('ByBye'); } Of course if I remove await from my source code or check it like this: if (myPromiseContent === 0) { it works again. But I can't use "!" with an await? Is it generally wrong? "eslint" doesn't warn me about this. Am I wrong?
Attachments
Patch
(4.68 KB, patch)
2017-10-04 12:22 PDT
,
GSkachkov
no flags
Details
Formatted Diff
Diff
Patch
(8.57 KB, patch)
2017-10-05 10:29 PDT
,
GSkachkov
no flags
Details
Formatted Diff
Diff
Patch
(8.75 KB, patch)
2017-10-06 15:06 PDT
,
GSkachkov
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2017-09-14 10:14:18 PDT
Could you please attach a complete reproducible test case?
GSkachkov
Comment 2
2017-10-04 08:35:13 PDT
Will look to this issue
GSkachkov
Comment 3
2017-10-04 08:47:44 PDT
I'm receiving error in following script: ``` (async () => { var obj = { content: Promise.resolve('abc') }; var a = !await obj.content; console.log(a); })(); // SyntaxError: Unexpected identifier 'obj'. Expected ';' after variable declaration. ``` Work well if wraps await in parentheses: ``` (async () => { var obj = { content: Promise.resolve('abc') }; var a = !(await obj.content); console.log(a); })(); ```
GSkachkov
Comment 4
2017-10-04 12:22:32 PDT
Created
attachment 322700
[details]
Patch WiP. Need more tests
GSkachkov
Comment 5
2017-10-05 10:29:35 PDT
Created
attachment 322850
[details]
Patch Patch
Saam Barati
Comment 6
2017-10-05 14:20:59 PDT
Comment on
attachment 322850
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=322850&action=review
> Source/JavaScriptCore/parser/Parser.cpp:4447 > + else if (currentFunctionScope()->isAsyncFunctionBoundary())
Is this the grammar that is specified?
GSkachkov
Comment 7
2017-10-06 01:17:33 PDT
Comment on
attachment 322850
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=322850&action=review
I think I'll update ChangeLog description to the link of the spec
>> Source/JavaScriptCore/parser/Parser.cpp:4447 >> + else if (currentFunctionScope()->isAsyncFunctionBoundary()) > > Is this the grammar that is specified?
This is how I understand Note 1 in
https://tc39.github.io/ecma262/#sec-async-function-definitions
: ``` AsyncFunctionBody: FunctionBody[~Yield, +Await] AwaitExpression[Yield]: awaitUnaryExpression[?Yield, +Await] Note 1 await is parsed as an AwaitExpression when the [Await] parameter is present. The [Await] parameter is present in the following contexts: In an AsyncFunctionBody. In the FormalParameters of an AsyncFunctionDeclaration and AsyncFunctionExpression. AwaitExpression in this position is a Syntax error via static semantics. ``` I hope this is correct understanding of the spec.
GSkachkov
Comment 8
2017-10-06 15:06:44 PDT
Created
attachment 323048
[details]
Patch Fix ChangeLog description
WebKit Commit Bot
Comment 9
2017-10-09 02:59:30 PDT
Comment on
attachment 323048
[details]
Patch Clearing flags on attachment: 323048 Committed
r223043
: <
http://trac.webkit.org/changeset/223043
>
WebKit Commit Bot
Comment 10
2017-10-09 02:59:32 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 11
2017-10-09 03:00:07 PDT
<
rdar://problem/34882523
>
Ryan Haddad
Comment 12
2017-10-09 13:27:49 PDT
This change caused 32 test262 "failures" which are seemingly unexpected passes: test262.yaml/test262/test/language/expressions/async-arrow-function/await-as-identifier-reference.js.default-strict: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/expressions/async-function/await-as-identifier-reference.js.default: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/expressions/async-function/await-as-identifier-reference.js.default-strict: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/expressions/async-function/named-await-as-identifier-reference.js.default: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/expressions/async-function/named-await-as-identifier-reference.js.default-strict: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/expressions/async-generator/await-as-identifier-reference.js.default: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/expressions/async-generator/await-as-identifier-reference.js.default-strict: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/expressions/async-generator/named-await-as-identifier-reference.js.default: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/expressions/async-generator/named-await-as-identifier-reference.js.default-strict: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/expressions/class/async-gen-method-await-as-identifier-reference.js.default: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/expressions/class/async-gen-method-await-as-identifier-reference.js.default-strict: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/expressions/class/async-gen-method-static-await-as-identifier-reference.js.default: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/expressions/class/async-gen-method-static-await-as-identifier-reference.js.default-strict: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/expressions/class/async-method-await-as-identifier-reference.js.default: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/expressions/class/async-method-await-as-identifier-reference.js.default-strict: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/expressions/class/async-method-static-await-as-identifier-reference.js.default: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/expressions/class/async-method-static-await-as-identifier-reference.js.default-strict: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/expressions/object/method-definition/async-await-as-identifier-reference.js.default-strict: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/expressions/object/method-definition/async-await-as-identifier-reference.js.default: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/expressions/object/method-definition/async-gen-await-as-identifier-reference.js.default: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/expressions/object/method-definition/async-gen-await-as-identifier-reference.js.default-strict: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/statements/async-function/await-as-identifier-reference.js.default: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/statements/async-function/await-as-identifier-reference.js.default-strict: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/statements/async-generator/await-as-identifier-reference.js.default: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/statements/async-generator/await-as-identifier-reference.js.default-strict: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/statements/class/async-gen-method-await-as-identifier-reference.js.default: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/statements/class/async-gen-method-await-as-identifier-reference.js.default-strict: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/statements/class/async-gen-method-static-await-as-identifier-reference.js.default: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/statements/class/async-gen-method-static-await-as-identifier-reference.js.default-strict: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/statements/class/async-method-await-as-identifier-reference.js.default: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/statements/class/async-method-await-as-identifier-reference.js.default-strict: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/statements/class/async-method-static-await-as-identifier-reference.js.default-strict: ERROR: Unexpected exit code: 0 test262.yaml/test262/test/language/statements/class/async-method-static-await-as-identifier-reference.js.default: ERROR: Unexpected exit code: 0
https://build.webkit.org/builders/Apple%20El%20Capitan%20Release%20Test262%20%28Tests%29/builds/4709
I will update the expectations.
Ryan Haddad
Comment 13
2017-10-09 13:46:38 PDT
(In reply to Ryan Haddad from
comment #12
)
> I will update the expectations.
Done in
https://trac.webkit.org/changeset/223067/webkit
Alexey Shvayka
Comment 14
2023-10-11 17:06:31 PDT
***
Bug 177851
has been marked as a duplicate of this bug. ***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug