[webkit-dev] Improving DOM Exception console messages.
esprehn at chromium.org
Wed Sep 26 17:17:53 PDT 2012
Awesome! This had come up as something I wanted to fix a few weeks ago as
On Wed, Sep 26, 2012 at 9:20 AM, Ojan Vafai <ojan at chromium.org> wrote:
> Sounds great!
> On Wed, Sep 26, 2012 at 8:12 AM, Mike West <mkwst at chromium.org> wrote:
>> Hello, webkit-dev!
>> TL;DR: I'd like to improve the console messages displayed for DOM
>> exceptions. I'm hoping that no one thinks this is a miserable,
>> miserable idea.
>> At the moment, the following code generates an exception with a
>> message reading "SECURITY_ERR: DOM Exception 18".
>> <!doctype html>
>> <title>Bug 152212</title>
>> <meta http-equiv="X-WebKit-CSP" content="connect-src 'none'">
>> var xhr = new XMLHttpRequest();
>> var url = '
>> xhr.open('GET', url, true);
>> In this case, the exception is generated because Content Security
>> Policy blocks the XMLHttpRequest, but it's tough to tell, because the
>> exact same error crops up for 31 different exception cases. It
>> might be CSP, it might be a disallowed HTTP method, who knows. Because
>> of the variety, searching for the exception message is unhelpful. In
>> this case, I end up on StackOverflow, reading about cookies and
>> jQuery, which is unlikely to be of service.
>> This isn't a great experience, and while SECURITY_ERR is particularly
>> widespread, the scenario is similar for the other DOM exceptions
>> WebKit throws. Each ends up in ExceptionBase, where a message is
>> assembled from the exception type and code, and the developer is left
>> more than a little underinformed.
>> I'd like to add the ability to pass some sort of contextual message
>> along with the error code. This would involve some work on JSC and V8
>> bindings, as well as a whole lot of single-line changes to the various
>> bits of the DOM where these error codes are generated.
>> In this case, a useful message might be: "SECURITY_ERR: DOM Exception
>> 18. XMLHttpRequest connections to
>> 'http://localhost:8000/xmlhttprequest/resources/get.txt' are blocked
>> due to this page's Content Security Policy." This would have the
>> positive impact of giving developers something useful to work with. It
>> would also have the impact of changing the exception text, which is
>> why I'm writing this email. :)
>> Before I get too far along in experimental implementations, are there
>> fundamental objections to changing the exception text to include some
>> optional context?
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the webkit-dev