Use page version of XHR when in GM4 so withCredentials works. #1597
This commit is contained in:
parent
a604d7b799
commit
56ae941c4e
@ -45,10 +45,10 @@ $.ajax = do ->
|
|||||||
# With the `If-Modified-Since` header we only receive the HTTP headers and no body for 304 responses.
|
# With the `If-Modified-Since` header we only receive the HTTP headers and no body for 304 responses.
|
||||||
# This saves a lot of bandwidth and CPU time for both the users and the servers.
|
# This saves a lot of bandwidth and CPU time for both the users and the servers.
|
||||||
lastModified = {}
|
lastModified = {}
|
||||||
<% if (type === 'crx') { %>
|
if window.wrappedJSObject and not XMLHttpRequest.wrappedJSObject
|
||||||
if XPCNativeWrapper?
|
|
||||||
pageXHR = XPCNativeWrapper window.wrappedJSObject.XMLHttpRequest
|
pageXHR = XPCNativeWrapper window.wrappedJSObject.XMLHttpRequest
|
||||||
<% } %>
|
else
|
||||||
|
pageXHR = XMLHttpRequest
|
||||||
|
|
||||||
(url, options={}, extra={}) ->
|
(url, options={}, extra={}) ->
|
||||||
{type, whenModified, upCallbacks, form} = extra
|
{type, whenModified, upCallbacks, form} = extra
|
||||||
@ -57,11 +57,7 @@ $.ajax = do ->
|
|||||||
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
|
# XXX https://bugs.chromium.org/p/chromium/issues/detail?id=643659
|
||||||
url += "?s=#{whenModified}" if $.engine is 'blink' and whenModified
|
url += "?s=#{whenModified}" if $.engine is 'blink' and whenModified
|
||||||
xhr = XMLHttpRequest
|
r = new pageXHR()
|
||||||
<% if (type === 'crx') { %>
|
|
||||||
xhr = pageXHR or xhr
|
|
||||||
<% } %>
|
|
||||||
r = new xhr()
|
|
||||||
type or= form and 'post' or 'get'
|
type or= form and 'post' or 'get'
|
||||||
try
|
try
|
||||||
r.open type, url, true
|
r.open type, url, true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user