WebKit Bugzilla
Attachment 372410 Details for
Bug 198975
: Non-standard Error properties should not be enumerable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-198975-20190619031842.patch (text/plain), 10.93 KB, created by
Alexey Shvayka
on 2019-06-18 17:18:44 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alexey Shvayka
Created:
2019-06-18 17:18:44 PDT
Size:
10.93 KB
patch
obsolete
>Index: JSTests/ChangeLog >=================================================================== >--- JSTests/ChangeLog (revision 246576) >+++ JSTests/ChangeLog (working copy) >@@ -1,3 +1,12 @@ >+2019-06-18 Alexey Shvayka <shvaikalesh@gmail.com> >+ >+ Non-standard Error properties should not be enumerable >+ https://bugs.webkit.org/show_bug.cgi?id=198975 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * test262/expectations.yaml: Mark 6 test cases as passing. >+ > 2019-06-18 Justin Michaud <justin_michaud@apple.com> > > [WASM-References] Add support for multiple tables >Index: JSTests/test262/expectations.yaml >=================================================================== >--- JSTests/test262/expectations.yaml (revision 246567) >+++ JSTests/test262/expectations.yaml (working copy) >@@ -1067,15 +1067,6 @@ test/built-ins/Number/prototype/toFixed/ > test/built-ins/Number/prototype/toPrecision/range.js: > default: 'RangeError: toPrecision() argument must be between 1 and 21' > strict mode: 'RangeError: toPrecision() argument must be between 1 and 21' >-test/built-ins/Object/defineProperties/15.2.3.7-2-15.js: >- default: 'TypeError: Property description must be an object.' >- strict mode: 'TypeError: Property description must be an object.' >-test/built-ins/Object/defineProperties/15.2.3.7-5-a-16.js: >- default: 'TypeError: Property description must be an object.' >- strict mode: 'TypeError: Property description must be an object.' >-test/built-ins/Object/defineProperties/15.2.3.7-5-b-248.js: >- default: 'TypeError: Property description must be an object.' >- strict mode: 'TypeError: Property description must be an object.' > test/built-ins/Object/internals/DefineOwnProperty/consistent-value-function-arguments.js: > default: 'Test262Error: Expected SameValue(ënullû, ë[object Arguments]û) to be true' > test/built-ins/Object/internals/DefineOwnProperty/consistent-value-function-caller.js: >Index: Source/JavaScriptCore/ChangeLog >=================================================================== >--- Source/JavaScriptCore/ChangeLog (revision 246567) >+++ Source/JavaScriptCore/ChangeLog (working copy) >@@ -1,3 +1,15 @@ >+2019-06-18 Alexey Shvayka <shvaikalesh@gmail.com> >+ >+ Non-standard Error properties should not be enumerable >+ https://bugs.webkit.org/show_bug.cgi?id=198975 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Define non-standard Error properties "line" and "column" as non-enumerable. >+ >+ * runtime/ErrorInstance.cpp: >+ (JSC::ErrorInstance::materializeErrorInfoIfNeeded): >+ > 2019-06-18 Alexey Shvayka <shvaikalesh@gmail.com> > > [ESNExt] String.prototype.matchAll >Index: Source/JavaScriptCore/runtime/ErrorInstance.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/ErrorInstance.cpp (revision 246567) >+++ Source/JavaScriptCore/runtime/ErrorInstance.cpp (working copy) >@@ -238,12 +238,14 @@ bool ErrorInstance::materializeErrorInfo > computeErrorInfo(vm); > > if (!m_stackString.isNull()) { >- putDirect(vm, vm.propertyNames->line, jsNumber(m_line)); >- putDirect(vm, vm.propertyNames->column, jsNumber(m_column)); >+ auto attributes = static_cast<unsigned>(PropertyAttribute::DontEnum); >+ >+ putDirect(vm, vm.propertyNames->line, jsNumber(m_line), attributes); >+ putDirect(vm, vm.propertyNames->column, jsNumber(m_column), attributes); > if (!m_sourceURL.isEmpty()) >- putDirect(vm, vm.propertyNames->sourceURL, jsString(&vm, WTFMove(m_sourceURL))); >+ putDirect(vm, vm.propertyNames->sourceURL, jsString(&vm, WTFMove(m_sourceURL)), attributes); > >- putDirect(vm, vm.propertyNames->stack, jsString(&vm, WTFMove(m_stackString)), static_cast<unsigned>(PropertyAttribute::DontEnum)); >+ putDirect(vm, vm.propertyNames->stack, jsString(&vm, WTFMove(m_stackString)), attributes); > } > > m_errorInfoMaterialized = true; >Index: LayoutTests/ChangeLog >=================================================================== >--- LayoutTests/ChangeLog (revision 246567) >+++ LayoutTests/ChangeLog (working copy) >@@ -1,3 +1,19 @@ >+2019-06-18 Alexey Shvayka <shvaikalesh@gmail.com> >+ >+ Non-standard Error properties should not be enumerable >+ https://bugs.webkit.org/show_bug.cgi?id=198975 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * inspector/debugger/resources/exception.js: Extract stringifyError helper. >+ * inspector/debugger/setPauseOnExceptions-all.html: >+ * inspector/debugger/setPauseOnExceptions-none.html: >+ * inspector/debugger/setPauseOnExceptions-uncaught.html: >+ * js/exception-properties-expected.txt: >+ * js/script-tests/exception-properties.js: >+ (catch): >+ (enumerableProperties): Deleted. >+ > 2019-06-18 Alexey Shvayka <shvaikalesh@gmail.com> > > [ESNExt] String.prototype.matchAll >Index: LayoutTests/inspector/debugger/setPauseOnExceptions-all.html >=================================================================== >--- LayoutTests/inspector/debugger/setPauseOnExceptions-all.html (revision 246567) >+++ LayoutTests/inspector/debugger/setPauseOnExceptions-all.html (working copy) >@@ -15,7 +15,7 @@ function test() > > var currentCaughtExceptionStatement = 0; > var statementsWithCaughtExceptions = [ >- "try{ ({}).a.b.c.d } catch (e) { console.log('caught inline: ' + JSON.stringify(e)); }", >+ "try{ ({}).a.b.c.d } catch (e) { console.log(`caught inline: ${stringifyError(e)}`); }", > "catchNested(exceptionBasic, 1);", > "catchNested(exceptionDOM, 2);", > "catchNested(exceptionInHostFunction, 3);", >Index: LayoutTests/inspector/debugger/setPauseOnExceptions-none.html >=================================================================== >--- LayoutTests/inspector/debugger/setPauseOnExceptions-none.html (revision 246567) >+++ LayoutTests/inspector/debugger/setPauseOnExceptions-none.html (working copy) >@@ -13,7 +13,7 @@ function test() > InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { 1+1; }, 0);"}); > InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { noException(); }, 0);"}); > InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { catchNested(noException, 7); }, 0);"}); >- InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { try{ ({}).a.b.c.d } catch (e) { console.log('caught inline: ' + JSON.stringify(e)); } }, 0);"}); >+ InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { try{ ({}).a.b.c.d } catch (e) { console.log(`caught inline: ${stringifyError(e)}`); } }, 0);"}); > InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { catchNested(exceptionBasic, 1); }, 0);"}); > InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { catchNested(exceptionDOM, 2); }, 0);"}); > InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { catchNested(exceptionInHostFunction, 3); }, 0);"}); >Index: LayoutTests/inspector/debugger/setPauseOnExceptions-uncaught.html >=================================================================== >--- LayoutTests/inspector/debugger/setPauseOnExceptions-uncaught.html (revision 246567) >+++ LayoutTests/inspector/debugger/setPauseOnExceptions-uncaught.html (working copy) >@@ -14,7 +14,7 @@ function test() > ]; > > var statementsWithCaughtExceptions = [ >- "try{ ({}).a.b.c.d } catch (e) { console.log('caught inline: ' + JSON.stringify(e)); }", >+ "try{ ({}).a.b.c.d } catch (e) { console.log(`caught inline: ${stringifyError(e)}`); }", > "catchNested(exceptionBasic, 1);", > "catchNested(exceptionDOM, 2);", > "catchNested(exceptionInHostFunction, 3);", >Index: LayoutTests/inspector/debugger/resources/exception.js >=================================================================== >--- LayoutTests/inspector/debugger/resources/exception.js (revision 246567) >+++ LayoutTests/inspector/debugger/resources/exception.js (working copy) >@@ -35,11 +35,23 @@ function catchNested(func, depth /* opti > try { > func.apply(this, Array.prototype.slice.call(arguments, 2)); > } catch (e) { >- console.log("catchNested caught exception: " + JSON.stringify(e)); >+ console.log(`catchNested caught exception: ${stringifyError(e)}`); > } > } > } > >+function stringifyError(err) >+{ >+ if (typeof err === "string") >+ return JSON.stringify(err); >+ >+ return JSON.stringify({ >+ line: err.line, >+ column: err.column, >+ sourceURL: err.sourceURL, >+ }); >+} >+ > function noException() > { > return "no exception"; >Index: LayoutTests/js/exception-properties-expected.txt >=================================================================== >--- LayoutTests/js/exception-properties-expected.txt (revision 246567) >+++ LayoutTests/js/exception-properties-expected.txt (working copy) >@@ -3,8 +3,10 @@ Test for correct properties on Error obj > On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". > > >-PASS enumerableProperties(error).sort() is ["column", "line", "sourceURL"] >-PASS enumerableProperties(nativeError).sort() is ["column", "line", "sourceURL"] >+PASS Object.keys(error).sort() is [] >+PASS Object.keys(nativeError).sort() is [] >+PASS Object.getOwnPropertyNames(error).sort() is ["column", "line", "message", "sourceURL", "stack"] >+PASS Object.getOwnPropertyNames(nativeError).sort() is ["column", "line", "message", "sourceURL", "stack"] > PASS Object.getPrototypeOf(nativeError).name is "RangeError" > PASS Object.getPrototypeOf(nativeError).message is "" > PASS successfullyParsed is true >Index: LayoutTests/js/script-tests/exception-properties.js >=================================================================== >--- LayoutTests/js/script-tests/exception-properties.js (revision 246567) >+++ LayoutTests/js/script-tests/exception-properties.js (working copy) >@@ -1,13 +1,5 @@ > description("Test for correct properties on Error objects."); > >-function enumerableProperties(object) >-{ >- var result = []; >- for (var i in object) >- result.push(i); >- return result; >-} >- > try { > // generate a RangeError. > [].length = -1; >@@ -15,8 +7,11 @@ try { > var nativeError = rangeError; > var error = new Error("message"); > >- shouldBe('enumerableProperties(error).sort()', '["column", "line", "sourceURL"]'); >- shouldBe('enumerableProperties(nativeError).sort()', '["column", "line", "sourceURL"]'); >+ shouldBe('Object.keys(error).sort()', '[]'); >+ shouldBe('Object.keys(nativeError).sort()', '[]'); >+ >+ shouldBe('Object.getOwnPropertyNames(error).sort()', '["column", "line", "message", "sourceURL", "stack"]'); >+ shouldBe('Object.getOwnPropertyNames(nativeError).sort()', '["column", "line", "message", "sourceURL", "stack"]'); > > shouldBe('Object.getPrototypeOf(nativeError).name', '"RangeError"'); > shouldBe('Object.getPrototypeOf(nativeError).message', '""');
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 198975
:
372375
|
372384
|
372385
|
372392
|
372395
|
372410
|
372451
|
379739