Bug 74811 - 'this' object is sometimes the DOMWindow when it shouldn't be
Summary: 'this' object is sometimes the DOMWindow when it shouldn't be
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: InRadar
Depends on:
Blocks:
 
Reported: 2011-12-18 09:56 PST by Timothy Hatcher
Modified: 2012-10-11 16:38 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Timothy Hatcher 2011-12-18 09:56:59 PST
I've been hitting an odd bug in the Web Inspector's TreeOutline (very old and stable code) that calls a function on this, but the this object inside the function is sometimes the window and not the 'this' from the callee.

Changing the code from:

this.onpopulate();

To:

this.onpopulate.call(this);

Which fixes it 100%. Otherwise it only works fine 95-99% of the time, and randomly seems to forget the 'this' object.

This is with TOT r103101.
Comment 1 Timothy Hatcher 2011-12-18 10:02:36 PST
Obviously the callee has the right 'this' object, otherwise it would throw an exception calling "onpopulate".

I haven't been able to narrow it down to a test case yet. If you want to reproduce it, contact me.
Comment 2 Timothy Hatcher 2011-12-18 11:44:49 PST
<rdar://problem/10592017>
Comment 3 Simon Fraser (smfr) 2011-12-19 08:24:46 PST
Do you have  regression range?
Comment 4 Timothy Hatcher 2011-12-19 08:53:57 PST
No, it isn't 100% reproducible so it would be time consuming to find the range.