WebKit Bugzilla
Attachment 372363 Details for
Bug 198495
: Date.prototype.toJSON throws if toISOString returns an object
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-198495-20190618224742.patch (text/plain), 6.10 KB, created by
Alexey Shvayka
on 2019-06-18 12:47:43 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alexey Shvayka
Created:
2019-06-18 12:47:43 PDT
Size:
6.10 KB
patch
obsolete
>Index: JSTests/ChangeLog >=================================================================== >--- JSTests/ChangeLog (revision 246559) >+++ JSTests/ChangeLog (working copy) >@@ -1,3 +1,12 @@ >+2019-06-18 Alexey Shvayka <shvaikalesh@gmail.com> >+ >+ Date.prototype.toJSON throws if toISOString returns an object >+ https://bugs.webkit.org/show_bug.cgi?id=198495 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * test262/expectations.yaml: Mark 6 test cases as passing. >+ > 2019-06-18 Tadeu Zagallo <tzagallo@apple.com> > > DFG code should not reify the names of builtin functions with private names >Index: JSTests/test262/expectations.yaml >=================================================================== >--- JSTests/test262/expectations.yaml (revision 246558) >+++ JSTests/test262/expectations.yaml (working copy) >@@ -870,18 +870,9 @@ test/built-ins/Date/proto-from-ctor-real > test/built-ins/Date/prototype/toDateString/negative-year.js: > default: 'Test262Error: Date.prototype.toDateString serializes year -1 to "-0001" Expected SameValue(ë-001û, ë-0001û) to be true' > strict mode: 'Test262Error: Date.prototype.toDateString serializes year -1 to "-0001" Expected SameValue(ë-001û, ë-0001û) to be true' >-test/built-ins/Date/prototype/toJSON/invoke-result.js: >- default: 'TypeError: toISOString did not return a primitive value' >- strict mode: 'TypeError: toISOString did not return a primitive value' > test/built-ins/Date/prototype/toJSON/to-object.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/Date/prototype/toJSON/to-primitive-symbol.js: >- default: 'TypeError: toISOString did not return a primitive value' >- strict mode: 'TypeError: toISOString did not return a primitive value' >-test/built-ins/Date/prototype/toJSON/to-primitive-value-of.js: >- default: 'TypeError: toISOString did not return a primitive value' >- strict mode: 'TypeError: toISOString did not return a primitive value' > test/built-ins/Date/prototype/toString/negative-year.js: > default: 'Test262Error: Date.prototype.toString serializes year -1 to "-0001" Expected SameValue(ë-001û, ë-0001û) to be true' > strict mode: 'Test262Error: Date.prototype.toString serializes year -1 to "-0001" Expected SameValue(ë-001û, ë-0001û) to be true' >Index: Source/JavaScriptCore/ChangeLog >=================================================================== >--- Source/JavaScriptCore/ChangeLog (revision 246558) >+++ Source/JavaScriptCore/ChangeLog (working copy) >@@ -1,3 +1,16 @@ >+2019-06-18 Alexey Shvayka <shvaikalesh@gmail.com> >+ >+ Date.prototype.toJSON throws if toISOString returns an object >+ https://bugs.webkit.org/show_bug.cgi?id=198495 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Don't throw TypeError if result of toISOString call is not a primitive. >+ (step 4 of https://tc39.github.io/ecma262/#sec-date.prototype.tojson) >+ >+ * runtime/DatePrototype.cpp: >+ (JSC::dateProtoFuncToJSON): Remove isObject check. >+ > 2019-06-18 Tadeu Zagallo <tzagallo@apple.com> > > DFG code should not reify the names of builtin functions with private names >Index: Source/JavaScriptCore/runtime/DatePrototype.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/DatePrototype.cpp (revision 246558) >+++ Source/JavaScriptCore/runtime/DatePrototype.cpp (working copy) >@@ -1163,8 +1163,6 @@ EncodedJSValue JSC_HOST_CALL dateProtoFu > > JSValue result = call(exec, asObject(toISOValue), callType, callData, object, *vm.emptyList); > RETURN_IF_EXCEPTION(scope, encodedJSValue()); >- if (result.isObject()) >- return throwVMTypeError(exec, scope, "toISOString did not return a primitive value"_s); > return JSValue::encode(result); > } > >Index: LayoutTests/ChangeLog >=================================================================== >--- LayoutTests/ChangeLog (revision 246558) >+++ LayoutTests/ChangeLog (working copy) >@@ -1,3 +1,16 @@ >+2019-06-18 Alexey Shvayka <shvaikalesh@gmail.com> >+ >+ Date.prototype.toJSON throws if toISOString returns an object >+ https://bugs.webkit.org/show_bug.cgi?id=198495 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ TypeError shouldn't be thrown if result of toISOString call is an object. >+ (step 4 of https://tc39.github.io/ecma262/#sec-date.prototype.tojson) >+ >+ * js/dom/JSON-stringify-expected.txt: >+ * js/resources/JSON-stringify.js: >+ > 2019-06-18 Saam Barati <sbarati@apple.com> > > [WHLSL] Do not generate duplicate constructors/copy constructors in synthesizeConstructors >Index: LayoutTests/js/dom/JSON-stringify-expected.txt >=================================================================== >--- LayoutTests/js/dom/JSON-stringify-expected.txt (revision 246558) >+++ LayoutTests/js/dom/JSON-stringify-expected.txt (working copy) >@@ -91,7 +91,7 @@ PASS tests[i](nativeJSON) is tests[i](JS > function (jsonObject){ > return jsonObject.stringify({toJSON: Date.prototype.toJSON, toISOString: function(){ return {}; }}); > } >-PASS tests[i](nativeJSON) threw exception TypeError: toISOString did not return a primitive value. >+PASS tests[i](nativeJSON) is tests[i].expected > function (jsonObject){ > return jsonObject.stringify({toJSON: Date.prototype.toJSON, toISOString: function(){ throw "An exception"; }}); > } >Index: LayoutTests/js/resources/JSON-stringify.js >=================================================================== >--- LayoutTests/js/resources/JSON-stringify.js (revision 246558) >+++ LayoutTests/js/resources/JSON-stringify.js (working copy) >@@ -95,7 +95,7 @@ function createTests() { > result.push(function(jsonObject){ > return jsonObject.stringify({toJSON: Date.prototype.toJSON, toISOString: function(){ return {}; }}); > }); >- result[result.length - 1].throws = true; >+ result[result.length - 1].expected = '{}'; > result.push(function(jsonObject){ > return jsonObject.stringify({toJSON: Date.prototype.toJSON, toISOString: function(){ throw "An exception"; }}); > });
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 198495
:
371211
|
371218
|
371219
|
371222
|
371223
|
371226
|
371240
|
371255
|
371260
|
371390
|
372363
|
376709