I have encountered a strange error with the latest nightlys (rev. 34824). Special switch statements seem to modifiy the function context (aka this) and set if to the value "false". This can be observed in this simple example. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <body> <script type="text/javascript" charset="utf-8"> function test() { alert(this == switchFunction.call(this, 12)); } function switchFunction(val) { switch (val) { case this: break; default: break; } return this; } test(); </script> </body> </html>
Created attachment 22028 [details] Test case for this bug Example which shows this problem. Other browser including Safari 3.1.1 return "true" while the current nightly returns "false"
<rdar://problem/6048093>
Created attachment 22033 [details] Codegen dump The problem is that it is writing the result of stricteq to lr2, which is 'this'. I will fix this after dinner.
Created attachment 22034 [details] Proposed patch (without tests) Here's a patch. I will add tests to fast/js/codegen-temporaries for both the 'this' and local variable cases.
Comment on attachment 22034 [details] Proposed patch (without tests) Patch looks good. r=me But why not include the tests with the patch next time?
(In reply to comment #5) > (From update of attachment 22034 [details] [edit]) > Patch looks good. r=me > > But why not include the tests with the patch next time? Going out for a Canada Day dinner and didn't have the time.
Landed in r34940.
Awesome. This was really quick! Works for me.