Changeset 134681 in webkit
- Timestamp:
- Nov 14, 2012 3:29:37 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 10 added
- 21 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r134676 r134681 1 2012-11-08 Andy Estes <aestes@apple.com> 2 3 [WebKit2] Need API in UIProcess to enable loading of custom protocols 4 https://bugs.webkit.org/show_bug.cgi?id=101674 5 6 Reviewed by Brady Eidson. 7 8 Enable clients of WebKit2 to implement NSURLProtocol subclasses to 9 control the loading of resources with schemes that WebKit2 cannot 10 handle natively. Since loading happens in a different process, we 11 accomplish this by registering a global NSURLProtocol in the web 12 process and proxying NSURLProtocol and NSURLProtocolClient calls to 13 the client's NSURLProtocol in the UI process. 14 15 * DerivedSources.make: Addded new .messages.in files. 16 * Platform/CoreIPC/MessageID.h: 17 * Shared/WebProcessCreationParameters.cpp: Added the list of supported schemes. 18 (WebKit::WebProcessCreationParameters::encode): 19 (WebKit::WebProcessCreationParameters::decode): 20 * Shared/WebProcessCreationParameters.h: 21 * UIProcess/API/mac/WKBrowsingContextController.h: 22 * UIProcess/API/mac/WKBrowsingContextController.mm: 23 (+[WKBrowsingContextController registerSchemeForCustomProtocol:]): 24 Added a class method where a client can register a scheme that it supports. 25 (+[WKBrowsingContextController unregisterSchemeForCustomProtocol:]): 26 Added a class method where a client can unregister a scheme that it no longer supports. 27 (+[WKBrowsingContextController customSchemes]): 28 * UIProcess/API/mac/WKBrowsingContextControllerInternal.h: 29 * UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h: Added. 30 * UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.messages.in: Added. 31 * UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm: Added. 32 33 Implemented an NSURLConnectionDelegate that proxies messages to the 34 equivalent NSURLProtocolClient in the web process: 35 (-[WKCustomProtocolLoader initWithCustomProtocolManagerProxy:customProtocolID:request:connection:]): 36 (-[WKCustomProtocolLoader dealloc]): 37 (-[WKCustomProtocolLoader connection:didFailWithError:]): 38 (-[WKCustomProtocolLoader connection:willCacheResponse:]): 39 (-[WKCustomProtocolLoader connection:didReceiveResponse:]): 40 (-[WKCustomProtocolLoader connection:didReceiveData:]): 41 (-[WKCustomProtocolLoader connection:willSendRequest:redirectResponse:]): 42 (-[WKCustomProtocolLoader connectionDidFinishLoading:]): 43 44 Implemented a proxy that recieves -startLoading and -stopLoading 45 messages from the NSURLProtocol in the web process and starts an 46 NSURLConnection in the UI process, which will instantiate the client's NSURLProtocol: 47 (WebKit::CustomProtocolManagerProxy::CustomProtocolManagerProxy): 48 (WebKit::CustomProtocolManagerProxy::didReceiveMessage): 49 (WebKit::CustomProtocolManagerProxy::startLoading): 50 (WebKit::CustomProtocolManagerProxy::stopLoading): 51 52 * UIProcess/WebContext.h: Declared strings that store names of 53 NSNotifications used for scheme registration in the UI process. 54 * UIProcess/WebProcessProxy.cpp: 55 (WebKit::WebProcessProxy::WebProcessProxy): 56 (WebKit::WebProcessProxy::didReceiveMessage): Forwarded messages to the 57 CustomProtocolManagerProxy. 58 * UIProcess/WebProcessProxy.h: 59 * UIProcess/mac/WebContextMac.mm: 60 (WebKit::WebContext::platformInitializeWebProcess): Added the currently 61 registered schemes to the WebProcessCreationParameters and register 62 NSNotification observers for new scheme registration that forwards to 63 the context's web processes. 64 * WebKit2.xcodeproj/project.pbxproj: 65 * WebKit2Prefix.h: Enabled the CUSTOM_PROTOCOLS macro for the Mac. 66 * WebProcess/Network/CustomProtocols/CustomProtocolManager.h: Added. 67 * WebProcess/Network/CustomProtocols/CustomProtocolManager.messages.in: Added. 68 * WebProcess/Network/CustomProtocols/mac/CustomProtocolManagerMac.mm: Added. 69 (generateCustomProtocolID): Generate a per-WebProcess unique ID. 70 71 Implemented a global NSURLProtocol that claims to support all schemes 72 registered in the UI process. When NSURLConnection calls -startLoading 73 and -stopLoading, we forward these messages to the client's NSURLProtocol 74 in the UI process: 75 (+[WKCustomProtocol canInitWithRequest:]): 76 (+[WKCustomProtocol canonicalRequestForRequest:]): 77 (+[WKCustomProtocol requestIsCacheEquivalent:toRequest:]): 78 (-[WKCustomProtocol initWithRequest:cachedResponse:client:]): 79 (-[WKCustomProtocol startLoading]): 80 (-[WKCustomProtocol stopLoading]): 81 82 Implemented a manager that receives NSURLConnectionDelegate messages 83 forwarded from the UI process and passes them to the global NSURLProtocol's NSURLProtocolClient: 84 (WebKit::CustomProtocolManager::shared): 85 (WebKit::CustomProtocolManager::registerCustomProtocolClass): 86 (WebKit::CustomProtocolManager::addCustomProtocol): 87 (WebKit::CustomProtocolManager::removeCustomProtocol): 88 (WebKit::CustomProtocolManager::registerScheme): 89 (WebKit::CustomProtocolManager::unregisterScheme): 90 (WebKit::CustomProtocolManager::supportsScheme): 91 (WebKit::CustomProtocolManager::didReceiveMessage): 92 (WebKit::CustomProtocolManager::didFailWithError): 93 (WebKit::CustomProtocolManager::didLoadData): 94 (WebKit::CustomProtocolManager::didReceiveResponse): 95 (WebKit::CustomProtocolManager::didFinishLoading): 96 (WebKit::CustomProtocolManager::protocolForID): 97 98 * WebProcess/WebProcess.cpp: 99 (WebKit::WebProcess::didReceiveMessage): Forwarded messages to the 100 shared CustomProtocolManager. 101 (WebKit::WebProcess::registerSchemeForCustomProtocol): Register a 102 scheme received from the UI process. 103 (WebKit::WebProcess::unregisterSchemeForCustomProtocol): Unregister a 104 scheme received from the UI process. 105 * WebProcess/WebProcess.h: 106 * WebProcess/WebProcess.messages.in: Declared messages for passing 107 supported schemes from the UI process the web process. 108 * WebProcess/mac/WebProcessMac.mm: 109 (WebKit::WebProcess::platformInitializeWebProcess): Register the 110 schemes contained in the WebProcessCreationParameters. 111 1 112 2012-11-14 Helder Correia <helder.correia@nokia.com> 2 113 -
trunk/Source/WebKit2/DerivedSources.make
r134324 r134681 38 38 $(WebKit2)/WebProcess/MediaCache \ 39 39 $(WebKit2)/WebProcess/Network \ 40 $(WebKit2)/WebProcess/Network/CustomProtocols \ 40 41 $(WebKit2)/WebProcess/Notifications \ 41 42 $(WebKit2)/WebProcess/Plugins \ … … 47 48 $(WebKit2)/UIProcess/Downloads \ 48 49 $(WebKit2)/UIProcess/Network \ 50 $(WebKit2)/UIProcess/Network/CustomProtocols \ 49 51 $(WebKit2)/UIProcess/Notifications \ 50 52 $(WebKit2)/UIProcess/Plugins \ … … 55 57 MESSAGE_RECEIVERS = \ 56 58 AuthenticationManager \ 59 CustomProtocolManager \ 60 CustomProtocolManagerProxy \ 57 61 DrawingArea \ 58 62 DrawingAreaProxy \ -
trunk/Source/WebKit2/Platform/CoreIPC/MessageID.h
r134324 r134681 127 127 // Messages sent by the shared worker process to the UI process. 128 128 MessageClassSharedWorkerProcessProxy, 129 130 #if ENABLE(CUSTOM_PROTOCOLS) 131 // Messages sent by the UI process to a web process (soon the network process). 132 MessageClassCustomProtocolManager, 133 134 // Messages sent by a web process (soon the network process) to the UI process. 135 MessageClassCustomProtocolManagerProxy, 136 #endif 129 137 }; 130 138 -
trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp
r133410 r134681 74 74 encoder << urlSchemesRegisteredAsDisplayIsolated; 75 75 encoder << urlSchemesRegisteredAsCORSEnabled; 76 #if ENABLE(CUSTOM_PROTOCOLS) 77 encoder << urlSchemesRegisteredForCustomProtocols; 78 #endif 76 79 encoder.encodeEnum(cacheModel); 77 80 encoder << shouldTrackVisitedLinks; … … 159 162 if (!decoder->decode(parameters.urlSchemesRegisteredAsCORSEnabled)) 160 163 return false; 164 #if ENABLE(CUSTOM_PROTOCOLS) 165 if (!decoder->decode(parameters.urlSchemesRegisteredForCustomProtocols)) 166 return false; 167 #endif 161 168 if (!decoder->decodeEnum(parameters.cacheModel)) 162 169 return false; -
trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h
r133410 r134681 73 73 Vector<String> urlSchemesRegisteredAsDisplayIsolated; 74 74 Vector<String> urlSchemesRegisteredAsCORSEnabled; 75 #if ENABLE(CUSTOM_PROTOCOLS) 76 Vector<String> urlSchemesRegisteredForCustomProtocols; 77 #endif 75 78 76 79 CacheModel cacheModel; -
trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.h
r124121 r134681 42 42 43 43 #pragma mark Loading 44 45 + (void)registerSchemeForCustomProtocol:(NSString *)scheme; 46 + (void)unregisterSchemeForCustomProtocol:(NSString *)scheme; 44 47 45 48 /* Load a request. This is only valid for requests of non-file: URLs. Passing a -
trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm
r124121 r134681 37 37 #import "WKURLRequest.h" 38 38 #import "WKURLRequestNS.h" 39 #import "WebContext.h" 39 40 #import <wtf/RetainPtr.h> 40 41 … … 103 104 104 105 #pragma mark Loading 106 107 + (void)registerSchemeForCustomProtocol:(NSString *)scheme 108 { 109 NSString *lowercaseScheme = [scheme lowercaseString]; 110 [[WKBrowsingContextController customSchemes] addObject:lowercaseScheme]; 111 [[NSNotificationCenter defaultCenter] postNotificationName:WebKit::SchemeForCustomProtocolRegisteredNotificationName object:lowercaseScheme]; 112 } 113 114 + (void)unregisterSchemeForCustomProtocol:(NSString *)scheme 115 { 116 NSString *lowercaseScheme = [scheme lowercaseString]; 117 [[WKBrowsingContextController customSchemes] removeObject:lowercaseScheme]; 118 [[NSNotificationCenter defaultCenter] postNotificationName:WebKit::SchemeForCustomProtocolUnregisteredNotificationName object:lowercaseScheme]; 119 } 105 120 106 121 - (void)loadRequest:(NSURLRequest *)request … … 404 419 } 405 420 406 @end 421 + (NSMutableSet *)customSchemes 422 { 423 static NSMutableSet *customSchemes = [[NSMutableSet alloc] init]; 424 return customSchemes; 425 } 426 427 @end -
trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerInternal.h
r102633 r134681 30 30 /* This should only be called from associate view. */ 31 31 - (id)_initWithPageRef:(WKPageRef)pageRef; 32 + (NSMutableSet *)customSchemes; 32 33 33 34 @end -
trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h
r134679 r134681 1 1 /* 2 * Copyright (C) 201 1Apple Inc. All rights reserved.2 * Copyright (C) 2012 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #import <WebKit2/WKBrowsingContextController.h> 26 #ifndef CustomProtocolManagerProxy_h 27 #define CustomProtocolManagerProxy_h 27 28 28 @interface WKBrowsingContextController (Internal)29 #if ENABLE(CUSTOM_PROTOCOLS) 29 30 30 /* This should only be called from associate view. */ 31 - (id)_initWithPageRef:(WKPageRef)pageRef; 31 #include "MessageID.h" 32 32 33 @end 33 #if PLATFORM(MAC) 34 #include <wtf/HashMap.h> 35 #include <wtf/RetainPtr.h> 36 OBJC_CLASS WKCustomProtocolLoader; 37 #endif 38 39 namespace CoreIPC { 40 class Connection; 41 class MessageDecoder; 42 } // namespace CoreIPC 43 44 namespace WebCore { 45 class ResourceRequest; 46 } // namespace WebCore 47 48 namespace WebKit { 49 50 class WebProcessProxy; 51 52 class CustomProtocolManagerProxy { 53 public: 54 explicit CustomProtocolManagerProxy(WebProcessProxy*); 55 56 void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); 57 void startLoading(uint64_t customProtocolID, const WebCore::ResourceRequest&); 58 void stopLoading(uint64_t customProtocolID); 59 60 private: 61 void didReceiveCustomProtocolManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); 62 63 WebProcessProxy* m_webProcessProxy; 64 65 #if PLATFORM(MAC) 66 typedef HashMap<uint64_t, RetainPtr<WKCustomProtocolLoader> > LoaderMap; 67 LoaderMap m_loaderMap; 68 #endif 69 }; 70 71 } // namespace WebKit 72 73 #endif // ENABLE(CUSTOM_PROTOCOLS) 74 75 #endif // CustomProtocolManagerProxy_h -
trunk/Source/WebKit2/UIProcess/WebContext.h
r133828 r134681 75 75 typedef GenericCallback<WKDictionaryRef> DictionaryCallback; 76 76 77 #if PLATFORM(MAC) 78 extern NSString *SchemeForCustomProtocolRegisteredNotificationName; 79 extern NSString *SchemeForCustomProtocolUnregisteredNotificationName; 80 #endif 81 77 82 class WebContext : public APIObject, private CoreIPC::MessageReceiver { 78 83 public: … … 382 387 #if PLATFORM(MAC) 383 388 RetainPtr<CFTypeRef> m_enhancedAccessibilityObserver; 389 RetainPtr<CFTypeRef> m_customSchemeRegisteredObserver; 390 RetainPtr<CFTypeRef> m_customSchemeUnregisteredObserver; 384 391 #endif 385 392 -
trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp
r134324 r134681 94 94 , m_context(context) 95 95 , m_mayHaveUniversalFileReadSandboxExtension(false) 96 #if ENABLE(CUSTOM_PROTOCOLS) 97 , m_customProtocolManagerProxy(this) 98 #endif 96 99 { 97 100 connect(); … … 437 440 } 438 441 442 #if ENABLE(CUSTOM_PROTOCOLS) 443 if (messageID.is<CoreIPC::MessageClassCustomProtocolManagerProxy>()) { 444 m_customProtocolManagerProxy.didReceiveMessage(connection, messageID, decoder); 445 return; 446 } 447 #endif 448 439 449 uint64_t pageID = decoder.destinationID(); 440 450 if (!pageID) -
trunk/Source/WebKit2/UIProcess/WebProcessProxy.h
r134324 r134681 41 41 #include <wtf/RefCounted.h> 42 42 43 #if ENABLE(CUSTOM_PROTOCOLS) 44 #include "CustomProtocolManagerProxy.h" 45 #endif 46 43 47 namespace WebCore { 44 48 class KURL; … … 220 224 WebFrameProxyMap m_frameMap; 221 225 WebBackForwardListItemMap m_backForwardListItemMap; 226 227 #if ENABLE(CUSTOM_PROTOCOLS) 228 CustomProtocolManagerProxy m_customProtocolManagerProxy; 229 #endif 222 230 }; 223 231 -
trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm
r133699 r134681 30 30 #import "PluginProcessManager.h" 31 31 #import "SharedWorkerProcessManager.h" 32 #import "WKBrowsingContextControllerInternal.h" 32 33 #import "WebKitSystemInterface.h" 33 34 #import "WebProcessCreationParameters.h" … … 57 58 namespace WebKit { 58 59 60 NSString *SchemeForCustomProtocolRegisteredNotificationName = @"WebKitSchemeForCustomProtocolRegisteredNotification"; 61 NSString *SchemeForCustomProtocolUnregisteredNotificationName = @"WebKitSchemeForCustomProtocolUnregisteredNotification"; 62 59 63 bool WebContext::s_applicationIsOccluded = false; 60 64 … … 124 128 125 129 parameters.uiProcessBundleIdentifier = String([[NSBundle mainBundle] bundleIdentifier]); 130 131 NSArray *schemes = [[WKBrowsingContextController customSchemes] allObjects]; 132 for (size_t i = 0; i < [schemes count]; ++i) 133 parameters.urlSchemesRegisteredForCustomProtocols.append([schemes objectAtIndex:i]); 134 135 m_customSchemeRegisteredObserver = [[NSNotificationCenter defaultCenter] addObserverForName:WebKit::SchemeForCustomProtocolRegisteredNotificationName object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *notification) { 136 NSString *scheme = [notification object]; 137 ASSERT([scheme isKindOfClass:[NSString class]]); 138 sendToAllProcesses(Messages::WebProcess::RegisterSchemeForCustomProtocol(scheme)); 139 }]; 140 141 m_customSchemeUnregisteredObserver = [[NSNotificationCenter defaultCenter] addObserverForName:WebKit::SchemeForCustomProtocolUnregisteredNotificationName object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *notification) { 142 NSString *scheme = [notification object]; 143 ASSERT([scheme isKindOfClass:[NSString class]]); 144 sendToAllProcesses(Messages::WebProcess::UnregisterSchemeForCustomProtocol(scheme)); 145 }]; 126 146 127 147 // Listen for enhanced accessibility changes and propagate them to the WebProcess. -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r134640 r134681 281 281 296BD85D15019BC30071F424 /* StringUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 296BD85B15019BC30071F424 /* StringUtilities.h */; }; 282 282 296BD85E15019BC30071F424 /* StringUtilities.mm in Sources */ = {isa = PBXBuildFile; fileRef = 296BD85C15019BC30071F424 /* StringUtilities.mm */; }; 283 2984F57C164B915F004BC0C6 /* CustomProtocolManagerProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2984F57A164B915F004BC0C6 /* CustomProtocolManagerProxyMessageReceiver.cpp */; }; 284 2984F57D164B915F004BC0C6 /* CustomProtocolManagerProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 2984F57B164B915F004BC0C6 /* CustomProtocolManagerProxyMessages.h */; }; 285 2984F581164B9BBD004BC0C6 /* CustomProtocolManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 2984F580164B9BBD004BC0C6 /* CustomProtocolManager.h */; }; 286 2984F583164B9BD9004BC0C6 /* CustomProtocolManagerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2984F582164B9BD9004BC0C6 /* CustomProtocolManagerMac.mm */; }; 287 2984F588164BA095004BC0C6 /* CustomProtocolManagerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2984F586164BA095004BC0C6 /* CustomProtocolManagerMessageReceiver.cpp */; }; 288 2984F589164BA095004BC0C6 /* CustomProtocolManagerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 2984F587164BA095004BC0C6 /* CustomProtocolManagerMessages.h */; }; 289 29AD3093164B4C5D0072DEA9 /* CustomProtocolManagerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 29AD3092164B4C5D0072DEA9 /* CustomProtocolManagerProxy.h */; }; 290 29AD3096164B4C930072DEA9 /* CustomProtocolManagerProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29AD3095164B4C930072DEA9 /* CustomProtocolManagerProxyMac.mm */; }; 283 291 29CD55AA128E294F00133C85 /* WKAccessibilityWebPageObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 29CD55A8128E294F00133C85 /* WKAccessibilityWebPageObject.h */; }; 284 292 29CD55AB128E294F00133C85 /* WKAccessibilityWebPageObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29CD55A9128E294F00133C85 /* WKAccessibilityWebPageObject.mm */; }; … … 1482 1490 296BD85B15019BC30071F424 /* StringUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringUtilities.h; sourceTree = "<group>"; }; 1483 1491 296BD85C15019BC30071F424 /* StringUtilities.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringUtilities.mm; sourceTree = "<group>"; }; 1492 2984F57A164B915F004BC0C6 /* CustomProtocolManagerProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CustomProtocolManagerProxyMessageReceiver.cpp; sourceTree = "<group>"; }; 1493 2984F57B164B915F004BC0C6 /* CustomProtocolManagerProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomProtocolManagerProxyMessages.h; sourceTree = "<group>"; }; 1494 2984F580164B9BBD004BC0C6 /* CustomProtocolManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CustomProtocolManager.h; path = Network/CustomProtocols/CustomProtocolManager.h; sourceTree = "<group>"; }; 1495 2984F582164B9BD9004BC0C6 /* CustomProtocolManagerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CustomProtocolManagerMac.mm; path = Network/CustomProtocols/mac/CustomProtocolManagerMac.mm; sourceTree = "<group>"; }; 1496 2984F584164B9ED9004BC0C6 /* CustomProtocolManager.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CustomProtocolManager.messages.in; path = Network/CustomProtocols/CustomProtocolManager.messages.in; sourceTree = "<group>"; }; 1497 2984F586164BA095004BC0C6 /* CustomProtocolManagerMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CustomProtocolManagerMessageReceiver.cpp; path = CustomProtocolManagerMessageReceiver.cpp; sourceTree = "<group>"; }; 1498 2984F587164BA095004BC0C6 /* CustomProtocolManagerMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CustomProtocolManagerMessages.h; path = CustomProtocolManagerMessages.h; sourceTree = "<group>"; }; 1499 29AD3092164B4C5D0072DEA9 /* CustomProtocolManagerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CustomProtocolManagerProxy.h; path = CustomProtocols/CustomProtocolManagerProxy.h; sourceTree = "<group>"; }; 1500 29AD3095164B4C930072DEA9 /* CustomProtocolManagerProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CustomProtocolManagerProxyMac.mm; path = CustomProtocols/mac/CustomProtocolManagerProxyMac.mm; sourceTree = "<group>"; }; 1501 29AD3097164B4E210072DEA9 /* CustomProtocolManagerProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CustomProtocolManagerProxy.messages.in; path = CustomProtocols/CustomProtocolManagerProxy.messages.in; sourceTree = "<group>"; }; 1484 1502 29CD55A8128E294F00133C85 /* WKAccessibilityWebPageObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKAccessibilityWebPageObject.h; sourceTree = "<group>"; }; 1485 1503 29CD55A9128E294F00133C85 /* WKAccessibilityWebPageObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKAccessibilityWebPageObject.mm; sourceTree = "<group>"; }; … … 2968 2986 sourceTree = "<group>"; 2969 2987 }; 2988 2984F57E164B9B56004BC0C6 /* CustomProtocols */ = { 2989 isa = PBXGroup; 2990 children = ( 2991 2984F57F164B9B5D004BC0C6 /* mac */, 2992 2984F580164B9BBD004BC0C6 /* CustomProtocolManager.h */, 2993 2984F584164B9ED9004BC0C6 /* CustomProtocolManager.messages.in */, 2994 ); 2995 name = CustomProtocols; 2996 sourceTree = "<group>"; 2997 }; 2998 2984F57F164B9B5D004BC0C6 /* mac */ = { 2999 isa = PBXGroup; 3000 children = ( 3001 2984F582164B9BD9004BC0C6 /* CustomProtocolManagerMac.mm */, 3002 ); 3003 name = mac; 3004 sourceTree = "<group>"; 3005 }; 3006 29AD3091164B4C100072DEA9 /* CustomProtocols */ = { 3007 isa = PBXGroup; 3008 children = ( 3009 29AD3094164B4C830072DEA9 /* mac */, 3010 29AD3092164B4C5D0072DEA9 /* CustomProtocolManagerProxy.h */, 3011 29AD3097164B4E210072DEA9 /* CustomProtocolManagerProxy.messages.in */, 3012 ); 3013 name = CustomProtocols; 3014 sourceTree = "<group>"; 3015 }; 3016 29AD3094164B4C830072DEA9 /* mac */ = { 3017 isa = PBXGroup; 3018 children = ( 3019 29AD3095164B4C930072DEA9 /* CustomProtocolManagerProxyMac.mm */, 3020 ); 3021 name = mac; 3022 sourceTree = "<group>"; 3023 }; 2970 3024 31099974146C8AA80029DEB9 /* Notifications (User) */ = { 2971 3025 isa = PBXGroup; … … 3052 3106 isa = PBXGroup; 3053 3107 children = ( 3108 2984F57E164B9B56004BC0C6 /* CustomProtocols */, 3054 3109 5105B0D4162F7A7A00E27709 /* NetworkProcessConnection.cpp */, 3055 3110 5105B0D5162F7A7A00E27709 /* NetworkProcessConnection.h */, … … 3100 3155 isa = PBXGroup; 3101 3156 children = ( 3157 29AD3091164B4C100072DEA9 /* CustomProtocols */, 3102 3158 516319931628980E00E22F00 /* mac */, 3103 3159 5105B0DB162F7E9D00E27709 /* NetworkProcessManager.cpp */, … … 4176 4232 512F58A012A883AD00629530 /* AuthenticationManagerMessageReceiver.cpp */, 4177 4233 512F58A112A883AD00629530 /* AuthenticationManagerMessages.h */, 4234 2984F586164BA095004BC0C6 /* CustomProtocolManagerMessageReceiver.cpp */, 4235 2984F587164BA095004BC0C6 /* CustomProtocolManagerMessages.h */, 4236 2984F57A164B915F004BC0C6 /* CustomProtocolManagerProxyMessageReceiver.cpp */, 4237 2984F57B164B915F004BC0C6 /* CustomProtocolManagerProxyMessages.h */, 4178 4238 E1967E35150AB5D500C73169 /* com.apple.WebKit.PluginProcess.sb */, 4179 4239 E1967E37150AB5E200C73169 /* com.apple.WebProcess.sb */, … … 4916 4976 51CBBA10165219B6005BE8FD /* NetworkResourceLoadParameters.h in Headers */, 4917 4977 510AFFBA16542048001BA05E /* WebResourceLoader.h in Headers */, 4978 29AD3093164B4C5D0072DEA9 /* CustomProtocolManagerProxy.h in Headers */, 4979 2984F57D164B915F004BC0C6 /* CustomProtocolManagerProxyMessages.h in Headers */, 4980 2984F581164B9BBD004BC0C6 /* CustomProtocolManager.h in Headers */, 4981 2984F589164BA095004BC0C6 /* CustomProtocolManagerMessages.h in Headers */, 4918 4982 ); 4919 4983 runOnlyForDeploymentPostprocessing = 0; … … 5863 5927 51CBBA0F165219B6005BE8FD /* NetworkResourceLoadParameters.cpp in Sources */, 5864 5928 510AFFB916542048001BA05E /* WebResourceLoader.cpp in Sources */, 5929 29AD3096164B4C930072DEA9 /* CustomProtocolManagerProxyMac.mm in Sources */, 5930 2984F57C164B915F004BC0C6 /* CustomProtocolManagerProxyMessageReceiver.cpp in Sources */, 5931 2984F583164B9BD9004BC0C6 /* CustomProtocolManagerMac.mm in Sources */, 5932 2984F588164BA095004BC0C6 /* CustomProtocolManagerMessageReceiver.cpp in Sources */, 5865 5933 ); 5866 5934 runOnlyForDeploymentPostprocessing = 0; -
trunk/Source/WebKit2/WebKit2Prefix.h
r132974 r134681 45 45 #define ENABLE_MEMORY_SAMPLER 1 46 46 47 #define ENABLE_CUSTOM_PROTOCOLS 1 48 47 49 #include <CoreFoundation/CoreFoundation.h> 48 50 #include <CoreGraphics/CoreGraphics.h> -
trunk/Source/WebKit2/WebProcess/WebProcess.cpp
r133410 r134681 99 99 #endif 100 100 101 #if ENABLE(CUSTOM_PROTOCOLS) 102 #include "CustomProtocolManager.h" 103 #endif 104 101 105 using namespace JSC; 102 106 using namespace WebCore; … … 708 712 } 709 713 714 #if ENABLE(CUSTOM_PROTOCOLS) 715 if (messageID.is<CoreIPC::MessageClassCustomProtocolManager>()) { 716 CustomProtocolManager::shared().didReceiveMessage(connection, messageID, decoder); 717 return; 718 } 719 #endif 720 710 721 if (messageID.is<CoreIPC::MessageClassWebPageGroupProxy>()) { 711 722 uint64_t pageGroupID = decoder.destinationID(); … … 1140 1151 #endif // ENABLE(PLUGIN_PROCESS) 1141 1152 1153 #if ENABLE(CUSTOM_PROTOCOLS) 1154 void WebProcess::registerSchemeForCustomProtocol(const WTF::String& scheme) 1155 { 1156 CustomProtocolManager::shared().registerScheme(scheme); 1157 } 1158 1159 void WebProcess::unregisterSchemeForCustomProtocol(const WTF::String& scheme) 1160 { 1161 CustomProtocolManager::shared().unregisterScheme(scheme); 1162 } 1163 #endif 1164 1142 1165 } // namespace WebKit -
trunk/Source/WebKit2/WebProcess/WebProcess.h
r133045 r134681 305 305 #endif 306 306 307 #if ENABLE(CUSTOM_PROTOCOLS) 308 void registerSchemeForCustomProtocol(const WTF::String&); 309 void unregisterSchemeForCustomProtocol(const WTF::String&); 310 #endif 311 307 312 RefPtr<WebConnectionToUIProcess> m_connection; 308 313 CoreIPC::MessageReceiverMap m_messageReceiverMap; -
trunk/Source/WebKit2/WebProcess/WebProcess.messages.in
r133699 r134681 102 102 SetApplicationIsOccluded(bool flag); 103 103 #endif 104 105 #if ENABLE(CUSTOM_PROTOCOLS) 106 RegisterSchemeForCustomProtocol(WTF::String name) 107 UnregisterSchemeForCustomProtocol(WTF::String name) 108 #endif 104 109 } -
trunk/Source/WebKit2/WebProcess/mac/WebProcessMac.mm
r132294 r134681 27 27 #import "WebProcess.h" 28 28 29 #import "CustomProtocolManager.h" 29 30 #import "SandboxExtension.h" 30 31 #import "WKFullKeyboardAccessWatcher.h" … … 292 293 Method methodToPatch = class_getInstanceMethod([NSApplication class], @selector(accessibilityFocusedUIElement)); 293 294 method_setImplementation(methodToPatch, (IMP)NSApplicationAccessibilityFocusedUIElement); 295 296 for (size_t i = 0; i < parameters.urlSchemesRegisteredForCustomProtocols.size(); ++i) 297 CustomProtocolManager::shared().registerScheme(parameters.urlSchemesRegisteredForCustomProtocols[i]); 298 299 CustomProtocolManager::registerCustomProtocolClass(); 294 300 } 295 301 -
trunk/Tools/ChangeLog
r134675 r134681 1 2012-11-08 Andy Estes <aestes@apple.com> 2 3 [WebKit2] Need API in UIProcess to enable loading of custom protocols 4 https://bugs.webkit.org/show_bug.cgi?id=101674 5 6 Reviewed by Brady Eidson. 7 8 Add an API test that implements a custom protocol and attempts to load 9 a resource requiring that protocol in a WKView. The test passes only if 10 didFinishLoadForFrame: fires. 11 12 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 13 * TestWebKitAPI/Tests/WebKit2ObjC/CustomProtocolsTest.mm: Added. 14 (+[TestProtocol canInitWithRequest:]): 15 (+[TestProtocol canonicalRequestForRequest:]): 16 (+[TestProtocol requestIsCacheEquivalent:toRequest:]): 17 (-[TestProtocol startLoading]): 18 (-[TestProtocol stopLoading]): 19 * TestWebKitAPI/Tests/WebKit2ObjC/UserContentTest.mm: 20 * TestWebKitAPI/mac/TestBrowsingContextLoadDelegate.h: Copied from Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerInternal.h. 21 * TestWebKitAPI/mac/TestBrowsingContextLoadDelegate.mm: Copied from Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerInternal.h. 22 (-[TestBrowsingContextLoadDelegate initWithBlockToRunOnLoad:]): 23 (-[TestBrowsingContextLoadDelegate browsingContextControllerDidFinishLoad:]): 24 1 25 2012-11-14 Ojan Vafai <ojan@chromium.org> 2 26 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r133103 r134681 33 33 26F1B44515CA434F00D1E4BF /* StringImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F1B44315CA434F00D1E4BF /* StringImpl.cpp */; }; 34 34 2943BE86161DFEB800999E3D /* UserContentTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2943BE84161DFEB800999E3D /* UserContentTest.mm */; }; 35 29AB8AA1164C735800D49BEC /* CustomProtocolsTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29AB8A9F164C735800D49BEC /* CustomProtocolsTest.mm */; }; 36 29AB8AA4164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29AB8AA2164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.mm */; }; 35 37 333B9CE21277F23100FEFCE3 /* PreventEmptyUserAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 333B9CE11277F23100FEFCE3 /* PreventEmptyUserAgent.cpp */; }; 36 38 33BE5AF5137B5A6C00705813 /* MouseMoveAfterCrash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33BE5AF4137B5A6C00705813 /* MouseMoveAfterCrash.cpp */; }; … … 275 277 26F1B44315CA434F00D1E4BF /* StringImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringImpl.cpp; path = WTF/StringImpl.cpp; sourceTree = "<group>"; }; 276 278 2943BE84161DFEB800999E3D /* UserContentTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = UserContentTest.mm; path = WebKit2ObjC/UserContentTest.mm; sourceTree = "<group>"; }; 279 29AB8A9F164C735800D49BEC /* CustomProtocolsTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CustomProtocolsTest.mm; path = WebKit2ObjC/CustomProtocolsTest.mm; sourceTree = "<group>"; }; 280 29AB8AA2164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TestBrowsingContextLoadDelegate.mm; sourceTree = "<group>"; }; 281 29AB8AA3164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestBrowsingContextLoadDelegate.h; sourceTree = "<group>"; }; 277 282 333B9CE11277F23100FEFCE3 /* PreventEmptyUserAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PreventEmptyUserAgent.cpp; sourceTree = "<group>"; }; 278 283 33BE5AF4137B5A6C00705813 /* MouseMoveAfterCrash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseMoveAfterCrash.cpp; sourceTree = "<group>"; }; … … 542 547 isa = PBXGroup; 543 548 children = ( 549 29AB8A9F164C735800D49BEC /* CustomProtocolsTest.mm */, 544 550 2943BE84161DFEB800999E3D /* UserContentTest.mm */, 545 551 BC3C4C7D14587AA60025FB62 /* WKBrowsingContextGroupTest.mm */, … … 712 718 C081224313FC19EC00DC39AE /* SyntheticBackingScaleFactorWindow.h */, 713 719 C081224413FC19EC00DC39AE /* SyntheticBackingScaleFactorWindow.m */, 720 29AB8AA3164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.h */, 721 29AB8AA2164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.mm */, 714 722 C08587BE13FE956C001EF4E5 /* WebKitAgnosticTest.h */, 715 723 C08587BD13FE956C001EF4E5 /* WebKitAgnosticTest.mm */, … … 1017 1025 378E64731632646D00B6C676 /* InjectedBundleFrameHitTest.cpp in Sources */, 1018 1026 FE217ECD1640A54A0052988B /* VMInspector.cpp in Sources */, 1027 29AB8AA1164C735800D49BEC /* CustomProtocolsTest.mm in Sources */, 1028 29AB8AA4164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.mm in Sources */, 1019 1029 ); 1020 1030 runOnlyForDeploymentPostprocessing = 0; -
trunk/Tools/TestWebKitAPI/Tests/WebKit2ObjC/UserContentTest.mm
r131544 r134681 28 28 29 29 #import "PlatformUtilities.h" 30 #import "TestBrowsingContextLoadDelegate.h" 30 31 #import <JavaScriptCore/JSRetainPtr.h> 31 32 #import <JavaScriptCore/JavaScriptCore.h> … … 42 43 static const char* redInRGB = "rgb(255, 0, 0)"; 43 44 static const char* userScriptTestProperty = "window._userScriptInstalled"; 44 45 typedef void (^OnLoadBlock)(WKBrowsingContextController *);46 47 @interface UserContentTestLoadDelegate : NSObject <WKBrowsingContextLoadDelegate>48 {49 OnLoadBlock _onLoadBlock;50 }51 52 @property (nonatomic, copy) OnLoadBlock onLoadBlock;53 54 - (id)initWithBlockToRunOnLoad:(OnLoadBlock)block;55 56 @end57 58 @implementation UserContentTestLoadDelegate59 60 @synthesize onLoadBlock = _onLoadBlock;61 62 - (id)initWithBlockToRunOnLoad:(OnLoadBlock)block63 {64 if (!(self = [super init]))65 return nil;66 67 self.onLoadBlock = block;68 return self;69 }70 71 - (void)browsingContextControllerDidFinishLoad:(WKBrowsingContextController *)sender72 {73 if (_onLoadBlock)74 _onLoadBlock(sender);75 }76 77 @end78 45 79 46 namespace { … … 144 111 WKView *wkView = [[WKView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) processGroup:processGroup browsingContextGroup:browsingContextGroup]; 145 112 WKStringRef backgroundColorQuery = WKStringCreateWithUTF8CString(backgroundColorScript); 146 wkView.browsingContextController.loadDelegate = [[ UserContentTestLoadDelegate alloc] initWithBlockToRunOnLoad:^(WKBrowsingContextController *sender) {113 wkView.browsingContextController.loadDelegate = [[TestBrowsingContextLoadDelegate alloc] initWithBlockToRunOnLoad:^(WKBrowsingContextController *sender) { 147 114 WKPageRunJavaScriptInMainFrame_b(wkView.pageRef, backgroundColorQuery, ^(WKSerializedScriptValueRef serializedScriptValue, WKErrorRef error) { 148 115 expectScriptValueIsString(serializedScriptValue, greenInRGB); … … 163 130 WKView *wkView = [[WKView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) processGroup:processGroup browsingContextGroup:browsingContextGroup]; 164 131 WKStringRef backgroundColorQuery = WKStringCreateWithUTF8CString(backgroundColorScript); 165 wkView.browsingContextController.loadDelegate = [[ UserContentTestLoadDelegate alloc] initWithBlockToRunOnLoad:^(WKBrowsingContextController *sender) {132 wkView.browsingContextController.loadDelegate = [[TestBrowsingContextLoadDelegate alloc] initWithBlockToRunOnLoad:^(WKBrowsingContextController *sender) { 166 133 WKPageRunJavaScriptInMainFrame_b(wkView.pageRef, backgroundColorQuery, ^(WKSerializedScriptValueRef serializedScriptValue, WKErrorRef error) { 167 134 expectScriptValueIsString(serializedScriptValue, greenInRGB); … … 185 152 WKView *wkView = [[WKView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) processGroup:processGroup browsingContextGroup:browsingContextGroup]; 186 153 WKStringRef backgroundColorQuery = WKStringCreateWithUTF8CString(backgroundColorScript); 187 wkView.browsingContextController.loadDelegate = [[ UserContentTestLoadDelegate alloc] initWithBlockToRunOnLoad:^(WKBrowsingContextController *sender) {154 wkView.browsingContextController.loadDelegate = [[TestBrowsingContextLoadDelegate alloc] initWithBlockToRunOnLoad:^(WKBrowsingContextController *sender) { 188 155 WKPageRunJavaScriptInMainFrame_b(wkView.pageRef, backgroundColorQuery, ^(WKSerializedScriptValueRef serializedScriptValue, WKErrorRef error) { 189 156 expectScriptValueIsString(serializedScriptValue, redInRGB); … … 207 174 WKView *wkView = [[WKView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) processGroup:processGroup browsingContextGroup:browsingContextGroup]; 208 175 WKStringRef userScriptTestPropertyString = WKStringCreateWithUTF8CString(userScriptTestProperty); 209 wkView.browsingContextController.loadDelegate = [[ UserContentTestLoadDelegate alloc] initWithBlockToRunOnLoad:^(WKBrowsingContextController *sender) {176 wkView.browsingContextController.loadDelegate = [[TestBrowsingContextLoadDelegate alloc] initWithBlockToRunOnLoad:^(WKBrowsingContextController *sender) { 210 177 WKPageRunJavaScriptInMainFrame_b(wkView.pageRef, userScriptTestPropertyString, ^(WKSerializedScriptValueRef serializedScriptValue, WKErrorRef error) { 211 178 expectScriptValueIsBoolean(serializedScriptValue, true); … … 226 193 WKView *wkView = [[WKView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) processGroup:processGroup browsingContextGroup:browsingContextGroup]; 227 194 WKStringRef userScriptTestPropertyString = WKStringCreateWithUTF8CString(userScriptTestProperty); 228 wkView.browsingContextController.loadDelegate = [[ UserContentTestLoadDelegate alloc] initWithBlockToRunOnLoad:^(WKBrowsingContextController *sender) {195 wkView.browsingContextController.loadDelegate = [[TestBrowsingContextLoadDelegate alloc] initWithBlockToRunOnLoad:^(WKBrowsingContextController *sender) { 229 196 WKPageRunJavaScriptInMainFrame_b(wkView.pageRef, userScriptTestPropertyString, ^(WKSerializedScriptValueRef serializedScriptValue, WKErrorRef error) { 230 197 expectScriptValueIsBoolean(serializedScriptValue, true); … … 248 215 WKView *wkView = [[WKView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) processGroup:processGroup browsingContextGroup:browsingContextGroup]; 249 216 WKStringRef userScriptTestPropertyString = WKStringCreateWithUTF8CString(userScriptTestProperty); 250 wkView.browsingContextController.loadDelegate = [[ UserContentTestLoadDelegate alloc] initWithBlockToRunOnLoad:^(WKBrowsingContextController *sender) {217 wkView.browsingContextController.loadDelegate = [[TestBrowsingContextLoadDelegate alloc] initWithBlockToRunOnLoad:^(WKBrowsingContextController *sender) { 251 218 WKPageRunJavaScriptInMainFrame_b(wkView.pageRef, userScriptTestPropertyString, ^(WKSerializedScriptValueRef serializedScriptValue, WKErrorRef error) { 252 219 expectScriptValueIsUndefined(serializedScriptValue); -
trunk/Tools/TestWebKitAPI/mac/TestBrowsingContextLoadDelegate.h
r134679 r134681 1 1 /* 2 * Copyright (C) 201 1Apple Inc. All rights reserved.2 * Copyright (C) 2012 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #import <WebKit2/W KBrowsingContextController.h>26 #import <WebKit2/WebKit2.h> 27 27 28 @interface WKBrowsingContextController (Internal) 28 typedef void (^OnLoadBlock)(WKBrowsingContextController *); 29 29 30 /* This should only be called from associate view. */ 31 - (id)_initWithPageRef:(WKPageRef)pageRef; 30 @interface TestBrowsingContextLoadDelegate : NSObject <WKBrowsingContextLoadDelegate> { 31 } 32 33 @property(nonatomic, copy) OnLoadBlock onLoadBlock; 34 35 - (id)initWithBlockToRunOnLoad:(OnLoadBlock)block; 32 36 33 37 @end -
trunk/Tools/TestWebKitAPI/mac/TestBrowsingContextLoadDelegate.mm
r134679 r134681 1 1 /* 2 * Copyright (C) 201 1Apple Inc. All rights reserved.2 * Copyright (C) 2012 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #import <WebKit2/WKBrowsingContextController.h> 26 #include "config.h" 27 #include "TestBrowsingContextLoadDelegate.h" 27 28 28 @i nterface WKBrowsingContextController (Internal)29 @implementation TestBrowsingContextLoadDelegate 29 30 30 /* This should only be called from associate view. */ 31 - (id)_initWithPageRef:(WKPageRef)pageRef; 31 @synthesize onLoadBlock = _onLoadBlock; 32 33 - (id)initWithBlockToRunOnLoad:(OnLoadBlock)block 34 { 35 if (!(self = [super init])) 36 return nil; 37 38 self.onLoadBlock = block; 39 return self; 40 } 41 42 - (void)browsingContextControllerDidFinishLoad:(WKBrowsingContextController *)sender 43 { 44 if (_onLoadBlock) 45 _onLoadBlock(sender); 46 } 32 47 33 48 @end
Note: See TracChangeset
for help on using the changeset viewer.