[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-142-g786665c
darin at apple.com
darin at apple.com
Mon Dec 27 16:30:45 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit c134f9b98360b5e6512de1bbb2f8976a0b7e2c43
Author: darin at apple.com <darin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Dec 22 20:22:50 2010 +0000
2010-12-21 Darin Adler <darin at apple.com>
Reviewed by Brady Eidson and Sam Weinig.
Add a way to get a web archive in WebKit2
https://bugs.webkit.org/show_bug.cgi?id=51437
* UIProcess/API/C/WKFrame.cpp:
(WKFrameGetWebArchive): Added.
(callGetWebArchiveBlockAndDispose): Added.
(WKFrameGetWebArchive_b): Added.
* UIProcess/API/C/WKFrame.h: Added functions above.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::close): Clear out m_webArchiveCallbacks.
(WebKit::WebPageProxy::getWebArchiveOfFrame): Added.
(WebKit::WebPageProxy::didGetWebArchiveOfFrame): Added.
(WebKit::WebPageProxy::processDidCrash): Clear out m_webArchiveCallbacks.
* UIProcess/WebPageProxy.h: Added functions above.
* UIProcess/WebPageProxy.messages.in: Added DidGetWebArchiveOfFrame.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::getWebArchiveOfFrame): Added.
* WebProcess/WebPage/WebPage.h: Added function above.
* WebProcess/WebPage/WebPage.messages.in: Added GetWebArchiveOfFrame.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74494 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 97e0bb2..7c75084 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,27 @@
+2010-12-21 Darin Adler <darin at apple.com>
+
+ Reviewed by Brady Eidson and Sam Weinig.
+
+ Add a way to get a web archive in WebKit2
+ https://bugs.webkit.org/show_bug.cgi?id=51437
+
+ * UIProcess/API/C/WKFrame.cpp:
+ (WKFrameGetWebArchive): Added.
+ (callGetWebArchiveBlockAndDispose): Added.
+ (WKFrameGetWebArchive_b): Added.
+ * UIProcess/API/C/WKFrame.h: Added functions above.
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::close): Clear out m_webArchiveCallbacks.
+ (WebKit::WebPageProxy::getWebArchiveOfFrame): Added.
+ (WebKit::WebPageProxy::didGetWebArchiveOfFrame): Added.
+ (WebKit::WebPageProxy::processDidCrash): Clear out m_webArchiveCallbacks.
+ * UIProcess/WebPageProxy.h: Added functions above.
+ * UIProcess/WebPageProxy.messages.in: Added DidGetWebArchiveOfFrame.
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::getWebArchiveOfFrame): Added.
+ * WebProcess/WebPage/WebPage.h: Added function above.
+ * WebProcess/WebPage/WebPage.messages.in: Added GetWebArchiveOfFrame.
+
2010-12-21 Siddharth Mathur <siddharth.mathur at nokia.com>
Reviewed by Laszlo Gombos.
diff --git a/WebKit2/UIProcess/API/C/WKFrame.cpp b/WebKit2/UIProcess/API/C/WKFrame.cpp
index 84acb4f..a5bc71d 100644
--- a/WebKit2/UIProcess/API/C/WKFrame.cpp
+++ b/WebKit2/UIProcess/API/C/WKFrame.cpp
@@ -28,6 +28,10 @@
#include "WKAPICast.h"
#include "WebFrameProxy.h"
+#ifdef __BLOCKS__
+#include <Block.h>
+#endif
+
using namespace WebKit;
WKTypeID WKFrameGetTypeID()
@@ -115,3 +119,22 @@ bool WKFrameIsFrameSet(WKFrameRef frameRef)
{
return toImpl(frameRef)->isFrameSet();
}
+
+void WKFrameGetWebArchive(WKFrameRef frameRef, WKFrameGetWebArchiveFunction callback, void* context)
+{
+ toImpl(frameRef)->getWebArchive(WebArchiveCallback::create(context, callback));
+}
+
+#ifdef __BLOCKS__
+static void callGetWebArchiveBlockAndDispose(WKDataRef archiveData, WKErrorRef error, void* context)
+{
+ WKFrameGetWebArchiveBlock block = (WKFrameGetWebArchiveBlock)context;
+ block(archiveData, error);
+ Block_release(block);
+}
+
+void WKFrameGetWebArchive_b(WKFrameRef frameRef, WKFrameGetWebArchiveBlock block)
+{
+ WKFrameGetWebArchive(frameRef, callGetWebArchiveBlockAndDispose, Block_copy(block));
+}
+#endif
diff --git a/WebKit2/UIProcess/API/C/WKFrame.h b/WebKit2/UIProcess/API/C/WKFrame.h
index 0784bf0..2ab5c9f 100644
--- a/WebKit2/UIProcess/API/C/WKFrame.h
+++ b/WebKit2/UIProcess/API/C/WKFrame.h
@@ -66,6 +66,13 @@ WK_EXPORT bool WKFrameIsDisplayingMarkupDocument(WKFrameRef frame);
WK_EXPORT bool WKFrameIsFrameSet(WKFrameRef frame);
+typedef void (*WKFrameGetWebArchiveFunction)(WKDataRef archiveData, WKErrorRef error, void* functionContext);
+WK_EXPORT void WKFrameGetWebArchive(WKFrameRef frame, WKFrameGetWebArchiveFunction function, void* functionContext);
+#ifdef __BLOCKS__
+typedef void (^WKFrameGetWebArchiveBlock)(WKDataRef archiveData, WKErrorRef error);
+WK_EXPORT void WKFrameGetWebArchive_b(WKFrameRef frame, WKFrameGetWebArchiveBlock block);
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/WebKit2/UIProcess/WebFrameProxy.cpp b/WebKit2/UIProcess/WebFrameProxy.cpp
index 04e3b52..46d64ff 100644
--- a/WebKit2/UIProcess/WebFrameProxy.cpp
+++ b/WebKit2/UIProcess/WebFrameProxy.cpp
@@ -195,4 +195,14 @@ WebFormSubmissionListenerProxy* WebFrameProxy::setUpFormSubmissionListenerProxy(
return static_cast<WebFormSubmissionListenerProxy*>(m_activeListener.get());
}
+void WebFrameProxy::getWebArchive(PassRefPtr<WebArchiveCallback> callback)
+{
+ if (!m_page) {
+ callback->invalidate();
+ return;
+ }
+
+ m_page->getWebArchiveOfFrame(this, callback);
+}
+
} // namespace WebKit
diff --git a/WebKit2/UIProcess/WebFrameProxy.h b/WebKit2/UIProcess/WebFrameProxy.h
index 01a9233..e0159bb 100644
--- a/WebKit2/UIProcess/WebFrameProxy.h
+++ b/WebKit2/UIProcess/WebFrameProxy.h
@@ -27,6 +27,7 @@
#define WebFrameProxy_h
#include "APIObject.h"
+#include "GenericCallback.h"
#include "WebFrameListenerProxy.h"
#include <WebCore/FrameLoaderTypes.h>
#include <wtf/Forward.h>
@@ -47,6 +48,8 @@ class WebFormSubmissionListenerProxy;
class WebFramePolicyListenerProxy;
class WebPageProxy;
+typedef GenericCallback<WKDataRef> WebArchiveCallback;
+
class WebFrameProxy : public APIObject {
public:
static const Type APIType = TypeFrame;
@@ -95,6 +98,8 @@ public:
bool isDisplayingStandaloneImageDocument() const;
bool isDisplayingMarkupDocument() const;
+ void getWebArchive(PassRefPtr<WebArchiveCallback>);
+
void didStartProvisionalLoad(const String& url);
void didReceiveServerRedirectForProvisionalLoad(const String& url);
void didFailProvisionalLoad();
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index bef2e2d..abd6add 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -249,6 +249,7 @@ void WebPageProxy::close()
invalidateCallbackMap(m_frameSourceCallbacks);
invalidateCallbackMap(m_renderTreeExternalRepresentationCallbacks);
invalidateCallbackMap(m_scriptReturnValueCallbacks);
+ invalidateCallbackMap(m_webArchiveCallbacks);
Vector<WebEditCommandProxy*> editCommandVector;
copyToVector(m_editCommandSet, editCommandVector);
@@ -815,6 +816,14 @@ void WebPageProxy::getContentsAsString(PassRefPtr<ContentsAsStringCallback> prpC
process()->send(Messages::WebPage::GetContentsAsString(callbackID), m_pageID);
}
+void WebPageProxy::getWebArchiveOfFrame(WebFrameProxy* frame, PassRefPtr<WebArchiveCallback> prpCallback)
+{
+ RefPtr<WebArchiveCallback> callback = prpCallback;
+ uint64_t callbackID = callback->callbackID();
+ m_webArchiveCallbacks.set(callbackID, callback.get());
+ process()->send(Messages::WebPage::GetWebArchiveOfFrame(frame->frameID(), callbackID), m_pageID);
+}
+
void WebPageProxy::preferencesDidChange()
{
if (!isValid())
@@ -1746,6 +1755,21 @@ void WebPageProxy::didGetSourceForFrame(const String& resultString, uint64_t cal
callback->performCallbackWithReturnValue(resultString.impl());
}
+void WebPageProxy::didGetWebArchiveOfFrame(const CoreIPC::DataReference& dataReference, uint64_t callbackID)
+{
+ RefPtr<WebArchiveCallback> callback = m_webArchiveCallbacks.take(callbackID);
+ if (!callback) {
+ // FIXME: Log error or assert.
+ return;
+ }
+
+ RefPtr<WebData> data;
+ if (size_t size = dataReference.size())
+ data = WebData::create(dataReference.data(), size);
+
+ callback->performCallbackWithReturnValue(data.get());
+}
+
void WebPageProxy::focusedFrameChanged(uint64_t frameID)
{
m_focusedFrame = frameID ? process()->webFrame(frameID) : 0;
@@ -1802,6 +1826,7 @@ void WebPageProxy::processDidCrash()
invalidateCallbackMap(m_frameSourceCallbacks);
invalidateCallbackMap(m_renderTreeExternalRepresentationCallbacks);
invalidateCallbackMap(m_scriptReturnValueCallbacks);
+ invalidateCallbackMap(m_webArchiveCallbacks);
Vector<WebEditCommandProxy*> editCommandVector;
copyToVector(m_editCommandSet, editCommandVector);
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index 49866cf..18c191a 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -28,7 +28,6 @@
#include "APIObject.h"
#include "DrawingAreaProxy.h"
-#include "GenericCallback.h"
#include "SharedMemory.h"
#include "WKBase.h"
#include "WebContextMenuItemData.h"
@@ -245,6 +244,7 @@ public:
void getRenderTreeExternalRepresentation(PassRefPtr<RenderTreeExternalRepresentationCallback>);
void getSourceForFrame(WebFrameProxy*, PassRefPtr<FrameSourceCallback>);
void getContentsAsString(PassRefPtr<ContentsAsStringCallback>);
+ void getWebArchiveOfFrame(WebFrameProxy*, PassRefPtr<WebArchiveCallback>);
void receivedPolicyDecision(WebCore::PolicyAction, WebFrameProxy*, uint64_t listenerID);
@@ -424,6 +424,7 @@ private:
void didRunJavaScriptInMainFrame(const String&, uint64_t);
void didGetRenderTreeExternalRepresentation(const String&, uint64_t);
void didGetSourceForFrame(const String&, uint64_t);
+ void didGetWebArchiveOfFrame(const CoreIPC::DataReference&, uint64_t);
void focusedFrameChanged(uint64_t frameID);
@@ -470,6 +471,7 @@ private:
HashMap<uint64_t, RefPtr<FrameSourceCallback> > m_frameSourceCallbacks;
HashMap<uint64_t, RefPtr<RenderTreeExternalRepresentationCallback> > m_renderTreeExternalRepresentationCallbacks;
HashMap<uint64_t, RefPtr<ScriptReturnValueCallback> > m_scriptReturnValueCallbacks;
+ HashMap<uint64_t, RefPtr<WebArchiveCallback> > m_webArchiveCallbacks;
HashSet<WebEditCommandProxy*> m_editCommandSet;
diff --git a/WebKit2/UIProcess/WebPageProxy.messages.in b/WebKit2/UIProcess/WebPageProxy.messages.in
index 6168123..6da2f03 100644
--- a/WebKit2/UIProcess/WebPageProxy.messages.in
+++ b/WebKit2/UIProcess/WebPageProxy.messages.in
@@ -111,6 +111,7 @@ messages -> WebPageProxy {
DidGetContentsAsString(WTF::String resultString, uint64_t callbackID)
DidGetRenderTreeExternalRepresentation(WTF::String resultString, uint64_t callbackID)
DidGetSourceForFrame(WTF::String resultString, uint64_t callbackID)
+ DidGetWebArchiveOfFrame(CoreIPC::DataReference archiveData, uint64_t callbackID)
DidRunJavaScriptInMainFrame(WTF::String resultString, uint64_t callbackID)
#if PLATFORM(MAC)
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index bf8dc71..6df0ebf 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -26,6 +26,7 @@
#include "WebPage.h"
#include "Arguments.h"
+#include "DataReference.h"
#include "DrawingArea.h"
#include "InjectedBundle.h"
#include "InjectedBundleBackForwardList.h"
@@ -78,6 +79,10 @@
#include <runtime/JSLock.h>
#include <runtime/JSValue.h>
+#if PLATFORM(MAC) || PLATFORM(WIN)
+#include <WebCore/LegacyWebArchive.h>
+#endif
+
#if ENABLE(PLUGIN_PROCESS)
// FIXME: This is currently Mac-specific!
#include "MachPort.h"
@@ -930,6 +935,23 @@ void WebPage::getSourceForFrame(uint64_t frameID, uint64_t callbackID)
send(Messages::WebPageProxy::DidGetSourceForFrame(resultString, callbackID));
}
+void WebPage::getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID)
+{
+ CoreIPC::DataReference dataReference;
+
+#if PLATFORM(MAC) || PLATFORM(WIN)
+ RetainPtr<CFDataRef> data;
+ if (WebFrame* frame = WebProcess::shared().webFrame(frameID)) {
+ if (RefPtr<LegacyWebArchive> archive = LegacyWebArchive::create(frame->coreFrame())) {
+ if ((data = archive->rawDataRepresentation()))
+ dataReference = CoreIPC::DataReference(CFDataGetBytePtr(data.get()), CFDataGetLength(data.get()));
+ }
+ }
+#endif
+
+ send(Messages::WebPageProxy::DidGetWebArchiveOfFrame(dataReference, callbackID));
+}
+
void WebPage::preferencesDidChange(const WebPreferencesStore& store)
{
WebPreferencesStore::removeTestRunnerOverrides();
diff --git a/WebKit2/WebProcess/WebPage/WebPage.h b/WebKit2/WebProcess/WebPage/WebPage.h
index 3339c3d..cacfd0b 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/WebKit2/WebProcess/WebPage/WebPage.h
@@ -310,6 +310,7 @@ private:
void getContentsAsString(uint64_t callbackID);
void getRenderTreeExternalRepresentation(uint64_t callbackID);
void getSourceForFrame(uint64_t frameID, uint64_t callbackID);
+ void getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID);
void runJavaScriptInMainFrame(const String&, uint64_t callbackID);
void preferencesDidChange(const WebPreferencesStore&);
diff --git a/WebKit2/WebProcess/WebPage/WebPage.messages.in b/WebKit2/WebProcess/WebPage/WebPage.messages.in
index b898c14..37b860f 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.messages.in
+++ b/WebKit2/WebProcess/WebPage/WebPage.messages.in
@@ -53,6 +53,7 @@ messages -> WebPage {
GetRenderTreeExternalRepresentation(uint64_t callbackID)
GetContentsAsString(uint64_t callbackID)
GetSourceForFrame(uint64_t frameID, uint64_t callbackID)
+ GetWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID)
RunJavaScriptInMainFrame(WTF::String script, uint64_t callbackID)
PreferencesDidChange(WebKit::WebPreferencesStore store)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list