bool ResourceErrorBase::compare(const ResourceError& a, const ResourceError& b) { if (a.isNull() && b.isNull()) return true; if (a.isNull() || b.isNull()) return false; if (a.domain() != b.domain()) return false; if (a.errorCode() != b.errorCode()) return false; if (a.failingURL() != b.failingURL()) return false; if (a.localizedDescription() != b.localizedDescription()) return false; if (a.isCancellation() != b.isCancellation()) return false; return platformCompare(a, b); }
void FrameLoaderClientEfl::dispatchDidFailProvisionalLoad(const ResourceError& err) { Ewk_Frame_Load_Error error; CString errorDomain = err.domain().utf8(); CString errorDescription = err.localizedDescription().utf8(); CString failingUrl = err.failingURL().utf8(); DBG("ewkFrame=%p, error=%s (%d, cancellation=%hhu) \"%s\", url=%s", m_frame, errorDomain.data(), err.errorCode(), err.isCancellation(), errorDescription.data(), failingUrl.data()); error.code = err.errorCode(); error.is_cancellation = err.isCancellation(); error.domain = errorDomain.data(); error.description = errorDescription.data(); error.failing_url = failingUrl.data(); error.resource_identifier = 0; error.frame = m_frame; ewk_frame_load_provisional_failed(m_frame, &error); if (isLoadingMainFrame()) ewk_view_load_provisional_failed(m_view, &error); dispatchDidFailLoad(err); }
bool WebFrameLoaderClient::shouldFallBack(const ResourceError& error) { if (error.errorCode() == WebURLErrorCancelled && error.domain() == String(WebURLErrorDomain)) return false; if (error.errorCode() == WebKitErrorPlugInWillHandleLoad && error.domain() == String(WebKitErrorDomain)) return false; return true; }
void FrameLoaderClientBlackBerry::dispatchDidFailProvisionalLoad(const ResourceError& error) { if (isMainFrame()) { m_loadError = error; m_webPagePrivate->setLoadState(WebPagePrivate::Failed); if (error.domain() == ResourceError::platformErrorDomain && (error.errorCode() == BlackBerry::Platform::FilterStream::StatusErrorAlreadyHandled)) { // Error has already been displayed by client. return; } if (error.domain().isEmpty() && !error.errorCode() && error.failingURL().isEmpty() && error.localizedDescription().isEmpty()) { // Don't try to display empty errors returned from the unimplemented error functions in FrameLoaderClientBlackBerry - there's nothing to display anyway. return; } } if (m_webPagePrivate->m_dumpRenderTree) m_webPagePrivate->m_dumpRenderTree->didFailProvisionalLoadForFrame(m_frame); if (!isMainFrame()) return; String errorPage = m_webPagePrivate->m_client->getErrorPage(error.errorCode() , error.localizedDescription().isEmpty() ? "" : error.localizedDescription().utf8().data() , error.failingURL().isEmpty() ? "" : error.failingURL().utf8().data()); // Make sure we're still in the provisionalLoad state - getErrorPage runs a // nested event loop while it's waiting for client resources to load so // there's a small window for the user to hit stop. if (m_frame->loader()->provisionalDocumentLoader()) { SubstituteData errorData(utf8Buffer(errorPage), "text/html", "utf-8", KURL(KURL(), error.failingURL())); ResourceRequest originalRequest = m_frame->loader()->provisionalDocumentLoader()->originalRequest(); // Loading using SubstituteData will replace the original request with our // error data. This must be done within dispatchDidFailProvisionalLoad, // and do NOT call stopAllLoaders first, because the loader checks the // provisionalDocumentLoader to decide the load type; if called any other // way, the error page is added to the end of the history instead of // replacing the failed load. // // If this comes from a back/forward navigation, we need to save the current viewstate // to original historyitem, and prevent the restore of view state to the error page. if (isBackForwardLoadType(m_frame->loader()->loadType())) { m_frame->loader()->history()->saveScrollPositionAndViewStateToItem(m_frame->loader()->history()->currentItem()); ASSERT(m_frame->loader()->history()->provisionalItem()); m_frame->loader()->history()->provisionalItem()->viewState().shouldSaveViewState = false; } m_loadingErrorPage = true; m_frame->loader()->load(originalRequest, errorData, false); } }
void FrameLoaderClientAndroid::setMainDocumentError(DocumentLoader* docLoader, const ResourceError& error) { ASSERT(m_frame); if (m_manualLoader) { m_manualLoader->didFail(error); m_manualLoader = NULL; m_hasSentResponseToPlugin = false; } else { if (!error.isNull() && error.errorCode() >= InternalErrorLast) m_webFrame->reportError(error.errorCode(), error.localizedDescription(), error.failingURL()); } }
void FrameLoaderClientEfl::dispatchDidFailLoad(const ResourceError& err) { ewk_frame_load_error(m_frame, err.domain().utf8().data(), err.errorCode(), err.isCancellation(), err.localizedDescription().utf8().data(), err.failingURL().utf8().data()); ewk_frame_load_finished(m_frame, err.domain().utf8().data(), err.errorCode(), err.isCancellation(), err.localizedDescription().utf8().data(), err.failingURL().utf8().data()); }
void FileReaderLoader::didFail(const ResourceError& error) { // If we're aborting, do not proceed with normal error handling since it is covered in aborting code. if (m_errorCode == FileError::ABORT_ERR) return; failed(toErrorCode(static_cast<BlobResourceHandle::Error>(error.errorCode()))); }
void webkitDownloadFailed(WebKitDownload* download, const ResourceError& resourceError) { GUniquePtr<GError> webError(g_error_new_literal(g_quark_from_string(resourceError.domain().utf8().data()), toWebKitError(resourceError.errorCode()), resourceError.localizedDescription().utf8().data())); if (download->priv->timer) g_timer_stop(download->priv->timer.get()); g_signal_emit(download, signals[FAILED], 0, webError.get()); g_signal_emit(download, signals[FINISHED], 0, NULL); }
void ArgumentCoder<ResourceError>::encode(ArgumentEncoder* encoder, const ResourceError& resourceError) { encoder->encode(resourceError.domain()); encoder->encode(resourceError.errorCode()); encoder->encode(resourceError.failingURL()); encoder->encode(resourceError.localizedDescription()); #if USE(CFNETWORK) encoder->encode(PlatformCertificateInfo(resourceError.certificate())); #endif }
bool WebFrameLoaderClient::shouldFallBack(const ResourceError& error) { DEFINE_STATIC_LOCAL(const ResourceError, cancelledError, (this->cancelledError(ResourceRequest()))); DEFINE_STATIC_LOCAL(const ResourceError, pluginWillHandleLoadError, (this->pluginWillHandleLoadError(ResourceResponse()))); if (error.errorCode() == cancelledError.errorCode() && error.domain() == cancelledError.domain()) return false; if (error.errorCode() == pluginWillHandleLoadError.errorCode() && error.domain() == pluginWillHandleLoadError.domain()) return false; #if PLATFORM(QT) DEFINE_STATIC_LOCAL(const ResourceError, errorInterruptedForPolicyChange, (this->interruptedForPolicyChangeError(ResourceRequest()))); if (error.errorCode() == errorInterruptedForPolicyChange.errorCode() && error.domain() == errorInterruptedForPolicyChange.domain()) return false; #endif return true; }
void ArgumentCoder<ResourceError>::encode(ArgumentEncoder* encoder, const ResourceError& resourceError) { bool errorIsNull = resourceError.isNull(); encoder->encode(errorIsNull); if (errorIsNull) return; encoder->encode(resourceError.domain()); encoder->encode(resourceError.errorCode()); encoder->encode(resourceError.failingURL()); encoder->encode(resourceError.localizedDescription()); }
void FrameLoaderClientEfl::dispatchDidFailLoading(DocumentLoader*, unsigned long identifier, const ResourceError& err) { Ewk_Frame_Load_Error error; CString errorDomain = err.domain().utf8(); CString errorDescription = err.localizedDescription().utf8(); CString failingUrl = err.failingURL().utf8(); DBG("ewkFrame=%p, resource=%ld, error=%s (%d, cancellation=%hhu) \"%s\", url=%s", m_frame, identifier, errorDomain.data(), err.errorCode(), err.isCancellation(), errorDescription.data(), failingUrl.data()); error.code = err.errorCode(); error.is_cancellation = err.isCancellation(); error.domain = errorDomain.data(); error.description = errorDescription.data(); error.failing_url = failingUrl.data(); error.resource_identifier = identifier; error.frame = m_frame; ewk_frame_load_resource_failed(m_frame, &error); evas_object_smart_callback_call(m_view, "load,resource,failed", &error); }
/*this function shows an error message in a popup*/ void FrameLoaderClientWebUI::dispatchDidFailProvisionalLoad(const ResourceError& error) { if (!(error.isNull())) { char errorCode[2]; sprintf(errorCode, "%i", error.errorCode()); String description = error.localizedDescription().deprecatedString().ascii(); description = description.replace("'","\\'"); executeJS(m_frame, "errorLoad('" + String(error.domain().deprecatedString().ascii()) + "','" + String(errorCode) + "','" + String(error.failingURL().deprecatedString().ascii()) + "','" + description + "')"); } m_loadFailed = true; }
void FrameLoaderClient::dispatchDidFailLoad(const ResourceError& error) { if (m_loadingErrorPage) return; notifyStatus(m_frame, WEBKIT_LOAD_FAILED); WebKitWebView* webView = getViewFromFrame(m_frame); GError* webError = g_error_new_literal(g_quark_from_string(error.domain().utf8().data()), error.errorCode(), error.localizedDescription().utf8().data()); gboolean isHandled = false; g_signal_emit_by_name(webView, "load-error", m_frame, error.failingURL().utf8().data(), webError, &isHandled); if (isHandled) { g_error_free(webError); return; } if (!shouldFallBack(error)) { g_error_free(webError); return; } m_loadingErrorPage = true; String content; gchar* fileContent = 0; gchar* errorURI = g_filename_to_uri(DATA_DIR"/webkit-1.0/resources/error.html", NULL, NULL); GFile* errorFile = g_file_new_for_uri(errorURI); g_free(errorURI); if (!errorFile) content = makeString("<html><body>", webError->message, "</body></html>"); else { gboolean loaded = g_file_load_contents(errorFile, 0, &fileContent, 0, 0, 0); if (!loaded) content = makeString("<html><body>", webError->message, "</body></html>"); else content = String::format(fileContent, error.failingURL().utf8().data(), webError->message); } webkit_web_frame_load_alternate_string(m_frame, content.utf8().data(), 0, error.failingURL().utf8().data()); g_free(fileContent); if (errorFile) g_object_unref(errorFile); g_error_free(webError); }
void FrameLoaderClient::dispatchDidFailLoad(const ResourceError& error) { WebKitWebView* webView = getViewFromFrame(m_frame); GError* webError = g_error_new_literal(g_quark_from_string(error.domain().utf8().data()), error.errorCode(), error.localizedDescription().utf8().data()); gboolean isHandled = false; g_signal_emit_by_name(webView, "load-error", m_frame, error.failingURL().utf8().data(), webError, &isHandled); if (isHandled) { g_error_free(webError); return; } if (!shouldFallBack(error)) { g_error_free(webError); // FIXME: load-done is deprecated. Please remove when signal's been removed. g_signal_emit_by_name(m_frame, "load-done", false); return; } String content; gchar* fileContent = 0; gchar* errorURI = g_filename_to_uri(DATA_DIR"/webkit-1.0/resources/error.html", NULL, NULL); GFile* errorFile = g_file_new_for_uri(errorURI); g_free(errorURI); if (!errorFile) content = String::format("<html><body>%s</body></html>", webError->message); else { gboolean loaded = g_file_load_contents(errorFile, 0, &fileContent, 0, 0, 0); if (!loaded) content = String::format("<html><body>%s</body></html>", webError->message); else content = String::format(fileContent, error.failingURL().utf8().data(), webError->message); } webkit_web_frame_load_alternate_string(m_frame, content.utf8().data(), 0, error.failingURL().utf8().data()); g_free(fileContent); if (errorFile) g_object_unref(errorFile); g_error_free(webError); // FIXME: load-done is deprecated. Please remove when signal's been removed. g_signal_emit_by_name(m_frame, "load-done", false); }
bool ResourceError::compare(const ResourceError& a, const ResourceError& b) { if (a.isNull() && b.isNull()) return true; if (a.isNull() || b.isNull()) return false; if (a.domain() != b.domain()) return false; if (a.errorCode() != b.errorCode()) return false; if (a.failingURL() != b.failingURL()) return false; if (a.localizedDescription() != b.localizedDescription()) return false; if (a.isCancellation() != b.isCancellation()) return false; if (a.isAccessCheck() != b.isAccessCheck()) return false; if (a.isTimeout() != b.isTimeout()) return false; if (a.staleCopyInCache() != b.staleCopyInCache()) return false; if (a.wasIgnoredByHandler() != b.wasIgnoredByHandler()) return false; return true; }
void ResourceHandle::platformLoadResourceSynchronously(NetworkingContext* context, const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& data) { LOG(Network, "ResourceHandle::platformLoadResourceSynchronously:%s allowStoredCredentials:%u", request.url().string().utf8().data(), storedCredentials); ASSERT(!request.isEmpty()); ASSERT(response.isNull()); ASSERT(error.isNull()); OwnPtr<SynchronousLoaderClient> client = SynchronousLoaderClient::create(); client->setAllowStoredCredentials(storedCredentials == AllowStoredCredentials); RefPtr<ResourceHandle> handle = adoptRef(new ResourceHandle(context, request, client.get(), false /*defersLoading*/, true /*shouldContentSniff*/)); handle->d->m_storageSession = context->storageSession().platformSession(); if (handle->d->m_scheduledFailureType != NoFailure) { error = context->blockedError(request); return; } handle->createCFURLConnection(storedCredentials == AllowStoredCredentials, ResourceHandle::shouldContentSniffURL(request.url()), SchedulingBehavior::Synchronous, handle->client()->connectionProperties(handle.get()).get()); CFURLConnectionScheduleWithRunLoop(handle->connection(), CFRunLoopGetCurrent(), synchronousLoadRunLoopMode()); CFURLConnectionScheduleDownloadWithRunLoop(handle->connection(), CFRunLoopGetCurrent(), synchronousLoadRunLoopMode()); CFURLConnectionStart(handle->connection()); while (!client->isDone()) CFRunLoopRunInMode(synchronousLoadRunLoopMode(), UINT_MAX, true); error = client->error(); CFURLConnectionCancel(handle->connection()); if (error.isNull()) response = client->response(); else { response = ResourceResponse(request.url(), String(), 0, String(), String()); // FIXME: ResourceHandleMac also handles authentication errors by setting code to 401. CFNet version should probably do the same. if (error.domain() == String(kCFErrorDomainCFNetwork)) response.setHTTPStatusCode(error.errorCode()); else response.setHTTPStatusCode(404); } data.swap(client->mutableData()); }
void ArgumentCoder<ResourceError>::encodePlatformData(ArgumentEncoder& encoder, const ResourceError& resourceError) { bool errorIsNull = resourceError.isNull(); encoder << errorIsNull; if (errorIsNull) return; encoder << resourceError.domain(); encoder << resourceError.errorCode(); encoder << resourceError.failingURL().string(); encoder << resourceError.localizedDescription(); encoder << resourceError.isCancellation(); encoder << resourceError.isTimeout(); encoder << CertificateInfo(resourceError); }
void ArgumentCoder<ResourceError>::encode(ArgumentEncoder& encoder, const ResourceError& resourceError) { if (kShouldSerializeWebCoreData) { bool errorIsNull = resourceError.isNull(); encoder << errorIsNull; if (errorIsNull) return; encoder << resourceError.domain(); encoder << resourceError.errorCode(); encoder << resourceError.failingURL(); encoder << resourceError.localizedDescription(); encoder << resourceError.isCancellation(); encoder << resourceError.isTimeout(); } encodePlatformData(encoder, resourceError); }
static void webkitDownloadEmitError(WebKitDownload* download, const ResourceError& error) { WebKitDownloadError errorCode; switch (error.errorCode()) { case DownloadErrorNetwork: errorCode = WEBKIT_DOWNLOAD_ERROR_NETWORK; break; case DownloadErrorCancelledByUser: errorCode = WEBKIT_DOWNLOAD_ERROR_CANCELLED_BY_USER; break; case DownloadErrorDestination: errorCode = WEBKIT_DOWNLOAD_ERROR_DESTINATION; break; default: g_assert_not_reached(); } gboolean handled; g_signal_emit_by_name(download, "error", 0, errorCode, error.localizedDescription().utf8().data(), &handled); }
void FrameLoaderClientAndroid::dispatchDidFailProvisionalLoad(const ResourceError& error) { ASSERT(m_frame); // Ignore ErrorInterrupted since it is due to a policy interruption. This // is caused by a decision to download the main resource rather than // display it. if (error.errorCode() == InternalErrorInterrupted || error.errorCode() == InternalErrorCancelled) { // If we decided to download the main resource or if the user cancelled // it, make sure we report that the load is done. didFinishLoad(); return; } AssetManager* am = globalAssetManager(); // Check to see if the error code was not generated internally WebCore::PlatformBridge::rawResId id = WebCore::PlatformBridge::NoDomain; if ((error.errorCode() == ErrorFile || error.errorCode() == ErrorFileNotFound) && (!error.localizedDescription().isEmpty())) { id = WebCore::PlatformBridge::LoadError; } String filename = m_webFrame->getRawResourceFilename(id); if (filename.isEmpty()) return; // Grab the error page from the asset manager Asset* a = am->openNonAsset( filename.utf8().data(), Asset::ACCESS_BUFFER); if (!a) return; // Take the failing url and encode html entities so javascript urls are not // executed. CString failingUrl = error.failingURL().utf8(); WTF::Vector<char> url; int len = failingUrl.length(); const char* data = failingUrl.data(); for (int i = 0; i < len; i++) { char c = data[i]; if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')) url.append(c); else { char buf[16]; int res = sprintf(buf, "&#%d;", c); buf[res] = 0; url.append(buf, res); } } // Replace all occurances of %s with the failing url. String s = UTF8Encoding().decode((const char*)a->getBuffer(false), a->getLength()); // samsung shkim // \frameworks\base\core\res\res\raw-XX\nodomain.html or loaderror.html // These error pages does not have <viewport> tag, it is loaded as low zoom scale if( s.contains( "viewport" ) == false ) s = s.replace( "<head>", "<head> <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=no\"/>" ); s = s.replace("%s", String(url.data(), url.size())); // Replace all occurances of %e with the error text s = s.replace("%e", error.localizedDescription()); // Create the request and the substitute data and tell the FrameLoader to // load with the replacement data. // use KURL(const char*) as KURL(const String& url) can trigger ASSERT for // invalidate URL string. loadDataIntoFrame(m_frame, KURL(ParsedURLString, data), error.failingURL(), s); // Delete the asset. delete a; }
bool FrameLoaderClientEfl::shouldFallBack(const ResourceError& error) { return !(error.isCancellation() || error.errorCode() == PolicyErrorFrameLoadInterruptedByPolicyChange || error.errorCode() == PluginErrorWillHandleLoad); }
void NetworkResourceLoader::didFailLoading(const ResourceError& error) { NETWORKRESOURCELOADER_LOG_ALWAYS("Failed loading network resource: loader = %p, pageID = %llu, frameID = %llu, isMainResource = %d, isSynchronous = %d, isTimeout = %d, isCancellation = %d, errCode = %d", this, m_parameters.webPageID, m_parameters.webFrameID, isMainResource(), isSynchronous(), error.isTimeout(), error.isCancellation(), error.errorCode()); ASSERT(!error.isNull()); #if ENABLE(NETWORK_CACHE) m_cacheEntryForValidation = nullptr; #endif if (isSynchronous()) { m_synchronousLoadData->error = error; sendReplyToSynchronousRequest(*m_synchronousLoadData, nullptr); } else send(Messages::WebResourceLoader::DidFailResourceLoad(error)); cleanup(); }
void NetworkResourceLoader::didFailLoading(const ResourceError& error) { RELEASE_LOG_IF_ALLOWED("didFailLoading: (pageID = %" PRIu64 ", frameID = %" PRIu64 ", resourceID = %" PRIu64 ", isTimeout = %d, isCancellation = %d, errCode = %d)", m_parameters.webPageID, m_parameters.webFrameID, m_parameters.identifier, error.isTimeout(), error.isCancellation(), error.errorCode()); ASSERT(!error.isNull()); #if ENABLE(NETWORK_CACHE) m_cacheEntryForValidation = nullptr; #endif if (isSynchronous()) { m_synchronousLoadData->error = error; sendReplyToSynchronousRequest(*m_synchronousLoadData, nullptr); } else if (auto* connection = messageSenderConnection()) connection->send(Messages::WebResourceLoader::DidFailResourceLoad(error), messageSenderDestinationID()); cleanup(); }
bool WebFrame::shouldFallBack(const ResourceError& error) { return error.errorCode() != WebURLErrorCancelled; }
void didFail(ResourceHandle*, const ResourceError& error) { downloadFailed(platformDownloadNetworkError(error.errorCode(), error.failingURL(), error.localizedDescription())); }
bool FrameLoaderClient::shouldFallBack(const ResourceError& error) { return !(error.isCancellation() || error.errorCode() == WEBKIT_POLICY_ERROR_FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE || error.errorCode() == WEBKIT_PLUGIN_ERROR_WILL_HANDLE_LOAD); }
bool FrameLoaderClient::shouldFallBack(const ResourceError& error) { // FIXME: Mac checks for WebKitErrorPlugInWillHandleLoad here to avoid // loading plugin content twice. Do we need it? return !(error.isCancellation() || error.errorCode() == WEBKIT_POLICY_ERROR_FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE); }
bool FrameLoaderClientEfl::shouldFallBack(const ResourceError& error) { return !(error.isCancellation() || (error.errorCode() == WebKitErrorFrameLoadInterruptedByPolicyChange)); }