Summary: Custom Error properties (line, column, sourceURL) should be writable and configurable Steps to Reproduce: >>> "use strict"; (new SyntaxError).line = 1; Exception: TypeError: Attempted to assign to readonly property. -- Some JavaScript libraries (Objective-J) expect to be able to assign to the "line" and "column" properties of a SyntaxError instance they create. This currently doesn't work in Safari where these properties are readonly. > function raise(pos, message) { > if (typeof pos == "number") pos = getLineInfo(input, pos); > var syntaxError = new SyntaxError(message); > syntaxError.line = pos.line; > syntaxError.column = pos.column; > syntaxError.lineStart = pos.lineStart; > syntaxError.lineEnd = pos.lineEnd; > syntaxError.fileName = sourceFile; > > throw syntaxError; > } In strict mode, this throws an exception, which was unexpected. We should be more lenient. Notes: - These properties are non-standard. Firefox adds (lineNumber, columnNumber, fileName). I didn't see any in Chrome. - Non-standard Error properties added by JavaScriptCore are currently readonly and enumerable. - All other engine non-standard error properties are configurable, writable, and not enumerable. - Lets start by making them configurable/writable.
<rdar://problem/27905979>
Created attachment 286418 [details] [PATCH] Proposed Fix
Comment on attachment 286418 [details] [PATCH] Proposed Fix Clearing flags on attachment: 286418 Committed r204663: <http://trac.webkit.org/changeset/204663>
All reviewed patches have been landed. Closing bug.
*** Bug 146047 has been marked as a duplicate of this bug. ***