[WK2] API::URLRequest, API::URLResponse creation functions should return Ref<>
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Apr 2015 08:06:58 +0000 (08:06 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Apr 2015 08:06:58 +0000 (08:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=144224

Reviewed by Darin Adler.

Have API::URLRequest and API::URLResponse creation functions return Ref<>.
The call-sites are also updated, using and operating on the returned Ref<> object
where possible.

* Shared/API/APIURLRequest.h:
(API::URLRequest::create):
* Shared/API/APIURLResponse.h:
(API::URLResponse::create):
* Shared/API/c/WKURLRequest.cpp:
(WKURLRequestCreateWithWKURL):
* Shared/API/c/mac/WKURLRequestNS.mm:
(WKURLRequestCreateWithNSURLRequest):
* Shared/API/c/mac/WKURLResponseNS.mm:
(WKURLResponseCreateWithNSURLResponse):
* UIProcess/API/C/WKContext.cpp:
(WKContextSetDownloadClient):
* UIProcess/API/C/WKDownload.cpp:
(WKDownloadCopyRequest):
* UIProcess/API/C/WKNavigationDataRef.cpp:
(WKNavigationDataCopyOriginalRequest):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPagePolicyClient):
(WKPageSetPageUIClient):
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
* UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp:
(WebKit::WebSoupCustomProtocolRequestManagerClient::startLoading):
* WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp:
(willSendRequestForFrame):
* WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.cpp:
(WebKit::InjectedBundlePagePolicyClient::decidePolicyForNavigationAction):
(WebKit::InjectedBundlePagePolicyClient::decidePolicyForNewWindowAction):
(WebKit::InjectedBundlePagePolicyClient::decidePolicyForResponse):

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

14 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/API/APIURLRequest.h
Source/WebKit2/Shared/API/APIURLResponse.h
Source/WebKit2/Shared/API/c/WKURLRequest.cpp
Source/WebKit2/Shared/API/c/mac/WKURLRequestNS.mm
Source/WebKit2/Shared/API/c/mac/WKURLResponseNS.mm
Source/WebKit2/UIProcess/API/C/WKContext.cpp
Source/WebKit2/UIProcess/API/C/WKDownload.cpp
Source/WebKit2/UIProcess/API/C/WKNavigationDataRef.cpp
Source/WebKit2/UIProcess/API/C/WKPage.cpp
Source/WebKit2/UIProcess/Cocoa/NavigationState.mm
Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp
Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.cpp

index 63ccdf7..a3fc052 100644 (file)
@@ -1,3 +1,44 @@
+2015-04-28  Zan Dobersek  <zdobersek@igalia.com>
+
+        [WK2] API::URLRequest, API::URLResponse creation functions should return Ref<>
+        https://bugs.webkit.org/show_bug.cgi?id=144224
+
+        Reviewed by Darin Adler.
+
+        Have API::URLRequest and API::URLResponse creation functions return Ref<>.
+        The call-sites are also updated, using and operating on the returned Ref<> object
+        where possible.
+
+        * Shared/API/APIURLRequest.h:
+        (API::URLRequest::create):
+        * Shared/API/APIURLResponse.h:
+        (API::URLResponse::create):
+        * Shared/API/c/WKURLRequest.cpp:
+        (WKURLRequestCreateWithWKURL):
+        * Shared/API/c/mac/WKURLRequestNS.mm:
+        (WKURLRequestCreateWithNSURLRequest):
+        * Shared/API/c/mac/WKURLResponseNS.mm:
+        (WKURLResponseCreateWithNSURLResponse):
+        * UIProcess/API/C/WKContext.cpp:
+        (WKContextSetDownloadClient):
+        * UIProcess/API/C/WKDownload.cpp:
+        (WKDownloadCopyRequest):
+        * UIProcess/API/C/WKNavigationDataRef.cpp:
+        (WKNavigationDataCopyOriginalRequest):
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageSetPagePolicyClient):
+        (WKPageSetPageUIClient):
+        * UIProcess/Cocoa/NavigationState.mm:
+        (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
+        * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp:
+        (WebKit::WebSoupCustomProtocolRequestManagerClient::startLoading):
+        * WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp:
+        (willSendRequestForFrame):
+        * WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.cpp:
+        (WebKit::InjectedBundlePagePolicyClient::decidePolicyForNavigationAction):
+        (WebKit::InjectedBundlePagePolicyClient::decidePolicyForNewWindowAction):
+        (WebKit::InjectedBundlePagePolicyClient::decidePolicyForResponse):
+
 2015-04-27  Zan Dobersek  <zdobersek@igalia.com>
 
         [WK2] API::Point, API::Size, API::Rect creation functions should return Ref<>
 2015-04-27  Zan Dobersek  <zdobersek@igalia.com>
 
         [WK2] API::Point, API::Size, API::Rect creation functions should return Ref<>
index d5e4d4a..026cce3 100644 (file)
@@ -39,9 +39,9 @@ namespace API {
 
 class URLRequest : public ObjectImpl<Object::Type::URLRequest> {
 public:
 
 class URLRequest : public ObjectImpl<Object::Type::URLRequest> {
 public:
-    static PassRefPtr<URLRequest> create(const WebCore::ResourceRequest& request)
+    static Ref<URLRequest> create(const WebCore::ResourceRequest& request)
     {
     {
-        return adoptRef(new URLRequest(request));
+        return adoptRef(*new URLRequest(request));
     }
 
     const WebCore::ResourceRequest& resourceRequest() const { return m_request; }
     }
 
     const WebCore::ResourceRequest& resourceRequest() const { return m_request; }
index 2790b9f..db81b3f 100644 (file)
@@ -39,9 +39,9 @@ namespace API {
 
 class URLResponse : public ObjectImpl<Object::Type::URLResponse> {
 public:
 
 class URLResponse : public ObjectImpl<Object::Type::URLResponse> {
 public:
-    static PassRefPtr<URLResponse> create(const WebCore::ResourceResponse& response)
+    static Ref<URLResponse> create(const WebCore::ResourceResponse& response)
     {
     {
-        return adoptRef(new URLResponse(response));
+        return adoptRef(*new URLResponse(response));
     }
 
     const WebCore::ResourceResponse& resourceResponse() const { return m_response; }
     }
 
     const WebCore::ResourceResponse& resourceResponse() const { return m_response; }
index edbf219..1a337b2 100644 (file)
@@ -40,7 +40,7 @@ WKTypeID WKURLRequestGetTypeID()
 
 WKURLRequestRef WKURLRequestCreateWithWKURL(WKURLRef url)
 {
 
 WKURLRequestRef WKURLRequestCreateWithWKURL(WKURLRef url)
 {
-    return toAPI(API::URLRequest::create(URL(URL(), toImpl(url)->string())).leakRef());
+    return toAPI(&API::URLRequest::create(URL(URL(), toImpl(url)->string())).leakRef());
 }
 
 WKURLRef WKURLRequestCopyURL(WKURLRequestRef requestRef)
 }
 
 WKURLRef WKURLRequestCopyURL(WKURLRequestRef requestRef)
index f804158..aadddd1 100644 (file)
@@ -35,8 +35,7 @@ using namespace WebKit;
 WKURLRequestRef WKURLRequestCreateWithNSURLRequest(NSURLRequest* urlRequest)
 {
     RetainPtr<NSURLRequest> copiedURLRequest = adoptNS([urlRequest copy]);
 WKURLRequestRef WKURLRequestCreateWithNSURLRequest(NSURLRequest* urlRequest)
 {
     RetainPtr<NSURLRequest> copiedURLRequest = adoptNS([urlRequest copy]);
-    RefPtr<API::URLRequest> request = API::URLRequest::create(copiedURLRequest.get());
-    return toAPI(request.release().leakRef());
+    return toAPI(&API::URLRequest::create(copiedURLRequest.get()).leakRef());
 }
 
 NSURLRequest* WKURLRequestCopyNSURLRequest(WKURLRequestRef urlRequest)
 }
 
 NSURLRequest* WKURLRequestCopyNSURLRequest(WKURLRequestRef urlRequest)
index 87211e6..8921859 100644 (file)
@@ -34,8 +34,7 @@ using namespace WebKit;
 WKURLResponseRef WKURLResponseCreateWithNSURLResponse(NSURLResponse* urlResponse)
 {
     RetainPtr<NSURLResponse> copiedURLResponse = adoptNS([urlResponse copy]);
 WKURLResponseRef WKURLResponseCreateWithNSURLResponse(NSURLResponse* urlResponse)
 {
     RetainPtr<NSURLResponse> copiedURLResponse = adoptNS([urlResponse copy]);
-    RefPtr<API::URLResponse> response = API::URLResponse::create(copiedURLResponse.get());
-    return toAPI(response.release().leakRef());
+    return toAPI(&API::URLResponse::create(copiedURLResponse.get()).leakRef());
 }
 
 NSURLResponse* WKURLResponseCopyNSURLResponse(WKURLResponseRef urlResponse)
 }
 
 NSURLResponse* WKURLResponseCopyNSURLResponse(WKURLResponseRef urlResponse)
index 581d997..563ec01 100644 (file)
@@ -203,7 +203,7 @@ void WKContextSetDownloadClient(WKContextRef contextRef, const WKContextDownload
             if (!m_client.didReceiveResponse)
                 return;
 
             if (!m_client.didReceiveResponse)
                 return;
 
-            m_client.didReceiveResponse(toAPI(processPool), toAPI(downloadProxy), toAPI(API::URLResponse::create(response).get()), m_client.base.clientInfo);
+            m_client.didReceiveResponse(toAPI(processPool), toAPI(downloadProxy), toAPI(API::URLResponse::create(response).ptr()), m_client.base.clientInfo);
         }
 
         virtual void didReceiveData(WebProcessPool* processPool, DownloadProxy* downloadProxy, uint64_t length) override
         }
 
         virtual void didReceiveData(WebProcessPool* processPool, DownloadProxy* downloadProxy, uint64_t length) override
index beb829b..705cff0 100644 (file)
@@ -45,7 +45,7 @@ uint64_t WKDownloadGetID(WKDownloadRef download)
 
 WKURLRequestRef WKDownloadCopyRequest(WKDownloadRef download)
 {
 
 WKURLRequestRef WKDownloadCopyRequest(WKDownloadRef download)
 {
-    return toAPI(API::URLRequest::create(toImpl(download)->request()).leakRef());
+    return toAPI(&API::URLRequest::create(toImpl(download)->request()).leakRef());
 }
 
 WKDataRef WKDownloadGetResumeData(WKDownloadRef download)
 }
 
 WKDataRef WKDownloadGetResumeData(WKDownloadRef download)
index 86840e3..0a815bb 100644 (file)
@@ -55,5 +55,5 @@ WKURLRef WKNavigationDataCopyNavigationDestinationURL(WKNavigationDataRef naviga
 
 WKURLRequestRef WKNavigationDataCopyOriginalRequest(WKNavigationDataRef navigationData)
 {
 
 WKURLRequestRef WKNavigationDataCopyOriginalRequest(WKNavigationDataRef navigationData)
 {
-    return toAPI(API::URLRequest::create(toImpl(navigationData)->originalRequest()).leakRef());
+    return toAPI(&API::URLRequest::create(toImpl(navigationData)->originalRequest()).leakRef());
 }
 }
index 27d8a12..9db513d 100644 (file)
@@ -1257,15 +1257,15 @@ void WKPageSetPagePolicyClient(WKPageRef pageRef, const WKPagePolicyClientBase*
                 return;
             }
 
                 return;
             }
 
-            RefPtr<API::URLRequest> originalRequest = API::URLRequest::create(originalResourceRequest);
-            RefPtr<API::URLRequest> request = API::URLRequest::create(resourceRequest);
+            Ref<API::URLRequest> originalRequest = API::URLRequest::create(originalResourceRequest);
+            Ref<API::URLRequest> request = API::URLRequest::create(resourceRequest);
 
             if (m_client.decidePolicyForNavigationAction_deprecatedForUseWithV0)
 
             if (m_client.decidePolicyForNavigationAction_deprecatedForUseWithV0)
-                m_client.decidePolicyForNavigationAction_deprecatedForUseWithV0(toAPI(&page), toAPI(frame), toAPI(navigationActionData.navigationType), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), toAPI(request.get()), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo);
+                m_client.decidePolicyForNavigationAction_deprecatedForUseWithV0(toAPI(&page), toAPI(frame), toAPI(navigationActionData.navigationType), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), toAPI(request.ptr()), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo);
             else if (m_client.decidePolicyForNavigationAction_deprecatedForUseWithV1)
             else if (m_client.decidePolicyForNavigationAction_deprecatedForUseWithV1)
-                m_client.decidePolicyForNavigationAction_deprecatedForUseWithV1(toAPI(&page), toAPI(frame), toAPI(navigationActionData.navigationType), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), toAPI(originatingFrame), toAPI(request.get()), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo);
+                m_client.decidePolicyForNavigationAction_deprecatedForUseWithV1(toAPI(&page), toAPI(frame), toAPI(navigationActionData.navigationType), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), toAPI(originatingFrame), toAPI(request.ptr()), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo);
             else
             else
-                m_client.decidePolicyForNavigationAction(toAPI(&page), toAPI(frame), toAPI(navigationActionData.navigationType), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), toAPI(originatingFrame), toAPI(originalRequest.get()), toAPI(request.get()), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo);
+                m_client.decidePolicyForNavigationAction(toAPI(&page), toAPI(frame), toAPI(navigationActionData.navigationType), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), toAPI(originatingFrame), toAPI(originalRequest.ptr()), toAPI(request.ptr()), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo);
         }
 
         virtual void decidePolicyForNewWindowAction(WebPageProxy& page, WebFrameProxy& frame, const NavigationActionData& navigationActionData, const ResourceRequest& resourceRequest, const String& frameName, Ref<WebFramePolicyListenerProxy>&& listener, API::Object* userData) override
         }
 
         virtual void decidePolicyForNewWindowAction(WebPageProxy& page, WebFrameProxy& frame, const NavigationActionData& navigationActionData, const ResourceRequest& resourceRequest, const String& frameName, Ref<WebFramePolicyListenerProxy>&& listener, API::Object* userData) override
@@ -1275,9 +1275,9 @@ void WKPageSetPagePolicyClient(WKPageRef pageRef, const WKPagePolicyClientBase*
                 return;
             }
 
                 return;
             }
 
-            RefPtr<API::URLRequest> request = API::URLRequest::create(resourceRequest);
+            Ref<API::URLRequest> request = API::URLRequest::create(resourceRequest);
 
 
-            m_client.decidePolicyForNewWindowAction(toAPI(&page), toAPI(&frame), toAPI(navigationActionData.navigationType), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), toAPI(request.get()), toAPI(frameName.impl()), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo);
+            m_client.decidePolicyForNewWindowAction(toAPI(&page), toAPI(&frame), toAPI(navigationActionData.navigationType), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), toAPI(request.ptr()), toAPI(frameName.impl()), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo);
         }
 
         virtual void decidePolicyForResponse(WebPageProxy& page, WebFrameProxy& frame, const ResourceResponse& resourceResponse, const ResourceRequest& resourceRequest, bool canShowMIMEType, Ref<WebFramePolicyListenerProxy>&& listener, API::Object* userData) override
         }
 
         virtual void decidePolicyForResponse(WebPageProxy& page, WebFrameProxy& frame, const ResourceResponse& resourceResponse, const ResourceRequest& resourceRequest, bool canShowMIMEType, Ref<WebFramePolicyListenerProxy>&& listener, API::Object* userData) override
@@ -1287,13 +1287,13 @@ void WKPageSetPagePolicyClient(WKPageRef pageRef, const WKPagePolicyClientBase*
                 return;
             }
 
                 return;
             }
 
-            RefPtr<API::URLResponse> response = API::URLResponse::create(resourceResponse);
-            RefPtr<API::URLRequest> request = API::URLRequest::create(resourceRequest);
+            Ref<API::URLResponse> response = API::URLResponse::create(resourceResponse);
+            Ref<API::URLRequest> request = API::URLRequest::create(resourceRequest);
 
             if (m_client.decidePolicyForResponse_deprecatedForUseWithV0)
 
             if (m_client.decidePolicyForResponse_deprecatedForUseWithV0)
-                m_client.decidePolicyForResponse_deprecatedForUseWithV0(toAPI(&page), toAPI(&frame), toAPI(response.get()), toAPI(request.get()), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo);
+                m_client.decidePolicyForResponse_deprecatedForUseWithV0(toAPI(&page), toAPI(&frame), toAPI(response.ptr()), toAPI(request.ptr()), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo);
             else
             else
-                m_client.decidePolicyForResponse(toAPI(&page), toAPI(&frame), toAPI(response.get()), toAPI(request.get()), canShowMIMEType, toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo);
+                m_client.decidePolicyForResponse(toAPI(&page), toAPI(&frame), toAPI(response.ptr()), toAPI(request.ptr()), canShowMIMEType, toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo);
         }
 
         virtual void unableToImplementPolicy(WebPageProxy& page, WebFrameProxy& frame, const ResourceError& error, API::Object* userData) override
         }
 
         virtual void unableToImplementPolicy(WebPageProxy& page, WebFrameProxy& frame, const ResourceError& error, API::Object* userData) override
@@ -1348,8 +1348,8 @@ void WKPageSetPageUIClient(WKPageRef pageRef, const WKPageUIClientBase* wkClient
             if (!m_client.base.version)
                 return adoptRef(toImpl(m_client.createNewPage_deprecatedForUseWithV0(toAPI(page), toAPI(featuresMap.ptr()), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), m_client.base.clientInfo)));
 
             if (!m_client.base.version)
                 return adoptRef(toImpl(m_client.createNewPage_deprecatedForUseWithV0(toAPI(page), toAPI(featuresMap.ptr()), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), m_client.base.clientInfo)));
 
-            RefPtr<API::URLRequest> request = API::URLRequest::create(resourceRequest);
-            return adoptRef(toImpl(m_client.createNewPage(toAPI(page), toAPI(request.get()), toAPI(featuresMap.ptr()), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), m_client.base.clientInfo)));
+            Ref<API::URLRequest> request = API::URLRequest::create(resourceRequest);
+            return adoptRef(toImpl(m_client.createNewPage(toAPI(page), toAPI(request.ptr()), toAPI(featuresMap.ptr()), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), m_client.base.clientInfo)));
         }
 
         virtual void showPage(WebPageProxy* page) override
         }
 
         virtual void showPage(WebPageProxy* page) override
index 0b0bd75..8626251 100644 (file)
@@ -265,7 +265,7 @@ void NavigationState::NavigationClient::decidePolicyForNavigationAction(WebPageP
                 return;
             }
 
                 return;
             }
 
-            RetainPtr<NSURLRequest> nsURLRequest = adoptNS(wrapper(*API::URLRequest::create(localNavigationAction->request()).leakRef()));
+            RetainPtr<NSURLRequest> nsURLRequest = adoptNS(wrapper(API::URLRequest::create(localNavigationAction->request()).leakRef()));
             if ([NSURLConnection canHandleRequest:nsURLRequest.get()]) {
                 localListener->use();
                 return;
             if ([NSURLConnection canHandleRequest:nsURLRequest.get()]) {
                 localListener->use();
                 return;
index 5091a26..c4def62 100644 (file)
@@ -29,8 +29,8 @@ bool WebSoupCustomProtocolRequestManagerClient::startLoading(WebSoupCustomProtoc
     if (!m_client.startLoading)
         return false;
 
     if (!m_client.startLoading)
         return false;
 
-    RefPtr<API::URLRequest> urlRequest = API::URLRequest::create(request);
-    m_client.startLoading(toAPI(soupRequestManager), customProtocolID, toAPI(urlRequest.get()), m_client.base.clientInfo);
+    Ref<API::URLRequest> urlRequest = API::URLRequest::create(request);
+    m_client.startLoading(toAPI(soupRequestManager), customProtocolID, toAPI(urlRequest.ptr()), m_client.base.clientInfo);
     return true;
 }
 
     return true;
 }
 
index 1385a1c..7472618 100644 (file)
@@ -203,17 +203,17 @@ static WKURLRequestRef willSendRequestForFrame(WKBundlePageRef page, WKBundleFra
     ResourceRequest resourceRequest;
     webkitURIRequestGetResourceRequest(request.get(), resourceRequest);
     resourceRequest.setInitiatingPageID(toImpl(page)->pageID());
     ResourceRequest resourceRequest;
     webkitURIRequestGetResourceRequest(request.get(), resourceRequest);
     resourceRequest.setInitiatingPageID(toImpl(page)->pageID());
-    RefPtr<API::URLRequest> newRequest = API::URLRequest::create(resourceRequest);
+    Ref<API::URLRequest> newRequest = API::URLRequest::create(resourceRequest);
 
     API::Dictionary::MapType message;
     message.set(String::fromUTF8("Page"), toImpl(page));
     message.set(String::fromUTF8("Identifier"), API::UInt64::create(identifier));
 
     API::Dictionary::MapType message;
     message.set(String::fromUTF8("Page"), toImpl(page));
     message.set(String::fromUTF8("Identifier"), API::UInt64::create(identifier));
-    message.set(String::fromUTF8("Request"), newRequest.get());
+    message.set(String::fromUTF8("Request"), newRequest.ptr());
     if (!redirectResourceResponse.isNull())
         message.set(String::fromUTF8("RedirectResponse"), toImpl(wkRedirectResponse));
     WebProcess::singleton().injectedBundle()->postMessage(String::fromUTF8("WebPage.DidSendRequestForResource"), API::Dictionary::create(WTF::move(message)).ptr());
 
     if (!redirectResourceResponse.isNull())
         message.set(String::fromUTF8("RedirectResponse"), toImpl(wkRedirectResponse));
     WebProcess::singleton().injectedBundle()->postMessage(String::fromUTF8("WebPage.DidSendRequestForResource"), API::Dictionary::create(WTF::move(message)).ptr());
 
-    return toAPI(newRequest.release().leakRef());
+    return toAPI(&newRequest.leakRef());
 }
 
 static void didReceiveResponseForResource(WKBundlePageRef page, WKBundleFrameRef, uint64_t identifier, WKURLResponseRef response, const void*)
 }
 
 static void didReceiveResponseForResource(WKBundlePageRef page, WKBundleFrameRef, uint64_t identifier, WKURLResponseRef response, const void*)
index 0e11fbf..2cb977c 100644 (file)
@@ -42,10 +42,10 @@ WKBundlePagePolicyAction InjectedBundlePagePolicyClient::decidePolicyForNavigati
     if (!m_client.decidePolicyForNavigationAction)
         return WKBundlePagePolicyActionPassThrough;
 
     if (!m_client.decidePolicyForNavigationAction)
         return WKBundlePagePolicyActionPassThrough;
 
-    RefPtr<API::URLRequest> request = API::URLRequest::create(resourceRequest);
+    Ref<API::URLRequest> request = API::URLRequest::create(resourceRequest);
 
     WKTypeRef userDataToPass = 0;
 
     WKTypeRef userDataToPass = 0;
-    WKBundlePagePolicyAction policy = m_client.decidePolicyForNavigationAction(toAPI(page), toAPI(frame), toAPI(action), toAPI(request.get()), &userDataToPass, m_client.base.clientInfo);
+    WKBundlePagePolicyAction policy = m_client.decidePolicyForNavigationAction(toAPI(page), toAPI(frame), toAPI(action), toAPI(request.ptr()), &userDataToPass, m_client.base.clientInfo);
     userData = adoptRef(toImpl(userDataToPass));
     return policy;
 }
     userData = adoptRef(toImpl(userDataToPass));
     return policy;
 }
@@ -55,10 +55,10 @@ WKBundlePagePolicyAction InjectedBundlePagePolicyClient::decidePolicyForNewWindo
     if (!m_client.decidePolicyForNewWindowAction)
         return WKBundlePagePolicyActionPassThrough;
 
     if (!m_client.decidePolicyForNewWindowAction)
         return WKBundlePagePolicyActionPassThrough;
 
-    RefPtr<API::URLRequest> request = API::URLRequest::create(resourceRequest);
+    Ref<API::URLRequest> request = API::URLRequest::create(resourceRequest);
 
     WKTypeRef userDataToPass = 0;
 
     WKTypeRef userDataToPass = 0;
-    WKBundlePagePolicyAction policy = m_client.decidePolicyForNewWindowAction(toAPI(page), toAPI(frame), toAPI(action), toAPI(request.get()), toAPI(frameName.impl()), &userDataToPass, m_client.base.clientInfo);
+    WKBundlePagePolicyAction policy = m_client.decidePolicyForNewWindowAction(toAPI(page), toAPI(frame), toAPI(action), toAPI(request.ptr()), toAPI(frameName.impl()), &userDataToPass, m_client.base.clientInfo);
     userData = adoptRef(toImpl(userDataToPass));
     return policy;
 }
     userData = adoptRef(toImpl(userDataToPass));
     return policy;
 }
@@ -68,11 +68,11 @@ WKBundlePagePolicyAction InjectedBundlePagePolicyClient::decidePolicyForResponse
     if (!m_client.decidePolicyForResponse)
         return WKBundlePagePolicyActionPassThrough;
 
     if (!m_client.decidePolicyForResponse)
         return WKBundlePagePolicyActionPassThrough;
 
-    RefPtr<API::URLResponse> response = API::URLResponse::create(resourceResponse);
-    RefPtr<API::URLRequest> request = API::URLRequest::create(resourceRequest);
+    Ref<API::URLResponse> response = API::URLResponse::create(resourceResponse);
+    Ref<API::URLRequest> request = API::URLRequest::create(resourceRequest);
 
     WKTypeRef userDataToPass = 0;
 
     WKTypeRef userDataToPass = 0;
-    WKBundlePagePolicyAction policy = m_client.decidePolicyForResponse(toAPI(page), toAPI(frame), toAPI(response.get()), toAPI(request.get()), &userDataToPass, m_client.base.clientInfo);
+    WKBundlePagePolicyAction policy = m_client.decidePolicyForResponse(toAPI(page), toAPI(frame), toAPI(response.ptr()), toAPI(request.ptr()), &userDataToPass, m_client.base.clientInfo);
     userData = adoptRef(toImpl(userDataToPass));
     return policy;
 }
     userData = adoptRef(toImpl(userDataToPass));
     return policy;
 }