[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
weinig at apple.com
weinig at apple.com
Wed Dec 22 14:46:34 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 291fc5a480ed24d048d074515b2e01ae759df609
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Oct 19 22:45:36 2010 +0000
Add alternateHTMLString and unreachableURL API to WebKit2
<rdar://problem/8557864>
https://bugs.webkit.org/show_bug.cgi?id=47938
Reviewed by Anders Carlsson.
* UIProcess/API/C/WKFrame.cpp:
(WKFrameCopyUnreachableURL):
* UIProcess/API/C/WKFrame.h:
Add accessor for the unreachableURL if one is set. It will only be
set during a loadAlternateHTMLString and will be unset on the next normal
didStartProvisionalLoadForFrame call.
* UIProcess/API/C/WKPage.cpp:
(WKPageLoadHTMLString): Remove whitespace.
(WKPageLoadAlternateHTMLString):
* UIProcess/API/C/WKPage.h:
Add function to load a string as "alternate", meant for use as error pages.
* UIProcess/WebFrameProxy.h:
(WebKit::WebFrameProxy::setUnreachableURL):
(WebKit::WebFrameProxy::unreachableURL):
Add setter/getter for the unreachableURL.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::loadAlternateHTMLString):
Plumb through the call to loadAlternateHTMLString to the WebProcess
and set the main frame's unreachableURL. This does nothing if no pages
have ever been loaded in this page.
(WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
If this is not a provisional load of substitute data for an unreachableURL
(e.g. someone who called WKPageLoadAlternateHTMLString), reset the
frame's unreachableURL.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
Update function signatures.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad):
Pass whether or not this is a load of SubstituteData for an unreachableURL
to the UIProcess.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::loadData):
(WebKit::WebPage::loadAlternateHTMLString):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
Plumb through the loading of the alternate HTML string.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 2ec263b..170c5d4 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,56 @@
+2010-10-19 Sam Weinig <sam at webkit.org>
+
+ Reviewed by Anders Carlsson.
+
+ Add alternateHTMLString and unreachableURL API to WebKit2
+ <rdar://problem/8557864>
+ https://bugs.webkit.org/show_bug.cgi?id=47938
+
+ * UIProcess/API/C/WKFrame.cpp:
+ (WKFrameCopyUnreachableURL):
+ * UIProcess/API/C/WKFrame.h:
+ Add accessor for the unreachableURL if one is set. It will only be
+ set during a loadAlternateHTMLString and will be unset on the next normal
+ didStartProvisionalLoadForFrame call.
+
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageLoadHTMLString): Remove whitespace.
+ (WKPageLoadAlternateHTMLString):
+ * UIProcess/API/C/WKPage.h:
+ Add function to load a string as "alternate", meant for use as error pages.
+
+ * UIProcess/WebFrameProxy.h:
+ (WebKit::WebFrameProxy::setUnreachableURL):
+ (WebKit::WebFrameProxy::unreachableURL):
+ Add setter/getter for the unreachableURL.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::loadAlternateHTMLString):
+ Plumb through the call to loadAlternateHTMLString to the WebProcess
+ and set the main frame's unreachableURL. This does nothing if no pages
+ have ever been loaded in this page.
+
+ (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
+ If this is not a provisional load of substitute data for an unreachableURL
+ (e.g. someone who called WKPageLoadAlternateHTMLString), reset the
+ frame's unreachableURL.
+
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ Update function signatures.
+
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad):
+ Pass whether or not this is a load of SubstituteData for an unreachableURL
+ to the UIProcess.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::loadData):
+ (WebKit::WebPage::loadAlternateHTMLString):
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+ Plumb through the loading of the alternate HTML string.
+
2010-10-19 Alexey Proskuryakov <ap at apple.com>
Reviewed by Anders Carlsson.
diff --git a/WebKit2/UIProcess/API/C/WKFrame.cpp b/WebKit2/UIProcess/API/C/WKFrame.cpp
index 67f7a8c..f73ef08 100644
--- a/WebKit2/UIProcess/API/C/WKFrame.cpp
+++ b/WebKit2/UIProcess/API/C/WKFrame.cpp
@@ -66,6 +66,11 @@ WKURLRef WKFrameCopyURL(WKFrameRef frameRef)
return toCopiedURLAPI(toImpl(frameRef)->url());
}
+WKURLRef WKFrameCopyUnreachableURL(WKFrameRef frameRef)
+{
+ return toCopiedURLAPI(toImpl(frameRef)->unreachableURL());
+}
+
WKStringRef WKFrameCopyMIMEType(WKFrameRef frameRef)
{
return toCopiedAPI(toImpl(frameRef)->mimeType());
diff --git a/WebKit2/UIProcess/API/C/WKFrame.h b/WebKit2/UIProcess/API/C/WKFrame.h
index 36f88aa..4dfeb9c 100644
--- a/WebKit2/UIProcess/API/C/WKFrame.h
+++ b/WebKit2/UIProcess/API/C/WKFrame.h
@@ -50,6 +50,8 @@ WK_EXPORT WKFrameLoadState WKFrameGetFrameLoadState(WKFrameRef frame);
WK_EXPORT WKURLRef WKFrameCopyProvisionalURL(WKFrameRef frame);
WK_EXPORT WKURLRef WKFrameCopyURL(WKFrameRef frame);
+WK_EXPORT WKURLRef WKFrameCopyUnreachableURL(WKFrameRef frame);
+
WK_EXPORT WKStringRef WKFrameCopyMIMEType(WKFrameRef frame);
WK_EXPORT WKPageRef WKFrameGetPage(WKFrameRef frame);
diff --git a/WebKit2/UIProcess/API/C/WKPage.cpp b/WebKit2/UIProcess/API/C/WKPage.cpp
index 6e75a17..36a7ef9 100644
--- a/WebKit2/UIProcess/API/C/WKPage.cpp
+++ b/WebKit2/UIProcess/API/C/WKPage.cpp
@@ -59,7 +59,12 @@ void WKPageLoadURLRequest(WKPageRef pageRef, WKURLRequestRef urlRequestRef)
void WKPageLoadHTMLString(WKPageRef pageRef, WKStringRef htmlStringRef, WKURLRef baseURLRef)
{
- toImpl(pageRef)->loadHTMLString(toWTFString(htmlStringRef), toWTFString(baseURLRef));
+ toImpl(pageRef)->loadHTMLString(toWTFString(htmlStringRef), toWTFString(baseURLRef));
+}
+
+void WKPageLoadAlternateHTMLString(WKPageRef pageRef, WKStringRef htmlStringRef, WKURLRef baseURLRef, WKURLRef unreachableURLRef)
+{
+ toImpl(pageRef)->loadAlternateHTMLString(toWTFString(htmlStringRef), toWTFString(baseURLRef), toWTFString(unreachableURLRef));
}
void WKPageLoadPlainTextString(WKPageRef pageRef, WKStringRef plainTextStringRef)
diff --git a/WebKit2/UIProcess/API/C/WKPage.h b/WebKit2/UIProcess/API/C/WKPage.h
index 41adf92..40e46fd 100644
--- a/WebKit2/UIProcess/API/C/WKPage.h
+++ b/WebKit2/UIProcess/API/C/WKPage.h
@@ -183,6 +183,7 @@ WK_EXPORT WKPageNamespaceRef WKPageGetPageNamespace(WKPageRef page);
WK_EXPORT void WKPageLoadURL(WKPageRef page, WKURLRef url);
WK_EXPORT void WKPageLoadURLRequest(WKPageRef page, WKURLRequestRef urlRequest);
WK_EXPORT void WKPageLoadHTMLString(WKPageRef page, WKStringRef htmlString, WKURLRef baseURL);
+WK_EXPORT void WKPageLoadAlternateHTMLString(WKPageRef page, WKStringRef htmlString, WKURLRef baseURL, WKURLRef unreachableURL);
WK_EXPORT void WKPageLoadPlainTextString(WKPageRef page, WKStringRef plainTextString);
WK_EXPORT void WKPageStopLoading(WKPageRef page);
diff --git a/WebKit2/UIProcess/WebFrameProxy.h b/WebKit2/UIProcess/WebFrameProxy.h
index 3fe41f4..15f61dc 100644
--- a/WebKit2/UIProcess/WebFrameProxy.h
+++ b/WebKit2/UIProcess/WebFrameProxy.h
@@ -74,6 +74,9 @@ public:
const String& url() const { return m_url; }
const String& provisionalURL() const { return m_provisionalURL; }
+ void setUnreachableURL(const String& unreachableURL) { m_unreachableURL = unreachableURL; }
+ const String& unreachableURL() const { return m_unreachableURL; }
+
void setMIMEType(const String& mimeType) { m_MIMEType = mimeType; }
const String& mimeType() const { return m_MIMEType; }
@@ -101,6 +104,7 @@ private:
LoadState m_loadState;
String m_url;
String m_provisionalURL;
+ String m_unreachableURL;
String m_MIMEType;
RefPtr<WebCertificateInfo> m_certificateInfo;
RefPtr<WebFrameListenerProxy> m_activeListener;
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 14b329f..73b92dd 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -262,6 +262,18 @@ void WebPageProxy::loadHTMLString(const String& htmlString, const String& baseUR
process()->send(Messages::WebPage::LoadHTMLString(htmlString, baseURL), m_pageID);
}
+void WebPageProxy::loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL)
+{
+ if (!isValid())
+ return;
+
+ if (!m_mainFrame)
+ return;
+
+ m_mainFrame->setUnreachableURL(unreachableURL);
+ process()->send(Messages::WebPage::LoadAlternateHTMLString(htmlString, baseURL, unreachableURL), m_pageID);
+}
+
void WebPageProxy::loadPlainTextString(const String& string)
{
if (!isValid())
@@ -615,7 +627,7 @@ void WebPageProxy::didFinishProgress()
m_loaderClient.didFinishProgress(this);
}
-void WebPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, const String& url, CoreIPC::ArgumentDecoder* arguments)
+void WebPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, const String& url, bool loadingSubstituteDataForUnreachableURL, CoreIPC::ArgumentDecoder* arguments)
{
RefPtr<APIObject> userData;
WebContextUserMessageDecoder messageDecoder(userData, pageNamespace()->context());
@@ -624,6 +636,9 @@ void WebPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, const Strin
WebFrameProxy* frame = process()->webFrame(frameID);
+ if (!loadingSubstituteDataForUnreachableURL)
+ frame->setUnreachableURL(String());
+
frame->didStartProvisionalLoad(url);
m_loaderClient.didStartProvisionalLoadForFrame(this, frame, userData.get());
}
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index 9f84698..ba2f2e1 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -125,6 +125,7 @@ public:
void loadURL(const String&);
void loadURLRequest(WebURLRequest*);
void loadHTMLString(const String& htmlString, const String& baseURL);
+ void loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL);
void loadPlainTextString(const String& string);
void stopLoading();
@@ -233,7 +234,7 @@ private:
void didCreateMainFrame(uint64_t frameID);
void didCreateSubFrame(uint64_t frameID);
- void didStartProvisionalLoadForFrame(uint64_t frameID, const String&, CoreIPC::ArgumentDecoder*);
+ void didStartProvisionalLoadForFrame(uint64_t frameID, const String&, bool loadingSubstituteDataForUnreachableURL, CoreIPC::ArgumentDecoder*);
void didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, const String&, CoreIPC::ArgumentDecoder*);
void didFailProvisionalLoadForFrame(uint64_t frameID, const WebCore::ResourceError&, CoreIPC::ArgumentDecoder*);
void didCommitLoadForFrame(uint64_t frameID, const String& mimeType, const PlatformCertificateInfo&, CoreIPC::ArgumentDecoder*);
diff --git a/WebKit2/UIProcess/WebPageProxy.messages.in b/WebKit2/UIProcess/WebPageProxy.messages.in
index cfb1414..1c4b300 100644
--- a/WebKit2/UIProcess/WebPageProxy.messages.in
+++ b/WebKit2/UIProcess/WebPageProxy.messages.in
@@ -66,7 +66,7 @@ messages -> WebPageProxy {
DidFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData)
DidReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, WTF::String url, WebKit::InjectedBundleUserMessageEncoder userData)
DidRemoveFrameFromHierarchy(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData)
- DidStartProvisionalLoadForFrame(uint64_t frameID, WTF::String url, WebKit::InjectedBundleUserMessageEncoder userData)
+ DidStartProvisionalLoadForFrame(uint64_t frameID, WTF::String url, bool loadingSubstituteDataForUnreachableURL, WebKit::InjectedBundleUserMessageEncoder userData)
DidReceiveTitleForFrame(uint64_t frameID, WTF::String title, WebKit::InjectedBundleUserMessageEncoder userData)
# Forms messages.
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
index 3c1aa00..c32e5fe 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
@@ -298,8 +298,11 @@ void WebFrameLoaderClient::dispatchDidStartProvisionalLoad()
// Notify the bundle client.
webPage->injectedBundleLoaderClient().didStartProvisionalLoadForFrame(webPage, m_frame, userData);
+
+ bool loadingSubstituteDataForUnreachableURL = !provisionalLoader->unreachableURL().isNull();
+
// Notify the UIProcess.
- WebProcess::shared().connection()->send(Messages::WebPageProxy::DidStartProvisionalLoadForFrame(m_frame->frameID(), url, InjectedBundleUserMessageEncoder(userData.get())), webPage->pageID());
+ WebProcess::shared().connection()->send(Messages::WebPageProxy::DidStartProvisionalLoadForFrame(m_frame->frameID(), url, loadingSubstituteDataForUnreachableURL, InjectedBundleUserMessageEncoder(userData.get())), webPage->pageID());
}
void WebFrameLoaderClient::dispatchDidReceiveTitle(const String& title)
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index 516ef78..2325fad 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -306,10 +306,10 @@ void WebPage::loadURLRequest(const ResourceRequest& request)
m_mainFrame->coreFrame()->loader()->load(request, false);
}
-void WebPage::loadData(PassRefPtr<SharedBuffer> sharedBuffer, const String& MIMEType, const String& encodingName, const KURL& baseURL, const KURL& failingURL)
+void WebPage::loadData(PassRefPtr<SharedBuffer> sharedBuffer, const String& MIMEType, const String& encodingName, const KURL& baseURL, const KURL& unreachableURL)
{
ResourceRequest request(baseURL);
- SubstituteData substituteData(sharedBuffer, MIMEType, encodingName, failingURL);
+ SubstituteData substituteData(sharedBuffer, MIMEType, encodingName, unreachableURL);
m_mainFrame->coreFrame()->loader()->load(request, substituteData, false);
}
@@ -320,6 +320,14 @@ void WebPage::loadHTMLString(const String& htmlString, const String& baseURLStri
loadData(sharedBuffer, "text/html", "utf-16", baseURL, KURL());
}
+void WebPage::loadAlternateHTMLString(const String& htmlString, const String& baseURLString, const String& unreachableURLString)
+{
+ RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(reinterpret_cast<const char*>(htmlString.characters()), htmlString.length() * sizeof(UChar));
+ KURL baseURL = baseURLString.isEmpty() ? blankURL() : KURL(KURL(), baseURLString);
+ KURL unreachableURL = unreachableURLString.isEmpty() ? KURL() : KURL(KURL(), unreachableURLString) ;
+ loadData(sharedBuffer, "text/html", "utf-16", baseURL, unreachableURL);
+}
+
void WebPage::loadPlainTextString(const String& string)
{
RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(reinterpret_cast<const char*>(string.characters()), string.length() * sizeof(UChar));
diff --git a/WebKit2/WebProcess/WebPage/WebPage.h b/WebKit2/WebProcess/WebPage/WebPage.h
index c9d3484..2393c42 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/WebKit2/WebProcess/WebPage/WebPage.h
@@ -189,6 +189,7 @@ private:
void loadURL(const String&);
void loadURLRequest(const WebCore::ResourceRequest&);
void loadHTMLString(const String& htmlString, const String& baseURL);
+ void loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL);
void loadPlainTextString(const String&);
void reload(bool reloadFromOrigin);
void goForward(uint64_t);
diff --git a/WebKit2/WebProcess/WebPage/WebPage.messages.in b/WebKit2/WebProcess/WebPage/WebPage.messages.in
index 411d7e3..2d2523c 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.messages.in
+++ b/WebKit2/WebProcess/WebPage/WebPage.messages.in
@@ -35,7 +35,8 @@ messages -> WebPage {
GoBack(uint64_t backForwardItemID)
GoForward(uint64_t backForwardItemID)
GoToBackForwardItem(uint64_t backForwardItemID)
- LoadHTMLString(WTF::String htmlString, WTF::String url)
+ LoadHTMLString(WTF::String htmlString, WTF::String baseURL)
+ LoadAlternateHTMLString(WTF::String htmlString, WTF::String baseURL, WTF::String unreachableURL);
LoadPlainTextString(WTF::String string)
LoadURL(WTF::String url)
LoadURLRequest(WebCore::ResourceRequest request)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list