Closed Bug 1020775 Opened 10 years ago Closed 10 years ago

default parameters are executed with the wrong "this" value

Categories

(Core :: General, defect)

32 Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: blindwanderer, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 5.1; rv:32.0) Gecko/20100101 Firefox/32.0 (Beta/Release)
Build ID: 20140604030202

Steps to reproduce:

function fun(dt = getInnerThis()){
  function getInnerThis(){ return this; } return [this, dt];
}
fun.apply({0:0})


Actual results:

[ {0:0}, Window ]


Expected results:

[{0:0}, {0:0}]
I'm stupid, ignore please. I forgot that it wasn't going to inhert the value of this.

function fun(dt = getInnerThis()){
  function getInnerThis(){ return this; } return [this, getInnerThis(), dt];
}
fun.apply({0:0})//[{0:0}, window, window]
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.