2011-03-03 Anders Carlsson <andersca@apple.com>
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Mar 2011 19:14:45 +0000 (19:14 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Mar 2011 19:14:45 +0000 (19:14 +0000)
        Reviewed by Darin Adler.

        Remove CanRunBeforeUnloadConfirmPanel sync message
        https://bugs.webkit.org/show_bug.cgi?id=55689

        * Shared/WebPageCreationParameters.cpp:
        (WebKit::WebPageCreationParameters::encode):
        (WebKit::WebPageCreationParameters::decode):
        Encode and decode canRunBeforeUnloadConfirmPanel, as well as canRunModal, which wasn't
        being encoded/decoded.

        * Shared/WebPageCreationParameters.h:
        Add canRunBeforeUnloadConfirmPanel.

        * UIProcess/WebPageProxy.cpp:
        (WebKit::WebPageProxy::initializeUIClient):
        Send SetCanRunBeforeUnloadConfirmPanel and SetCanRunModal messages.

        (WebKit::WebPageProxy::creationParameters):
        Initialize parameters.canRunBeforeUnloadConfirmPanel.

        * UIProcess/WebPageProxy.messages.in:
        Remove CanRunBeforeUnloadConfirmPanel message.

        * UIProcess/WebUIClient.cpp:
        (WebKit::WebUIClient::canRunBeforeUnloadConfirmPanel):
        * UIProcess/WebUIClient.h:
        Make canRunBeforeUnloadConfirmPanel const.

        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
        (WebKit::WebChromeClient::canRunBeforeUnloadConfirmPanel):
        Ask the web page instead of sending a synchronous message.

        * WebProcess/WebPage/WebPage.cpp:
        (WebKit::WebPage::WebPage):
        Initialize m_canRunBeforeUnloadConfirmPanel.

        * WebProcess/WebPage/WebPage.h:
        (WebKit::WebPage::canRunBeforeUnloadConfirmPanel):
        (WebKit::WebPage::setCanRunBeforeUnloadConfirmPanel):
        Add getter and setter for m_canRunBeforeUnloadConfirmPanel.

        (WebKit::WebPage::setCanRunModal):
        Add setter for m_canRunModal.

        * WebProcess/WebPage/WebPage.messages.in:
        Add SetCanRunBeforeUnloadConfirmPanel and SetCanRunModal messages.

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

12 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPageCreationParameters.cpp
Source/WebKit2/Shared/WebPageCreationParameters.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebPageProxy.messages.in
Source/WebKit2/UIProcess/WebUIClient.cpp
Source/WebKit2/UIProcess/WebUIClient.h
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in

index c7eaf91..895104b 100644 (file)
@@ -1,3 +1,53 @@
+2011-03-03  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Darin Adler.
+
+        Remove CanRunBeforeUnloadConfirmPanel sync message
+        https://bugs.webkit.org/show_bug.cgi?id=55689
+
+        * Shared/WebPageCreationParameters.cpp:
+        (WebKit::WebPageCreationParameters::encode):
+        (WebKit::WebPageCreationParameters::decode):
+        Encode and decode canRunBeforeUnloadConfirmPanel, as well as canRunModal, which wasn't
+        being encoded/decoded.
+
+        * Shared/WebPageCreationParameters.h:
+        Add canRunBeforeUnloadConfirmPanel.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::initializeUIClient):
+        Send SetCanRunBeforeUnloadConfirmPanel and SetCanRunModal messages.
+
+        (WebKit::WebPageProxy::creationParameters):
+        Initialize parameters.canRunBeforeUnloadConfirmPanel.
+
+        * UIProcess/WebPageProxy.messages.in:
+        Remove CanRunBeforeUnloadConfirmPanel message.
+
+        * UIProcess/WebUIClient.cpp:
+        (WebKit::WebUIClient::canRunBeforeUnloadConfirmPanel):
+        * UIProcess/WebUIClient.h:
+        Make canRunBeforeUnloadConfirmPanel const.
+
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::canRunBeforeUnloadConfirmPanel):
+        Ask the web page instead of sending a synchronous message.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::WebPage):
+        Initialize m_canRunBeforeUnloadConfirmPanel.
+
+        * WebProcess/WebPage/WebPage.h:
+        (WebKit::WebPage::canRunBeforeUnloadConfirmPanel):
+        (WebKit::WebPage::setCanRunBeforeUnloadConfirmPanel):
+        Add getter and setter for m_canRunBeforeUnloadConfirmPanel.
+
+        (WebKit::WebPage::setCanRunModal):
+        Add setter for m_canRunModal.
+
+        * WebProcess/WebPage/WebPage.messages.in:
+        Add SetCanRunBeforeUnloadConfirmPanel and SetCanRunModal messages.
+
 2011-03-03  Adam Roben  <aroben@apple.com>
 
         Create the CFBundleRef for WebKit.dll on Windows if needed
index 8b5b92a..33b53e3 100644 (file)
@@ -49,6 +49,8 @@ void WebPageCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) const
     encoder->encode(userAgent);
     encoder->encode(sessionState);
     encoder->encode(highestUsedBackForwardItemID);
+    encoder->encode(canRunBeforeUnloadConfirmPanel);
+    encoder->encode(canRunModal);
 
 #if PLATFORM(MAC)
     encoder->encode(isSmartInsertDeleteEnabled);
@@ -93,6 +95,10 @@ bool WebPageCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, WebPag
         return false;
     if (!decoder->decode(parameters.highestUsedBackForwardItemID))
         return false;
+    if (!decoder->decode(parameters.canRunBeforeUnloadConfirmPanel))
+        return false;
+    if (!decoder->decode(parameters.canRunModal))
+        return false;
 
 #if PLATFORM(MAC)
     if (!decoder->decode(parameters.isSmartInsertDeleteEnabled))
index 5e929f5..31759e1 100644 (file)
@@ -68,6 +68,7 @@ struct WebPageCreationParameters {
     SessionState sessionState;
     uint64_t highestUsedBackForwardItemID;
 
+    bool canRunBeforeUnloadConfirmPanel;
     bool canRunModal;
 
 #if PLATFORM(MAC)
index 051edc3..3ffdff2 100644 (file)
@@ -221,6 +221,9 @@ void WebPageProxy::initializeResourceLoadClient(const WKPageResourceLoadClient*
 void WebPageProxy::initializeUIClient(const WKPageUIClient* client)
 {
     m_uiClient.initialize(client);
+
+    process()->send(Messages::WebPage::SetCanRunBeforeUnloadConfirmPanel(m_uiClient.canRunBeforeUnloadConfirmPanel()), m_pageID);
+    process()->send(Messages::WebPage::SetCanRunModal(m_uiClient.canRunModal()), m_pageID);
 }
 
 void WebPageProxy::initializeFindClient(const WKPageFindClient* client)
@@ -1867,11 +1870,6 @@ void WebPageProxy::getWindowFrame(FloatRect& newWindowFrame)
     newWindowFrame = m_pageClient->convertToUserSpace(m_uiClient.windowFrame(this));
 }
 
-void WebPageProxy::canRunBeforeUnloadConfirmPanel(bool& canRun)
-{
-    canRun = m_uiClient.canRunBeforeUnloadConfirmPanel();
-}
-
 void WebPageProxy::runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose)
 {
     WebFrameProxy* frame = process()->webFrame(frameID);
@@ -2591,6 +2589,7 @@ WebPageCreationParameters WebPageProxy::creationParameters() const
     parameters.userAgent = userAgent();
     parameters.sessionState = SessionState(m_backForwardList->entries(), m_backForwardList->currentIndex());
     parameters.highestUsedBackForwardItemID = WebBackForwardListItem::highedUsedItemID();
+    parameters.canRunBeforeUnloadConfirmPanel = m_uiClient.canRunBeforeUnloadConfirmPanel();
     parameters.canRunModal = m_uiClient.canRunModal();
 
 #if PLATFORM(MAC)
index 931014f..cd854b7 100644 (file)
@@ -487,7 +487,6 @@ private:
     void getIsResizable(bool& isResizable);
     void setWindowFrame(const WebCore::FloatRect&);
     void getWindowFrame(WebCore::FloatRect&);
-    void canRunBeforeUnloadConfirmPanel(bool& canRun);
     void runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose);
     void didChangeViewportData(const WebCore::ViewportArguments&);
     void pageDidScroll();
index a5433a6..230c7fa 100644 (file)
@@ -49,7 +49,6 @@ messages -> WebPageProxy {
     GetIsResizable() -> (bool isResizable)
     SetWindowFrame(WebCore::FloatRect windowFrame)
     GetWindowFrame() -> (WebCore::FloatRect windowFrame)
-    CanRunBeforeUnloadConfirmPanel() -> (bool canRun)
     RunBeforeUnloadConfirmPanel(WTF::String message, uint64_t frameID) -> (bool shouldClose)
     PageDidScroll()
     RunOpenPanel(uint64_t frameID, WebKit::WebOpenPanelParameters::Data parameters)
index 076b331..a2310ab 100644 (file)
@@ -218,7 +218,7 @@ FloatRect WebUIClient::windowFrame(WebPageProxy* page)
     return toFloatRect(m_client.getWindowFrame(toAPI(page), m_client.clientInfo));
 }
 
-bool WebUIClient::canRunBeforeUnloadConfirmPanel()
+bool WebUIClient::canRunBeforeUnloadConfirmPanel() const
 {
     return m_client.runBeforeUnloadConfirmPanel;
 }
index d8e0bff..5b37e28 100644 (file)
@@ -76,7 +76,7 @@ public:
     void setWindowFrame(WebPageProxy*, const WebCore::FloatRect&);
     WebCore::FloatRect windowFrame(WebPageProxy*);
 
-    bool canRunBeforeUnloadConfirmPanel();
+    bool canRunBeforeUnloadConfirmPanel() const;
     bool runBeforeUnloadConfirmPanel(WebPageProxy*, const String&, WebFrameProxy*);
 
     void didDraw(WebPageProxy*);
index cf0c297..18ba26b 100644 (file)
@@ -252,11 +252,7 @@ void WebChromeClient::addMessageToConsole(MessageSource, MessageType, MessageLev
 
 bool WebChromeClient::canRunBeforeUnloadConfirmPanel()
 {
-    bool canRun = false;
-    if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::CanRunBeforeUnloadConfirmPanel(), Messages::WebPageProxy::CanRunBeforeUnloadConfirmPanel::Reply(canRun), m_page->pageID()))
-        return false;
-
-    return canRun;
+    return m_page->canRunBeforeUnloadConfirmPanel();
 }
 
 bool WebChromeClient::runBeforeUnloadConfirmPanel(const String& message, Frame* frame)
index 2518ac6..24371e3 100644 (file)
@@ -154,6 +154,7 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
     , m_findController(this)
     , m_geolocationPermissionRequestManager(this)
     , m_pageID(pageID)
+    , m_canRunBeforeUnloadConfirmPanel(parameters.canRunBeforeUnloadConfirmPanel)
     , m_canRunModal(parameters.canRunModal)
     , m_isRunningModal(false)
     , m_cachedMainFrameIsPinnedToLeftSide(false)
index 0c9a1eb..5fa230a 100644 (file)
@@ -337,7 +337,12 @@ public:
 
     void didChangeScrollOffsetForMainFrame();
 
+    bool canRunBeforeUnloadConfirmPanel() const { return m_canRunBeforeUnloadConfirmPanel; }
+    void setCanRunBeforeUnloadConfirmPanel(bool canRunBeforeUnloadConfirmPanel) { m_canRunBeforeUnloadConfirmPanel = canRunBeforeUnloadConfirmPanel; }
+
     bool canRunModal() const { return m_canRunModal; }
+    void setCanRunModal(bool canRunModal) { m_canRunModal = canRunModal; }
+
     void runModal();
 
     void setMemoryCacheMessagesEnabled(bool);
@@ -543,6 +548,8 @@ private:
     SandboxExtensionTracker m_sandboxExtensionTracker;
     uint64_t m_pageID;
 
+    bool m_canRunBeforeUnloadConfirmPanel;
+
     bool m_canRunModal;
     bool m_isRunningModal;
 
index f34fe77..e2bc8e0 100644 (file)
@@ -167,6 +167,9 @@ messages -> WebPage {
     // any synchronous messages, and should be removed when <rdar://problem/8775115> is fixed.
     Dummy() -> (bool dummyReturn)
 
+    SetCanRunBeforeUnloadConfirmPanel(bool canRunBeforeUnloadConfirmPanel)
+    SetCanRunModal(bool canRunModal)
+
 #if PLATFORM(MAC)
     # Complex text input support for plug-ins.
     SendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, String textInput)