Changeset 159016 in webkit
- Timestamp:
- Nov 9, 2013, 10:49:13 PM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r159004 r159016 1 2013-11-09 Dan Bernstein <mitz@apple.com> 2 3 Use createCFURLFromBuffer when converting a String to a CFURL 4 https://bugs.webkit.org/show_bug.cgi?id=124113 5 6 Reviewed by Anders Carlsson. 7 8 * Shared/API/c/cf/WKURLCF.mm: 9 (WKURLCopyCFURL): Replaced some code with a call to createCFURLFromBuffer(), which does the 10 same thing. 11 12 * Shared/Cocoa/WKNSURLExtras.h: Added. 13 * Shared/Cocoa/WKNSURLExtras.mm: Added. 14 (+[NSURL _web_URLWithWTFString:relativeToURL:]): Added. Returns nil for the null String, 15 otherwise returns the result of createCFURLFromBuffer(). 16 17 * UIProcess/API/Cocoa/WKBackForwardListItem.mm: 18 (-[WKBackForwardListItem URL]): Changed to use +_web_URLWithWTFString:relativeToURL:. 19 (-[WKBackForwardListItem originalURL]): Ditto. 20 21 * UIProcess/API/Cocoa/WKNavigationData.mm: 22 (-[WKNavigationData destinationURL]): Ditto. 23 24 * UIProcess/API/mac/WKBrowsingContextController.mm: 25 (-[WKBrowsingContextController unreachableURL]): Ditto. 26 27 * WebKit2.xcodeproj/project.pbxproj: Added references to new files. 28 1 29 2013-11-09 Anders Carlsson <andersca@apple.com> 2 30 -
trunk/Source/WebKit2/Shared/API/c/cf/WKURLCF.mm
r158456 r159016 31 31 #import <WebCore/CFURLExtras.h> 32 32 #import <objc/runtime.h> 33 #import <wtf/PassRefPtr.h>34 #import <wtf/RefPtr.h>35 33 #import <wtf/text/CString.h> 36 #import <wtf/text/WTFString.h>37 34 38 35 using namespace WebCore; … … 76 73 // UTF-8 which uses less memory and is what WebKit clients might expect. 77 74 78 // This pattern of using UTF-8 and then falling back to Latin1 on failure matches URL::createCFString with the79 // major differnce being that URL does not do a UTF-8 conversion and instead chops off the high bits of the UTF-1680 // character sequence.81 82 75 CString buffer = toImpl(URLRef)->string().utf8(); 83 CFURLRef result = CFURLCreateAbsoluteURLWithBytes(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(buffer.data()), buffer.length(), kCFStringEncodingUTF8, 0, true); 84 if (!result) 85 result = CFURLCreateAbsoluteURLWithBytes(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(buffer.data()), buffer.length(), kCFStringEncodingISOLatin1, 0, true); 86 return result; 76 return createCFURLFromBuffer(buffer.data(), buffer.length(), 0).leakRef(); 87 77 } -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBackForwardListItem.mm
r158324 r159016 29 29 #if WK_API_ENABLED 30 30 31 #import "W ebString.h"31 #import "WKNSURLExtras.h" 32 32 33 33 using namespace WebKit; … … 46 46 - (NSURL *)URL 47 47 { 48 if (!reinterpret_cast<WebBackForwardListItem*>(&_item)->url()) 49 return nil; 50 51 return [NSURL URLWithString:reinterpret_cast<WebBackForwardListItem*>(&_item)->url()]; 48 return [NSURL _web_URLWithWTFString:reinterpret_cast<WebBackForwardListItem*>(&_item)->url() relativeToURL:nil]; 52 49 } 53 50 … … 62 59 - (NSURL *)originalURL 63 60 { 64 if (!reinterpret_cast<WebBackForwardListItem*>(&_item)->originalURL()) 65 return nil; 66 67 return [NSURL URLWithString:reinterpret_cast<WebBackForwardListItem*>(&_item)->originalURL()]; 61 return [NSURL _web_URLWithWTFString:reinterpret_cast<WebBackForwardListItem*>(&_item)->originalURL() relativeToURL:nil]; 68 62 } 69 63 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationData.mm
r158779 r159016 29 29 #if WK_API_ENABLED 30 30 31 #import "WKNSURLExtras.h" 31 32 #import <WebCore/ResourceRequest.h> 32 33 #import <WebCore/ResourceResponse.h> … … 57 58 - (NSURL *)destinationURL 58 59 { 59 return [NSURL URLWithString:reinterpret_cast<WebNavigationData*>(&_data)->url()];60 return [NSURL _web_URLWithWTFString:reinterpret_cast<WebNavigationData*>(&_data)->url() relativeToURL:nil]; 60 61 } 61 62 -
trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm
r158949 r159016 34 34 #import "WKFramePolicyListener.h" 35 35 #import "WKNSArray.h" 36 #import "WKNSURLExtras.h" 36 37 #import "WKPagePrivate.h" 37 38 #import "WKRetainPtr.h" … … 333 334 - (NSURL *)unreachableURL 334 335 { 335 const String& unreachableURL = toImpl(_data->_pageRef.get())->unreachableURL(); 336 if (!unreachableURL) 337 return nil; 338 339 return !unreachableURL ? nil : [NSURL URLWithString:unreachableURL]; 336 return [NSURL _web_URLWithWTFString:toImpl(_data->_pageRef.get())->unreachableURL() relativeToURL:nil]; 340 337 } 341 338 -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r158971 r159016 408 408 370F34A51829BEA3009027C8 /* WKNavigationDataInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 370F34A41829BEA3009027C8 /* WKNavigationDataInternal.h */; }; 409 409 370F34A71829CFF3009027C8 /* WKBrowsingContextHistoryDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 370F34A61829CFF3009027C8 /* WKBrowsingContextHistoryDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 410 37183D56182F4E700080C811 /* WKNSURLExtras.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37183D54182F4E700080C811 /* WKNSURLExtras.mm */; }; 411 37183D57182F4E700080C811 /* WKNSURLExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 37183D55182F4E700080C811 /* WKNSURLExtras.h */; }; 410 412 371A19411824D29300F32A5E /* WKNSDictionary.mm in Sources */ = {isa = PBXBuildFile; fileRef = 371A193F1824D29300F32A5E /* WKNSDictionary.mm */; }; 411 413 371A19421824D29300F32A5E /* WKNSDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 371A19401824D29300F32A5E /* WKNSDictionary.h */; }; … … 1913 1915 370F34A41829BEA3009027C8 /* WKNavigationDataInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNavigationDataInternal.h; sourceTree = "<group>"; }; 1914 1916 370F34A61829CFF3009027C8 /* WKBrowsingContextHistoryDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBrowsingContextHistoryDelegate.h; sourceTree = "<group>"; }; 1917 37183D54182F4E700080C811 /* WKNSURLExtras.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKNSURLExtras.mm; sourceTree = "<group>"; }; 1918 37183D55182F4E700080C811 /* WKNSURLExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNSURLExtras.h; sourceTree = "<group>"; }; 1915 1919 371A193F1824D29300F32A5E /* WKNSDictionary.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKNSDictionary.mm; sourceTree = "<group>"; }; 1916 1920 371A19401824D29300F32A5E /* WKNSDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNSDictionary.h; sourceTree = "<group>"; }; … … 3718 3722 378E1A4C18208D700031007A /* WKNSURL.h */, 3719 3723 378E1A4B18208D700031007A /* WKNSURL.mm */, 3724 37183D55182F4E700080C811 /* WKNSURLExtras.h */, 3725 37183D54182F4E700080C811 /* WKNSURLExtras.mm */, 3720 3726 378E1A3F181EDA010031007A /* WKObject.h */, 3721 3727 374436871820E7240049579F /* WKObject.mm */, … … 5913 5919 51A555F6128C6C47009ABCEC /* WKContextMenuItem.h in Headers */, 5914 5920 51A55601128C6D92009ABCEC /* WKContextMenuItemTypes.h in Headers */, 5921 37183D57182F4E700080C811 /* WKNSURLExtras.h in Headers */, 5915 5922 BCC938E11180DE440085E5FE /* WKContextPrivate.h in Headers */, 5916 5923 9FB5F395169E6A80002C25BF /* WKContextPrivateMac.h in Headers */, … … 7007 7014 1AF05D8614688348008B1E81 /* TiledCoreAnimationDrawingAreaProxy.mm in Sources */, 7008 7015 1A64245F12DE29A100CAAE2C /* UpdateInfo.cpp in Sources */, 7016 37183D56182F4E700080C811 /* WKNSURLExtras.mm in Sources */, 7009 7017 374436881820E7240049579F /* WKObject.mm in Sources */, 7010 7018 1A0F29E3120B44420053D1B9 /* VisitedLinkProvider.cpp in Sources */,
Note:
See TracChangeset
for help on using the changeset viewer.