Let abort always exist, but we can't guarantee it will do anything.
This commit is contained in:
parent
8cfd16f0a4
commit
695e995dce
@ -204,8 +204,7 @@ ThreadWatcher =
|
|||||||
abort: ->
|
abort: ->
|
||||||
for req in ThreadWatcher.requests when !req.finished
|
for req in ThreadWatcher.requests when !req.finished
|
||||||
req.finished = true
|
req.finished = true
|
||||||
try
|
req.abort()
|
||||||
req.abort?()
|
|
||||||
ThreadWatcher.clearRequests()
|
ThreadWatcher.clearRequests()
|
||||||
|
|
||||||
initLastModified: ->
|
initLastModified: ->
|
||||||
|
|||||||
@ -82,6 +82,7 @@ CrossOrigin =
|
|||||||
val = header[i+1..].trim()
|
val = header[i+1..].trim()
|
||||||
@responseHeaders[key] = val
|
@responseHeaders[key] = val
|
||||||
(@responseHeaders or {})[headerName.toLowerCase()] ? null
|
(@responseHeaders or {})[headerName.toLowerCase()] ? null
|
||||||
|
abort: ->
|
||||||
|
|
||||||
# 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.
|
||||||
@ -93,7 +94,7 @@ CrossOrigin =
|
|||||||
# `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` - if present, can be called to abort the request
|
# `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={}, extra={}) ->
|
||||||
{onloadend, timeout} = options
|
{onloadend, timeout} = options
|
||||||
@ -127,7 +128,10 @@ CrossOrigin =
|
|||||||
onabort: -> req.onloadend()
|
onabort: -> req.onloadend()
|
||||||
ontimeout: -> req.onloadend()
|
ontimeout: -> req.onloadend()
|
||||||
}
|
}
|
||||||
req.abort = gmReq.abort
|
if typeof gmReq.abort is 'function'
|
||||||
|
req.abort = ->
|
||||||
|
try
|
||||||
|
gmReq.abort()
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
<% if (type === 'crx') { %>
|
<% if (type === 'crx') { %>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user