Support loading a WKPage from web archive data
authorjeffm@apple.com <jeffm@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Mar 2012 23:39:11 +0000 (23:39 +0000)
committerjeffm@apple.com <jeffm@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Mar 2012 23:39:11 +0000 (23:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=81044

This code was written by Jessie Berlin.

Reviewed by Brady Eidson.

* UIProcess/API/C/WKPage.cpp:
(WKPageLoadWebArchiveData): Added.

* UIProcess/API/C/WKPage.h: Added WKPageLoadWebArchiveData().

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::loadWebArchiveData): Added.

* UIProcess/WebPageProxy.h: Added loadWebArchiveData().

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::loadWebArchiveData): Added.

* WebProcess/WebPage/WebPage.h: Added loadWebArchiveData().

* WebProcess/WebPage/WebPage.messages.in: Added LoadWebArchiveData message.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@110638 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/C/WKPage.cpp
Source/WebKit2/UIProcess/API/C/WKPage.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in

index 80d9d13..b2751d6 100644 (file)
@@ -1,3 +1,29 @@
+2012-03-13  Jeff Miller  <jeffm@apple.com>
+
+        Support loading a WKPage from web archive data
+        https://bugs.webkit.org/show_bug.cgi?id=81044
+
+        This code was written by Jessie Berlin.
+
+        Reviewed by Brady Eidson.
+
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageLoadWebArchiveData): Added.
+        
+        * UIProcess/API/C/WKPage.h: Added WKPageLoadWebArchiveData().
+        
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::loadWebArchiveData): Added.
+        
+        * UIProcess/WebPageProxy.h: Added loadWebArchiveData().
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::loadWebArchiveData): Added.
+        
+        * WebProcess/WebPage/WebPage.h: Added loadWebArchiveData().
+
+        * WebProcess/WebPage/WebPage.messages.in: Added LoadWebArchiveData message.
+
 2012-03-13  Adam Barth  <abarth@webkit.org> && Benjamin Poulain  <bpoulain@apple.com>
 
         Always enable ENABLE(CLIENT_BASED_GEOLOCATION)
index 130dd0e..645e2f9 100644 (file)
@@ -82,6 +82,11 @@ void WKPageLoadPlainTextString(WKPageRef pageRef, WKStringRef plainTextStringRef
     toImpl(pageRef)->loadPlainTextString(toWTFString(plainTextStringRef));    
 }
 
+void WKPageLoadWebArchiveData(WKPageRef pageRef, WKDataRef webArchiveDataRef)
+{
+    toImpl(pageRef)->loadWebArchiveData(toImpl(webArchiveDataRef));
+}
+
 void WKPageStopLoading(WKPageRef pageRef)
 {
     toImpl(pageRef)->stopLoading();
index 05b7aff..b07b6c0 100644 (file)
@@ -319,6 +319,7 @@ 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 WKPageLoadWebArchiveData(WKPageRef page, WKDataRef webArchiveData);
 
 WK_EXPORT void WKPageStopLoading(WKPageRef page);
 WK_EXPORT void WKPageReload(WKPageRef page);
index 4097344..e8bbcaf 100644 (file)
@@ -504,6 +504,15 @@ void WebPageProxy::loadPlainTextString(const String& string)
     process()->responsivenessTimer()->start();
 }
 
+void WebPageProxy::loadWebArchiveData(const WebData* webArchiveData)
+{
+    if (!isValid())
+        reattachToWebProcess();
+
+    process()->send(Messages::WebPage::LoadWebArchiveData(webArchiveData->dataReference()), m_pageID);
+    process()->responsivenessTimer()->start();
+}
+
 void WebPageProxy::stopLoading()
 {
     if (!isValid())
index fb7802c..ee233d2 100644 (file)
@@ -254,6 +254,7 @@ public:
     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 loadWebArchiveData(const WebData*);
 
     void stopLoading();
     void reload(bool reloadFromOrigin);
index 38f45e4..88c88f0 100644 (file)
@@ -682,6 +682,12 @@ void WebPage::loadPlainTextString(const String& string)
     loadData(sharedBuffer, "text/plain", "utf-16", blankURL(), KURL());
 }
 
+void WebPage::loadWebArchiveData(const CoreIPC::DataReference& webArchiveData)
+{
+    RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(reinterpret_cast<const char*>(webArchiveData.data()), webArchiveData.size() * sizeof(uint8_t));
+    loadData(sharedBuffer, "application/x-webarchive", "utf-16", blankURL(), KURL());
+}
+
 void WebPage::linkClicked(const String& url, const WebMouseEvent& event)
 {
     Frame* frame = m_page->mainFrame();
index bc84e35..1981e14 100644 (file)
@@ -540,6 +540,7 @@ private:
     void loadHTMLString(const String& htmlString, const String& baseURL);
     void loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL);
     void loadPlainTextString(const String&);
+    void loadWebArchiveData(const CoreIPC::DataReference&);
     void linkClicked(const String& url, const WebMouseEvent&);
     void reload(bool reloadFromOrigin, const SandboxExtension::Handle&);
     void goForward(uint64_t);
index 2c94360..c20b0d9 100644 (file)
@@ -57,6 +57,7 @@ messages -> WebPage {
     LoadHTMLString(WTF::String htmlString, WTF::String baseURL)
     LoadAlternateHTMLString(WTF::String htmlString, WTF::String baseURL, WTF::String unreachableURL); 
     LoadPlainTextString(WTF::String string)
+    LoadWebArchiveData(CoreIPC::DataReference webArchiveData)
     LoadURL(WTF::String url, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
     LoadURLRequest(WebCore::ResourceRequest request, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
     LinkClicked(WTF::String url, WebKit::WebMouseEvent event)