Bug 141670 - Descriptor of Function.arguments is inconsistent
Summary: Descriptor of Function.arguments is inconsistent
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-16 15:25 PST by Joseph Pecoraro
Modified: 2015-02-16 15:29 PST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2015-02-16 15:25:40 PST
* SUMMARY
Descriptor of Function.arguments is inconsistent. Sometimes it is a value, sometimes it is a getter/setter. This doesn't seem expected.

  js> Object.getOwnPropertyDescriptor(function(){}, "arguments")
  < {value: null, writable: false, enumerable: false, configurable: false}

  js> Object.getOwnPropertyDescriptor(function(){}.bind(this), "arguments")
  < {get: function, set: function, enumerable: false, configurable: false}

Also, it is possible that "arguments" should not be on the instance but actually on Function.prototype.
Comment 1 Joseph Pecoraro 2015-02-16 15:29:16 PST
Note, this affects Web Inspector. We look at descriptors when expanding objects. When the "arguments" property getter is invoked outside of an invocation of the function it produces an error:

  js> (function(){}).bind(this).arguments
  < TypeError: Type error

So when inspector tries to show the value of "arguments" in object expansion, we encounter the errors. It is a bit unfortunate and we may want to workaround this.

  js> dir(function(){}.bind(this))
  < function () { [native code] }
      arguments: [Exception: TypeError: Type error]
      caller: [Exception: TypeError: Type error]
      length: 0
      name: ""
      __proto__: function () {