Bug 102698

Summary: Remove XMLHttpRequestException
Product: WebKit Reporter: Erik Arvidsson <arv>
Component: DOMAssignee: Daniel Bates <dbates>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, annevk, ap, bfulgham, buildbot, cdumez, dbates, gyuyoung.kim, ojan.autocc, ojan, rakuco, rniwa, syoichi, webkit-bug-importer, webkit.review.bot, youennf
Priority: P2 Keywords: InRadar, WebExposed
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
URL: http://xhr.spec.whatwg.org/
See Also: https://bugs.webkit.org/show_bug.cgi?id=149597
Bug Depends on:    
Bug Blocks: 102505    
Attachments:
Description Flags
Patch
none
Patch
none
Patch cdumez: review+

Description Erik Arvidsson 2012-11-19 10:45:17 PST
The spec says to throw a DOMException instead.
Comment 1 Erik Arvidsson 2012-11-19 11:43:01 PST
Created attachment 175013 [details]
Patch
Comment 2 Adam Barth 2012-11-19 13:00:27 PST
My main worry here is causing compatibility problems by changing the exception number from 101 to 19 for network error.  Have you doing anything to assess the compatibility risk from this change?
Comment 3 Erik Arvidsson 2012-11-19 13:41:02 PST
(In reply to comment #2)
> My main worry here is causing compatibility problems by changing the exception number from 101 to 19 for network error.  Have you doing anything to assess the compatibility risk from this change?

The compat risk should be low because other browsers do not even have XMLHttpRequestException object and they have never had a code property with the value 101.
Comment 4 Alexey Proskuryakov 2012-11-19 13:42:23 PST
This looks quite dangerous to me, too.

How did you assess compatibility impact for mobile content, Dashboard widgets, and other environments where WebKit is prevalent?
Comment 5 Erik Arvidsson 2012-11-19 15:43:53 PST
(In reply to comment #4)
> This looks quite dangerous to me, too.
> 
> How did you assess compatibility impact for mobile content, Dashboard widgets, and other environments where WebKit is prevalent?

People don't rely on error codes for XHR exceptions. People use events and check the status property.
Comment 6 Alexey Proskuryakov 2012-11-19 16:01:46 PST
Is there any need to change this behavior in WebKit if no one relies on it?

It's perplexing that anyone could consider removing this exception code after it being in the standard for years. Is there any reason for WebKit to track standards if they get changed on a whim despite successful implementation experience?
Comment 7 Ojan Vafai 2012-11-19 16:07:51 PST
It simplifies the platform. Is removing cruft that nobody relies on not beneficial? I think it is.

In this specific case, if we need to, we can keep the exception number for XHR network exceptions 101 without keeping the whole XMLHttpRequestException class, but it seems extremely unlikely to me that sites are depending on this.
Comment 8 Erik Arvidsson 2012-11-19 16:39:41 PST
(In reply to comment #6)
> Is there any need to change this behavior in WebKit if no one relies on it?

This is a philosophical question that I don't think we will ever agree on. I strongly believe that we should improve the platform where it is possible.
Comment 9 Build Bot 2012-11-19 17:33:32 PST
Comment on attachment 175013 [details]
Patch

Attachment 175013 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/14905375

New failing tests:
http/tests/xmlhttprequest/XMLHttpRequestException.html
Comment 10 Build Bot 2012-11-19 18:30:43 PST
Comment on attachment 175013 [details]
Patch

Attachment 175013 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/14905394

New failing tests:
http/tests/xmlhttprequest/XMLHttpRequestException.html
Comment 11 Alexey Proskuryakov 2012-11-19 21:37:09 PST
> I strongly believe that we should improve the platform where it is possible.

Making the platform inconsistent with previous generation specs and unreliable benefits companies with large web development budgets who can maintain compatibility with a wide range of browser versions, at the expense of smaller competitors and users, as browsers gradually become incompatible with web sites outside of top 100 or so.

It's just business, nothing philosophical.
Comment 12 Anne van Kesteren 2012-11-21 12:15:50 PST
FWIW, this was only in the spec in the 2007-2008 timeframe. It changed end of 2008 afaict. The whole concept of XMLHttpRequestException only lasted during 2007.
Comment 13 Erik Arvidsson 2012-12-06 13:58:36 PST
Created attachment 178073 [details]
Patch
Comment 14 Alexey Proskuryakov 2012-12-06 14:07:15 PST
> The whole concept of XMLHttpRequestException only lasted during 2007.

I think that this statement is misleading. XMLHttpRequestException is present in a lot of browsers in 2012. That should be enough of a reason to add it back.
Comment 15 Erik Arvidsson 2012-12-06 14:29:58 PST
(In reply to comment #14)
> > The whole concept of XMLHttpRequestException only lasted during 2007.
> 
> XMLHttpRequestException is present in a lot of browsers in 2012.

I don't think WebKit alone counts as a lot of browsers.

XMLHttpRequestException is not available in Firefox.
XMLHttpRequestException is not available in Internet Explorer.
XMLHttpRequestException is not available in Opera.
Comment 16 Build Bot 2012-12-06 14:53:49 PST
Comment on attachment 178073 [details]
Patch

Attachment 178073 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/15159837
Comment 17 Alexey Proskuryakov 2012-12-06 16:10:57 PST
> XMLHttpRequestException is not available in Firefox.
> XMLHttpRequestException is not available in Internet Explorer.
> XMLHttpRequestException is not available in Opera.

This is not a very good way to count browsers for compatibility analysis. Counting engines is helpful to count independent implementations, which is useful to assess technical feasibility of widespread implementation.
Comment 18 Build Bot 2012-12-06 16:55:56 PST
Comment on attachment 178073 [details]
Patch

Attachment 178073 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/15185147
Comment 19 Build Bot 2013-01-16 18:01:16 PST
Comment on attachment 178073 [details]
Patch

Attachment 178073 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://queues.webkit.org/results/15909636
Comment 20 youenn fablet 2014-02-17 08:14:19 PST
Blink removed XMLHttpRequestException a while back (https://code.google.com/p/chromium/issues/detail?id=229395).

We are now probably safe removing it as well?
Comment 21 Chris Dumez 2016-01-25 14:45:12 PST
(In reply to comment #20)
> Blink removed XMLHttpRequestException a while back
> (https://code.google.com/p/chromium/issues/detail?id=229395).
> 
> We are now probably safe removing it as well?

I vote yes.
Comment 22 Chris Dumez 2016-01-25 14:47:28 PST
Note that similarly, I already dropped support for the legacy EventException in Bug 149597 fairly recently.
Comment 23 Radar WebKit Bug Importer 2016-01-25 16:56:46 PST
<rdar://problem/24338476>
Comment 24 Daniel Bates 2016-01-25 17:19:23 PST
Created attachment 269822 [details]
Patch
Comment 25 Chris Dumez 2016-01-25 19:02:57 PST
Comment on attachment 269822 [details]
Patch

r=me
Comment 26 Daniel Bates 2016-01-26 08:06:50 PST
Committed r195588: <http://trac.webkit.org/changeset/195588>