https://bugzilla.wikimedia.org/show_bug.cgi?id=64822

--- Comment #8 from Krinkle <[email protected]> ---
(In reply to Krinkle from comment #7)
> (In reply to Barry Coughlan from comment #2)
> > The crossDomain logic will switch between the 'script' and 'xhr' transports,
> > but both requests will still have be JSONP and have the callback parameter.
> > 
> > See here: http://jsfiddle.net/yvzSL/228/
> > 
> > In your developer tools console you can see that the local request uses XHR,
> > but it is still a JSONP request over XHR. I have read through the $.ajax
> > docs a number of times now and I see no indication that it should behave
> > otherwise.
> 
> That example is broken. The first request is is malformed. "json jsonp" is
> not a valid dataType. This value is invalid and unsupported. It seems to
> default to a script tag instead, but as you can see the callback in that
> code never fires. Here's a forked version of that example where I added
> number "1" and "2". You'll find that "DONE 1" never appears.
> 
> http://jsfiddle.net/L5PtK/

To clarify, I know dataType supports multiple values, but that's for converting
the response (e.g. xml over jsonp). But you can't convert the actual data from
json to jsonp or from json to jsonp (unless an API would embed javascript
inside json or something like that).

As for VisualEditor, it should use json when contacting the local API. and
jsonp when contacting any foreign API (whether on the same domain or not).

There is logic for this in jQuery that automatically switches from "json" to
"jsonp" for cross domain urls.

However that doesn't trigger the way I expected. It makes the assumption that
1) you should only make 'json' requests to APIs on the same domain or with CORS
authentication set up. Then if a browser doesn't support CORS it will use
script  with JSONP instead of XHR. So it functions like a fallback for browsers
not supporting CORS, *not* as a convenience to switch to JSONP automatically
for any cross domain url.

jquery.js
> if ( !options.crossDomain || support.cors ) {

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to