-
Notifications
You must be signed in to change notification settings - Fork 27.5k
$http responseType: 'json' triggers DOM Exception 12 in Mobile Webkit #6115
Comments
responseType is from XMLHttpRequest2, which probably isn't supported on mobile safari 7 or something. That said, I don't see anything in the IDL which would cause it to throw for setting the response type, it should probably just be ignored. Any any rate, I can't seem to reproduce this on mobile Safari 7. Could you post a reproduction and list the affected devices+browsers you've tested with? edit I can reproduce this with mobile safari 6.1 in ios simulator |
I saw this on an iPhone 4S running iOS 6.1.3. I had a coworker come by with an iPhone 5 and iOS 7 and report the same issue. I ended up just removing the responseType declaration, as Angular seems to do JSON conversion by default, but just wanted to raise the issue in case it was a red flag for a deeper problem. |
It seems that the exception gets thrown when assigning xhr.responseType (although I see no reason in the IDL why that should happen!) We could get around this by wrapping it in a try/catch block (but I don't really like this idea) |
It looks like safari 6.1 doesn't support the "json" responseType. http://trac.webkit.org/changeset/154992 was checked in only a couple months ago, and I guess the 6.1 release didn't include that patch. So this explains it. For what it's worth though, if you just use responseType="text" or ignore the responseType setting entirely, angular will automatically parse JSON for you. (which apparently you've already mentioned!) |
I think this is probably a WON'TFIX as I don't think it's a totally great idea to hide the exception if it happens, so I'm gonna close this. |
re-opening this for now as Igor suggests it might be worth working around the bug. |
It was definitely difficult to trace, so at least a note in the
|
WebKit added support for the json responseType value on 09/03/2013 https://bugs.webkit.org/show_bug.cgi?id=73648. Versions of Safari prior to 7 are known to throw when setting the value "json" as the response type. Other older browsers implementing the responseType. Other browsers with infrequent update cycles may also be affected. The json responseType value can be ignored if not supported, because JSON payloads are parsed on the client-side regardless. Closes angular#6115
WebKit added support for the json responseType value on 09/03/2013 https://bugs.webkit.org/show_bug.cgi?id=73648. Versions of Safari prior to 7 are known to throw when setting the value "json" as the response type. Other older browsers implementing the responseType. Other browsers with infrequent update cycles may also be affected. The json responseType value can be ignored if not supported, because JSON payloads are parsed on the client-side regardless. Closes angular#6115 Closes angular#6122
WebKit added support for the json responseType value on 09/03/2013 https://bugs.webkit.org/show_bug.cgi?id=73648. Versions of Safari prior to 7 are known to throw when setting the value "json" as the response type. Other older browsers implementing the responseType. Other browsers with infrequent update cycles may also be affected. The json responseType value can be ignored if not supported, because JSON payloads are parsed on the client-side regardless. Closes #6115 Closes #6122
Hi folks,
I'm building a nice little drag & drop upload form for a contest and came across an interesting error.
In trying to perform a simple
$http.get
call with some config passed, I've been getting DOM Exception 12 "SYNTAX ERROR" only in mobile phones with webkit-based browsers. Chrome does not seem to be affected.Here's the actual code to reproduce (found in v1.2.6):
Has anyone else run into this? The DOM error points to the line in $http's source where it sets the xhr.responseType property.
The text was updated successfully, but these errors were encountered: