WebKit Bugzilla
Attachment 372451 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-20190619125555.patch (text/plain), 12.30 KB, created by
Alexey Shvayka
on 2019-06-19 02:55:57 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alexey Shvayka
Created:
2019-06-19 02:55:57 PDT
Size:
12.30 KB
patch
obsolete
>Index: JSTests/ChangeLog >=================================================================== >--- JSTests/ChangeLog (revision 246583) >+++ JSTests/ChangeLog (working copy) >@@ -1,3 +1,14 @@ >+2019-06-19 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!). >+ >+ * ChakraCore/test/Error/NativeErrors.js: Fix test. >+ * microbenchmarks/let-for-in.js: Fix test. >+ * test262/expectations.yaml: Mark 6 test cases as passing. >+ > 2019-06-18 Justin Michaud <justin_michaud@apple.com> > > [WASM-References] Add support for Table.size, grow and fill instructions >Index: JSTests/ChakraCore/test/Error/NativeErrors.js >=================================================================== >--- JSTests/ChakraCore/test/Error/NativeErrors.js (revision 246576) >+++ JSTests/ChakraCore/test/Error/NativeErrors.js (working copy) >@@ -28,9 +28,9 @@ function DumpObject(o) > { > a[a.length] = i; > } >- a[a.length] = "description"; // Explicitly adding the known non-enumerable members >- a[a.length] = "number"; >- a[a.length] = "stack"; >+ // Explicitly adding the known non-enumerable members >+ a.push("line", "column", "stack"); >+ a.push("description", "number"); > a.sort(); > for (var i = 0; i < a.length; i++) > { >Index: JSTests/microbenchmarks/let-for-in.js >=================================================================== >--- JSTests/microbenchmarks/let-for-in.js (revision 246576) >+++ JSTests/microbenchmarks/let-for-in.js (working copy) >@@ -8,8 +8,14 @@ function foo(o) { > } > noInline(foo); > >+function Bar() { >+ this.line = 1; >+ this.column = 2; >+ this.stack = "str"; >+} >+ > var total = 0; > for (let j = 0; j < 100000; ++j) >- total += foo(new Error); >+ total += foo(new Bar); > if (total != 300000) > throw new Error("Bad result: " + total); >Index: JSTests/test262/expectations.yaml >=================================================================== >--- JSTests/test262/expectations.yaml (revision 246576) >+++ 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 246576) >+++ Source/JavaScriptCore/ChangeLog (working copy) >@@ -1,3 +1,15 @@ >+2019-06-19 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", "column", and "sourceURL" as non-enumerable. >+ >+ * runtime/ErrorInstance.cpp: >+ (JSC::ErrorInstance::materializeErrorInfoIfNeeded): >+ > 2019-06-18 Keith Miller <keith_miller@apple.com> > > Unreviewed, fix signature of currentWeakRefVersion to return an uintptr_t. >Index: Source/JavaScriptCore/runtime/ErrorInstance.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/ErrorInstance.cpp (revision 246576) >+++ 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 246576) >+++ LayoutTests/ChangeLog (working copy) >@@ -1,3 +1,17 @@ >+2019-06-19 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: >+ * 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: >+ > 2019-06-18 Russell Epstein <russell_e@apple.com> > > Layout Test imported/w3c/web-platform-tests/content-security-policy/reporting/report-only-in-meta.sub.html is failing. >Index: LayoutTests/inspector/debugger/setPauseOnExceptions-all.html >=================================================================== >--- LayoutTests/inspector/debugger/setPauseOnExceptions-all.html (revision 246576) >+++ 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 246576) >+++ 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 246576) >+++ 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 246576) >+++ 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 246576) >+++ 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 246576) >+++ 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