RESOLVED FIXED 152985
ES6: Classes: Should be allowed to create a static method with name "arguments"
https://bugs.webkit.org/show_bug.cgi?id=152985
Summary ES6: Classes: Should be allowed to create a static method with name "arguments"
Joseph Pecoraro
Reported 2016-01-11 14:21:50 PST
* SUMMARY ES6: Classes: Should be allowed to create a static method with name "arguments". jsc> class MyClass { static arguments() { } } Exception: TypeError: Attempting to change configurable attribute of unconfigurable property. * NOTES - Behaves fine in Firefox and Chrome. - See related bug 144281.
Attachments
Patch (10.53 KB, patch)
2016-05-01 15:09 PDT, GSkachkov
no flags
Patch (9.30 KB, patch)
2016-05-02 06:05 PDT, GSkachkov
no flags
Patch (25.86 KB, patch)
2016-05-07 16:25 PDT, GSkachkov
no flags
Patch (25.68 KB, patch)
2016-05-08 00:19 PDT, GSkachkov
no flags
Patch (33.67 KB, patch)
2016-05-08 04:18 PDT, GSkachkov
no flags
Patch (72.36 KB, patch)
2016-05-18 14:59 PDT, GSkachkov
no flags
Archive of layout-test-results from ews122 for ios-simulator-wk2 (9.85 MB, application/zip)
2016-05-18 16:23 PDT, Build Bot
no flags
Patch (72.50 KB, patch)
2016-05-23 12:58 PDT, GSkachkov
no flags
Patch (72.28 KB, patch)
2016-05-25 13:02 PDT, GSkachkov
no flags
Patch (108.24 KB, patch)
2016-06-13 11:44 PDT, GSkachkov
no flags
Patch (108.27 KB, patch)
2016-06-13 12:01 PDT, GSkachkov
no flags
Archive of layout-test-results from ews103 for mac-yosemite (1.08 MB, application/zip)
2016-06-13 12:56 PDT, Build Bot
no flags
Archive of layout-test-results from ews106 for mac-yosemite-wk2 (791.05 KB, application/zip)
2016-06-13 12:58 PDT, Build Bot
no flags
Archive of layout-test-results from ews126 for ios-simulator-wk2 (652.43 KB, application/zip)
2016-06-13 13:09 PDT, Build Bot
no flags
Archive of layout-test-results from ews117 for mac-yosemite (1.02 MB, application/zip)
2016-06-13 13:12 PDT, Build Bot
no flags
Patch (109.01 KB, patch)
2016-06-14 13:25 PDT, GSkachkov
no flags
Patch (108.98 KB, patch)
2016-06-14 13:42 PDT, GSkachkov
no flags
Patch (105.36 KB, patch)
2016-08-24 14:30 PDT, GSkachkov
no flags
Patch (106.45 KB, patch)
2016-08-24 16:17 PDT, GSkachkov
no flags
Archive of layout-test-results from ews101 for mac-yosemite (1.02 MB, application/zip)
2016-08-24 17:20 PDT, Build Bot
no flags
Archive of layout-test-results from ews116 for mac-yosemite (1.50 MB, application/zip)
2016-08-24 17:27 PDT, Build Bot
no flags
Archive of layout-test-results from ews121 for ios-simulator-elcapitan-wk2 (753.66 KB, application/zip)
2016-08-24 17:29 PDT, Build Bot
no flags
Archive of layout-test-results from ews107 for mac-yosemite-wk2 (1.01 MB, application/zip)
2016-08-24 17:35 PDT, Build Bot
no flags
Patch (106.34 KB, patch)
2016-08-25 02:09 PDT, GSkachkov
no flags
Archive of layout-test-results from ews101 for mac-yosemite (775.26 KB, application/zip)
2016-08-25 03:10 PDT, Build Bot
no flags
Archive of layout-test-results from ews106 for mac-yosemite-wk2 (891.37 KB, application/zip)
2016-08-25 03:15 PDT, Build Bot
no flags
Archive of layout-test-results from ews116 for mac-yosemite (1.47 MB, application/zip)
2016-08-25 03:18 PDT, Build Bot
no flags
Archive of layout-test-results from ews121 for ios-simulator-elcapitan-wk2 (623.82 KB, application/zip)
2016-08-25 03:27 PDT, Build Bot
no flags
Patch (94.32 KB, patch)
2016-08-25 13:18 PDT, GSkachkov
no flags
Archive of layout-test-results from ews102 for mac-yosemite (1.01 MB, application/zip)
2016-08-25 14:21 PDT, Build Bot
no flags
Archive of layout-test-results from ews107 for mac-yosemite-wk2 (809.93 KB, application/zip)
2016-08-25 14:25 PDT, Build Bot
no flags
Archive of layout-test-results from ews123 for ios-simulator-elcapitan-wk2 (694.26 KB, application/zip)
2016-08-25 14:35 PDT, Build Bot
no flags
Archive of layout-test-results from ews112 for mac-yosemite (1.75 MB, application/zip)
2016-08-25 16:32 PDT, Build Bot
no flags
Patch (99.63 KB, patch)
2016-08-26 12:26 PDT, GSkachkov
no flags
Patch (107.11 KB, patch)
2016-09-03 15:42 PDT, GSkachkov
no flags
Patch (111.06 KB, patch)
2016-09-09 16:26 PDT, GSkachkov
no flags
Patch (111.07 KB, patch)
2016-09-09 17:31 PDT, GSkachkov
no flags
Archive of layout-test-results from ews101 for mac-yosemite (1010.40 KB, application/zip)
2016-09-09 18:38 PDT, Build Bot
no flags
Archive of layout-test-results from ews105 for mac-yosemite-wk2 (904.39 KB, application/zip)
2016-09-09 18:42 PDT, Build Bot
no flags
Archive of layout-test-results from ews115 for mac-yosemite (1.49 MB, application/zip)
2016-09-09 18:53 PDT, Build Bot
no flags
Archive of layout-test-results from ews125 for ios-simulator-elcapitan-wk2 (12.23 MB, application/zip)
2016-09-09 20:53 PDT, Build Bot
no flags
Patch (111.07 KB, patch)
2016-09-10 00:07 PDT, GSkachkov
keith_miller: review+
GSkachkov
Comment 1 2016-05-01 03:38:59 PDT
I think should be the same for name 'caller' and getter and setter. class A { static get caller() { return '';} }
GSkachkov
Comment 2 2016-05-01 15:09:29 PDT
Created attachment 277870 [details] Patch Patch
Saam Barati
Comment 3 2016-05-01 16:21:58 PDT
Comment on attachment 277870 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=277870&action=review > Source/JavaScriptCore/ChangeLog:10 > + class A { static argumetns() { return 'value'; } } typo: 'argumetns' => 'arguments' > Source/JavaScriptCore/runtime/JSFunction.cpp:368 > + if (!(thisObject->jsExecutable()->isClass() && slot.internalMethodType() == PropertySlot::InternalMethodType::GetOwnProperty)) { Why do we only care to skip this if we're doing a GetOwnProperty access on a class? We will not skip if we're doing a normal Get or VMInquiry or HasProperty? > Source/JavaScriptCore/runtime/JSFunction.cpp:399 > + bool result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot); > + if (!result) { > + GetterSetter* errorGetterSetter = thisObject->jsExecutable()->isClassConstructorFunction() || thisObject->jsExecutable()->parseMode() == SourceParseMode::MethodMode > + ? thisObject->globalObject()->throwTypeErrorArgumentsAndCallerGetterSetter(exec->vm()) > + : thisObject->globalObject()->throwTypeErrorGetterSetter(exec->vm()); > + > + thisObject->putDirectAccessor(exec, propertyName, errorGetterSetter, DontDelete | DontEnum | Accessor); > + result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot); > + ASSERT(result); > + } > + return result; Can we write a helper for the common code?
GSkachkov
Comment 4 2016-05-02 06:05:53 PDT
Created attachment 277905 [details] Patch Fix comments
Joseph Pecoraro
Comment 5 2016-05-02 10:52:40 PDT
I see you are adding a new test. You should update the existing test that references this bug: > LayoutTests/js/script-tests/keyword-method-names.js:79 > + // FIXME: <https://webkit.org/b/152985> ES6: Classes: Should be allowed to create a static method with name "arguments" > + // static arguments() { }
GSkachkov
Comment 6 2016-05-07 01:04:18 PDT
I hope to upload soon new patch with fixes of your and Saam comments
GSkachkov
Comment 7 2016-05-07 16:25:58 PDT
Created attachment 278348 [details] Patch New patch for review
GSkachkov
Comment 8 2016-05-08 00:19:32 PDT
Created attachment 278358 [details] Patch Patch with rebase
GSkachkov
Comment 9 2016-05-08 04:18:34 PDT
Created attachment 278360 [details] Patch More tests
Keith Miller
Comment 10 2016-05-10 15:24:27 PDT
Comment on attachment 278360 [details] Patch I'm a little confused, if I have read the spec correctly (https://tc39.github.io/ecma262/#sec-forbidden-extensions), it looks like "arguments" and "caller" should not be on any non-strict function anyway. It seems like we should just get rid of those properties and make them act like normal for non-strict functions. I'm pretty sure that all class constructors are strict anyway so I think this would entirely fix this issue. Is there something I am missing?
GSkachkov
Comment 11 2016-05-11 11:00:30 PDT
(In reply to comment #10) > Comment on attachment 278360 [details] > Patch > > I'm a little confused, if I have read the spec correctly > (https://tc39.github.io/ecma262/#sec-forbidden-extensions), it looks like > "arguments" and "caller" should not be on any non-strict function anyway. It Hmm, I did not find that about non-strict function in this spec. Only about function in strict-mode and arrow function, class declaration and etc. > seems like we should just get rid of those properties and make them act like > normal for non-strict functions. I'm pretty sure that all class constructors > are strict anyway so I think this would entirely fix this issue. Is there > something I am missing? Currently my patch does not cover arrow function, GeneratorDeclaration, GeneratorExpression and functions created using the bind. So I'll add try to cover those cases
GSkachkov
Comment 12 2016-05-18 14:59:14 PDT
Created attachment 279291 [details] Patch New patch
Build Bot
Comment 13 2016-05-18 16:23:32 PDT
Comment on attachment 279291 [details] Patch Attachment 279291 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/1344770 New failing tests: fast/scrolling/ios/scrollTo-at-page-load.html
Build Bot
Comment 14 2016-05-18 16:23:36 PDT
Created attachment 279313 [details] Archive of layout-test-results from ews122 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews122 Port: ios-simulator-wk2 Platform: Mac OS X 10.11.4
GSkachkov
Comment 15 2016-05-23 12:58:28 PDT
Created attachment 279579 [details] Patch Small fixes
GSkachkov
Comment 16 2016-05-25 13:02:25 PDT
Created attachment 279797 [details] Patch Rebase
Keith Miller
Comment 17 2016-05-25 14:04:32 PDT
(In reply to comment #11) > (In reply to comment #10) > > Comment on attachment 278360 [details] > > Patch > > > > I'm a little confused, if I have read the spec correctly > > (https://tc39.github.io/ecma262/#sec-forbidden-extensions), it looks like > > "arguments" and "caller" should not be on any non-strict function anyway. It > Hmm, I did not find that about non-strict function in this spec. Only about > function in strict-mode and arrow function, class declaration and etc. > > seems like we should just get rid of those properties and make them act like > > normal for non-strict functions. I'm pretty sure that all class constructors > > are strict anyway so I think this would entirely fix this issue. Is there > > something I am missing? > > Currently my patch does not cover arrow function, GeneratorDeclaration, > GeneratorExpression and functions created using the bind. So I'll add try to > cover those cases I think you might have misunderstood my comment. I think that all strict functions should not have an "arguments" or "caller" property. Instead those properties should be on %FunctionPrototype% and should throw a type error on get or set. For example, function foo() { "use strict"; return 1; } class bar {} Object.getOwnPropertyDescriptor(foo, "arguments") // undefined Object.getOwnPropertyDescriptor(bar, "arguments") // undefined Object.getOwnPropertyDescriptor(foo, "caller") // undefined Object.getOwnPropertyDescriptor(bar, "caller") // undefined Object.getOwnPropertyDescriptor(foo.__proto__, "arguments") // { get: () => { throw new TypeError(), set: () => { throw new TypeError() }, writable: false, enumerable: false } Object.getOwnPropertyDescriptor(foo.__proto__, "caller") // { get: () => { throw new TypeError(), set: () => { throw new TypeError() }, writable: false, enumerable: false } Object.getOwnPropertyDescriptor(bar.__proto__, "arguments") // { get: () => { throw new TypeError(), set: () => { throw new TypeError() }, writable: false, enumerable: false } Object.getOwnPropertyDescriptor(bar.__proto__, "caller") // { get: () => { throw new TypeError(), set: () => { throw new TypeError() }, writable: false, enumerable: false } Does my example seem correct to you based on the spec?
GSkachkov
Comment 18 2016-05-25 22:31:21 PDT
(In reply to comment #17) > (In reply to comment #11) > > (In reply to comment #10) > > > Comment on attachment 278360 [details] > > > Patch > > > > > > I'm a little confused, if I have read the spec correctly > > > (https://tc39.github.io/ecma262/#sec-forbidden-extensions), it looks like > > > "arguments" and "caller" should not be on any non-strict function anyway. It > > Hmm, I did not find that about non-strict function in this spec. Only about > > function in strict-mode and arrow function, class declaration and etc. > > > seems like we should just get rid of those properties and make them act like > > > normal for non-strict functions. I'm pretty sure that all class constructors > > > are strict anyway so I think this would entirely fix this issue. Is there > > > something I am missing? > > > > Currently my patch does not cover arrow function, GeneratorDeclaration, > > GeneratorExpression and functions created using the bind. So I'll add try to > > cover those cases > > I think you might have misunderstood my comment. I think that all strict > functions should not have an "arguments" or "caller" property. Instead those > properties should be on %FunctionPrototype% and should throw a type error on > get or set. > > For example, > function foo() { > "use strict"; > return 1; > } > > class bar {} > > > Object.getOwnPropertyDescriptor(foo, "arguments") // undefined > Object.getOwnPropertyDescriptor(bar, "arguments") // undefined > Object.getOwnPropertyDescriptor(foo, "caller") // undefined > Object.getOwnPropertyDescriptor(bar, "caller") // undefined > > Object.getOwnPropertyDescriptor(foo.__proto__, "arguments") // { get: () => > { throw new TypeError(), set: () => { throw new TypeError() }, writable: > false, enumerable: false } > Object.getOwnPropertyDescriptor(foo.__proto__, "caller") // { get: () => { > throw new TypeError(), set: () => { throw new TypeError() }, writable: > false, enumerable: false } > > Object.getOwnPropertyDescriptor(bar.__proto__, "arguments") // { get: () => > { throw new TypeError(), set: () => { throw new TypeError() }, writable: > false, enumerable: false } > Object.getOwnPropertyDescriptor(bar.__proto__, "caller") // { get: () => { > throw new TypeError(), set: () => { throw new TypeError() }, writable: > false, enumerable: false } > > Does my example seem correct to you based on the spec? I got it. I think you are right. It should be in this way.
GSkachkov
Comment 19 2016-06-13 11:44:24 PDT
Created attachment 281184 [details] Patch Refactored patch
GSkachkov
Comment 20 2016-06-13 12:01:01 PDT
Created attachment 281186 [details] Patch Fix build
Build Bot
Comment 21 2016-06-13 12:56:30 PDT
Comment on attachment 281186 [details] Patch Attachment 281186 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/1496045 Number of test failures exceeded the failure limit.
Build Bot
Comment 22 2016-06-13 12:56:34 PDT
Created attachment 281189 [details] Archive of layout-test-results from ews103 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews103 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 23 2016-06-13 12:58:01 PDT
Comment on attachment 281186 [details] Patch Attachment 281186 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/1496044 Number of test failures exceeded the failure limit.
Build Bot
Comment 24 2016-06-13 12:58:04 PDT
Created attachment 281190 [details] Archive of layout-test-results from ews106 for mac-yosemite-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews106 Port: mac-yosemite-wk2 Platform: Mac OS X 10.10.5
Build Bot
Comment 25 2016-06-13 13:08:57 PDT
Comment on attachment 281186 [details] Patch Attachment 281186 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/1496067 New failing tests: js/kde/function_arguments.html
Build Bot
Comment 26 2016-06-13 13:09:00 PDT
Created attachment 281191 [details] Archive of layout-test-results from ews126 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews126 Port: ios-simulator-wk2 Platform: Mac OS X 10.11.4
Build Bot
Comment 27 2016-06-13 13:12:21 PDT
Comment on attachment 281186 [details] Patch Attachment 281186 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/1496051 Number of test failures exceeded the failure limit.
Build Bot
Comment 28 2016-06-13 13:12:24 PDT
Created attachment 281193 [details] Archive of layout-test-results from ews117 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews117 Port: mac-yosemite Platform: Mac OS X 10.10.5
GSkachkov
Comment 29 2016-06-14 13:25:23 PDT
Created attachment 281274 [details] Patch Fix webkit tests
GSkachkov
Comment 30 2016-06-14 13:42:26 PDT
Created attachment 281276 [details] Patch Made rebase
Keith Miller
Comment 31 2016-06-16 12:02:02 PDT
Comment on attachment 281276 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=281276&action=review So I'm a little confused what this patch changed. It would be great if the changelog went into more detail on what the code you changed does. It might also be helpful if you explained why you made the changes you did. Also, is there a reason why caller and arguments are not just normal static, lazy properties? Then you can have JSFunction intercept the lookup of arguments and caller for non-strict functions and it will probably make this code much simpler. > Source/JavaScriptCore/runtime/FunctionPrototype.cpp:247 > + if (thisObject->inherits(JSFunction::info())) { > + JSFunction* function = jsCast<JSFunction*>(thisObject); You can just do if (JSFunction* function = jsDynamicCast<JSFunction*>(JSValue::decode(thisValue))) > Source/JavaScriptCore/runtime/FunctionPrototype.cpp:254 > + ASSERT(!function->isHostFunction()); Is this code reachable?
GSkachkov
Comment 32 2016-06-16 12:51:23 PDT
(In reply to comment #31) > Comment on attachment 281276 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=281276&action=review > > So I'm a little confused what this patch changed. It would be great if the > changelog went into more detail on what the code you changed does. It might > also be helpful if you explained why you made the changes you did. Also, is > there a reason why caller and arguments are not just normal static, lazy > properties? Then you can have JSFunction intercept the lookup of arguments > and caller for non-strict functions and it will probably make this code much > simpler. OK. I'll try explain my changes in more details in ChangeLog. I think mostly my patch is moving all logic that is related to caller/arguments from JSFunction to FunctionPrototype with small adjustments. The main reason why I moved caller/arguments from JSFunction to FunctionPrototype class, because I decided to have all code that is related to caller/arguments in one place: So code that handle cases when lookup of arguments/caller of function and arguments/caller of function prototype in one place: var foo = function () {}; var args = foo.arguments; // case 1 var proto = foo.__proto__; var caller = proto.caller; // case 2 Do think it is better to split this logic between JSFunction and FunctionPrototype classes? > > > Source/JavaScriptCore/runtime/FunctionPrototype.cpp:247 > > + if (thisObject->inherits(JSFunction::info())) { > > + JSFunction* function = jsCast<JSFunction*>(thisObject); > > You can just do if (JSFunction* function = > jsDynamicCast<JSFunction*>(JSValue::decode(thisValue))) > > > Source/JavaScriptCore/runtime/FunctionPrototype.cpp:254 > > + ASSERT(!function->isHostFunction()); > > Is this code reachable?
GSkachkov
Comment 33 2016-08-24 14:30:54 PDT
Created attachment 286891 [details] Patch Rebase the patch
GSkachkov
Comment 34 2016-08-24 16:17:05 PDT
Created attachment 286904 [details] Patch Rebase the patch #2
Build Bot
Comment 35 2016-08-24 17:20:32 PDT
Comment on attachment 286904 [details] Patch Attachment 286904 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/1936681 New failing tests: js/class-method-and-constructor-properties.html inspector/model/remote-object-get-properties.html js/basic-strict-mode.html js/Object-getOwnPropertyNames.html
Build Bot
Comment 36 2016-08-24 17:20:36 PDT
Created attachment 286917 [details] Archive of layout-test-results from ews101 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews101 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 37 2016-08-24 17:27:37 PDT
Comment on attachment 286904 [details] Patch Attachment 286904 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/1936684 New failing tests: js/class-method-and-constructor-properties.html inspector/model/remote-object-get-properties.html js/basic-strict-mode.html js/Object-getOwnPropertyNames.html
Build Bot
Comment 38 2016-08-24 17:27:41 PDT
Created attachment 286918 [details] Archive of layout-test-results from ews116 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews116 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 39 2016-08-24 17:29:43 PDT
Comment on attachment 286904 [details] Patch Attachment 286904 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/1936663 New failing tests: js/class-method-and-constructor-properties.html js/basic-strict-mode.html js/Object-getOwnPropertyNames.html
Build Bot
Comment 40 2016-08-24 17:29:48 PDT
Created attachment 286920 [details] Archive of layout-test-results from ews121 for ios-simulator-elcapitan-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews121 Port: ios-simulator-elcapitan-wk2 Platform: Mac OS X 10.11.5
Build Bot
Comment 41 2016-08-24 17:35:10 PDT
Comment on attachment 286904 [details] Patch Attachment 286904 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/1936721 New failing tests: js/class-method-and-constructor-properties.html inspector/model/remote-object-get-properties.html js/basic-strict-mode.html js/Object-getOwnPropertyNames.html
Build Bot
Comment 42 2016-08-24 17:35:14 PDT
Created attachment 286921 [details] Archive of layout-test-results from ews107 for mac-yosemite-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-yosemite-wk2 Platform: Mac OS X 10.10.5
GSkachkov
Comment 43 2016-08-25 02:09:02 PDT
Created attachment 286952 [details] Patch Fix brocken tests
Build Bot
Comment 44 2016-08-25 03:10:20 PDT
Comment on attachment 286952 [details] Patch Attachment 286952 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/1939137 New failing tests: js/class-method-and-constructor-properties.html inspector/model/remote-object-get-properties.html
Build Bot
Comment 45 2016-08-25 03:10:25 PDT
Created attachment 286955 [details] Archive of layout-test-results from ews101 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews101 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 46 2016-08-25 03:15:41 PDT
Comment on attachment 286952 [details] Patch Attachment 286952 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/1939142 New failing tests: js/class-method-and-constructor-properties.html inspector/model/remote-object-get-properties.html
Build Bot
Comment 47 2016-08-25 03:15:46 PDT
Created attachment 286956 [details] Archive of layout-test-results from ews106 for mac-yosemite-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews106 Port: mac-yosemite-wk2 Platform: Mac OS X 10.10.5
Build Bot
Comment 48 2016-08-25 03:18:00 PDT
Comment on attachment 286952 [details] Patch Attachment 286952 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/1939140 New failing tests: js/class-method-and-constructor-properties.html inspector/model/remote-object-get-properties.html
Build Bot
Comment 49 2016-08-25 03:18:06 PDT
Created attachment 286957 [details] Archive of layout-test-results from ews116 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews116 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 50 2016-08-25 03:27:05 PDT
Comment on attachment 286952 [details] Patch Attachment 286952 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/1939154 New failing tests: js/class-method-and-constructor-properties.html
Build Bot
Comment 51 2016-08-25 03:27:10 PDT
Created attachment 286958 [details] Archive of layout-test-results from ews121 for ios-simulator-elcapitan-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews121 Port: ios-simulator-elcapitan-wk2 Platform: Mac OS X 10.11.5
GSkachkov
Comment 52 2016-08-25 04:14:55 PDT
Comment on attachment 286952 [details] Patch F
GSkachkov
Comment 53 2016-08-25 13:18:18 PDT
Created attachment 286999 [details] Patch Refactoring of the patch
GSkachkov
Comment 54 2016-08-25 13:53:49 PDT
(In reply to comment #31) > Comment on attachment 281276 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=281276&action=review > > So I'm a little confused what this patch changed. It would be great if the > changelog went into more detail on what the code you changed does. It might > also be helpful if you explained why you made the changes you did. Also, is > there a reason why caller and arguments are not just normal static, lazy > properties? Then you can have JSFunction intercept the lookup of arguments > and caller for non-strict functions and it will probably make this code much > simpler. > I've made refactoring of the Patch as you suggested, so it allow to decrease size of changes
Build Bot
Comment 55 2016-08-25 14:21:55 PDT
Comment on attachment 286999 [details] Patch Attachment 286999 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/1941656 New failing tests: js/class-method-and-constructor-properties.html
Build Bot
Comment 56 2016-08-25 14:21:59 PDT
Created attachment 287017 [details] Archive of layout-test-results from ews102 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews102 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 57 2016-08-25 14:25:36 PDT
Comment on attachment 286999 [details] Patch Attachment 286999 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/1941659 New failing tests: js/class-method-and-constructor-properties.html
Build Bot
Comment 58 2016-08-25 14:25:40 PDT
Created attachment 287018 [details] Archive of layout-test-results from ews107 for mac-yosemite-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-yosemite-wk2 Platform: Mac OS X 10.10.5
Keith Miller
Comment 59 2016-08-25 14:30:23 PDT
Comment on attachment 286999 [details] Patch Looks like EWS is angry that you deleted the class-method-and-constructor-properties.js file. Also, can you explain why "arguments" and "caller" are on Function prototype, I'm not sure why I follow that they need to be there?
Build Bot
Comment 60 2016-08-25 14:35:27 PDT
Comment on attachment 286999 [details] Patch Attachment 286999 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/1941670 New failing tests: js/class-method-and-constructor-properties.html
Build Bot
Comment 61 2016-08-25 14:35:31 PDT
Created attachment 287020 [details] Archive of layout-test-results from ews123 for ios-simulator-elcapitan-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews123 Port: ios-simulator-elcapitan-wk2 Platform: Mac OS X 10.11.5
Build Bot
Comment 62 2016-08-25 16:32:36 PDT
Comment on attachment 286999 [details] Patch Attachment 286999 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/1942205 New failing tests: js/class-method-and-constructor-properties.html
Build Bot
Comment 63 2016-08-25 16:32:42 PDT
Created attachment 287042 [details] Archive of layout-test-results from ews112 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews112 Port: mac-yosemite Platform: Mac OS X 10.10.5
GSkachkov
Comment 64 2016-08-26 12:26:13 PDT
GSkachkov
Comment 65 2016-08-26 12:40:34 PDT
(In reply to comment #59) > Comment on attachment 286999 [details] > Patch > > Looks like EWS is angry that you deleted the > class-method-and-constructor-properties.js file. Also, can you explain why > "arguments" and "caller" are on Function prototype, I'm not sure why I > follow that they need to be there? I move this to the Function prototype to allow execute following code: var f = function () {} f.__proto__.caller; //Should raise type error I've checked in Chrome and FireFox: 1) Chrome returns TypeError: 'caller' and 'arguments' are restricted function properties and cannot be accessed in this context 2) FireFox return just null.
Keith Miller
Comment 67 2016-08-26 14:31:06 PDT
Comment on attachment 287129 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=287129&action=review I think this is getting close but I still think there are a few things that need to be changed. > Source/JavaScriptCore/ChangeLog:62 > + * runtime/Executable.h: > + * runtime/FunctionPrototype.cpp: > + (JSC::FunctionPrototype::defineOwnProperty): > + (JSC::FunctionPrototype::getThrowTypeErrorOwnPropertySlot): > + (JSC::FunctionPrototype::getOwnPropertySlot): > + (JSC::FunctionPrototype::getOwnNonIndexPropertyNames): > + (JSC::functionProtoFuncBind): Deleted. > + * runtime/FunctionPrototype.h: > + * runtime/JSFunction.cpp: > + (JSC::JSFunction::getOwnPropertySlot): > + (JSC::JSFunction::getOwnNonIndexPropertyNames): > + (JSC::JSFunction::put): > + (JSC::JSFunction::deleteProperty): > + (JSC::JSFunction::defineOwnProperty): > + * runtime/JSFunction.h: > + * runtime/JSObject.cpp: > + (JSC::ordinarySetSlow): > + (JSC::JSObject::getOwnPropertyDescriptor): > + * runtime/PropertySlot.h: > + (JSC::PropertySlot::PropertySlot): > + (JSC::PropertySlot::setIsClassMethod): > + (JSC::PropertySlot::isClassMethod): > + (JSC::PropertySlot::isTaintedByOpaqueObject): Deleted. Delete. > Source/JavaScriptCore/runtime/FunctionPrototype.cpp:184 > + if (!object->inherits(JSFunction::info())) > + return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException); I don't think you need this check. object should always be FunctionPrototype*. > Source/JavaScriptCore/runtime/FunctionPrototype.cpp:204 > + JSFunction* thisObject = jsCast<JSFunction*>(object); > + if (thisObject->isHostOrBuiltinFunction()) > + return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException); > + > + if (propertyName == exec->propertyNames().arguments) { > + if (thisObject->jsExecutable()->isStrictMode() || thisObject->jsExecutable()->isArrowFunction()) { > + PropertySlot slot(thisObject, PropertySlot::InternalMethodType::VMInquiry); > + if (!Base::getOwnPropertySlot(thisObject, exec, propertyName, slot)) > + thisObject->putDirectAccessor(exec, propertyName, thisObject->globalObject()->throwTypeErrorArgumentsCalleeAndCallerGetterSetter(), DontDelete | DontEnum | Accessor); > + return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException); > + } > + } else if (propertyName == exec->propertyNames().caller) { > + if (thisObject->jsExecutable()->isStrictMode() || thisObject->jsExecutable()->isArrowFunction()) { > + PropertySlot slot(thisObject, PropertySlot::InternalMethodType::VMInquiry); > + if (!Base::getOwnPropertySlot(thisObject, exec, propertyName, slot)) > + thisObject->putDirectAccessor(exec, propertyName, thisObject->globalObject()->throwTypeErrorArgumentsCalleeAndCallerGetterSetter(), DontDelete | DontEnum | Accessor); > + return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException); > + } > + } I think this could just be FunctionPrototype* thisObject = jsCast<FunctionPrototype*>(object); You would need to add a reifyLazyPropertyIfNeeded function to FunctionPrototype that handles arguments and length like: void FunctionPrototype::reifyLazyPropertyIfNeeded(exec, propertyName) { if (propertyName == exec->propertyNames().arguments || propertyName == exec->propertyNames().caller) // Do reification of arguments/caller to type error getter/setter if needed. Base::reifyLazyPropertyIfNeeded(exec, propertyName); } > Source/JavaScriptCore/runtime/FunctionPrototype.cpp:231 > + if (propertyName == exec->propertyNames().caller || propertyName == exec->propertyNames().arguments) { > + // For non-host functions, don't let these properties by deleted - except by DefineOwnProperty. > + if (slot.thisValue().inherits(JSFunction::info())) { > + JSFunction* thisObject = jsDynamicCast<JSFunction*>(slot.thisValue()); > + if (!thisObject->isHostOrBuiltinFunction()) > + return getThrowTypeErrorOwnPropertySlot(object, exec, propertyName, slot); > + } else if (slot.thisValue().inherits(FunctionPrototype::info())) > + return getThrowTypeErrorOwnPropertySlot(object, exec, propertyName, slot); > + } This could just be (if you do my change above): FunctionPrototype* thisObject = jsCast<FunctionPrototype*>(object); thisObject->reifyLazyPropertyIfNeeded(exec, propertyName); > Source/JavaScriptCore/runtime/FunctionPrototype.cpp:246 > + VM& vm = exec->vm(); > + // Make sure prototype has been reified. > + PropertySlot slot(thisObject, PropertySlot::InternalMethodType::VMInquiry); > + thisObject->methodTable(vm)->getOwnPropertySlot(thisObject, exec, vm.propertyNames->prototype, slot); > + > + propertyNames.add(vm.propertyNames->arguments); > + propertyNames.add(vm.propertyNames->caller); Ditto. > Source/JavaScriptCore/runtime/JSFunction.cpp:402 > + if (!thisObject->jsExecutable()->isStrictMode()) { > + propertyNames.add(vm.propertyNames->arguments); > + propertyNames.add(vm.propertyNames->caller); > + } You might need to change this to work with my proposal for reification. > Source/JavaScriptCore/runtime/JSObject.cpp:517 > + // We do not update the value of caller & arguments properties in function Why do we not allow the user to set arguments on a strict function? > Source/JavaScriptCore/runtime/JSObject.cpp:518 > + if (object->inherits(JSFunction::info())) I think we usually just do this with jsDynamicCast<JSFunction>(object) > Source/JavaScriptCore/runtime/JSObject.cpp:2858 > + if (propertyName == exec->propertyNames().arguments || propertyName == exec->propertyNames().caller) { > + if (auto thisObject = jsDynamicCast<JSFunction*>(this)) { > + if (!thisObject->isHostFunctionNonInline() && thisObject->jsExecutable()->isClass() && !thisObject->jsExecutable()->isClassConstructorFunction()) > + slot.setIsClassMethod(); > + } > + } What does this do? It doesn't look like you use the isClassMethod bit anywhere?
Keith Miller
Comment 68 2016-08-26 14:53:51 PDT
(In reply to comment #66) > Also there are two tests that covered this case > https://github.com/WebKit/webkit/blob/master/JSTests/test262/test/built-ins/ > Function/prototype/restricted-property-arguments.js and > https://github.com/WebKit/webkit/blob/master/JSTests/test262/test/built-ins/ > Function/prototype/restricted-property-caller.js It would be great if you could also update the expected results for these tests in JSTests/test262.yaml too.
GSkachkov
Comment 69 2016-09-03 15:42:00 PDT
Created attachment 287871 [details] Patch Fix comments&refactoring
GSkachkov
Comment 70 2016-09-04 09:51:01 PDT
Comment on attachment 287129 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=287129&action=review >> Source/JavaScriptCore/ChangeLog:62 >> + (JSC::PropertySlot::isTaintedByOpaqueObject): Deleted. > > Delete. Done >> Source/JavaScriptCore/runtime/FunctionPrototype.cpp:184 >> + return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException); > > I don't think you need this check. object should always be FunctionPrototype*. Remove whole method :-) >> Source/JavaScriptCore/runtime/FunctionPrototype.cpp:204 >> + } > > I think this could just be FunctionPrototype* thisObject = jsCast<FunctionPrototype*>(object); > > You would need to add a reifyLazyPropertyIfNeeded function to FunctionPrototype that handles arguments and length like: > > void FunctionPrototype::reifyLazyPropertyIfNeeded(exec, propertyName) { > if (propertyName == exec->propertyNames().arguments || propertyName == exec->propertyNames().caller) > // Do reification of arguments/caller to type error getter/setter if needed. > Base::reifyLazyPropertyIfNeeded(exec, propertyName); > } Removed whole method >> Source/JavaScriptCore/runtime/FunctionPrototype.cpp:231 >> + } > > This could just be (if you do my change above): > > FunctionPrototype* thisObject = jsCast<FunctionPrototype*>(object); > thisObject->reifyLazyPropertyIfNeeded(exec, propertyName); Removed whole method >> Source/JavaScriptCore/runtime/FunctionPrototype.cpp:246 >> + propertyNames.add(vm.propertyNames->caller); > > Ditto. Removed whole method >> Source/JavaScriptCore/runtime/JSFunction.cpp:402 >> + } > > You might need to change this to work with my proposal for reification. I've just added small check, to add this method for function not in Strict mode >> Source/JavaScriptCore/runtime/JSObject.cpp:517 >> + // We do not update the value of caller & arguments properties in function > > Why do we not allow the user to set arguments on a strict function? Removed whole change >> Source/JavaScriptCore/runtime/JSObject.cpp:2858 >> + } > > What does this do? It doesn't look like you use the isClassMethod bit anywhere? Yes, you are right. It is not used anymore. Removed
Keith Miller
Comment 71 2016-09-06 18:27:20 PDT
Comment on attachment 287871 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=287871&action=review > Source/JavaScriptCore/runtime/JSFunction.cpp:404 > + if (!thisObject->jsExecutable()->isStrictMode()) { Don't you want !thisObject->jsExecutable()->isStrictMode() && !thisObject->jsExecutable()->isES6Function()? Also, does this work with Function.prototype when the arguments property has been deleted? i.e. delete Function.prototype.arguments; for (name in Function.prototype) { if (name !== "arguments") throw new Error("bad name"); }
GSkachkov
Comment 72 2016-09-09 16:26:16 PDT
Created attachment 288449 [details] Patch Small fix & rebase
GSkachkov
Comment 73 2016-09-09 16:36:20 PDT
Comment on attachment 287871 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=287871&action=review >> Source/JavaScriptCore/runtime/JSFunction.cpp:404 >> + if (!thisObject->jsExecutable()->isStrictMode()) { > > Don't you want !thisObject->jsExecutable()->isStrictMode() && !thisObject->jsExecutable()->isES6Function()? > > Also, does this work with Function.prototype when the arguments property has been deleted? i.e. > > delete Function.prototype.arguments; > for (name in Function.prototype) { > if (name !== "arguments") > throw new Error("bad name"); > } Yeah, I've add !thisObject->jsExecutable()->isES6Function() condition to the new patch. In case of 'delete Function.prototype.arguments;' we delete it from FunctionPrototyp(FunctionPrototype.cpp) where it added with property DontEnum, so it will not appear during for..in operation before and after delete operation.
Keith Miller
Comment 74 2016-09-09 16:42:13 PDT
(In reply to comment #73) > Comment on attachment 287871 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=287871&action=review > > >> Source/JavaScriptCore/runtime/JSFunction.cpp:404 > >> + if (!thisObject->jsExecutable()->isStrictMode()) { > > > > Don't you want !thisObject->jsExecutable()->isStrictMode() && !thisObject->jsExecutable()->isES6Function()? > > > > Also, does this work with Function.prototype when the arguments property has been deleted? i.e. > > > > delete Function.prototype.arguments; > > for (name in Function.prototype) { > > if (name !== "arguments") > > throw new Error("bad name"); > > } > > Yeah, I've add !thisObject->jsExecutable()->isES6Function() condition to the > new patch. > > In case of 'delete Function.prototype.arguments;' we delete it from > FunctionPrototyp(FunctionPrototype.cpp) where it added with property > DontEnum, so it will not appear during for..in operation before and after > delete operation. Ah, I was thinking that FunctionPrototype subclassed JSFunction but I see that it actually subclasses InternalFunction. Then, you're right, it should work for Function.prototype.
GSkachkov
Comment 75 2016-09-09 17:31:28 PDT
Created attachment 288454 [details] Patch Fix build
Build Bot
Comment 76 2016-09-09 18:38:08 PDT
Comment on attachment 288454 [details] Patch Attachment 288454 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/2044561 New failing tests: js/es6-function-properties.html
Build Bot
Comment 77 2016-09-09 18:38:13 PDT
Created attachment 288469 [details] Archive of layout-test-results from ews101 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews101 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 78 2016-09-09 18:42:17 PDT
Comment on attachment 288454 [details] Patch Attachment 288454 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/2044582 New failing tests: js/es6-function-properties.html
Build Bot
Comment 79 2016-09-09 18:42:24 PDT
Created attachment 288471 [details] Archive of layout-test-results from ews105 for mac-yosemite-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews105 Port: mac-yosemite-wk2 Platform: Mac OS X 10.10.5
Build Bot
Comment 80 2016-09-09 18:52:51 PDT
Comment on attachment 288454 [details] Patch Attachment 288454 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/2044600 New failing tests: js/es6-function-properties.html
Build Bot
Comment 81 2016-09-09 18:53:01 PDT
Comment on attachment 288454 [details] Patch Attachment 288454 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/2044581 New failing tests: js/es6-function-properties.html
Build Bot
Comment 82 2016-09-09 18:53:11 PDT
Created attachment 288474 [details] Archive of layout-test-results from ews115 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews115 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 83 2016-09-09 20:53:46 PDT
Comment on attachment 288454 [details] Patch Attachment 288454 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/2045124 New failing tests: js/es6-function-properties.html
Build Bot
Comment 84 2016-09-09 20:53:51 PDT
Created attachment 288480 [details] Archive of layout-test-results from ews125 for ios-simulator-elcapitan-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews125 Port: ios-simulator-elcapitan-wk2 Platform: Mac OS X 10.11.5
GSkachkov
Comment 85 2016-09-10 00:07:34 PDT
Created attachment 288483 [details] Patch Use debug intead of print in Layout tests
Keith Miller
Comment 86 2016-09-12 14:30:02 PDT
Comment on attachment 288483 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=288483&action=review r=me if you fix the typo. Thanks, for powering through this patch! :D > Source/JavaScriptCore/ChangeLog:15 > + To implement this patch âcallerâ and âargumentsâ were put to the FunctionPrototype should be "caller" and "arguments".
GSkachkov
Comment 87 2016-09-13 07:08:00 PDT
All reviewed patches have been landed. Closing bug. Committed r205856: <https://trac.webkit.org/changeset/205856>
Note You need to log in before you can comment on or make changes to this bug.