Title: [254626] trunk
- Revision
- 254626
- Author
- shvaikal...@gmail.com
- Date
- 2020-01-15 11:57:38 -0800 (Wed, 15 Jan 2020)
Log Message
Object.preventExtensions should throw if not successful
https://bugs.webkit.org/show_bug.cgi?id=206131
Reviewed by Ross Kirsling.
JSTests:
* test262/expectations.yaml: Mark 2 test cases as passing.
Source/_javascript_Core:
With this change, Object.preventExtensions throws TypeError if [[PreventExtensions]]
returns `false`. This is possible if Object.preventExtensions is called on a Proxy object.
(step 3 of https://tc39.es/ecma262/#sec-object.preventextensions)
* runtime/ObjectConstructor.cpp:
(JSC::objectConstructorPreventExtensions):
Modified Paths
Diff
Modified: trunk/JSTests/ChangeLog (254625 => 254626)
--- trunk/JSTests/ChangeLog 2020-01-15 19:33:52 UTC (rev 254625)
+++ trunk/JSTests/ChangeLog 2020-01-15 19:57:38 UTC (rev 254626)
@@ -1,3 +1,12 @@
+2020-01-15 Alexey Shvayka <shvaikal...@gmail.com>
+
+ Object.preventExtensions should throw if not successful
+ https://bugs.webkit.org/show_bug.cgi?id=206131
+
+ Reviewed by Ross Kirsling.
+
+ * test262/expectations.yaml: Mark 2 test cases as passing.
+
2020-01-14 Commit Queue <commit-qu...@webkit.org>
Unreviewed, rolling out r254480, r254496, and r254517.
Modified: trunk/JSTests/test262/expectations.yaml (254625 => 254626)
--- trunk/JSTests/test262/expectations.yaml 2020-01-15 19:33:52 UTC (rev 254625)
+++ trunk/JSTests/test262/expectations.yaml 2020-01-15 19:57:38 UTC (rev 254626)
@@ -1165,9 +1165,6 @@
test/built-ins/Object/internals/DefineOwnProperty/consistent-value-regexp-dollar1.js:
default: 'Test262Error: Expected SameValue(«», «x») to be true'
strict mode: 'Test262Error: Expected SameValue(«», «x») to be true'
-test/built-ins/Object/preventExtensions/throws-when-false.js:
- default: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all'
- strict mode: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all'
test/built-ins/Object/proto-from-ctor-realm.js:
default: 'Test262Error: Expected SameValue(«[object Object]», «[object Object]») to be true'
strict mode: 'Test262Error: Expected SameValue(«[object Object]», «[object Object]») to be true'
Modified: trunk/Source/_javascript_Core/ChangeLog (254625 => 254626)
--- trunk/Source/_javascript_Core/ChangeLog 2020-01-15 19:33:52 UTC (rev 254625)
+++ trunk/Source/_javascript_Core/ChangeLog 2020-01-15 19:57:38 UTC (rev 254626)
@@ -1,3 +1,17 @@
+2020-01-15 Alexey Shvayka <shvaikal...@gmail.com>
+
+ Object.preventExtensions should throw if not successful
+ https://bugs.webkit.org/show_bug.cgi?id=206131
+
+ Reviewed by Ross Kirsling.
+
+ With this change, Object.preventExtensions throws TypeError if [[PreventExtensions]]
+ returns `false`. This is possible if Object.preventExtensions is called on a Proxy object.
+ (step 3 of https://tc39.es/ecma262/#sec-object.preventextensions)
+
+ * runtime/ObjectConstructor.cpp:
+ (JSC::objectConstructorPreventExtensions):
+
2020-01-15 Jonathan Bedard <jbed...@apple.com>
webkitpy: Remove self assignments
Modified: trunk/Source/_javascript_Core/runtime/ObjectConstructor.cpp (254625 => 254626)
--- trunk/Source/_javascript_Core/runtime/ObjectConstructor.cpp 2020-01-15 19:33:52 UTC (rev 254625)
+++ trunk/Source/_javascript_Core/runtime/ObjectConstructor.cpp 2020-01-15 19:57:38 UTC (rev 254626)
@@ -836,11 +836,16 @@
EncodedJSValue JSC_HOST_CALL objectConstructorPreventExtensions(JSGlobalObject* globalObject, CallFrame* callFrame)
{
VM& vm = globalObject->vm();
+ auto scope = DECLARE_THROW_SCOPE(vm);
+
JSValue argument = callFrame->argument(0);
if (!argument.isObject())
return JSValue::encode(argument);
JSObject* object = asObject(argument);
- object->methodTable(vm)->preventExtensions(object, globalObject);
+ bool status = object->methodTable(vm)->preventExtensions(object, globalObject);
+ RETURN_IF_EXCEPTION(scope, { });
+ if (UNLIKELY(!status))
+ return throwVMTypeError(globalObject, scope, "Unable to prevent extension in Object.preventExtensions"_s);
return JSValue::encode(object);
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes