Also combine options and extra in CrossOrigin.ajax and in call from $.cache.

Fixes bugs from 71896af275ba612384e41bc05ab3c5acf78e9cbf.
This commit is contained in:
ccd0 2019-03-24 04:49:41 -07:00
parent 19c7e73d14
commit 2c4b77e8d7
2 changed files with 7 additions and 7 deletions

View File

@ -97,7 +97,8 @@ $.whenModified = (url, bucket, cb, options={}) ->
($.lastModified[bucket] or= {})[url0] = @getResponseHeader('Last-Modified') ($.lastModified[bucket] or= {})[url0] = @getResponseHeader('Last-Modified')
cb.call @ cb.call @
timeout timeout
}, {headers} headers
}
r r
do -> do ->

View File

@ -87,18 +87,17 @@ CrossOrigin =
# Attempts to fetch `url` in JSON format using cross-origin privileges, if available. # Attempts to fetch `url` in JSON format using cross-origin privileges, if available.
# Interface is a subset of that of $.ajax. # Interface is a subset of that of $.ajax.
# Options: # Options:
# `options.onloadend` - called with the returned object as `this` on success or error/abort/timeout. # `onloadend` - called with the returned object as `this` on success or error/abort/timeout.
# `options.timeout` - time limit for request # `timeout` - time limit for request
# `extra.headers` - request headers # `headers` - request headers
# Returned object properties: # Returned object properties:
# `status` - HTTP status (0 if connection not successful) # `status` - HTTP status (0 if connection not successful)
# `statusText` - HTTP status text # `statusText` - HTTP status text
# `response` - decoded response body # `response` - decoded response body
# `abort` - function for aborting the request (silently fails on some platforms) # `abort` - function for aborting the request (silently fails on some platforms)
# `getResponseHeader` - function for reading response headers # `getResponseHeader` - function for reading response headers
ajax: (url, options={}, extra={}) -> ajax: (url, options={}) ->
{onloadend, timeout} = options {onloadend, timeout, headers} = options
{headers} = extra
<% if (type === 'userscript') { %> <% if (type === 'userscript') { %>
unless GM?.xmlHttpRequest? or GM_xmlhttpRequest? unless GM?.xmlHttpRequest? or GM_xmlhttpRequest?