Commit 42115e1b authored by mitz@apple.com's avatar mitz@apple.com

Added a version of +[NSURL _web_URLWithWTFString:relativeToURL:] that doesn’t...

Added a version of +[NSURL _web_URLWithWTFString:relativeToURL:] that doesn’t take a base URL and switched all callers to it.
https://bugs.webkit.org/show_bug.cgi?id=125040

Reviewed by Sam Weinig.

* Shared/Cocoa/WKNSURLExtras.h: Declared new method.
* Shared/Cocoa/WKNSURLExtras.mm:
(urlWithWTFString): Added helper function.
(+[NSURL _web_URLWithWTFString:]): Added.
(+[NSURL _web_URLWithWTFString:relativeToURL:]): Changed to use helper function.
* UIProcess/API/Cocoa/WKBackForwardListItem.mm:
(-[WKBackForwardListItem URL]): Changed to call new method.
(-[WKBackForwardListItem originalURL]): Ditto.
* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
(-[WKBrowsingContextController activeURL]): Ditto.
(-[WKBrowsingContextController provisionalURL]): Ditto.
(-[WKBrowsingContextController committedURL]): Ditto.
(-[WKBrowsingContextController unreachableURL]): Ditto.
(setUpPagePolicyClient): Ditto.
* UIProcess/API/Cocoa/WKNavigationData.mm:
(-[WKNavigationData destinationURL]): Ditto.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159895 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1431d58b
2013-11-30 Dan Bernstein <mitz@apple.com>
Added a version of +[NSURL _web_URLWithWTFString:relativeToURL:] that doesn’t take a base URL and switched all callers to it.
https://bugs.webkit.org/show_bug.cgi?id=125040
Reviewed by Sam Weinig.
* Shared/Cocoa/WKNSURLExtras.h: Declared new method.
* Shared/Cocoa/WKNSURLExtras.mm:
(urlWithWTFString): Added helper function.
(+[NSURL _web_URLWithWTFString:]): Added.
(+[NSURL _web_URLWithWTFString:relativeToURL:]): Changed to use helper function.
* UIProcess/API/Cocoa/WKBackForwardListItem.mm:
(-[WKBackForwardListItem URL]): Changed to call new method.
(-[WKBackForwardListItem originalURL]): Ditto.
* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
(-[WKBrowsingContextController activeURL]): Ditto.
(-[WKBrowsingContextController provisionalURL]): Ditto.
(-[WKBrowsingContextController committedURL]): Ditto.
(-[WKBrowsingContextController unreachableURL]): Ditto.
(setUpPagePolicyClient): Ditto.
* UIProcess/API/Cocoa/WKNavigationData.mm:
(-[WKNavigationData destinationURL]): Ditto.
2013-11-30 Dan Bernstein <mitz@apple.com>
[Cocoa] Stop using the WKPageRef API in WKBrowsingContextController
......
......@@ -27,6 +27,7 @@
@interface NSURL (WKExtras)
+ (instancetype)_web_URLWithWTFString:(const String&)string;
+ (instancetype)_web_URLWithWTFString:(const String&)string relativeToURL:(NSURL *)baseURL;
- (String)_web_originalDataAsWTFString;
......
......@@ -34,7 +34,7 @@ using namespace WebCore;
@implementation NSURL (WKExtras)
+ (instancetype)_web_URLWithWTFString:(const WTF::String&)string relativeToURL:(NSURL *)baseURL
static inline NSURL *urlWithWTFString(const String& string, NSURL *baseURL = nil)
{
if (!string)
return nil;
......@@ -43,6 +43,16 @@ using namespace WebCore;
return CFBridgingRelease(createCFURLFromBuffer(buffer.data(), buffer.length(), (CFURLRef)baseURL).leakRef());
}
+ (instancetype)_web_URLWithWTFString:(const String&)string
{
return urlWithWTFString(string);
}
+ (instancetype)_web_URLWithWTFString:(const String&)string relativeToURL:(NSURL *)baseURL
{
return urlWithWTFString(string, baseURL);
}
- (String)_web_originalDataAsWTFString
{
CString originalData;
......
......@@ -45,7 +45,7 @@ using namespace WebKit;
- (NSURL *)URL
{
return [NSURL _web_URLWithWTFString:_item->url() relativeToURL:nil];
return [NSURL _web_URLWithWTFString:_item->url()];
}
- (NSString *)title
......@@ -58,7 +58,7 @@ using namespace WebKit;
- (NSURL *)originalURL
{
return [NSURL _web_URLWithWTFString:_item->originalURL() relativeToURL:nil];
return [NSURL _web_URLWithWTFString:_item->originalURL()];
}
#pragma mark WKObject protocol implementation
......
......@@ -277,22 +277,22 @@ static void releaseNSData(unsigned char*, const void* data)
- (NSURL *)activeURL
{
return [NSURL _web_URLWithWTFString:_page->pageLoadState().activeURL() relativeToURL:nil];
return [NSURL _web_URLWithWTFString:_page->pageLoadState().activeURL()];
}
- (NSURL *)provisionalURL
{
return [NSURL _web_URLWithWTFString:_page->pageLoadState().provisionalURL() relativeToURL:nil];
return [NSURL _web_URLWithWTFString:_page->pageLoadState().provisionalURL()];
}
- (NSURL *)committedURL
{
return [NSURL _web_URLWithWTFString:_page->pageLoadState().url() relativeToURL:nil];
return [NSURL _web_URLWithWTFString:_page->pageLoadState().url()];
}
- (NSURL *)unreachableURL
{
return [NSURL _web_URLWithWTFString:_page->pageLoadState().unreachableURL() relativeToURL:nil];
return [NSURL _web_URLWithWTFString:_page->pageLoadState().unreachableURL()];
}
- (double)estimatedProgress
......@@ -506,7 +506,7 @@ static void setUpPagePolicyClient(WKBrowsingContextController *browsingContext,
if (originatingFrame) {
actionDictionary = [[actionDictionary mutableCopy] autorelease];
[(NSMutableDictionary *)actionDictionary setObject:[NSURL _web_URLWithWTFString:toImpl(originatingFrame)->url() relativeToURL:nil] forKey:WKActionOriginatingFrameURLKey];
[(NSMutableDictionary *)actionDictionary setObject:[NSURL _web_URLWithWTFString:toImpl(originatingFrame)->url()] forKey:WKActionOriginatingFrameURLKey];
}
[browsingContext.policyDelegate browsingContextController:browsingContext decidePolicyForNavigationAction:actionDictionary decisionHandler:makePolicyDecisionBlock(listener)];
......
......@@ -57,7 +57,7 @@ using namespace WebKit;
- (NSURL *)destinationURL
{
return [NSURL _web_URLWithWTFString:_data->url() relativeToURL:nil];
return [NSURL _web_URLWithWTFString:_data->url()];
}
- (NSURLResponse *)response
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment