This is an incremental refactoring to introduce constructorCallbackCustom(). See bug 102763.
Created attachment 175142 [details] Patch
Comment on attachment 175142 [details] Patch Ok. This seems to increase the amount of code we generate slightly, but I'm willing to go with it.
Comment on attachment 175142 [details] Patch Attachment 175142 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/14919013 New failing tests: fast/dom/call-a-constructor-as-a-function.html
Comment on attachment 175142 [details] Patch > fast/dom/call-a-constructor-as-a-function.html This patch is wrong. We need to check if we're in a constructor or not before sorting overloaded constructor callbacks. Otherwise, we cannot distinguish 'WebSocket()' from 'new WebSocket()'. 'WebSocket()' should be 'Constructor cannot be called as a function' error, and 'new WebSocket()' should be 'Not enough arguments' error.
I see. We need to complain about being called as a function (rather than a constructor) before we figure out if we've got the right parameters.