From efa5bba1affe34b50ac6e4647397cee1d84930ed Mon Sep 17 00:00:00 2001 From: Mitar Date: Thu, 18 Sep 2014 21:11:28 -0700 Subject: [PATCH] Better hooks for local files. --- src/001-xml_http_request.coffee | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/001-xml_http_request.coffee b/src/001-xml_http_request.coffee index f47027c..657ac1e 100644 --- a/src/001-xml_http_request.coffee +++ b/src/001-xml_http_request.coffee @@ -182,6 +182,8 @@ class XMLHttpRequest extends XMLHttpRequestEventTarget @_sendFile data when 'http:', 'https:' @_sendHttp data + when null + @_sendRelative data else throw new NetworkError "Unsupported protocol #{@_url.protocol}" @@ -393,12 +395,18 @@ class XMLHttpRequest extends XMLHttpRequestEventTarget # XMLHttpRequest#send() implementation for the file: protocol. # # @private - _sendFile: -> - unless @_url.method is 'GET' + _sendFile: (data) -> + unless @_method is 'GET' throw new NetworkError 'The file protocol only supports GET' throw new Error "Protocol file: not implemented" + # XMLHttpRequest#send() implementation for the relative URLs. + # + # @private + _sendRelative: (data) -> + throw new Error "Relative URLs: not implemented" + # XMLHttpRequest#send() implementation for the http: and https: protocols. # # @private