RESOLVED INVALID 6601
valueOf confuses JSC when run through KDE shouldThrow test
https://bugs.webkit.org/show_bug.cgi?id=6601
Summary valueOf confuses JSC when run through KDE shouldThrow test
Geoffrey Garen
Reported 2006-01-16 18:34:16 PST
The attached reduction.html fails in Safari but passes in Firefox. This line: testPassed(_a + " threw exception " + exception + "."); ends up throwing an exception somehow. Using the function name "valueOf" in the test code is the key to triggering this bug.
Attachments
Reduction. (3.01 KB, text/html)
2006-01-16 18:35 PST, Geoffrey Garen
no flags
Geoffrey Garen
Comment 1 2006-01-16 18:35:11 PST
Created attachment 5729 [details] Reduction.
Cameron Zwarich (cpst)
Comment 2 2008-06-07 02:03:07 PDT
This doesn't pass in either Firefox or Opera, for the same reason as WebKit. Are you sure this is a bug?
Gavin Barraclough
Comment 3 2011-09-06 23:07:51 PDT
This test case is invalid, and correctly fails (it fails in firefox, too). The problem is that the test adds a valueOf method to the Object prototype. The test (that an error is thrown) then passes (an error is thrown when Date.prototype.valueOf is applied to a vanilla object). The test harness then tries to format up an error message indicating the test passed, using the following line: testPassed(_a + " threw exception " + exception + "."); This will call ToPrimitive with the numeric hint on exception, which will favor calling the valueOf operator on the object. Since TypeError derive from object, and the object prototype still has the date prototypes valueOf, the ToPrimitive conversion will correctly throw an error.
Note You need to log in before you can comment on or make changes to this bug.