Changeset 204565 in webkit
- Timestamp:
- Aug 17, 2016 12:19:05 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r204557 r204565 1 2016-08-17 Dan Bernstein <mitz@apple.com> 2 3 [Cocoa] -[NSString isEqualToString:] returns NO for any WKNSString argument 4 https://bugs.webkit.org/show_bug.cgi?id=160938 5 <rdar://problem/27876652> 6 7 Reviewed by Anders Carlsson. 8 9 -[NSString isEqualToString:] calls an internal NSObject method on its argument, which 10 NSString subclasses override to return YES, but WKObject does not override and does not 11 forward to its target NSString. 12 13 To fix this issue and other similar issues, we make WKObject a root class instead of an 14 NSObject subclass. 15 16 Test: TestWebKitAPI/Tests/WebKit2Cocoa/WKObject.mm 17 18 * Platform/spi/Cocoa/objcSPI.h: Added. 19 20 * Shared/Cocoa/WKObject.h: Make WKObject a root class instead of inhereting from NSObject. 21 22 * Shared/Cocoa/WKObject.mm: 23 (+[WKObject class]): Return self. 24 (-[WKObject allowsWeakReference]): Added. Called by the Objective-C runtime. 25 (-[WKObject retainWeakReference]): Ditto. 26 (-[WKObject hash]): If we don’t have a target, return our address. 27 (-[WKObject superclass]): Implement this NSObject protocol method. 28 (-[WKObject class]): Ditto. 29 (-[WKObject self]): Ditto. 30 (-[WKObject performSelector:]): Ditto. 31 (-[WKObject performSelector:withObject:]): Ditto. 32 (-[WKObject performSelector:withObject:withObject:]): Ditto. 33 (-[WKObject isProxy]): Ditto. 34 (-[WKObject respondsToSelector:]): Changed to not call super. 35 (-[WKObject conformsToProtocol:]): Ditto. 36 (-[WKObject description]): Ditto. 37 (-[WKObject retain]): Implement this NSObject protocol method. 38 (-[WKObject release]): Ditto. 39 (-[WKObject autorelease]): Ditto. 40 (-[WKObject retainCount]): Ditto. 41 (-[WKObject zone]): Ditto. 42 (-[WKObject dealloc]): Deleted. 43 (-[WKObject classForCoder]): Deleted. 44 (-[WKObject classForKeyedArchiver]): Deleted. 45 (-[WKObject _cfTypeID]): Deleted. 46 47 * WebKit2.xcodeproj/project.pbxproj: Added reference to new file. 48 1 49 2016-08-17 Hunseop Jeong <hs85.jeong@samsung.com> 2 50 -
trunk/Source/WebKit2/Shared/Cocoa/WKObject.h
r180362 r204565 53 53 @end 54 54 55 @interface WKObject : NSObject <WKObject> 55 NS_ROOT_CLASS 56 @interface WKObject <WKObject> 56 57 57 58 - (NSObject *)_web_createTarget NS_RETURNS_RETAINED; -
trunk/Source/WebKit2/Shared/Cocoa/WKObject.mm
r204432 r204565 30 30 31 31 #import "APIObject.h" 32 33 @interface NSObject () 34 - (CFTypeID)_cfTypeID; 35 @end 32 #import "objcSPI.h" 33 #import <wtf/ObjcRuntimeExtras.h> 36 34 37 35 @implementation WKObject { 36 Class _isa; 38 37 BOOL _hasInitializedTarget; 39 38 NSObject *_target; 40 39 } 41 40 42 - (void)dealloc 43 { 44 static_cast<API::Object*>(object_getIndexedIvars(self))->~Object(); 45 [_target release]; 46 47 [super dealloc]; 41 + (Class)class 42 { 43 return self; 48 44 } 49 45 … … 57 53 } 58 54 55 // MARK: Methods used by the Objective-C runtime 56 57 - (id)forwardingTargetForSelector:(SEL)selector 58 { 59 initializeTargetIfNeeded(self); 60 61 return _target; 62 } 63 64 - (BOOL)allowsWeakReference 65 { 66 return !_objc_rootIsDeallocating(self); 67 } 68 69 - (BOOL)retainWeakReference 70 { 71 return _objc_rootTryRetain(self); 72 } 73 74 // MARK: NSObject protocol implementation 75 59 76 - (BOOL)isEqual:(id)object 60 77 { … … 74 91 initializeTargetIfNeeded(self); 75 92 76 return _target ? [_target hash] : [super hash]; 93 return _target ? [_target hash] : reinterpret_cast<NSUInteger>(self); 94 } 95 96 - (Class)superclass 97 { 98 initializeTargetIfNeeded(self); 99 100 return _target ? [_target superclass] : class_getSuperclass(object_getClass(self)); 101 } 102 103 - (Class)class 104 { 105 initializeTargetIfNeeded(self); 106 107 return _target ? [_target class] : object_getClass(self); 108 } 109 110 - (instancetype)self 111 { 112 return self; 113 } 114 115 - (id)performSelector:(SEL)selector 116 { 117 return selector ? wtfObjcMsgSend<id>(self, selector) : nil; 118 } 119 120 - (id)performSelector:(SEL)selector withObject:(id)object 121 { 122 return selector ? wtfObjcMsgSend<id>(self, selector, object) : nil; 123 } 124 125 - (id)performSelector:(SEL)selector withObject:(id)object1 withObject:(id)object2 126 { 127 return selector ? wtfObjcMsgSend<id>(self, selector, object1, object2) : nil; 128 } 129 130 - (BOOL)isProxy 131 { 132 return NO; 77 133 } 78 134 … … 95 151 initializeTargetIfNeeded(self); 96 152 97 return [_target respondsToSelector:selector] || [super respondsToSelector:selector];153 return [_target respondsToSelector:selector] || (selector && class_respondsToSelector(object_getClass(self), selector)); 98 154 } 99 155 … … 102 158 initializeTargetIfNeeded(self); 103 159 104 return [_target conformsToProtocol:protocol] || [super conformsToProtocol:protocol]; 105 } 106 107 - (id)forwardingTargetForSelector:(SEL)selector 108 { 109 initializeTargetIfNeeded(self); 110 111 return _target; 160 if ([_target conformsToProtocol:protocol]) 161 return YES; 162 163 if (!protocol) 164 return NO; 165 166 for (Class cls = object_getClass(self); cls; cls = class_getSuperclass(cls)) { 167 if (class_conformsToProtocol(cls, protocol)) 168 return YES; 169 } 170 171 return NO; 112 172 } 113 173 … … 116 176 initializeTargetIfNeeded(self); 117 177 118 return _target ? [_target description] : [super description]; 119 } 120 121 - (Class)classForCoder 122 { 123 initializeTargetIfNeeded(self); 124 125 return [_target classForCoder]; 126 } 127 128 - (Class)classForKeyedArchiver 129 { 130 initializeTargetIfNeeded(self); 131 132 return [_target classForKeyedArchiver]; 133 } 134 135 - (CFTypeID)_cfTypeID 136 { 137 return _target ? [_target _cfTypeID] : [super _cfTypeID]; 178 return _target ? [_target description] : [NSString stringWithFormat:@"<%s %p>", class_getName(object_getClass(self)), self]; 179 } 180 181 - (instancetype)retain 182 { 183 return _objc_rootRetain(self); 184 } 185 186 - (oneway void)release 187 { 188 if (_objc_rootReleaseWasZero(self)) { 189 static_cast<API::Object*>(object_getIndexedIvars(self))->~Object(); 190 [_target release]; 191 _objc_rootDealloc(self); 192 } 193 } 194 195 - (instancetype)autorelease 196 { 197 return _objc_rootAutorelease(self); 198 } 199 200 - (NSUInteger)retainCount 201 { 202 return _objc_rootRetainCount(self); 203 } 204 205 - (NSZone *)zone 206 { 207 return NSDefaultMallocZone(); 138 208 } 139 209 -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r204535 r204565 833 833 37B0D1851C1E499A00D40D64 /* SecItemShim.dylib in Copy Shims */ = {isa = PBXBuildFile; fileRef = 510031F61379CACB00C8DFE4 /* SecItemShim.dylib */; }; 834 834 37B0D1861C1E499A00D40D64 /* WebProcessShim.dylib in Copy Shims */ = {isa = PBXBuildFile; fileRef = CDC3830617211799008A2FC3 /* WebProcessShim.dylib */; }; 835 37B47E2D1D64DB76005F4EFF /* objcSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 37B47E2C1D64DB76005F4EFF /* objcSPI.h */; }; 835 836 37B5045219EEF31300CE2CF8 /* WKErrorPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 37B5045119EEF31300CE2CF8 /* WKErrorPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 836 837 37BEC4DD1948FC6A008B4286 /* WebCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1C79A100E7FC50078DEBC /* WebCore.framework */; }; … … 2871 2872 37A64E5618F38F4600EB30F1 /* _WKFormInputSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKFormInputSession.h; sourceTree = "<group>"; }; 2872 2873 37B418EB1C9624F20031E63B /* WebContent-OSX.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "WebContent-OSX.entitlements"; sourceTree = "<group>"; }; 2874 37B47E2C1D64DB76005F4EFF /* objcSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = objcSPI.h; sourceTree = "<group>"; }; 2873 2875 37B5045119EEF31300CE2CF8 /* WKErrorPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKErrorPrivate.h; sourceTree = "<group>"; }; 2874 2876 37BEC4DE19491486008B4286 /* CompletionHandlerCallChecker.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CompletionHandlerCallChecker.mm; sourceTree = "<group>"; }; … … 5116 5118 1A5705101BE410E500874AF1 /* BlockSPI.h */, 5117 5119 3754D5441B3A29FD003A4C7F /* NSInvocationSPI.h */, 5120 37B47E2C1D64DB76005F4EFF /* objcSPI.h */, 5118 5121 ); 5119 5122 path = Cocoa; … … 7823 7826 1A0F29E4120B44420053D1B9 /* VisitedLinkStore.h in Headers */, 7824 7827 1A60224D18C16B9F00C3E8C9 /* VisitedLinkStoreMessages.h in Headers */, 7828 37B47E2D1D64DB76005F4EFF /* objcSPI.h in Headers */, 7825 7829 1A0F29CC120B37160053D1B9 /* VisitedLinkTable.h in Headers */, 7826 7830 1AF4CEF018BC481800BC2D34 /* VisitedLinkTableController.h in Headers */, -
trunk/Tools/ChangeLog
r204563 r204565 1 2016-08-17 Dan Bernstein <mitz@apple.com> 2 3 [Cocoa] -[NSString isEqualToString:] returns NO for any WKNSString argument 4 https://bugs.webkit.org/show_bug.cgi?id=160938 5 <rdar://problem/27876652> 6 7 Reviewed by Anders Carlsson. 8 9 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 10 * TestWebKitAPI/Tests/WebKit2Cocoa/WKObject.mm: Added. 11 (TestWebKitAPI::TEST): 12 1 13 2016-08-17 Chris Fleizach <cfleizach@apple.com> 2 14 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r204529 r204565 71 71 378E64791632707400B6C676 /* link-with-title.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 378E647816326FDF00B6C676 /* link-with-title.html */; }; 72 72 379028B914FAC24C007E6B43 /* acceptsFirstMouse.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 379028B814FABE49007E6B43 /* acceptsFirstMouse.html */; }; 73 37B47E301D64E7CA005F4EFF /* WKObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37B47E2E1D64E7CA005F4EFF /* WKObject.mm */; }; 73 74 37BCA61C1B596BA9002012CA /* ShouldOpenExternalURLsInNewWindowActions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37BCA61B1B596BA9002012CA /* ShouldOpenExternalURLsInNewWindowActions.mm */; }; 74 75 37D36ED71AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37D36ED61AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm */; }; … … 751 752 3799AD3914120A43005EB0C6 /* StringByEvaluatingJavaScriptFromString.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringByEvaluatingJavaScriptFromString.mm; sourceTree = "<group>"; }; 752 753 37A6895D148A9B50005100FA /* SubresourceErrorCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SubresourceErrorCrash.mm; sourceTree = "<group>"; }; 754 37B47E2E1D64E7CA005F4EFF /* WKObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKObject.mm; sourceTree = "<group>"; }; 753 755 37BCA61B1B596BA9002012CA /* ShouldOpenExternalURLsInNewWindowActions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ShouldOpenExternalURLsInNewWindowActions.mm; sourceTree = "<group>"; }; 754 756 37C784DE197C8F2E0010A496 /* RenderedImageFromDOMNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RenderedImageFromDOMNode.mm; sourceTree = "<group>"; }; … … 1298 1300 51714EB61CF8C7A4004723C4 /* WebProcessKillIDBCleanup.mm */, 1299 1301 1F83571A1D3FFB0E00E3967B /* WKBackForwardList.mm */, 1302 37B47E2E1D64E7CA005F4EFF /* WKObject.mm */, 1300 1303 2D00065D1C1F58940088E6A7 /* WKPDFViewResizeCrash.mm */, 1301 1304 5E4B1D2C1D404C6100053621 /* WKScrollViewDelegateCrash.mm */, … … 2214 2217 7C83E0BC1D0A650700FEBCF3 /* FixedLayoutSize.mm in Sources */, 2215 2218 7CCE7EF51A411AE600447C4C /* ForceRepaint.cpp in Sources */, 2219 37B47E301D64E7CA005F4EFF /* WKObject.mm in Sources */, 2216 2220 7CCE7EC01A411A7E00447C4C /* FragmentNavigation.mm in Sources */, 2217 2221 7CCE7EF61A411AE600447C4C /* FrameMIMETypeHTML.cpp in Sources */,
Note: See TracChangeset
for help on using the changeset viewer.