WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
147753
iOS WKWebView window.onerror Callback Doesn't Get a Useful msg
https://bugs.webkit.org/show_bug.cgi?id=147753
Summary
iOS WKWebView window.onerror Callback Doesn't Get a Useful msg
Kelly Roach
Reported
2015-08-06 16:06:56 PDT
Created
attachment 258414
[details]
JavaScript alert inside WKWebView displaying window.onerror args Unhandled JavaScript exceptions occurring in JavaScript code inside a iOS WKWebView doesn't generate useful information to window.onerror beyond msg = "Script error". It's a pity because older UIWebView does get better information. Unhandled JavaScript exceptions call user's window.onerror function if there is a function installed. For example, include function errorHandler(msg, url, line, col, errorObj) { try { alert(("msg: " + msg) + ("\nurl: " + url) + ("\nline: " + line) + ("\ncol: " + col) + ("\nerrorObj: " + errorObj)); } catch (e) { } return true; } window.onerror = errorHandler; along with other JavaScript code inside a <script> tag in an HTML file. In case of iOS UIWebView, we at least get a msg string with some variety indicative of the type of unhanded JavaScript exception which occurred. Examples: "INVALID_NODE_TYPE_ERR: DOM Range Exception 2: The container ..." "HierarchyRequestError: DOM Exception 3: A Node was inserted ..." "ReferenceError: Can't find variable: garbage" in addition to some line and col which generally are both non-zero integers. However, in case of iOS WKWebView, we find we are ALWAYS getting only the following values passed to our errorHandler: msg: Script error. url: [blank] line: 0 col: 0 errorObj: undefined This is still the case as of iOS 9 beta 4 . We'd prefer to get at least as much information unhandled JavaScript exceptions when using WKWebView as we do get when using UIWebView . One of my coworkers spoke to an Apple representative at the most recent WWDC about this matter. We're informed that the Apple representative thought it was a bug which should be reported.
Attachments
JavaScript alert inside WKWebView displaying window.onerror args
(86.17 KB, image/tiff)
2015-08-06 16:06 PDT
,
Kelly Roach
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Alexander Ewering
Comment 1
2016-11-29 04:34:09 PST
Still no word on this? I use an IDE which depends on onerror, it's useless this way!
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