Bug 21362

Summary: "this" object in methods called on primitives should be wrapper object
Product: WebKit Reporter: Maciej Stachowiak <mjs>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
Attachments:
Description Flags
the fix, with test case zwarich: review+

Maciej Stachowiak
Reported 2008-10-03 23:58:09 PDT
In cases like this: String.prototype.thisType = function() { return typeof this; }; Number.prototype.thisType = function() { return typeof this; }; Boolean.prototype.thisType = function() { return typeof this; }; shouldBe("(1).thisType()", "'object'"); shouldBe("(2.3).thisType()", "'object'"); shouldBe("'xxx'.thisType()", "'object'"); shouldBe("(false).thisType()", "'object'"); We're currently providing the raw number or string or bool as the "this" value, which is subtly wrong.
Attachments
the fix, with test case (23.10 KB, patch)
2008-10-04 00:02 PDT, Maciej Stachowiak
zwarich: review+
Maciej Stachowiak
Comment 1 2008-10-04 00:02:11 PDT
Created attachment 24084 [details] the fix, with test case
Cameron Zwarich (cpst)
Comment 2 2008-10-04 00:12:16 PDT
Comment on attachment 24084 [details] the fix, with test case r=me
Cameron Zwarich (cpst)
Comment 3 2008-10-04 08:58:32 PDT
Landed in r37285.
Note You need to log in before you can comment on or make changes to this bug.