[Webkit-unassigned] [Bug 147753] New: iOS WKWebView window.onerror Callback Doesn't Get a Useful msg

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Aug 6 16:06:56 PDT 2015


https://bugs.webkit.org/show_bug.cgi?id=147753

            Bug ID: 147753
           Summary: iOS WKWebView window.onerror Callback Doesn't Get a
                    Useful msg
    Classification: Unclassified
           Product: WebKit
           Version: 528+ (Nightly build)
          Hardware: iOS
                OS: iOS 8.2
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebCore JavaScript
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: kroach at crittercism.com

Created attachment 258414
  --> https://bugs.webkit.org/attachment.cgi?id=258414&action=review
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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150806/b1d60893/attachment.html>


More information about the webkit-unassigned mailing list