test262: @isConstructor incorrectly thinks Math.cos is a constructor test262/test/built-ins/Array/of/return-a-new-array-object.js @isConstructor just checks that the ConstructData is not None. However, host functions return ConstructType::Host even if their default behavior is to throw an exception that it should not be used as a constructor. We could return ConstructType::None for these default cases.
Created attachment 291596 [details] [PATCH] Proposed Fix
Created attachment 291599 [details] [PATCH] Proposed Fix Some additional test cases.
Comment on attachment 291599 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=291599&action=review r=me > JSTests/stress/is-constructor.js:6 > +let isConstructor = createBuiltin("(function(c) { return @isConstructor(c); })"); This is a nice test.
Comment on attachment 291599 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=291599&action=review r=me >> JSTests/stress/is-constructor.js:6 >> +let isConstructor = createBuiltin("(function(c) { return @isConstructor(c); })"); > > This is a nice test. This is a nice test. > Source/JavaScriptCore/runtime/JSFunction.cpp:576 > + if (thisObject->nativeConstructor() == callHostFunctionAsConstructor) Do we get a new kind of error message when we try to "new" non constructor host functions?
Comment on attachment 291599 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=291599&action=review >> Source/JavaScriptCore/runtime/JSFunction.cpp:576 >> + if (thisObject->nativeConstructor() == callHostFunctionAsConstructor) > > Do we get a new kind of error message when we try to "new" non constructor host functions? Nope, `new Math.cos` produces the exact same error message!
Comment on attachment 291599 [details] [PATCH] Proposed Fix Clearing flags on attachment: 291599 Committed r207347: <http://trac.webkit.org/changeset/207347>
All reviewed patches have been landed. Closing bug.