Bug 157545 - Improve error messages for accessing arguments.callee and similar getters in strict mode
Summary: Improve error messages for accessing arguments.callee and similar getters in ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-10 16:56 PDT by Joseph Pecoraro
Modified: 2016-05-11 11:32 PDT (History)
5 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (24.66 KB, patch)
2016-05-10 16:58 PDT, Joseph Pecoraro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2016-05-10 16:56:31 PDT
* SUMMARY
Improve error messages for accessing arguments.callee and similar getters in strict mode.

Error should be more like accessing callee inside of a class context.

* BEFORE:
>>> (function() { "use strict"; arguments.callee })()
Exception: TypeError: Type error
>>> (function() { "use strict"; arguments.callee }).arguments
Exception: TypeError: Type error
>>> class Foo { method() { arguments.callee; } }; (new Foo).method()
Exception: TypeError: 'callee' and 'caller' cannot be accessed in strict mode.

* AFTER:
>>> (function() { "use strict"; arguments.callee })()
Exception: TypeError: 'callee' and 'caller' cannot be accessed in strict mode.
>>> (function() { "use strict"; arguments.callee }).arguments
Exception: TypeError: 'caller' and 'arguments' cannot be accessed in strict mode.
>>> class Foo { method() { arguments.callee; } }; (new Foo).method()
Exception: TypeError: 'callee' and 'caller' cannot be accessed in strict mode.
Comment 1 Joseph Pecoraro 2016-05-10 16:58:58 PDT
Created attachment 278552 [details]
[PATCH] Proposed Fix
Comment 2 WebKit Commit Bot 2016-05-10 17:00:52 PDT
Attachment 278552 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/runtime/JSGlobalObject.cpp:399:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
ERROR: Source/JavaScriptCore/runtime/JSGlobalObject.cpp:407:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
Total errors found: 2 in 11 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Mark Lam 2016-05-10 17:08:14 PDT
Comment on attachment 278552 [details]
[PATCH] Proposed Fix

r=me
Comment 4 WebKit Commit Bot 2016-05-11 11:32:42 PDT
Comment on attachment 278552 [details]
[PATCH] Proposed Fix

Clearing flags on attachment: 278552

Committed r200694: <http://trac.webkit.org/changeset/200694>
Comment 5 WebKit Commit Bot 2016-05-11 11:32:45 PDT
All reviewed patches have been landed.  Closing bug.