[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

bweinstein at apple.com bweinstein at apple.com
Wed Dec 22 14:58:41 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit c9c2c8f12511225bfb0e721353f0f70fcf5a3ab2
Author: bweinstein at apple.com <bweinstein at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 26 20:16:18 2010 +0000

    Need a way to retrieve custom user agent from a WKPage
    https://bugs.webkit.org/show_bug.cgi?id=48360
    <rdar://problem/8466537>
    
    Reviewed by Darin Adler.
    
    Add an exported function on WKPage to get the page's custom user agent.
    
    * UIProcess/API/C/WKPage.cpp:
    (WKPageCopyCustomUserAgent): Exported function that returns the custom user
        agent.
    * UIProcess/API/C/WKPage.h:
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::close): Clear the custom user agent string.
    (WebKit::WebPageProxy::processDidCrash): Ditto.
    (WebKit::WebPageProxy::setCustomUserAgent): Add a new early return if we're setting
        the custom user agent to what it was before, and set the custom user agent member
        variable.
    * UIProcess/WebPageProxy.h:
    (WebKit::WebPageProxy::customUserAgent): Returns the custom user agent.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70561 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index cf55f71..44ef013 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,26 @@
+2010-10-26  Brian Weinstein  <bweinstein at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Need a way to retrieve custom user agent from a WKPage
+        https://bugs.webkit.org/show_bug.cgi?id=48360
+        <rdar://problem/8466537>
+        
+        Add an exported function on WKPage to get the page's custom user agent.
+
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageCopyCustomUserAgent): Exported function that returns the custom user
+            agent.
+        * UIProcess/API/C/WKPage.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::close): Clear the custom user agent string.
+        (WebKit::WebPageProxy::processDidCrash): Ditto.
+        (WebKit::WebPageProxy::setCustomUserAgent): Add a new early return if we're setting
+            the custom user agent to what it was before, and set the custom user agent member
+            variable.
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::customUserAgent): Returns the custom user agent.
+
 2010-10-26  Simon Fraser  <simon.fraser at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebKit2/UIProcess/API/C/WKPage.cpp b/WebKit2/UIProcess/API/C/WKPage.cpp
index 71bfa7c..3d6aa1a 100644
--- a/WebKit2/UIProcess/API/C/WKPage.cpp
+++ b/WebKit2/UIProcess/API/C/WKPage.cpp
@@ -152,6 +152,11 @@ double WKPageGetEstimatedProgress(WKPageRef pageRef)
     return toImpl(pageRef)->estimatedProgress();
 }
 
+WKStringRef WKPageCopyCustomUserAgent(WKPageRef pageRef)
+{
+    return toCopiedAPI(toImpl(pageRef)->customUserAgent());
+}
+
 void WKPageSetCustomUserAgent(WKPageRef pageRef, WKStringRef userAgentRef)
 {
     toImpl(pageRef)->setCustomUserAgent(toImpl(userAgentRef)->string());
diff --git a/WebKit2/UIProcess/API/C/WKPage.h b/WebKit2/UIProcess/API/C/WKPage.h
index 1251a89..d5d386c 100644
--- a/WebKit2/UIProcess/API/C/WKPage.h
+++ b/WebKit2/UIProcess/API/C/WKPage.h
@@ -214,6 +214,7 @@ WK_EXPORT double WKPageGetEstimatedProgress(WKPageRef page);
 
 WK_EXPORT WKInspectorRef WKPageGetInspector(WKPageRef page);
 
+WK_EXPORT WKStringRef WKPageCopyCustomUserAgent(WKPageRef page);
 WK_EXPORT void WKPageSetCustomUserAgent(WKPageRef page, WKStringRef userAgent);
 
 WK_EXPORT void WKPageTerminate(WKPageRef page);
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 304616a..f20cec5 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -186,6 +186,7 @@ void WebPageProxy::close()
     process()->disconnectFramesFromPage(this);
     m_mainFrame = 0;
 
+    m_customUserAgent = String();
     m_pageTitle = String();
     m_toolTip = String();
 
@@ -457,6 +458,10 @@ void WebPageProxy::setCustomUserAgent(const String& userAgent)
     if (!isValid())
         return;
 
+    if (m_customUserAgent == userAgent || (m_customUserAgent.isEmpty() && userAgent.isEmpty()))
+        return;
+
+    m_customUserAgent = userAgent;
     process()->send(Messages::WebPage::SetCustomUserAgent(userAgent), m_pageID);
 }
 
@@ -1178,6 +1183,7 @@ void WebPageProxy::processDidCrash()
         m_inspector = 0;
     }
 
+    m_customUserAgent = String();
     m_pageTitle = String();
     m_toolTip = String();
 
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index e48f5e2..e3ba662 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -166,6 +166,7 @@ public:
 
     const String& pageTitle() const { return m_pageTitle; }
     const String& toolTip() const { return m_toolTip; }
+    const String& customUserAgent() const { return m_customUserAgent; }
 
     double estimatedProgress() const { return m_estimatedProgress; }
 
@@ -327,6 +328,8 @@ private:
     RefPtr<WebFrameProxy> m_mainFrame;
     String m_pageTitle;
 
+    String m_customUserAgent;
+
     RefPtr<WebInspectorProxy> m_inspector;
 
     HashMap<uint64_t, RefPtr<ScriptReturnValueCallback> > m_scriptReturnValueCallbacks;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list