Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better hooks for local files #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/001-xml_http_request.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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}"

Expand Down Expand Up @@ -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
Expand Down