Bug 141670

Summary: Descriptor of Function.arguments is inconsistent
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: joepeck, mark.lam
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   

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 () {