This test is wrong: https://github.com/WebKit/webkit/blob/master/LayoutTests/js/script-tests/basic-strict-mode.js#L153 ``` "use strict"; var a = { b: 42 }; delete void a.b; ``` The delete expression should not throw, but it throws a syntax error requiring a reference expression. The specs says the expression should return true when the right hand expression is not a reference: https://tc39.github.io/ecma262/#sec-delete-operator-runtime-semantics-evaluation the void expression will normally return undefined and this value is not a reference. This bug is only seen on JSC. Other major engines are showing the expected behavior. ``` eshost -x '"use strict"; var a = { b: 42 }; delete void a.b' #### v8-harmony #### v8 #### jsc SyntaxError: The delete operator requires a reference expression. #### spidermonkey #### ch #### node ``` The same happens if the expression is `delete void 0` or `delete typeof 0` but changing the expression from `delete (void 0)` gets the correct behavior. I'm sending some tests to Test262 to support this and prevent it from other occurrences.
Created attachment 352650 [details] Patch
This is really interesting -- looks like that SyntaxError has been in JSC's parser forever, yet even looking through old editions of ECMA-262, it doesn't seem like it was ever spec-compliant. I don't believe there are any test cases to be added here, since we're just removing a strict-mode check that seemingly ought to have never existed.
Comment on attachment 352650 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=352650&action=review r=me. Could you update test262 expectations.yaml too? > LayoutTests/js/script-tests/basic-strict-mode.js:-153 > -shouldBeSyntaxError("'use strict'; if (0) delete +a.b"); > -shouldBeSyntaxError("'use strict'; if (0) delete ++a.b"); > -shouldBeSyntaxError("'use strict'; if (0) delete void a.b"); Lets'
Comment on attachment 352650 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=352650&action=review >> LayoutTests/js/script-tests/basic-strict-mode.js:-153 >> -shouldBeSyntaxError("'use strict'; if (0) delete void a.b"); > > Lets' Oops. Let's keep these tests as follows. `shouldBeXXX(...)`
Created attachment 352705 [details] Patch for landing
Comment on attachment 352705 [details] Patch for landing Clearing flags on attachment: 352705 Committed r237259: <https://trac.webkit.org/changeset/237259>
All reviewed patches have been landed. Closing bug.
<rdar://problem/45375223>