void FrameLoaderClientQt::callErrorPageExtension(const WebCore::ResourceError& error) { QWebPage* page = m_webFrame->page(); if (page->supportsExtension(QWebPage::ErrorPageExtension)) { QWebPage::ErrorPageExtensionOption option; if (error.domain() == "QtNetwork") option.domain = QWebPage::QtNetwork; else if (error.domain() == "HTTP") option.domain = QWebPage::Http; else if (error.domain() == "WebKit") option.domain = QWebPage::WebKit; else return; option.url = QUrl(error.failingURL()); option.frame = m_webFrame; option.error = error.errorCode(); option.errorString = error.localizedDescription(); QWebPage::ErrorPageExtensionReturn output; if (!page->extension(QWebPage::ErrorPageExtension, &option, &output)) return; KURL baseUrl(output.baseUrl); KURL failingUrl(option.url); WebCore::ResourceRequest request(baseUrl); WTF::RefPtr<WebCore::SharedBuffer> buffer = WebCore::SharedBuffer::create(output.content.constData(), output.content.length()); WebCore::SubstituteData substituteData(buffer, output.contentType, output.encoding, failingUrl); m_frame->loader()->load(request, substituteData, false); } }
bool QWebPageProto::extension(QWebPage::Extension extension, const QWebPage::ExtensionOption * option, QWebPage::ExtensionReturn * output) { QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject()); if (item) return item->extension(extension, option, output); return false; }