[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e
darin at apple.com
darin at apple.com
Fri Jan 21 14:36:23 UTC 2011
The following commit has been merged in the debian/experimental branch:
commit 19460e275e9d692ca4b56d014f1b6855a66413ff
Author: darin at apple.com <darin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Dec 23 01:45:58 2010 +0000
2010-12-22 Darin Adler <darin at apple.com>
Reviewed by Anders Carlsson.
WebKit2 needs a way to return the main resource data
https://bugs.webkit.org/show_bug.cgi?id=51510
* UIProcess/API/C/WKFrame.cpp:
(WKFrameGetMainResourceData): Added.
(callGetMainResourceDataBlockAndDispose): Added.
(WKFrameGetMainResourceData_b): Added.
* UIProcess/API/C/WKFrame.h: Added WKFrameGetMainResourceData.
* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::getMainResourceData): Added.
* UIProcess/WebFrameProxy.h: Ditto.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::getMainResourceDataOfFrame): Added.
(WebKit::WebPageProxy::dataCallback): Replaced the individual callbacks
with just these two.
(WebKit::WebPageProxy::stringCallback): Ditto.
* UIProcess/WebPageProxy.h: Ditto.
* UIProcess/WebPageProxy.messages.in: Ditto.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::runJavaScriptInMainFrame): Send the string callback
message instead of a specific one.
(WebKit::WebPage::getContentsAsString): Ditto.
(WebKit::WebPage::getRenderTreeExternalRepresentation): Ditto.
(WebKit::WebPage::getSelectionOrContentsAsString): Ditto.
(WebKit::WebPage::getSourceForFrame): Ditto.
(WebKit::WebPage::getMainResourceDataOfFrame): Added.
(WebKit::WebPage::getWebArchiveOfFrame): Send the data callback message
instead of a specific one.
* WebProcess/WebPage/WebPage.h: Added getMainResourceDataOfFrame.
* WebProcess/WebPage/WebPage.messages.in: Ditto.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74527 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 483aefc..2355257 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,5 +1,43 @@
2010-12-22 Darin Adler <darin at apple.com>
+ Reviewed by Anders Carlsson.
+
+ WebKit2 needs a way to return the main resource data
+ https://bugs.webkit.org/show_bug.cgi?id=51510
+
+ * UIProcess/API/C/WKFrame.cpp:
+ (WKFrameGetMainResourceData): Added.
+ (callGetMainResourceDataBlockAndDispose): Added.
+ (WKFrameGetMainResourceData_b): Added.
+ * UIProcess/API/C/WKFrame.h: Added WKFrameGetMainResourceData.
+
+ * UIProcess/WebFrameProxy.cpp:
+ (WebKit::WebFrameProxy::getMainResourceData): Added.
+ * UIProcess/WebFrameProxy.h: Ditto.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::getMainResourceDataOfFrame): Added.
+ (WebKit::WebPageProxy::dataCallback): Replaced the individual callbacks
+ with just these two.
+ (WebKit::WebPageProxy::stringCallback): Ditto.
+ * UIProcess/WebPageProxy.h: Ditto.
+ * UIProcess/WebPageProxy.messages.in: Ditto.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::runJavaScriptInMainFrame): Send the string callback
+ message instead of a specific one.
+ (WebKit::WebPage::getContentsAsString): Ditto.
+ (WebKit::WebPage::getRenderTreeExternalRepresentation): Ditto.
+ (WebKit::WebPage::getSelectionOrContentsAsString): Ditto.
+ (WebKit::WebPage::getSourceForFrame): Ditto.
+ (WebKit::WebPage::getMainResourceDataOfFrame): Added.
+ (WebKit::WebPage::getWebArchiveOfFrame): Send the data callback message
+ instead of a specific one.
+ * WebProcess/WebPage/WebPage.h: Added getMainResourceDataOfFrame.
+ * WebProcess/WebPage/WebPage.messages.in: Ditto.
+
+2010-12-22 Darin Adler <darin at apple.com>
+
* WebProcess/WebPage/WebPage.cpp: Add #if to try to fix non-Mac builds.
2010-12-22 Darin Adler <darin at apple.com>
diff --git a/WebKit2/UIProcess/API/C/WKFrame.cpp b/WebKit2/UIProcess/API/C/WKFrame.cpp
index cb44ed7..5fee675 100644
--- a/WebKit2/UIProcess/API/C/WKFrame.cpp
+++ b/WebKit2/UIProcess/API/C/WKFrame.cpp
@@ -120,6 +120,25 @@ bool WKFrameIsFrameSet(WKFrameRef frameRef)
return toImpl(frameRef)->isFrameSet();
}
+void WKFrameGetMainResourceData(WKFrameRef frameRef, WKFrameGetMainResourceDataFunction callback, void* context)
+{
+ toImpl(frameRef)->getMainResourceData(DataCallback::create(context, callback));
+}
+
+#ifdef __BLOCKS__
+static void callGetMainResourceDataBlockAndDispose(WKDataRef data, WKErrorRef error, void* context)
+{
+ WKFrameGetMainResourceDataBlock block = (WKFrameGetMainResourceDataBlock)context;
+ block(data, error);
+ Block_release(block);
+}
+
+void WKFrameGetMainResourceData_b(WKFrameRef frameRef, WKFrameGetMainResourceDataBlock block)
+{
+ WKFrameGetMainResourceData(frameRef, callGetMainResourceDataBlockAndDispose, Block_copy(block));
+}
+#endif
+
void WKFrameGetWebArchive(WKFrameRef frameRef, WKFrameGetWebArchiveFunction callback, void* context)
{
toImpl(frameRef)->getWebArchive(DataCallback::create(context, callback));
diff --git a/WebKit2/UIProcess/API/C/WKFrame.h b/WebKit2/UIProcess/API/C/WKFrame.h
index 2ab5c9f..b9e31d8 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 (*WKFrameGetMainResourceDataFunction)(WKDataRef data, WKErrorRef error, void* functionContext);
+WK_EXPORT void WKFrameGetMainResourceData(WKFrameRef frame, WKFrameGetMainResourceDataFunction function, void* functionContext);
+#ifdef __BLOCKS__
+typedef void (^WKFrameGetMainResourceDataBlock)(WKDataRef data, WKErrorRef error);
+WK_EXPORT void WKFrameGetMainResourceData_b(WKFrameRef frame, WKFrameGetMainResourceDataBlock block);
+#endif
+
typedef void (*WKFrameGetWebArchiveFunction)(WKDataRef archiveData, WKErrorRef error, void* functionContext);
WK_EXPORT void WKFrameGetWebArchive(WKFrameRef frame, WKFrameGetWebArchiveFunction function, void* functionContext);
#ifdef __BLOCKS__
diff --git a/WebKit2/UIProcess/WebFrameProxy.cpp b/WebKit2/UIProcess/WebFrameProxy.cpp
index b33acfa..9d50ba0 100644
--- a/WebKit2/UIProcess/WebFrameProxy.cpp
+++ b/WebKit2/UIProcess/WebFrameProxy.cpp
@@ -204,4 +204,14 @@ void WebFrameProxy::getWebArchive(PassRefPtr<DataCallback> callback)
m_page->getWebArchiveOfFrame(this, callback);
}
+void WebFrameProxy::getMainResourceData(PassRefPtr<DataCallback> callback)
+{
+ if (!m_page) {
+ callback->invalidate();
+ return;
+ }
+
+ m_page->getMainResourceDataOfFrame(this, callback);
+}
+
} // namespace WebKit
diff --git a/WebKit2/UIProcess/WebFrameProxy.h b/WebKit2/UIProcess/WebFrameProxy.h
index 2d9f804..c8fc008 100644
--- a/WebKit2/UIProcess/WebFrameProxy.h
+++ b/WebKit2/UIProcess/WebFrameProxy.h
@@ -97,6 +97,7 @@ public:
bool isDisplayingMarkupDocument() const;
void getWebArchive(PassRefPtr<DataCallback>);
+ void getMainResourceData(PassRefPtr<DataCallback>);
void didStartProvisionalLoad(const String& url);
void didReceiveServerRedirectForProvisionalLoad(const String& url);
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index dafe7ef..d8c412e 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -821,6 +821,14 @@ void WebPageProxy::getSelectionOrContentsAsString(PassRefPtr<StringCallback> prp
process()->send(Messages::WebPage::GetSelectionOrContentsAsString(callbackID), m_pageID);
}
+void WebPageProxy::getMainResourceDataOfFrame(WebFrameProxy* frame, PassRefPtr<DataCallback> prpCallback)
+{
+ RefPtr<DataCallback> callback = prpCallback;
+ uint64_t callbackID = callback->callbackID();
+ m_dataCallbacks.set(callbackID, callback.get());
+ process()->send(Messages::WebPage::GetMainResourceDataOfFrame(frame->frameID(), callbackID), m_pageID);
+}
+
void WebPageProxy::getWebArchiveOfFrame(WebFrameProxy* frame, PassRefPtr<DataCallback> prpCallback)
{
RefPtr<DataCallback> callback = prpCallback;
@@ -1713,51 +1721,22 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
}
}
-void WebPageProxy::didGetContentsAsString(const String& resultString, uint64_t callbackID)
-{
- RefPtr<StringCallback> callback = m_stringCallbacks.take(callbackID);
- if (!callback) {
- // FIXME: Log error or assert.
- return;
- }
-
- callback->performCallbackWithReturnValue(resultString.impl());
-}
-
-void WebPageProxy::didGetSelectionOrContentsAsString(const String& resultString, uint64_t callbackID)
-{
- RefPtr<StringCallback> callback = m_stringCallbacks.take(callbackID);
- if (!callback) {
- // FIXME: Log error or assert.
- return;
- }
-
- callback->performCallbackWithReturnValue(resultString.impl());
-}
-
-void WebPageProxy::didRunJavaScriptInMainFrame(const String& resultString, uint64_t callbackID)
+void WebPageProxy::dataCallback(const CoreIPC::DataReference& dataReference, uint64_t callbackID)
{
- RefPtr<StringCallback> callback = m_stringCallbacks.take(callbackID);
+ RefPtr<DataCallback> callback = m_dataCallbacks.take(callbackID);
if (!callback) {
// FIXME: Log error or assert.
return;
}
- callback->performCallbackWithReturnValue(resultString.impl());
-}
-
-void WebPageProxy::didGetRenderTreeExternalRepresentation(const String& resultString, uint64_t callbackID)
-{
- RefPtr<StringCallback> callback = m_stringCallbacks.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(resultString.impl());
+ callback->performCallbackWithReturnValue(data.get());
}
-void WebPageProxy::didGetSourceForFrame(const String& resultString, uint64_t callbackID)
+void WebPageProxy::stringCallback(const String& resultString, uint64_t callbackID)
{
RefPtr<StringCallback> callback = m_stringCallbacks.take(callbackID);
if (!callback) {
@@ -1768,21 +1747,6 @@ void WebPageProxy::didGetSourceForFrame(const String& resultString, uint64_t cal
callback->performCallbackWithReturnValue(resultString.impl());
}
-void WebPageProxy::didGetWebArchiveOfFrame(const CoreIPC::DataReference& dataReference, uint64_t callbackID)
-{
- RefPtr<DataCallback> callback = m_dataCallbacks.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;
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index 1b10fc1..cff9fc5 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -237,12 +237,13 @@ public:
void hideFindUI();
void countStringMatches(const String&, FindOptions, unsigned maxMatchCount);
- void runJavaScriptInMainFrame(const String&, PassRefPtr<StringCallback>);
- void getRenderTreeExternalRepresentation(PassRefPtr<StringCallback>);
- void getSourceForFrame(WebFrameProxy*, PassRefPtr<StringCallback>);
void getContentsAsString(PassRefPtr<StringCallback>);
+ void getMainResourceDataOfFrame(WebFrameProxy*, PassRefPtr<DataCallback>);
+ void getRenderTreeExternalRepresentation(PassRefPtr<StringCallback>);
void getSelectionOrContentsAsString(PassRefPtr<StringCallback>);
+ void getSourceForFrame(WebFrameProxy*, PassRefPtr<StringCallback>);
void getWebArchiveOfFrame(WebFrameProxy*, PassRefPtr<DataCallback>);
+ void runJavaScriptInMainFrame(const String&, PassRefPtr<StringCallback>);
void receivedPolicyDecision(WebCore::PolicyAction, WebFrameProxy*, uint64_t listenerID);
@@ -425,12 +426,8 @@ private:
void didReceiveEvent(uint32_t opaqueType, bool handled);
- void didGetContentsAsString(const String&, uint64_t);
- void didGetRenderTreeExternalRepresentation(const String&, uint64_t);
- void didGetSelectionOrContentsAsString(const String&, uint64_t);
- void didGetSourceForFrame(const String&, uint64_t);
- void didGetWebArchiveOfFrame(const CoreIPC::DataReference&, uint64_t);
- void didRunJavaScriptInMainFrame(const String&, uint64_t);
+ void dataCallback(const CoreIPC::DataReference&, uint64_t);
+ void stringCallback(const String&, uint64_t);
void focusedFrameChanged(uint64_t frameID);
diff --git a/WebKit2/UIProcess/WebPageProxy.messages.in b/WebKit2/UIProcess/WebPageProxy.messages.in
index f8d721f..ce2d0b4 100644
--- a/WebKit2/UIProcess/WebPageProxy.messages.in
+++ b/WebKit2/UIProcess/WebPageProxy.messages.in
@@ -108,12 +108,8 @@ messages -> WebPageProxy {
WillSubmitForm(uint64_t frameID, uint64_t sourceFrameID, WebKit::StringPairVector textFieldValues, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData)
# Callback messages.
- DidGetContentsAsString(WTF::String resultString, uint64_t callbackID)
- DidGetSelectionOrContentsAsString(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)
+ DataCallback(CoreIPC::DataReference resultData, uint64_t callbackID)
+ StringCallback(WTF::String resultString, uint64_t callbackID)
#if PLATFORM(MAC)
# Keyboard support messages.
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index dd8dd60..6d77dc0 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -911,19 +911,19 @@ void WebPage::runJavaScriptInMainFrame(const String& script, uint64_t callbackID
if (resultValue)
resultString = ustringToString(resultValue.toString(m_mainFrame->coreFrame()->script()->globalObject(mainThreadNormalWorld())->globalExec()));
- send(Messages::WebPageProxy::DidRunJavaScriptInMainFrame(resultString, callbackID));
+ send(Messages::WebPageProxy::StringCallback(resultString, callbackID));
}
void WebPage::getContentsAsString(uint64_t callbackID)
{
String resultString = m_mainFrame->contentsAsString();
- send(Messages::WebPageProxy::DidGetContentsAsString(resultString, callbackID));
+ send(Messages::WebPageProxy::StringCallback(resultString, callbackID));
}
void WebPage::getRenderTreeExternalRepresentation(uint64_t callbackID)
{
String resultString = renderTreeExternalRepresentation();
- send(Messages::WebPageProxy::DidGetRenderTreeExternalRepresentation(resultString, callbackID));
+ send(Messages::WebPageProxy::StringCallback(resultString, callbackID));
}
void WebPage::getSelectionOrContentsAsString(uint64_t callbackID)
@@ -931,7 +931,7 @@ void WebPage::getSelectionOrContentsAsString(uint64_t callbackID)
String resultString = m_mainFrame->selectionAsString();
if (resultString.isEmpty())
resultString = m_mainFrame->contentsAsString();
- send(Messages::WebPageProxy::DidGetContentsAsString(resultString, callbackID));
+ send(Messages::WebPageProxy::StringCallback(resultString, callbackID));
}
void WebPage::getSourceForFrame(uint64_t frameID, uint64_t callbackID)
@@ -940,7 +940,22 @@ void WebPage::getSourceForFrame(uint64_t frameID, uint64_t callbackID)
if (WebFrame* frame = WebProcess::shared().webFrame(frameID))
resultString = frame->source();
- send(Messages::WebPageProxy::DidGetSourceForFrame(resultString, callbackID));
+ send(Messages::WebPageProxy::StringCallback(resultString, callbackID));
+}
+
+void WebPage::getMainResourceDataOfFrame(uint64_t frameID, uint64_t callbackID)
+{
+ CoreIPC::DataReference dataReference;
+
+ RefPtr<SharedBuffer> buffer;
+ if (WebFrame* frame = WebProcess::shared().webFrame(frameID)) {
+ if (DocumentLoader* loader = frame->coreFrame()->loader()->documentLoader()) {
+ if ((buffer = loader->mainResourceData()))
+ dataReference = CoreIPC::DataReference(reinterpret_cast<const uint8_t*>(buffer->data()), buffer->size());
+ }
+ }
+
+ send(Messages::WebPageProxy::DataCallback(dataReference, callbackID));
}
void WebPage::getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID)
@@ -957,7 +972,7 @@ void WebPage::getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID)
}
#endif
- send(Messages::WebPageProxy::DidGetWebArchiveOfFrame(dataReference, callbackID));
+ send(Messages::WebPageProxy::DataCallback(dataReference, callbackID));
}
void WebPage::preferencesDidChange(const WebPreferencesStore& store)
diff --git a/WebKit2/WebProcess/WebPage/WebPage.h b/WebKit2/WebProcess/WebPage/WebPage.h
index 81c5933..7b24691 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/WebKit2/WebProcess/WebPage/WebPage.h
@@ -317,6 +317,7 @@ private:
void setDrawsTransparentBackground(bool);
void getContentsAsString(uint64_t callbackID);
+ void getMainResourceDataOfFrame(uint64_t frameID, uint64_t callbackID);
void getRenderTreeExternalRepresentation(uint64_t callbackID);
void getSelectionOrContentsAsString(uint64_t callbackID);
void getSourceForFrame(uint64_t frameID, uint64_t callbackID);
diff --git a/WebKit2/WebProcess/WebPage/WebPage.messages.in b/WebKit2/WebProcess/WebPage/WebPage.messages.in
index fc7a885..f973a1b 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.messages.in
+++ b/WebKit2/WebProcess/WebPage/WebPage.messages.in
@@ -50,8 +50,9 @@ messages -> WebPage {
DidReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t downloadID)
# Callbacks.
- GetRenderTreeExternalRepresentation(uint64_t callbackID)
GetContentsAsString(uint64_t callbackID)
+ GetMainResourceDataOfFrame(uint64_t frameID, uint64_t callbackID)
+ GetRenderTreeExternalRepresentation(uint64_t callbackID)
GetSelectionOrContentsAsString(uint64_t callbackID)
GetSourceForFrame(uint64_t frameID, uint64_t callbackID)
GetWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list