WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
221184
[JSC] Add @ in Error.stack if URL exists
https://bugs.webkit.org/show_bug.cgi?id=221184
Summary
[JSC] Add @ in Error.stack if URL exists
John A. Bilicki III
Reported
2021-01-31 02:25:08 PST
The error object (the fifth parameter for the window.onerror event handler) should ALWAYS return an @ deliminator. Because WebKit/Safari doesn't in order to parse and clean up the error details for proper error reporting developers have to add pointless additional logic. Gecko browsers always use the @ deliminator; if no function is used the deliminator[0] index is simply empty though the deliminator[1] index is the same for all stack trace indexes. This would make the error object compatible with existing browser engines and likely the only need is to remove whatever excessive logic exists in the code that conditionally outputs the @ deliminator so this should be easy for someone familiar with the engine to fix. The general overview of what is happening plus a prerequisite function for my platform: function array_remove_empty(a) { var k = []; for (var i = 0; i < a.length; i++) {if (a[i] == '') {k.push(i);}} var r = array_remove_keys(a,k); return r; } window.onerror = function(msg,url,line,col,error) { a = array_trim(array_remove_empty(a.split('\n').reverse())); console.log(a); } The text string output: 0 "
http://1.0.0.1/scripts/index.js?1612087732:7859:96
" 1 "window_onload@
http://1.0.0.1/scripts/index.js?1612087732:7368:5
" 2 "az19@
http://1.0.0.1/scripts/index.js?1612087732:7364:9
" As demonstrated [0] index lacks the @ deliminator creating pointless complications. Tested with the latest version of Safari 14 as of 2021-01-31.
Attachments
Patch
(2.54 KB, patch)
2021-01-31 12:51 PST
,
Yusuke Suzuki
keith_miller
: review+
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(3.09 KB, patch)
2021-01-31 13:03 PST
,
Yusuke Suzuki
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(28.06 KB, patch)
2021-02-01 01:43 PST
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Yusuke Suzuki
Comment 1
2021-01-31 12:44:53 PST
While Error.stack format is not standardized (this means any format is OK), maybe, having @ for source URL case is not so bad idea.
Yusuke Suzuki
Comment 2
2021-01-31 12:51:37 PST
Created
attachment 418830
[details]
Patch
Keith Miller
Comment 3
2021-01-31 12:53:34 PST
Comment on
attachment 418830
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=418830&action=review
> Source/JavaScriptCore/ChangeLog:8 > + Append '@' if URL exists even if function name does not exist.
Can you say why you want this here?
Yusuke Suzuki
Comment 4
2021-01-31 12:55:51 PST
Comment on
attachment 418830
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=418830&action=review
>> Source/JavaScriptCore/ChangeLog:8 >> + Append '@' if URL exists even if function name does not exist. > > Can you say why you want this here?
Added :)
Yusuke Suzuki
Comment 5
2021-01-31 13:03:25 PST
Created
attachment 418831
[details]
Patch
Yusuke Suzuki
Comment 6
2021-02-01 01:43:34 PST
Created
attachment 418843
[details]
Patch
EWS
Comment 7
2021-02-01 03:04:29 PST
Committed
r272139
: <
https://trac.webkit.org/changeset/272139
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 418843
[details]
.
Radar WebKit Bug Importer
Comment 8
2021-02-01 03:05:15 PST
<
rdar://problem/73823423
>
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