From a103d266dcfb43a9ad1c255f7013254e64e39de5 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sun, 11 Sep 2016 20:39:20 -0700 Subject: [PATCH] Work around Chromium 304 bug. #1057 --- src/platform/$.coffee | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/platform/$.coffee b/src/platform/$.coffee index e471eb98d..edfb70fec 100644 --- a/src/platform/$.coffee +++ b/src/platform/$.coffee @@ -45,8 +45,11 @@ $.ajax = do -> (url, options={}, 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 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() type or= form and 'post' or 'get' try @@ -54,8 +57,6 @@ $.ajax = do -> if whenModified r.setRequestHeader 'If-Modified-Since', lastModified[whenModified][url] if lastModified[whenModified]?[url]? $.on r, 'load', -> (lastModified[whenModified] or= {})[url] = r.getResponseHeader 'Last-Modified' - if /\.json$/.test url - options.responseType ?= 'json' $.extend r, options $.extend r.upload, upCallbacks # connection error or content blocker