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>
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
Description Flags
the fix, with test case zwarich: review+

Description Maciej Stachowiak 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.
Comment 1 Maciej Stachowiak 2008-10-04 00:02:11 PDT
Created attachment 24084 [details]
the fix, with test case
Comment 2 Cameron Zwarich (cpst) 2008-10-04 00:12:16 PDT
Comment on attachment 24084 [details]
the fix, with test case

Comment 3 Cameron Zwarich (cpst) 2008-10-04 08:58:32 PDT
Landed in r37285.