RESOLVED FIXED 142882
Extending null should set __proto__ to null
https://bugs.webkit.org/show_bug.cgi?id=142882
Summary Extending null should set __proto__ to null
Ryosuke Niwa
Reported 2015-03-19 15:41:00 PDT
new (class A extends null {}).__proto__ should evalute to null according to the spec. Function.prototype.isPrototypeOf(A) should still be true.
Attachments
Fixes the bug (8.56 KB, patch)
2015-03-27 23:00 PDT, Ryosuke Niwa
no flags
Archive of layout-test-results from ews105 for mac-mavericks-wk2 (571.55 KB, application/zip)
2015-03-27 23:36 PDT, Build Bot
no flags
Archive of layout-test-results from ews100 for mac-mavericks (534.64 KB, application/zip)
2015-03-27 23:47 PDT, Build Bot
no flags
Fixes the bug (14.46 KB, patch)
2015-03-28 01:32 PDT, Ryosuke Niwa
ggaren: review+
Ryosuke Niwa
Comment 1 2015-03-20 14:30:00 PDT
@@ -2899,6 +2903,9 @@ RegisterID* ClassExprNode::emitBytecode(BytecodeGenerator& generator, RegisterID prototype = generator.emitGetById(generator.newTemporary(), constructor.get(), generator.propertyNames().prototype); if (superclass) { + RefPtr<RegisterID> protoParent = generator.newTemporary(); + generator.emitLoad(protoParent.get(), jsNull()); + RefPtr<RegisterID> tempRegister = generator.newTemporary(); RefPtr<Label> superclassIsNullLabel = generator.newLabel(); generator.emitJumpIfTrue(generator.emitUnaryOp(op_eq_null, tempRegister.get(), superclass.get()), superclassIsNullLabel.get()); @@ -2908,8 +2915,6 @@ RegisterID* ClassExprNode::emitBytecode(BytecodeGenerator& generator, RegisterID generator.emitJumpIfTrue(generator.emitIsObject(tempRegister.get(), superclass.get()), superclassIsObjectLabel.get()); generator.emitThrowTypeError(ASCIILiteral("The superclass is not an object.")); generator.emitLabel(superclassIsObjectLabel.get()); - - RefPtr<RegisterID> protoParent = generator.newTemporary(); generator.emitGetById(protoParent.get(), superclass.get(), generator.propertyNames().prototype); RefPtr<Label> protoParentIsObjectOrNullLabel = generator.newLabel(); @@ -2918,9 +2923,9 @@ RegisterID* ClassExprNode::emitBytecode(BytecodeGenerator& generator, RegisterID generator.emitLabel(protoParentIsObjectOrNullLabel.get()); generator.emitDirectPutById(constructor.get(), generator.propertyNames().underscoreProto, superclass.get(), PropertyNode::Unknown); + generator.emitLabel(superclassIsNullLabel.get()); generator.emitDirectPutById(prototype.get(), generator.propertyNames().underscoreProto, protoParent.get(), PropertyNode::Unknown); - generator.emitLabel(superclassIsNullLabel.get()); emitPutHomeObject(generator, constructor.get(), prototype.get()); }
Ryosuke Niwa
Comment 2 2015-03-27 23:00:28 PDT
Created attachment 249644 [details] Fixes the bug
Build Bot
Comment 3 2015-03-27 23:36:24 PDT
Comment on attachment 249644 [details] Fixes the bug Attachment 249644 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/5684121242173440 New failing tests: js/class-syntax-super.html js/class-syntax-call.html
Build Bot
Comment 4 2015-03-27 23:36:28 PDT
Created attachment 249645 [details] Archive of layout-test-results from ews105 for mac-mavericks-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews105 Port: mac-mavericks-wk2 Platform: Mac OS X 10.9.5
Build Bot
Comment 5 2015-03-27 23:47:49 PDT
Comment on attachment 249644 [details] Fixes the bug Attachment 249644 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/5383994296238080 New failing tests: js/class-syntax-super.html js/class-syntax-call.html
Build Bot
Comment 6 2015-03-27 23:47:53 PDT
Created attachment 249647 [details] Archive of layout-test-results from ews100 for mac-mavericks The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews100 Port: mac-mavericks Platform: Mac OS X 10.9.5
Ryosuke Niwa
Comment 7 2015-03-28 01:32:11 PDT
Created attachment 249656 [details] Fixes the bug
Geoffrey Garen
Comment 8 2015-03-30 15:51:03 PDT
Comment on attachment 249656 [details] Fixes the bug r=me
Benjamin Poulain
Comment 9 2015-03-30 15:57:29 PDT
View in context: https://bugs.webkit.org/attachment.cgi?id=249656&action=review > LayoutTests/js/script-tests/class-syntax-extends.js:72 > +shouldBe('Object.getPrototypeOf((class extends null { constructor () { super(); } }).prototype)', 'null'); You should also have coverage for extending undefined. > LayoutTests/js/script-tests/class-syntax-extends.js:74 > +shouldThrow('new (class extends null { constructor () { super(); } })', '"TypeError: undefined is not an object (evaluating \'super()\')"'); + add a test case where the constructor return a new, completely different, object.
Ryosuke Niwa
Comment 10 2015-03-30 19:00:15 PDT
Note You need to log in before you can comment on or make changes to this bug.