WebKit2: Need API to stop loading a WKFrame
authorbweinstein@apple.com <bweinstein@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Jan 2011 23:42:00 +0000 (23:42 +0000)
committerbweinstein@apple.com <bweinstein@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Jan 2011 23:42:00 +0000 (23:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=52925

Reviewed by Adam Roben.

* UIProcess/API/C/WKFrame.cpp:
(WKFrameStopLoading): Call through to WebFrameProxy::stopLoading.
* UIProcess/API/C/WKFrame.h:
* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::stopLoading): Send a message to the WebProcess to stop loading the frame
    with the passed in ID.
* UIProcess/WebFrameProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::stopLoadingFrame): Call stopForUserCancel on the passed-in frame.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in: Add StopLoadingFrame.

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/C/WKFrame.cpp
Source/WebKit2/UIProcess/API/C/WKFrame.h
Source/WebKit2/UIProcess/WebFrameProxy.cpp
Source/WebKit2/UIProcess/WebFrameProxy.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in

index 5a350c432094f2caa620747c75414a14da5d9a0c..e83c4edd021e7b90dcc57fa4d402ada188d92bc2 100644 (file)
@@ -1,3 +1,22 @@
+2011-01-21  Brian Weinstein  <bweinstein@apple.com>
+
+        Reviewed by Adam Roben.
+
+        WebKit2: Need API to stop loading a WKFrame
+        https://bugs.webkit.org/show_bug.cgi?id=52925
+
+        * UIProcess/API/C/WKFrame.cpp:
+        (WKFrameStopLoading): Call through to WebFrameProxy::stopLoading.
+        * UIProcess/API/C/WKFrame.h:
+        * UIProcess/WebFrameProxy.cpp:
+        (WebKit::WebFrameProxy::stopLoading): Send a message to the WebProcess to stop loading the frame
+            with the passed in ID.
+        * UIProcess/WebFrameProxy.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::stopLoadingFrame): Call stopForUserCancel on the passed-in frame.
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in: Add StopLoadingFrame.
+
 2011-01-21  Brady Eidson  <beidson@apple.com>
 
         Reviewed by Adam Roben.
index 282e12409d34b9126869b8e2485866f1b6964196..cce572a34fc3e5ee02671672cf46265b213b700b 100644 (file)
@@ -75,6 +75,11 @@ WKURLRef WKFrameCopyUnreachableURL(WKFrameRef frameRef)
     return toCopiedURLAPI(toImpl(frameRef)->unreachableURL());
 }
 
+void WKFrameStopLoading(WKFrameRef frameRef)
+{
+    toImpl(frameRef)->stopLoading();
+}
+
 WKStringRef WKFrameCopyMIMEType(WKFrameRef frameRef)
 {
     return toCopiedAPI(toImpl(frameRef)->mimeType());
index 7c096421f4d9b03dc8056a6b889ef8acf8233018..334a27bca8de02953a5bb473f842b64ad3d98431 100644 (file)
@@ -51,6 +51,8 @@ WK_EXPORT WKURLRef WKFrameCopyProvisionalURL(WKFrameRef frame);
 WK_EXPORT WKURLRef WKFrameCopyURL(WKFrameRef frame);
 WK_EXPORT WKURLRef WKFrameCopyUnreachableURL(WKFrameRef frame);
 
+WK_EXPORT void WKFrameStopLoading(WKFrameRef frame);
+
 WK_EXPORT WKStringRef WKFrameCopyMIMEType(WKFrameRef frame);
 WK_EXPORT WKStringRef WKFrameCopyTitle(WKFrameRef frame);
 
index 77a2b1938fedecd4a76d5283030db50f07491697..779cf6191739d6515e1d5bf6c66e728aa3ba2b2d 100644 (file)
@@ -29,6 +29,7 @@
 #include "WebContext.h"
 #include "WebFormSubmissionListenerProxy.h"
 #include "WebFramePolicyListenerProxy.h"
+#include "WebPageMessages.h"
 #include "WebPageProxy.h"
 #include <WebCore/DOMImplementation.h>
 #include <WebCore/Image.h>
@@ -81,6 +82,17 @@ bool WebFrameProxy::isMainFrame() const
     return this == m_page->mainFrame();
 }
 
+void WebFrameProxy::stopLoading() const
+{
+    if (!m_page)
+        return;
+
+    if (!m_page->isValid())
+        return;
+
+    m_page->process()->send(Messages::WebPage::StopLoadingFrame(m_frameID), m_page->pageID());
+}
+    
 bool WebFrameProxy::canProvideSource() const
 {
     return isDisplayingMarkupDocument();
index ae97a78496e5dba0cf4d41732d4669a03b668518..6cc2130370865345667136040111f2d0ddad3cf3 100644 (file)
@@ -86,6 +86,8 @@ public:
     bool isFrameSet() const { return m_isFrameSet; }
 
     LoadState loadState() const { return m_loadState; }
+    
+    void stopLoading() const;
 
     const String& url() const { return m_url; }
     const String& provisionalURL() const { return m_provisionalURL; }
index a96a282de9f065820d20d4518cdc3b7fe203474a..af236e9757158bd6d0504a736fda317fb0879c97 100644 (file)
@@ -439,6 +439,15 @@ void WebPage::loadPlainTextString(const String& string)
     loadData(sharedBuffer, "text/plain", "utf-16", blankURL(), KURL());
 }
 
+void WebPage::stopLoadingFrame(uint64_t frameID)
+{
+    WebFrame* frame = WebProcess::shared().webFrame(frameID);
+    if (!frame)
+        return;
+
+    frame->coreFrame()->loader()->stopForUserCancel();
+}
+
 void WebPage::stopLoading()
 {
     m_mainFrame->coreFrame()->loader()->stopForUserCancel();
index d2d8754137aae6fb509541aa7dc1a6858b537cdf..d29400fa0e1df39e5b526d162eb07a37593f9730 100644 (file)
@@ -200,6 +200,7 @@ public:
     bool drawsTransparentBackground() const { return m_drawsTransparentBackground; }
 
     void stopLoading();
+    void stopLoadingFrame(uint64_t frameID);
     void setDefersLoading(bool deferLoading);
 
 #if USE(ACCELERATED_COMPOSITING)
index 327288679aa992cca78cc42eb5878ee9b6c9e92b..e0018641cf86121527a50cfc3aab5bfec57bb6c0 100644 (file)
@@ -46,6 +46,8 @@ messages -> WebPage {
     LoadURLRequest(WebCore::ResourceRequest request, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
     Reload(bool reloadFromOrigin)
     StopLoading()
+
+    StopLoadingFrame(uint64_t frameID)
     
     RestoreSessionAndNavigateToCurrentItem(WebKit::SessionState state)