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

weinig at apple.com weinig at apple.com
Wed Dec 22 11:31:12 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 50fde81c755a96c0675d430c2b1045548298bcf7
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jul 27 22:47:50 2010 +0000

    Patch for https://bugs.webkit.org/show_bug.cgi?id=43087
    Clean up handling of strings at the WebKit2 API layer.
    
    Reviewed by Anders Carlsson.
    
    WebKit2:
    
    - Always use the "copy" rule for functions that return WKStringRefs or WKURLRefs.
    - Never return a null WKStringRef or WKURLRef.
    
    * UIProcess/API/C/WKAPICast.h:
    (toRef):
    (toURLRef):
    (toCopiedRef):
    (toCopiedURLRef):
    * UIProcess/API/C/WKBackForwardListItem.cpp:
    (WKBackForwardListItemCopyOriginalURL):
    (WKBackForwardListItemCopyURL):
    (WKBackForwardListItemCopyTitle):
    * UIProcess/API/C/WKBackForwardListItem.h:
    * UIProcess/API/C/WKFrame.cpp:
    (WKFrameIsMainFrame):
    (WKFrameCopyProvisionalURL):
    (WKFrameCopyURL):
    (WKFrameGetPage):
    (WKFrameRetain):
    (WKFrameRelease):
    * UIProcess/API/C/WKFrame.h:
    * UIProcess/API/C/WKNavigationData.cpp:
    (WKNavigationDataCopyTitle):
    (WKNavigationDataCopyURL):
    * UIProcess/API/C/WKNavigationData.h:
    * UIProcess/API/C/WKPage.cpp:
    (WKPageCopyTitle):
    * UIProcess/API/C/WKPage.h:
    * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
    (WKBundleFrameCopyURL):
    (WKBundleFrameCopyName):
    (WKBundleFrameCopyCounterValue):
    (WKBundleFrameCopyMarkerText):
    * WebProcess/InjectedBundle/API/c/WKBundleFrame.h:
    * WebProcess/InjectedBundle/API/c/WKBundleNode.cpp:
    (WKBundleNodeCopyNodeName):
    * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
    (WKBundlePageCopyRenderTreeExternalRepresentation):
    
    WebKitTools:
    
    * MiniBrowser/mac/BrowserWindowController.m:
    (runJavaScriptAlert):
    (runJavaScriptConfirm):
    (runJavaScriptPrompt):
    (didNavigateWithNavigationData):
    (-[BrowserWindowController updateProvisionalURLForFrame:]):
    * MiniBrowser/mac/WebBundle/WebBundleMain.m:
    (_didClearWindowForFrame):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64172 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 9799355..d991842 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,49 @@
+2010-07-27  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Anders Carlsson.
+
+        Patch for https://bugs.webkit.org/show_bug.cgi?id=43087
+        Clean up handling of strings at the WebKit2 API layer.
+
+        - Always use the "copy" rule for functions that return WKStringRefs or WKURLRefs.
+        - Never return a null WKStringRef or WKURLRef.
+
+        * UIProcess/API/C/WKAPICast.h:
+        (toRef):
+        (toURLRef):
+        (toCopiedRef):
+        (toCopiedURLRef):
+        * UIProcess/API/C/WKBackForwardListItem.cpp:
+        (WKBackForwardListItemCopyOriginalURL):
+        (WKBackForwardListItemCopyURL):
+        (WKBackForwardListItemCopyTitle):
+        * UIProcess/API/C/WKBackForwardListItem.h:
+        * UIProcess/API/C/WKFrame.cpp:
+        (WKFrameIsMainFrame):
+        (WKFrameCopyProvisionalURL):
+        (WKFrameCopyURL):
+        (WKFrameGetPage):
+        (WKFrameRetain):
+        (WKFrameRelease):
+        * UIProcess/API/C/WKFrame.h:
+        * UIProcess/API/C/WKNavigationData.cpp:
+        (WKNavigationDataCopyTitle):
+        (WKNavigationDataCopyURL):
+        * UIProcess/API/C/WKNavigationData.h:
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageCopyTitle):
+        * UIProcess/API/C/WKPage.h:
+        * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
+        (WKBundleFrameCopyURL):
+        (WKBundleFrameCopyName):
+        (WKBundleFrameCopyCounterValue):
+        (WKBundleFrameCopyMarkerText):
+        * WebProcess/InjectedBundle/API/c/WKBundleFrame.h:
+        * WebProcess/InjectedBundle/API/c/WKBundleNode.cpp:
+        (WKBundleNodeCopyNodeName):
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+        (WKBundlePageCopyRenderTreeExternalRepresentation):
+
 2010-07-27  Adam Roben  <aroben at apple.com>
 
         Fix PageClient ownership in WebPageProxy
diff --git a/WebKit2/UIProcess/API/C/WKAPICast.h b/WebKit2/UIProcess/API/C/WKAPICast.h
index 9b6da3b..7a8fe82 100644
--- a/WebKit2/UIProcess/API/C/WKAPICast.h
+++ b/WebKit2/UIProcess/API/C/WKAPICast.h
@@ -29,15 +29,12 @@
 #include "WKBase.h"
 #include "WKPage.h"
 #include <WebCore/FrameLoaderTypes.h>
+#include <WebCore/PlatformString.h>
 
 #if defined(WIN32) || defined(_WIN32)
 #include "WKAPICastWin.h"
 #endif
 
-namespace WebCore {
-    class StringImpl;
-}
-
 namespace WebKit {
 
 class ImmutableArray;
@@ -94,11 +91,32 @@ inline typename WebKit::ImplTypeInfo<T>::APIType toRef(T t)
     return reinterpret_cast<typename WebKit::ImplTypeInfo<T>::APIType>(t);
 }
 
-/* Special case for WKURLRef which also uses StringImpl as an implementation. */
+/* Special cases. */
+
+inline WKStringRef toRef(WebCore::StringImpl* string)
+{
+    WebCore::StringImpl* impl = string ? string : WebCore::StringImpl::empty();
+    return reinterpret_cast<WKStringRef>(impl);
+}
+
+inline WKURLRef toURLRef(WebCore::StringImpl* string)
+{
+    WebCore::StringImpl* impl = string ? string : WebCore::StringImpl::empty();
+    return reinterpret_cast<WKURLRef>(impl);
+}
+
+inline WKStringRef toCopiedRef(const WebCore::String& string)
+{
+    WebCore::StringImpl* impl = string.impl() ? string.impl() : WebCore::StringImpl::empty();
+    impl->ref();
+    return reinterpret_cast<WKStringRef>(impl);
+}
 
-inline WKURLRef toURLRef(WebCore::StringImpl* s)
+inline WKURLRef toCopiedURLRef(const WebCore::String& string)
 {
-    return reinterpret_cast<WKURLRef>(s);
+    WebCore::StringImpl* impl = string.impl() ? string.impl() : WebCore::StringImpl::empty();
+    impl->ref();
+    return reinterpret_cast<WKURLRef>(impl);
 }
 
 inline WKFrameNavigationType toWK(WebCore::NavigationType type)
diff --git a/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp b/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp
index a280bc8..0c28fa1 100644
--- a/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp
+++ b/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp
@@ -30,19 +30,19 @@
 
 using namespace WebKit;
 
-WKURLRef WKBackForwardListItemGetOriginalURL(WKBackForwardListItemRef itemRef)
+WKURLRef WKBackForwardListItemCopyOriginalURL(WKBackForwardListItemRef itemRef)
 {
-    return toURLRef(toWK(itemRef)->originalURL().impl());
+    return toCopiedURLRef(toWK(itemRef)->originalURL());
 }
 
-WKURLRef WKBackForwardListItemGetURL(WKBackForwardListItemRef itemRef)
+WKURLRef WKBackForwardListItemCopyURL(WKBackForwardListItemRef itemRef)
 {
-    return toURLRef(toWK(itemRef)->url().impl());
+    return toCopiedURLRef(toWK(itemRef)->url());
 }
 
-WKStringRef WKBackForwardListItemGetTitle(WKBackForwardListItemRef itemRef)
+WKStringRef WKBackForwardListItemCopyTitle(WKBackForwardListItemRef itemRef)
 {
-    return toRef(toWK(itemRef)->title().impl());
+    return toCopiedRef(toWK(itemRef)->title());
 }
 
 WKBackForwardListItemRef WKBackForwardListItemRetain(WKBackForwardListItemRef itemRef)
diff --git a/WebKit2/UIProcess/API/C/WKBackForwardListItem.h b/WebKit2/UIProcess/API/C/WKBackForwardListItem.h
index d5a81b4..8f8e263 100644
--- a/WebKit2/UIProcess/API/C/WKBackForwardListItem.h
+++ b/WebKit2/UIProcess/API/C/WKBackForwardListItem.h
@@ -32,9 +32,9 @@
 extern "C" {
 #endif
 
-WK_EXPORT WKURLRef WKBackForwardListItemGetOriginalURL(WKBackForwardListItemRef item);
-WK_EXPORT WKURLRef WKBackForwardListItemGetURL(WKBackForwardListItemRef item);
-WK_EXPORT WKStringRef WKBackForwardListItemGetTitle(WKBackForwardListItemRef item);
+WK_EXPORT WKURLRef WKBackForwardListItemCopyOriginalURL(WKBackForwardListItemRef item);
+WK_EXPORT WKURLRef WKBackForwardListItemCopyURL(WKBackForwardListItemRef item);
+WK_EXPORT WKStringRef WKBackForwardListItemCopyTitle(WKBackForwardListItemRef item);
 
 WK_EXPORT WKBackForwardListItemRef WKBackForwardListItemRetain(WKBackForwardListItemRef item);
 WK_EXPORT void WKBackForwardListItemRelease(WKBackForwardListItemRef item);
diff --git a/WebKit2/UIProcess/API/C/WKFrame.cpp b/WebKit2/UIProcess/API/C/WKFrame.cpp
index 1a5d43f..1fc92fa 100644
--- a/WebKit2/UIProcess/API/C/WKFrame.cpp
+++ b/WebKit2/UIProcess/API/C/WKFrame.cpp
@@ -32,8 +32,7 @@ using namespace WebKit;
 
 bool WKFrameIsMainFrame(WKFrameRef frameRef)
 {
-    WebFrameProxy* frame = toWK(frameRef);
-    return frame->isMainFrame();
+    return toWK(frameRef)->isMainFrame();
 }
 
 WKFrameLoadState WKFrameGetFrameLoadState(WKFrameRef frameRef)
@@ -52,33 +51,28 @@ WKFrameLoadState WKFrameGetFrameLoadState(WKFrameRef frameRef)
     return kWKFrameLoadStateFinished;
 }
 
-WKURLRef WKFrameGetProvisionalURL(WKFrameRef frameRef)
+WKURLRef WKFrameCopyProvisionalURL(WKFrameRef frameRef)
 {
-    WebFrameProxy* frame = toWK(frameRef);
-    return toURLRef(frame->provisionalURL().impl());
+    return toCopiedURLRef(toWK(frameRef)->provisionalURL());
 }
 
-WKURLRef WKFrameGetURL(WKFrameRef frameRef)
+WKURLRef WKFrameCopyURL(WKFrameRef frameRef)
 {
-    WebFrameProxy* frame = toWK(frameRef);
-    return toURLRef(frame->url().impl());
+    return toCopiedURLRef(toWK(frameRef)->url());
 }
 
 WKPageRef WKFrameGetPage(WKFrameRef frameRef)
 {
-    WebFrameProxy* frame = toWK(frameRef);
-    return toRef(frame->page());
+    return toRef(toWK(frameRef)->page());
 }
 
 WKFrameRef WKFrameRetain(WKFrameRef frameRef)
 {
-    WebFrameProxy* frame = toWK(frameRef);
-    frame->ref();
+    toWK(frameRef)->ref();
     return frameRef;
 }
 
 void WKFrameRelease(WKFrameRef frameRef)
 {
-    WebFrameProxy* frame = toWK(frameRef);
-    frame->deref();
+    toWK(frameRef)->deref();
 }
diff --git a/WebKit2/UIProcess/API/C/WKFrame.h b/WebKit2/UIProcess/API/C/WKFrame.h
index 1e09cb7..8c9df16 100644
--- a/WebKit2/UIProcess/API/C/WKFrame.h
+++ b/WebKit2/UIProcess/API/C/WKFrame.h
@@ -45,8 +45,8 @@ typedef enum WKFrameLoadState WKFrameLoadState;
 
 WK_EXPORT bool WKFrameIsMainFrame(WKFrameRef frame);
 WK_EXPORT WKFrameLoadState WKFrameGetFrameLoadState(WKFrameRef frame);
-WK_EXPORT WKURLRef WKFrameGetProvisionalURL(WKFrameRef frame);
-WK_EXPORT WKURLRef WKFrameGetURL(WKFrameRef frame);
+WK_EXPORT WKURLRef WKFrameCopyProvisionalURL(WKFrameRef frame);
+WK_EXPORT WKURLRef WKFrameCopyURL(WKFrameRef frame);
 
 WK_EXPORT WKPageRef WKFrameGetPage(WKFrameRef frame);
 
diff --git a/WebKit2/UIProcess/API/C/WKNavigationData.cpp b/WebKit2/UIProcess/API/C/WKNavigationData.cpp
index 5370a44..0671955 100644
--- a/WebKit2/UIProcess/API/C/WKNavigationData.cpp
+++ b/WebKit2/UIProcess/API/C/WKNavigationData.cpp
@@ -30,14 +30,14 @@
 
 using namespace WebKit;
 
-WKStringRef WKNavigationDataGetTitle(WKNavigationDataRef navigationDataRef)
+WKStringRef WKNavigationDataCopyTitle(WKNavigationDataRef navigationDataRef)
 {
-    return toRef(toWK(navigationDataRef)->title().impl());
+    return toCopiedRef(toWK(navigationDataRef)->title());
 }
 
-WKURLRef WKNavigationDataGetURL(WKNavigationDataRef navigationDataRef)
+WKURLRef WKNavigationDataCopyURL(WKNavigationDataRef navigationDataRef)
 {
-    return toURLRef(toWK(navigationDataRef)->url().impl());
+    return toCopiedURLRef(toWK(navigationDataRef)->url());
 }
 
 WKNavigationDataRef WKNavigationDataRetain(WKNavigationDataRef navigationDataRef)
diff --git a/WebKit2/UIProcess/API/C/WKNavigationData.h b/WebKit2/UIProcess/API/C/WKNavigationData.h
index a3eaf8d..46be875 100644
--- a/WebKit2/UIProcess/API/C/WKNavigationData.h
+++ b/WebKit2/UIProcess/API/C/WKNavigationData.h
@@ -32,8 +32,8 @@
 extern "C" {
 #endif
 
-WK_EXPORT WKStringRef WKNavigationDataGetTitle(WKNavigationDataRef navigationData);
-WK_EXPORT WKURLRef WKNavigationDataGetURL(WKNavigationDataRef navigationData);
+WK_EXPORT WKStringRef WKNavigationDataCopyTitle(WKNavigationDataRef navigationData);
+WK_EXPORT WKURLRef WKNavigationDataCopyURL(WKNavigationDataRef navigationData);
 
 WK_EXPORT WKNavigationDataRef WKNavigationDataRetain(WKNavigationDataRef navigationData);
 WK_EXPORT void WKNavigationDataRelease(WKNavigationDataRef navigationData);
diff --git a/WebKit2/UIProcess/API/C/WKPage.cpp b/WebKit2/UIProcess/API/C/WKPage.cpp
index ec96104..e718e0e 100644
--- a/WebKit2/UIProcess/API/C/WKPage.cpp
+++ b/WebKit2/UIProcess/API/C/WKPage.cpp
@@ -106,9 +106,9 @@ WKBackForwardListRef WKPageGetBackForwardList(WKPageRef pageRef)
     return toRef(toWK(pageRef)->backForwardList());
 }
 
-WKStringRef WKPageGetTitle(WKPageRef pageRef)
+WKStringRef WKPageCopyTitle(WKPageRef pageRef)
 {
-    return toRef(toWK(pageRef)->pageTitle().impl());
+    return toCopiedRef(toWK(pageRef)->pageTitle());
 }
 
 WKFrameRef WKPageGetMainFrame(WKPageRef pageRef)
diff --git a/WebKit2/UIProcess/API/C/WKPage.h b/WebKit2/UIProcess/API/C/WKPage.h
index ae6469c..c8d8d34 100644
--- a/WebKit2/UIProcess/API/C/WKPage.h
+++ b/WebKit2/UIProcess/API/C/WKPage.h
@@ -168,7 +168,7 @@ WK_EXPORT bool WKPageCanGoBack(WKPageRef page);
 WK_EXPORT void WKPageGoToBackForwardListItem(WKPageRef page, WKBackForwardListItemRef item);
 WK_EXPORT WKBackForwardListRef WKPageGetBackForwardList(WKPageRef page);
 
-WK_EXPORT WKStringRef WKPageGetTitle(WKPageRef page);
+WK_EXPORT WKStringRef WKPageCopyTitle(WKPageRef page);
 
 WK_EXPORT WKFrameRef WKPageGetMainFrame(WKPageRef page);
 WK_EXPORT double WKPageGetEstimatedProgress(WKPageRef page);
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
index 5d46bdb..ddad52e 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
@@ -34,21 +34,14 @@
 using namespace WebCore;
 using namespace WebKit;
 
-static WKStringRef copiedString(const WebCore::String& string)
-{
-    StringImpl* impl = string.impl() ? string.impl() : StringImpl::empty();
-    impl->ref();
-    return toRef(impl);
-}
-
 bool WKBundleFrameIsMainFrame(WKBundleFrameRef frameRef)
 {
     return toWK(frameRef)->isMainFrame();
 }
 
-WKURLRef WKBundleFrameGetURL(WKBundleFrameRef frameRef)
+WKURLRef WKBundleFrameCopyURL(WKBundleFrameRef frameRef)
 {
-    return toURLRef(toWK(frameRef)->url().impl());
+    return toCopiedURLRef(toWK(frameRef)->url());
 }
 
 WKArrayRef WKBundleFrameCopyChildFrames(WKBundleFrameRef frameRef)
@@ -73,7 +66,7 @@ JSGlobalContextRef WKBundleFrameGetJavaScriptContext(WKBundleFrameRef frameRef)
 
 WKStringRef WKBundleFrameCopyName(WKBundleFrameRef frameRef)
 {
-    return copiedString(toWK(frameRef)->name());
+    return toCopiedRef(toWK(frameRef)->name());
 }
 
 JSValueRef WKBundleFrameGetComputedStyleIncludingVisitedInfo(WKBundleFrameRef frameRef, JSObjectRef element)
@@ -83,10 +76,10 @@ JSValueRef WKBundleFrameGetComputedStyleIncludingVisitedInfo(WKBundleFrameRef fr
 
 WKStringRef WKBundleFrameCopyCounterValue(WKBundleFrameRef frameRef, JSObjectRef element)
 {
-    return copiedString(toWK(frameRef)->counterValue(element));
+    return toCopiedRef(toWK(frameRef)->counterValue(element));
 }
 
 WKStringRef WKBundleFrameCopyMarkerText(WKBundleFrameRef frameRef, JSObjectRef element)
 {
-    return copiedString(toWK(frameRef)->markerText(element));
+    return toCopiedRef(toWK(frameRef)->markerText(element));
 }
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h
index 247ec7e..1b0ef20 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h
@@ -38,7 +38,7 @@ WK_EXPORT bool WKBundleFrameIsMainFrame(WKBundleFrameRef frame);
 WK_EXPORT WKArrayRef WKBundleFrameCopyChildFrames(WKBundleFrameRef frame);
 
 WK_EXPORT WKStringRef WKBundleFrameCopyName(WKBundleFrameRef frame);
-WK_EXPORT WKURLRef WKBundleFrameGetURL(WKBundleFrameRef frame);
+WK_EXPORT WKURLRef WKBundleFrameCopyURL(WKBundleFrameRef frame);
 
 WK_EXPORT JSGlobalContextRef WKBundleFrameGetJavaScriptContext(WKBundleFrameRef frame);
 
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNode.cpp b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNode.cpp
index f90c186..3c68549 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNode.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNode.cpp
@@ -35,8 +35,7 @@ using namespace WebKit;
 
 WKStringRef WKBundleNodeCopyNodeName(WKBundleNodeRef node)
 {
-    RefPtr<StringImpl> name = toWK(node)->nodeName().impl();
-    return toRef(name.release().releaseRef());
+    return toCopiedRef(toWK(node)->nodeName());
 }
 
 WKBundleNodeRef WKBundleNodeGetParent(WKBundleNodeRef node)
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
index bec1f8d..2f03789 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
@@ -58,7 +58,5 @@ WKBundleFrameRef WKBundlePageGetMainFrame(WKBundlePageRef pageRef)
 
 WKStringRef WKBundlePageCopyRenderTreeExternalRepresentation(WKBundlePageRef pageRef)
 {
-    WebCore::String string = toWK(pageRef)->renderTreeExternalRepresentation();
-    string.impl()->ref();
-    return toRef(string.impl());
+    return toCopiedRef(toWK(pageRef)->renderTreeExternalRepresentation());
 }
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 992d20d..86c15c1 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,19 @@
+2010-07-27  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Anders Carlsson.
+
+        Patch for https://bugs.webkit.org/show_bug.cgi?id=43087
+        Clean up handling of strings at the WebKit2 API layer.
+
+        * MiniBrowser/mac/BrowserWindowController.m:
+        (runJavaScriptAlert):
+        (runJavaScriptConfirm):
+        (runJavaScriptPrompt):
+        (didNavigateWithNavigationData):
+        (-[BrowserWindowController updateProvisionalURLForFrame:]):
+        * MiniBrowser/mac/WebBundle/WebBundleMain.m:
+        (_didClearWindowForFrame):
+
 2010-07-27  Ojan Vafai  <ojan at chromium.org>
 
         Reviewed by Eric Seidel.
diff --git a/WebKitTools/MiniBrowser/mac/BrowserWindowController.m b/WebKitTools/MiniBrowser/mac/BrowserWindowController.m
index 0b25abe..321c849 100644
--- a/WebKitTools/MiniBrowser/mac/BrowserWindowController.m
+++ b/WebKitTools/MiniBrowser/mac/BrowserWindowController.m
@@ -282,7 +282,10 @@ static void runJavaScriptAlert(WKPageRef page, WKStringRef message, WKFrameRef f
 {
     NSAlert* alert = [[NSAlert alloc] init];
 
-    CFURLRef cfURL = WKURLCopyCFURL(0, WKFrameGetURL(frame));
+    WKURLRef wkURL = WKFrameCopyURL(frame);
+    CFURLRef cfURL = WKURLCopyCFURL(0, wkURL);
+    WKURLRelease(wkURL);
+
     [alert setMessageText:[NSString stringWithFormat:@"JavaScript alert dialog from %@.", [(NSURL *)cfURL absoluteString]]];
     CFRelease(cfURL);
 
@@ -300,7 +303,10 @@ static bool runJavaScriptConfirm(WKPageRef page, WKStringRef message, WKFrameRef
 {
     NSAlert* alert = [[NSAlert alloc] init];
 
-    CFURLRef cfURL = WKURLCopyCFURL(0, WKFrameGetURL(frame));
+    WKURLRef wkURL = WKFrameCopyURL(frame);
+    CFURLRef cfURL = WKURLCopyCFURL(0, wkURL);
+    WKURLRelease(wkURL);
+
     [alert setMessageText:[NSString stringWithFormat:@"JavaScript confirm dialog from %@.", [(NSURL *)cfURL absoluteString]]];
     CFRelease(cfURL);
 
@@ -321,7 +327,10 @@ static WKStringRef runJavaScriptPrompt(WKPageRef page, WKStringRef message, WKSt
 {
     NSAlert* alert = [[NSAlert alloc] init];
 
-    CFURLRef cfURL = WKURLCopyCFURL(0, WKFrameGetURL(frame));
+    WKURLRef wkURL = WKFrameCopyURL(frame);
+    CFURLRef cfURL = WKURLCopyCFURL(0, wkURL);
+    WKURLRelease(wkURL);
+
     [alert setMessageText:[NSString stringWithFormat:@"JavaScript prompt dialog from %@.", [(NSURL *)cfURL absoluteString]]];
     CFRelease(cfURL);
 
@@ -358,8 +367,14 @@ static WKStringRef runJavaScriptPrompt(WKPageRef page, WKStringRef message, WKSt
 
 static void didNavigateWithNavigationData(WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef frame, const void *clientInfo)
 {
-    CFStringRef title = WKStringCopyCFString(0, WKNavigationDataGetTitle(navigationData));
-    CFURLRef url = WKURLCopyCFURL(0, WKNavigationDataGetURL(navigationData));
+    WKStringRef wkTitle = WKNavigationDataCopyTitle(navigationData);
+    CFStringRef title = WKStringCopyCFString(0, wkTitle);
+    WKStringRelease(wkTitle);
+
+    WKURLRef wkURL = WKNavigationDataCopyURL(navigationData);
+    CFURLRef url = WKURLCopyCFURL(0, wkURL);
+    WKURLRelease(wkURL);
+
     LOG(@"HistoryClient - didNavigateWithNavigationData - title: %@ - url: %@", title, url);
     CFRelease(title);
     CFRelease(url);
@@ -475,11 +490,13 @@ static void didUpdateHistoryTitle(WKPageRef page, WKStringRef title, WKURLRef UR
 
 - (void)updateProvisionalURLForFrame:(WKFrameRef)frame
 {
-    WKURLRef url = WKFrameGetProvisionalURL(frame);
+    WKURLRef url = WKFrameCopyProvisionalURL(frame);
     if (!url)
         return;
 
     CFURLRef cfSourceURL = WKURLCopyCFURL(0, url);
+    WKURLRelease(url);
+
     [urlText setStringValue:(NSString*)CFURLGetString(cfSourceURL)];
     CFRelease(cfSourceURL);
 }
diff --git a/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m b/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m
index 4eea646..cd5ee00 100644
--- a/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m
+++ b/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m
@@ -67,7 +67,10 @@ void _didReceiveTitleForFrame(WKBundlePageRef page, WKStringRef title, WKBundleF
 
 void _didClearWindowForFrame(WKBundlePageRef page, WKBundleFrameRef frame, JSGlobalContextRef context, JSObjectRef window, const void *clientInfo)
 {
-    CFURLRef cfURL = WKURLCopyCFURL(0, WKBundleFrameGetURL(WKBundlePageGetMainFrame(page)));
+    WKURLRef wkURL = WKBundleFrameCopyURL(WKBundlePageGetMainFrame(page));
+    CFURLRef cfURL = WKURLCopyCFURL(0, wkURL);
+    WKURLRelease(wkURL);
+
     LOG(@"WKBundlePageClient - _didClearWindowForFrame %@", [(NSURL *)cfURL absoluteString]);
     CFRelease(cfURL);
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list