WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
160984
Make custom Error properties (line, column, sourceURL) configurable and writable
https://bugs.webkit.org/show_bug.cgi?id=160984
Summary
Make custom Error properties (line, column, sourceURL) configurable and writable
Joseph Pecoraro
Reported
2016-08-18 17:01:07 PDT
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.
Attachments
[PATCH] Proposed Fix
(6.07 KB, patch)
2016-08-18 17:06 PDT
,
Joseph Pecoraro
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Joseph Pecoraro
Comment 1
2016-08-18 17:01:24 PDT
<
rdar://problem/27905979
>
Joseph Pecoraro
Comment 2
2016-08-18 17:06:58 PDT
Created
attachment 286418
[details]
[PATCH] Proposed Fix
WebKit Commit Bot
Comment 3
2016-08-19 15:51:05 PDT
Comment on
attachment 286418
[details]
[PATCH] Proposed Fix Clearing flags on attachment: 286418 Committed
r204663
: <
http://trac.webkit.org/changeset/204663
>
WebKit Commit Bot
Comment 4
2016-08-19 15:51:11 PDT
All reviewed patches have been landed. Closing bug.
Joseph Pecoraro
Comment 5
2016-08-19 19:01:03 PDT
***
Bug 146047
has been marked as a duplicate of this bug. ***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug