Skip to content

Commit

Permalink
Unreviewed, reverting 276904@main (1ff045b) and 277023@main (191d3fc)
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=274225
rdar://128077280

Breaks https://www.tax.ny.gov/online/.

Reverted changes:

    [JSC] `Function.prototype.toString` should print `set` / `get` for accessor properties
    https://bugs.webkit.org/show_bug.cgi?id=271946
    276904@main (1ff045b)

    [JSC] Update `expectations.yaml` for `/built-ins/Function/prototype/toString/`
    https://bugs.webkit.org/show_bug.cgi?id=272082
    277023@main (191d3fc)

Canonical link: https://commits.webkit.org/278825@main
  • Loading branch information
Mark Lam committed May 15, 2024
1 parent 5a33b20 commit d30eba5
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 126 deletions.
104 changes: 0 additions & 104 deletions JSTests/stress/function-toString-for-accessor-properties.js

This file was deleted.

4 changes: 2 additions & 2 deletions JSTests/test262/expectations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ test/built-ins/Function/internals/Construct/derived-this-uninitialized-realm.js:
default: 'Test262Error: Expected a ReferenceError but got a different error constructor with the same name'
strict mode: 'Test262Error: Expected a ReferenceError but got a different error constructor with the same name'
test/built-ins/Function/prototype/toString/built-in-function-object.js:
default: 'Test262Error: Conforms to NativeFunction Syntax: "function get $*() {\n [native code]\n}" (%RegExp%.$*)'
strict mode: 'Test262Error: Conforms to NativeFunction Syntax: "function get $*() {\n [native code]\n}" (%RegExp%.$*)'
default: 'Test262Error: Conforms to NativeFunction Syntax: "function $*() {\n [native code]\n}" (%RegExp%.$*)'
strict mode: 'Test262Error: Conforms to NativeFunction Syntax: "function $*() {\n [native code]\n}" (%RegExp%.$*)'
test/built-ins/Object/entries/order-after-define-property-with-function.js:
default: 'Test262Error: Expected [a, name] and [name, a] to have the same contents. '
strict mode: 'Test262Error: Expected [a, name] and [name, a] to have the same contents. '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ PASS Window interface: attribute parent
PASS Window interface: attribute frameElement
PASS Window interface: operation open(optional USVString, optional DOMString, optional DOMString)
PASS Window interface: attribute navigator
FAIL Window interface: attribute clientInformation assert_equals: setter must be undefined for readonly attributes expected (undefined) undefined but got (function) function "function set clientInformation() {
FAIL Window interface: attribute clientInformation assert_equals: setter must be undefined for readonly attributes expected (undefined) undefined but got (function) function "function clientInformation() {
[native code]
}"
FAIL Window interface: attribute originAgentCluster assert_own_property: The global object must have a property "originAgentCluster" expected property "originAgentCluster" missing
Expand Down
2 changes: 1 addition & 1 deletion LayoutTests/js/basic-strict-mode-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ PASS (function () {'use strict'; try { throw 1; } catch (e) { aGlobal = true; }
PASS try { throw 1; } catch (e) { aGlobal = true; } is true
PASS (function () { try { throw 1; } catch (e) { aGlobal = true; }})(); aGlobal; is true
PASS (function () {try { throw 1; } catch (e) { aGlobal = true; }})(); aGlobal; is true
PASS String(Object.getOwnPropertyDescriptor((function() { "use strict"; }).__proto__, "caller").get) is 'function get caller() {\n [native code]\n}'
PASS String(Object.getOwnPropertyDescriptor((function() { "use strict"; }).__proto__, "caller").get) is 'function caller() {\n [native code]\n}'
PASS successfullyParsed is true

TEST COMPLETE
Expand Down
8 changes: 4 additions & 4 deletions LayoutTests/js/dom/native-bindings-descriptors-expected.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
CONSOLE MESSAGE: [object Object]
CONSOLE MESSAGE: function get nodeType() {
CONSOLE MESSAGE: function nodeType() {
[native code]
}
document.title
PASS Object.getOwnPropertyDescriptor(Document.prototype, 'title') is not Object.getOwnPropertyDescriptor(Document.prototype, 'title')
PASS Object.getOwnPropertyDescriptor(Document.prototype, 'title').get is Object.getOwnPropertyDescriptor(Document.prototype, 'title').get
PASS Object.getOwnPropertyDescriptor(Document.prototype, 'title').set is Object.getOwnPropertyDescriptor(Document.prototype, 'title').set
PASS Object.getOwnPropertyDescriptor(Document.prototype, 'title').get.toString() is "function get title() {\n [native code]\n}"
PASS Object.getOwnPropertyDescriptor(Document.prototype, 'title').get.toString() is "function title() {\n [native code]\n}"
PASS Object.getOwnPropertyDescriptor(Document.prototype, 'title').get.length is 0
PASS Object.getOwnPropertyDescriptor(Document.prototype, 'title').set.toString() is "function set title() {\n [native code]\n}"
PASS Object.getOwnPropertyDescriptor(Document.prototype, 'title').set.toString() is "function title() {\n [native code]\n}"
PASS Object.getOwnPropertyDescriptor(Document.prototype, 'title').set.length is 1
PASS Object.getOwnPropertyDescriptor(Document.prototype, 'title').get.call(document) is document.title
PASS document.title is "old title"
Expand All @@ -27,7 +27,7 @@ document.readyState
PASS Object.getOwnPropertyDescriptor(Document.prototype, 'readyState') is not Object.getOwnPropertyDescriptor(Document.prototype, 'readyState')
PASS Object.getOwnPropertyDescriptor(Document.prototype, 'readyState').get is Object.getOwnPropertyDescriptor(Document.prototype, 'readyState').get
PASS Object.getOwnPropertyDescriptor(Document.prototype, 'readyState').set is Object.getOwnPropertyDescriptor(Document.prototype, 'readyState').set
PASS Object.getOwnPropertyDescriptor(Document.prototype, 'readyState').get.toString() is "function get readyState() {\n [native code]\n}"
PASS Object.getOwnPropertyDescriptor(Document.prototype, 'readyState').get.toString() is "function readyState() {\n [native code]\n}"
PASS Object.getOwnPropertyDescriptor(Document.prototype, 'readyState').get.length is 0
PASS Object.getOwnPropertyDescriptor(Document.prototype, 'readyState').get.call(document) is document.readyState
PASS Object.getOwnPropertyDescriptor(Document.prototype, 'readyState').set is undefined.
Expand Down
6 changes: 3 additions & 3 deletions LayoutTests/js/dom/native-bindings-descriptors.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
shouldNotBe("Object.getOwnPropertyDescriptor(Document.prototype, 'title')", "Object.getOwnPropertyDescriptor(Document.prototype, 'title')");
shouldBe("Object.getOwnPropertyDescriptor(Document.prototype, 'title').get", "Object.getOwnPropertyDescriptor(Document.prototype, 'title').get");
shouldBe("Object.getOwnPropertyDescriptor(Document.prototype, 'title').set", "Object.getOwnPropertyDescriptor(Document.prototype, 'title').set");
shouldBeEqualToString("Object.getOwnPropertyDescriptor(Document.prototype, 'title').get.toString()", "function get title() {\n [native code]\n}");
shouldBeEqualToString("Object.getOwnPropertyDescriptor(Document.prototype, 'title').get.toString()", "function title() {\n [native code]\n}");
shouldBe("Object.getOwnPropertyDescriptor(Document.prototype, 'title').get.length", "0");
shouldBeEqualToString("Object.getOwnPropertyDescriptor(Document.prototype, 'title').set.toString()", "function set title() {\n [native code]\n}");
shouldBeEqualToString("Object.getOwnPropertyDescriptor(Document.prototype, 'title').set.toString()", "function title() {\n [native code]\n}");
shouldBe("Object.getOwnPropertyDescriptor(Document.prototype, 'title').set.length", "1");
shouldBe("Object.getOwnPropertyDescriptor(Document.prototype, 'title').get.call(document)", "document.title");
shouldBeEqualToString('document.title', 'old title');
Expand All @@ -34,7 +34,7 @@
shouldNotBe("Object.getOwnPropertyDescriptor(Document.prototype, 'readyState')", "Object.getOwnPropertyDescriptor(Document.prototype, 'readyState')");
shouldBe("Object.getOwnPropertyDescriptor(Document.prototype, 'readyState').get", "Object.getOwnPropertyDescriptor(Document.prototype, 'readyState').get");
shouldBe("Object.getOwnPropertyDescriptor(Document.prototype, 'readyState').set", "Object.getOwnPropertyDescriptor(Document.prototype, 'readyState').set");
shouldBeEqualToString("Object.getOwnPropertyDescriptor(Document.prototype, 'readyState').get.toString()", "function get readyState() {\n [native code]\n}");
shouldBeEqualToString("Object.getOwnPropertyDescriptor(Document.prototype, 'readyState').get.toString()", "function readyState() {\n [native code]\n}");
shouldBe("Object.getOwnPropertyDescriptor(Document.prototype, 'readyState').get.length", "0");
shouldBe("Object.getOwnPropertyDescriptor(Document.prototype, 'readyState').get.call(document)", "document.readyState");
shouldBeUndefined("Object.getOwnPropertyDescriptor(Document.prototype, 'readyState').set");
Expand Down
2 changes: 1 addition & 1 deletion LayoutTests/js/script-tests/basic-strict-mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,4 @@ aGlobal = false;
shouldBeTrue("(function () {try { throw 1; } catch (e) { aGlobal = true; }})(); aGlobal;");

// Make sure this doesn't crash!
shouldBe('String(Object.getOwnPropertyDescriptor((function() { "use strict"; }).__proto__, "caller").get)', "'function get caller() {\\n [native code]\\n}'");
shouldBe('String(Object.getOwnPropertyDescriptor((function() { "use strict"; }).__proto__, "caller").get)', "'function caller() {\\n [native code]\\n}'");
4 changes: 2 additions & 2 deletions LayoutTests/js/script-tests/function-toString-vs-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -706,8 +706,8 @@ section = "JSBoundSlotBaseFunction";
{
if (typeof document !== "undefined") {
let desc = Object.getOwnPropertyDescriptor(document, "location");
test(desc.get, "get location", "function get location() { [native code] }");
test(desc.set, "set location", "function set location() { [native code] }");
test(desc.get, "get location", "function location() { [native code] }");
test(desc.set, "set location", "function location() { [native code] }");

section = "bound JSBoundSlotBaseFunction";
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ PASS Window interface: attribute parent
PASS Window interface: attribute frameElement
PASS Window interface: operation open(optional USVString, optional DOMString, optional DOMString)
PASS Window interface: attribute navigator
FAIL Window interface: attribute clientInformation assert_equals: setter must be undefined for readonly attributes expected (undefined) undefined but got (function) function "function set clientInformation() {
FAIL Window interface: attribute clientInformation assert_equals: setter must be undefined for readonly attributes expected (undefined) undefined but got (function) function "function clientInformation() {
[native code]
}"
FAIL Window interface: attribute originAgentCluster assert_own_property: The global object must have a property "originAgentCluster" expected property "originAgentCluster" missing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4438,7 +4438,7 @@ PASS Window interface: attribute parent
PASS Window interface: attribute frameElement
PASS Window interface: operation open(optional USVString, optional DOMString, optional DOMString)
PASS Window interface: attribute navigator
FAIL Window interface: attribute clientInformation assert_equals: setter must be undefined for readonly attributes expected (undefined) undefined but got (function) function "function set clientInformation() {
FAIL Window interface: attribute clientInformation assert_equals: setter must be undefined for readonly attributes expected (undefined) undefined but got (function) function "function clientInformation() {
[native code]
}"
FAIL Window interface: attribute originAgentCluster assert_own_property: The global object must have a property "originAgentCluster" expected property "originAgentCluster" missing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4438,7 +4438,7 @@ PASS Window interface: attribute parent
PASS Window interface: attribute frameElement
PASS Window interface: operation open(optional USVString, optional DOMString, optional DOMString)
PASS Window interface: attribute navigator
FAIL Window interface: attribute clientInformation assert_equals: setter must be undefined for readonly attributes expected (undefined) undefined but got (function) function "function set clientInformation() {
FAIL Window interface: attribute clientInformation assert_equals: setter must be undefined for readonly attributes expected (undefined) undefined but got (function) function "function clientInformation() {
[native code]
}"
FAIL Window interface: attribute originAgentCluster assert_own_property: The global object must have a property "originAgentCluster" expected property "originAgentCluster" missing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4438,7 +4438,7 @@ PASS Window interface: attribute parent
PASS Window interface: attribute frameElement
PASS Window interface: operation open(optional USVString, optional DOMString, optional DOMString)
PASS Window interface: attribute navigator
FAIL Window interface: attribute clientInformation assert_equals: setter must be undefined for readonly attributes expected (undefined) undefined but got (function) function "function set clientInformation() {
FAIL Window interface: attribute clientInformation assert_equals: setter must be undefined for readonly attributes expected (undefined) undefined but got (function) function "function clientInformation() {
[native code]
}"
FAIL Window interface: attribute originAgentCluster assert_own_property: The global object must have a property "originAgentCluster" expected property "originAgentCluster" missing
Expand Down
4 changes: 2 additions & 2 deletions Source/JavaScriptCore/runtime/JSCustomGetterFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ JSCustomGetterFunction::JSCustomGetterFunction(VM& vm, NativeExecutable* executa
JSCustomGetterFunction* JSCustomGetterFunction::create(VM& vm, JSGlobalObject* globalObject, const PropertyName& propertyName, CustomFunctionPointer getter, std::optional<DOMAttributeAnnotation> domAttribute)
{
ASSERT(getter);
auto name = makeString("get "_s, propertyName.publicName());
NativeExecutable* executable = vm.getHostFunction(customGetterFunctionCall, ImplementationVisibility::Public, callHostFunctionAsConstructor, name);
NativeExecutable* executable = vm.getHostFunction(customGetterFunctionCall, ImplementationVisibility::Public, callHostFunctionAsConstructor, String(propertyName.publicName()));
Structure* structure = globalObject->customGetterFunctionStructure();
JSCustomGetterFunction* function = new (NotNull, allocateCell<JSCustomGetterFunction>(vm)) JSCustomGetterFunction(vm, executable, globalObject, structure, propertyName, getter, domAttribute);

// Can't do this during initialization because getHostFunction might do a GC allocation.
auto name = makeString("get "_s, propertyName.publicName());
function->finishCreation(vm, executable, 0, name);
return function;
}
Expand Down
4 changes: 2 additions & 2 deletions Source/JavaScriptCore/runtime/JSCustomSetterFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ JSCustomSetterFunction::JSCustomSetterFunction(VM& vm, NativeExecutable* executa
JSCustomSetterFunction* JSCustomSetterFunction::create(VM& vm, JSGlobalObject* globalObject, const PropertyName& propertyName, CustomFunctionPointer setter)
{
ASSERT(setter);
auto name = makeString("set "_s, propertyName.publicName());
NativeExecutable* executable = vm.getHostFunction(customSetterFunctionCall, ImplementationVisibility::Public, callHostFunctionAsConstructor, name);
NativeExecutable* executable = vm.getHostFunction(customSetterFunctionCall, ImplementationVisibility::Public, callHostFunctionAsConstructor, String(propertyName.publicName()));
Structure* structure = globalObject->customSetterFunctionStructure();
JSCustomSetterFunction* function = new (NotNull, allocateCell<JSCustomSetterFunction>(vm)) JSCustomSetterFunction(vm, executable, globalObject, structure, propertyName, setter);

// Can't do this during initialization because getHostFunction might do a GC allocation.
auto name = makeString("set "_s, propertyName.publicName());
function->finishCreation(vm, executable, 1, name);
return function;
}
Expand Down

0 comments on commit d30eba5

Please sign in to comment.