RESOLVED FIXED 9815
JavaScript TypeError loading Dean Edwards' JS compressor/obfuscator
https://bugs.webkit.org/show_bug.cgi?id=9815
Summary JavaScript TypeError loading Dean Edwards' JS compressor/obfuscator
David Kilzer (:ddkilzer)
Reported Monday, July 10, 2006 1:29:24 AM UTC
I got a type error when loading Dean Edwards' JavaScript Compressor/Obfuscator (see URL).  This error needs to be reduced. [22954] http://dean.edwards.name/packer/packer-p.js line 1: TypeError: Value undefined (result of expression c.valueOf.prototype.specialize) is not object. Using Safari 2.0.4 (419.3) with locally-built WebKit r15267 with a WIP patch for Bug 9179 on Mac OS X 10.4.7 (8J135/PowerPC).
Attachments
JS snippet demonstrating js bug (361 bytes, application/x-javascript)
2006-09-27 14:51 PDT, allan28
no flags
Test case (380 bytes, text/html)
2007-01-07 20:38 PST, David Kilzer (:ddkilzer)
no flags
Patch v1 (4.04 KB, patch)
2007-01-28 11:08 PST, David Kilzer (:ddkilzer)
darin: review+
allan28
Comment 1 Wednesday, September 27, 2006 10:51:02 PM UTC
Created attachment 10808 [details] JS snippet demonstrating js bug Looks to be problem with creating new from "reference"? "new this.valueOf" causes new object in Firefox but not Safari. Reduced code from Dean Edwards ie7.js, which looks to use the same OO routines (the packer is obfuscated).
David Kilzer (:ddkilzer)
Comment 2 Monday, January 8, 2007 4:38:30 AM UTC
Created attachment 12291 [details] Test case Wrapped Attachment 10808 [details] in <script></script> tags.
David Kilzer (:ddkilzer)
Comment 3 Saturday, January 27, 2007 12:01:47 AM UTC
(In reply to comment #2) > Created an attachment (id=12291) [edit] > Test case > > Wrapped Attachment 10808 [details] [edit] in <script></script> tags. Incorrect behavior prints "undefined" in the alert. Correct behavior prints "function() { }" (on multiple lines) in the alert.
David Kilzer (:ddkilzer)
Comment 4 Sunday, January 28, 2007 4:32:43 PM UTC
It appears that assigning new Function() to a variable does not set it's prototype, while assigning an anonymous function does. Thus if you change this line: ICommon.valueOf = new Function("return this"); to this: ICommon.valueOf = function(){ return this; }; the test case will work.
David Kilzer (:ddkilzer)
Comment 5 Sunday, January 28, 2007 7:07:42 PM UTC
This bug is in JavaScriptCore, and exists in shipping Safari 2.0.4 (419.3) on Mac OS X 10.4.8 (8N1037). I also have a patch to fix it.
David Kilzer (:ddkilzer)
Comment 6 Sunday, January 28, 2007 7:08:44 PM UTC
Created attachment 12727 [details] Patch v1 Proposed fix.
David Kilzer (:ddkilzer)
Comment 7 Sunday, January 28, 2007 7:23:33 PM UTC
(In reply to comment #6) > Created an attachment (id=12727) [edit] > Patch v1 > Proposed fix. Note that all JavaScriptCore tests and all layout tests pass with this change.
Darin Adler
Comment 8 Monday, January 29, 2007 2:30:05 AM UTC
Comment on attachment 12727 [details] Patch v1 r=me
David Kilzer (:ddkilzer)
Comment 9 Monday, January 29, 2007 2:50:20 AM UTC
Committed revision 19203.
Note You need to log in before you can comment on or make changes to this bug.