Chromium Code Reviews| Index: Source/modules/serviceworkers/FetchManager.cpp |
| diff --git a/Source/modules/serviceworkers/FetchManager.cpp b/Source/modules/serviceworkers/FetchManager.cpp |
| index 60d36c97f7501562cdd2aad5c4d613fce7b9263d..6333f39f3cc123a0256d6293a650dd09bc04b648 100644 |
| --- a/Source/modules/serviceworkers/FetchManager.cpp |
| +++ b/Source/modules/serviceworkers/FetchManager.cpp |
| @@ -40,9 +40,9 @@ public: |
| private: |
| void performBasicFetch(); |
| - void performNetworkError(); |
| + void performNetworkError(const String& message); |
| void performHTTPFetch(); |
| - void failed(); |
| + void failed(const String& message); |
| void notifyFinished(); |
| ExecutionContext* m_executionContext; |
| @@ -120,17 +120,17 @@ void FetchManager::Loader::didFinishLoading(unsigned long, double) |
| void FetchManager::Loader::didFail(const ResourceError& error) |
| { |
| - failed(); |
| + failed("Fetch API cannot load " + error.failingURL() + ". " + error.localizedDescription()); |
| } |
| void FetchManager::Loader::didFailAccessControlCheck(const ResourceError& error) |
| { |
| - failed(); |
| + failed("Fetch API cannot load " + error.failingURL() + ". " + error.localizedDescription()); |
| } |
| void FetchManager::Loader::didFailRedirectCheck() |
| { |
| - failed(); |
| + failed("Fetch API cannot load " + m_request->url().string() + ". Unsupported redirection."); |
|
falken
2014/11/17 02:14:46
This message suggests there is a class of unsuppor
horo
2014/11/17 03:25:35
Done.
|
| } |
| void FetchManager::Loader::didDownloadData(int dataLength) |
| @@ -179,7 +179,7 @@ void FetchManager::Loader::start() |
| // "- |request|'s mode is |same-origin|" |
| if (m_request->mode() == WebURLRequest::FetchRequestModeSameOrigin) { |
| // "A network error." |
| - performNetworkError(); |
| + performNetworkError("Fetch API cannot load " + m_request->url().string() + ". Request mode is \"same-origin\" but the URL is not same origin."); |
|
falken
2014/11/17 02:14:46
not the same origin as what?
horo
2014/11/17 03:25:35
Done.
|
| return; |
| } |
| @@ -195,7 +195,7 @@ void FetchManager::Loader::start() |
| // "- |request|'s url's scheme is not one of 'http' and 'https'" |
| if (!m_request->url().protocolIsInHTTPFamily()) { |
| // "A network error." |
| - performNetworkError(); |
| + performNetworkError("Fetch API cannot load " + m_request->url().string() + ". URL scheme must be \"http\" or \"https\" for CORS request."); |
| return; |
| } |
| @@ -249,13 +249,13 @@ void FetchManager::Loader::performBasicFetch() |
| performHTTPFetch(); |
| } else { |
| // FIXME: implement other protocols. |
| - performNetworkError(); |
| + performNetworkError("Fetch API cannot load " + m_request->url().string() + ". URL scheme \"" + m_request->url().protocol() + "\" is not supported."); |
| } |
| } |
| -void FetchManager::Loader::performNetworkError() |
| +void FetchManager::Loader::performNetworkError(const String& message) |
| { |
| - failed(); |
| + failed(message); |
| } |
| void FetchManager::Loader::performHTTPFetch() |
| @@ -322,7 +322,7 @@ void FetchManager::Loader::performHTTPFetch() |
| m_loader = ThreadableLoader::create(*m_executionContext, this, request, threadableLoaderOptions, resourceLoaderOptions); |
| } |
| -void FetchManager::Loader::failed() |
| +void FetchManager::Loader::failed(const String& message) |
| { |
| if (m_failed) |
| return; |
| @@ -331,7 +331,7 @@ void FetchManager::Loader::failed() |
| m_failed = true; |
| ScriptState* state = m_resolver->scriptState(); |
| ScriptState::Scope scope(state); |
| - m_resolver->reject(V8ThrowException::createTypeError(state->isolate(), "Failed to fetch")); |
| + m_resolver->reject(V8ThrowException::createTypeError(state->isolate(), message)); |
| notifyFinished(); |
| } |