Work around Chromium 304 bug. #1057
This commit is contained in:
parent
44380d0cae
commit
a103d266dc
@ -45,8 +45,11 @@ $.ajax = do ->
|
|||||||
|
|
||||||
(url, options={}, extra={}) ->
|
(url, options={}, extra={}) ->
|
||||||
{type, whenModified, upCallbacks, form} = extra
|
{type, whenModified, upCallbacks, form} = extra
|
||||||
|
options.responseType ?= 'json' if /\.json$/.test url
|
||||||
# XXX https://forums.lanik.us/viewtopic.php?f=64&t=24173&p=78310
|
# XXX https://forums.lanik.us/viewtopic.php?f=64&t=24173&p=78310
|
||||||
url = url.replace /^((?:https?:)?\/\/(?:\w+\.)?4c(?:ha|d)n\.org)\/adv\//, '$1//adv/'
|
url = url.replace /^((?:https?:)?\/\/(?:\w+\.)?4c(?:ha|d)n\.org)\/adv\//, '$1//adv/'
|
||||||
|
# XXX https://bugs.chromium.org/p/chromium/issues/detail?id=643659
|
||||||
|
url += "?s=#{whenModified}" if $.engine is 'blink' and whenModified
|
||||||
r = new XMLHttpRequest()
|
r = new XMLHttpRequest()
|
||||||
type or= form and 'post' or 'get'
|
type or= form and 'post' or 'get'
|
||||||
try
|
try
|
||||||
@ -54,8 +57,6 @@ $.ajax = do ->
|
|||||||
if whenModified
|
if whenModified
|
||||||
r.setRequestHeader 'If-Modified-Since', lastModified[whenModified][url] if lastModified[whenModified]?[url]?
|
r.setRequestHeader 'If-Modified-Since', lastModified[whenModified][url] if lastModified[whenModified]?[url]?
|
||||||
$.on r, 'load', -> (lastModified[whenModified] or= {})[url] = r.getResponseHeader 'Last-Modified'
|
$.on r, 'load', -> (lastModified[whenModified] or= {})[url] = r.getResponseHeader 'Last-Modified'
|
||||||
if /\.json$/.test url
|
|
||||||
options.responseType ?= 'json'
|
|
||||||
$.extend r, options
|
$.extend r, options
|
||||||
$.extend r.upload, upCallbacks
|
$.extend r.upload, upCallbacks
|
||||||
# connection error or content blocker
|
# connection error or content blocker
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user