Changeset 269701 in webkit
- Timestamp:
- Nov 11, 2020 1:44:38 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 34 edited
- 10 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r269698 r269701 1 2020-11-11 Brian Burg <bburg@apple.com> 2 3 [Cocoa] Inspector Extensions: Add _WKInspectorExtension and related plumbing 4 https://bugs.webkit.org/show_bug.cgi?id=217783 5 <rdar://problem/69968787> 6 7 Reviewed by Devin Rousso. 8 9 * inspector/InspectorFrontendClient.h: 10 * inspector/InspectorFrontendClientLocal.h: 11 In order for WebInspectorUIExtensionController to work with remote and local 12 inspectors, it stores a weak pointer the inspector's InspectorFrontendClient. 13 Expose the frontend's page so that the frontend API dispatcher can dispatch to it. 14 1 15 2020-11-11 Chris Dumez <cdumez@apple.com> 2 16 -
trunk/Source/WebCore/inspector/InspectorFrontendClient.h
r269524 r269701 37 37 #include "UserInterfaceLayoutDirection.h" 38 38 #include <wtf/Forward.h> 39 #include <wtf/WeakPtr.h> 39 40 #include <wtf/text/WTFString.h> 40 41 … … 43 44 class FloatRect; 44 45 class InspectorFrontendAPIDispatcher; 46 class Page; 45 47 46 class InspectorFrontendClient {48 class InspectorFrontendClient : public CanMakeWeakPtr<InspectorFrontendClient> { 47 49 public: 48 50 enum class DockSide { … … 112 114 WEBCORE_EXPORT virtual void sendMessageToBackend(const String&) = 0; 113 115 WEBCORE_EXPORT virtual InspectorFrontendAPIDispatcher& frontendAPIDispatcher() = 0; 116 WEBCORE_EXPORT virtual Page* frontendPage() = 0; 114 117 115 118 WEBCORE_EXPORT virtual bool isUnderTest() = 0; -
trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h
r269524 r269701 96 96 97 97 InspectorFrontendAPIDispatcher& frontendAPIDispatcher() final { return m_frontendAPIDispatcher; } 98 98 Page* frontendPage() final { return m_frontendPage; } 99 99 100 WEBCORE_EXPORT bool canAttachWindow(); 100 101 WEBCORE_EXPORT void setDockingUnavailable(bool); -
trunk/Source/WebInspectorUI/ChangeLog
r269671 r269701 1 2020-11-11 Brian Burg <bburg@apple.com> 2 3 [Cocoa] Inspector Extensions: Add _WKInspectorExtension and related plumbing 4 https://bugs.webkit.org/show_bug.cgi?id=217783 5 <rdar://problem/69968787> 6 7 Reviewed by Devin Rousso. 8 9 * UserInterface/Main.html: Add new files. 10 11 * UserInterface/Controllers/AppControllerBase.js: 12 (WI.AppControllerBase): 13 (WI.AppControllerBase.prototype.get extensionController): 14 Hang the extension controller off of the global singleton, as there can only be one. 15 16 * UserInterface/Controllers/WebInspectorExtensionController.js: 17 (WI.WebInspectorExtensionController): 18 (WI.WebInspectorExtensionController.prototype.registerExtension): 19 (WI.WebInspectorExtensionController.prototype.unregisterExtension): 20 Added. For now, just keep the UUIDs in a map and log the result. 21 22 * UserInterface/Models/WebInspectorExtension.js: 23 (WI.WebInspectorExtension): 24 (WI.WebInspectorExtension.prototype.get extensionID): 25 (WI.WebInspectorExtension.prototype.get displayName): 26 Added. This is a data object for now. 27 28 * UserInterface/Protocol/InspectorFrontendAPI.js: 29 (InspectorFrontendAPI.loadCompleted): 30 (InspectorFrontendAPI.registerExtension): 31 (InspectorFrontendAPI.unregisterExtension): 32 Added. Forward invocations to the extension controller. 33 1 34 2020-11-10 Commit Queue <commit-queue@webkit.org> 2 35 -
trunk/Source/WebInspectorUI/UserInterface/Controllers/AppControllerBase.js
r269524 r269701 42 42 { 43 43 this._initialized = false; 44 45 this._extensionController = new WI.WebInspectorExtensionController; 44 46 } 45 47 … … 47 49 48 50 get debuggableType() { throw WI.NotImplementedError.subclassMustOverride(); } 51 get extensionController() { return this._extensionController; } 49 52 50 53 // Since various members of the app controller depend on the global singleton to exist, -
trunk/Source/WebInspectorUI/UserInterface/Controllers/WebInspectorExtensionController.js
r269700 r269701 1 1 /* 2 * Copyright (C) 20 17Apple Inc. All rights reserved.2 * Copyright (C) 2020 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 WI.NotImplementedError = class NotImplementedError extends Error 27 { 28 constructor(message = "This method is not implemented.") 29 { 30 super(message); 31 } 32 33 static subclassMustOverride() 34 { 35 return new WI.NotImplementedError("This method must be overridden by a subclass."); 36 } 37 }; 38 39 WI.AppControllerBase = class AppControllerBase 26 WI.WebInspectorExtensionController = class WebInspectorExtensionController extends WI.Object 40 27 { 41 28 constructor() 42 29 { 43 this._initialized = false; 30 super(); 31 32 this._extensionIDMap = new Map; 44 33 } 45 34 46 35 // Public 47 36 48 get debuggableType() { throw WI.NotImplementedError.subclassMustOverride(); } 37 registerExtension(extensionID, displayName) 38 { 39 if (this._extensionIDMap.has(extensionID)) { 40 WI.reportInternalError("Unable to register extension, it's already registered: ", extensionID, displayName); 41 return WI.WebInspectorExtension.ErrorCode.RegistrationFailed; 42 } 49 43 50 // Since various members of the app controller depend on the global singleton to exist, 51 // some initialization needs to happen after the app controller has been constructed. 52 initialize() 53 { 54 if (this._initialized) 55 throw new Error("App controller is already initialized."); 44 let extension = new WI.WebInspectorExtension(extensionID, displayName); 45 this._extensionIDMap.set(extensionID, extension); 56 46 57 this._initialized = true; 58 59 // FIXME: eventually all code within WI.loaded should be distributed elsewhere. 60 WI.loaded(); 47 this.dispatchEventToListeners(WI.WebInspectorExtensionController.Event.ExtensionAdded, {extension}); 61 48 } 62 49 63 isWebDebuggable()50 unregisterExtension(extensionID) 64 51 { 65 return this.debuggableType === WI.DebuggableType.Page 66 || this.debuggableType === WI.DebuggableType.WebPage; 52 let extension = this._extensionIDMap.take(extensionID); 53 if (!extension) { 54 WI.reportInternalError("Unable to unregister extension with unknown ID: ", extensionID); 55 return WI.WebInspectorExtension.ErrorCode.InvalidRequest; 56 } 57 58 this.dispatchEventToListeners(WI.WebInspectorExtensionController.Event.ExtensionRemoved, {extension}); 67 59 } 68 60 }; 61 62 WI.WebInspectorExtensionController.Event = { 63 ExtensionAdded: "extension-added", 64 ExtensionRemoved: "extension-removed", 65 }; -
trunk/Source/WebInspectorUI/UserInterface/Main.html
r269524 r269701 485 485 <script src="Models/TypeSet.js"></script> 486 486 <script src="Models/URLBreakpoint.js"></script> 487 <script src="Models/WebInspectorExtension.js"></script> 487 488 <script src="Models/WebSocketResource.js"></script> 488 489 <script src="Models/WrappedPromise.js"></script> … … 899 900 <script src="Controllers/TimelineManager.js"></script> 900 901 <script src="Controllers/TypeTokenAnnotator.js"></script> 902 <script src="Controllers/WebInspectorExtensionController.js"></script> 901 903 <script src="Controllers/WorkerManager.js"></script> 902 904 -
trunk/Source/WebInspectorUI/UserInterface/Models/WebInspectorExtension.js
r269700 r269701 1 1 /* 2 * Copyright (C) 20 17Apple Inc. All rights reserved.2 * Copyright (C) 2020 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 WI. NotImplementedError = class NotImplementedError extends Error26 WI.WebInspectorExtension = class WebInspectorExtension 27 27 { 28 constructor( message = "This method is not implemented.")28 constructor(extensionID, displayName) 29 29 { 30 super(message);31 }30 console.assert(typeof extensionID === "string", extensionID); 31 console.assert(typeof displayName === "string", displayName); 32 32 33 static subclassMustOverride() 34 { 35 return new WI.NotImplementedError("This method must be overridden by a subclass."); 36 } 37 }; 38 39 WI.AppControllerBase = class AppControllerBase 40 { 41 constructor() 42 { 43 this._initialized = false; 33 this._extensionID = extensionID; 34 this._displayName = displayName; 44 35 } 45 36 46 37 // Public 47 38 48 get debuggableType() { throw WI.NotImplementedError.subclassMustOverride(); } 39 get extensionID() { return this._extensionID; } 40 get displayName() { return this._displayName; } 41 }; 49 42 50 // Since various members of the app controller depend on the global singleton to exist, 51 // some initialization needs to happen after the app controller has been constructed. 52 initialize() 53 { 54 if (this._initialized) 55 throw new Error("App controller is already initialized."); 56 57 this._initialized = true; 58 59 // FIXME: eventually all code within WI.loaded should be distributed elsewhere. 60 WI.loaded(); 61 } 62 63 isWebDebuggable() 64 { 65 return this.debuggableType === WI.DebuggableType.Page 66 || this.debuggableType === WI.DebuggableType.WebPage; 67 } 43 // Note: these values are synonymous with the values of enum class WebKit::InspectorExtensionError. 44 WI.WebInspectorExtension.ErrorCode = { 45 ContextDestroyed: "ContextDestroyed", 46 InternalError: "InternalError", 47 InvalidRequest: "InvalidRequest", 48 RegistrationFailed: "RegistrationFailed", 68 49 }; -
trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js
r269524 r269701 197 197 198 198 delete InspectorFrontendAPI._pendingCommands; 199 } 199 }, 200 201 // Returns a WI.WebInspectorExtension.ErrorCode if an error occurred, otherwise nothing. 202 registerExtension(extensionID, displayName) 203 { 204 return WI.sharedApp.extensionController.registerExtension(extensionID, displayName); 205 }, 206 207 // Returns a WI.WebInspectorExtension.ErrorCode if an error occurred, otherwise nothing. 208 unregisterExtension(extensionID) 209 { 210 return WI.sharedApp.extensionController.unregisterExtension(extensionID); 211 }, 200 212 }; -
trunk/Source/WebInspectorUI/UserInterface/Test.html
r269524 r269701 221 221 <script src="Models/TimelineRecording.js"></script> 222 222 <script src="Models/URLBreakpoint.js"></script> 223 <script src="Models/WebInspectorExtension.js"></script> 223 224 <script src="Models/WebSocketResource.js"></script> 224 225 <script src="Models/WrappedPromise.js"></script> … … 264 265 <script src="Controllers/TargetManager.js"></script> 265 266 <script src="Controllers/TimelineManager.js"></script> 267 <script src="Controllers/WebInspectorExtensionController.js"></script> 266 268 <script src="Controllers/WorkerManager.js"></script> 267 269 -
trunk/Source/WebKit/ChangeLog
r269700 r269701 1 2020-11-11 Brian Burg <bburg@apple.com> 2 3 [Cocoa] Inspector Extensions: Add _WKInspectorExtension and related plumbing 4 https://bugs.webkit.org/show_bug.cgi?id=217783 5 <rdar://problem/69968787> 6 7 Reviewed by Devin Rousso. 8 9 _WKInspectorExtension is new SPI that represents a Web Extension that uses the 'devtools' 10 API to interact with Web Inspector. An extension is associated with its _WKInspectorExtensionHost. 11 A WebKit client that supports Web Extensions can use this class to implement 'devtools' extension APIs. 12 13 Add _WKInspectorExtensionHost methods to register and unregister an extension. 14 Add plumbing so that the extension in registered in the frontend with WI.InspectorExtensionController. 15 16 Later patches will flesh out the needed functionality to implement rest of the 'devtools' API. 17 18 * Sources.txt: 19 * SourcesCocoa.txt: 20 * DerivedSources-input.xcfilelist: 21 * DerivedSources-output.xcfilelist: 22 * DerivedSources.make: 23 * WebKit.xcodeproj/project.pbxproj: 24 Add new files. 25 26 * Scripts/webkit/messages.py: If a message includes InspectorExtensionError, 27 then generate an include for InspectorExtensionTypes.h where it is declared. 28 29 * Shared/API/APIObject.h: 30 * Shared/Cocoa/APIObject.mm: 31 (API::Object::newObject): 32 New API object type. 33 34 * Shared/InspectorExtensionTypes.h: Added error code enum and useful type aliases. 35 * Shared/InspectorExtensionTypes.cpp: 36 (WebKit::inspectorExtensionErrorToString): 37 38 * UIProcess/API/APIInspectorExtension.h: 39 * UIProcess/API/APIInspectorExtension.cpp: 40 (API::InspectorExtension::create): 41 (API::InspectorExtension::InspectorExtension): 42 (API::InspectorExtension::~InspectorExtension): 43 Added. This is a placeholder object that's used for the wrapper system, 44 since we don't have single C++ objects for each extension to back the API object. 45 46 * UIProcess/API/Cocoa/_WKInspector.h: 47 * UIProcess/API/Cocoa/_WKInspector.mm: 48 (-[_WKInspector registerExtensionWithID:displayName:completionHandler:]): 49 (-[_WKInspector unregisterExtension:completionHandler:]): 50 Implement new _WKInspectorExtensionHost methods. Send IPC to the Inspector web process. 51 52 * UIProcess/API/Cocoa/_WKInspectorExtension.h: 53 * UIProcess/API/Cocoa/_WKInspectorExtension.mm: 54 (-[_WKInspectorExtension initWithIdentifier:]): 55 (-[_WKInspectorExtension dealloc]): 56 (-[_WKInspectorExtension _apiObject]): 57 (-[_WKInspectorExtension extensionID]): 58 Added. This is a data object that's also used as a token to unregister the extension. 59 60 * UIProcess/API/Cocoa/_WKInspectorExtensionHost.h: Add new SPI. 61 * UIProcess/API/Cocoa/_WKInspectorExtensionInternal.h: 62 63 * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h: 64 * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm: 65 (-[_WKRemoteWebInspectorViewController registerExtensionWithID:displayName:completionHandler:]): 66 (-[_WKRemoteWebInspectorViewController unregisterExtension:completionHandler:]): 67 Implement new _WKInspectorExtensionHost methods. Send IPC to the Inspector web process. 68 69 * UIProcess/Inspector/RemoteWebInspectorProxy.h: 70 * UIProcess/Inspector/RemoteWebInspectorProxy.messages.in: Add FrontendLoaded. 71 (WebKit::RemoteWebInspectorProxy::extensionController const): Added. 72 * UIProcess/Inspector/RemoteWebInspectorProxy.cpp: 73 (WebKit::RemoteWebInspectorProxy::frontendLoaded): 74 (WebKit::RemoteWebInspectorProxy::createFrontendPageAndWindow): 75 Set up the extension controller object after the frontend has been created. 76 Hook up the FrontendLoaded event sent from Inspector web process so that the 77 extension controller can be notified of when it's safe to message the frontend. 78 79 * UIProcess/Inspector/WebInspectorProxy.cpp: 80 (WebKit::WebInspectorProxy::createFrontendPage): 81 (WebKit::WebInspectorProxy::closeFrontendPageAndWindow): 82 (WebKit::WebInspectorProxy::frontendLoaded): 83 Set up the extension controller object after the frontend has been created. 84 85 * UIProcess/Inspector/WebInspectorProxy.h: 86 (WebKit::WebInspectorProxy::extensionController const): Added. 87 88 * UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.h: 89 * UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp: Added. 90 (WebKit::WebInspectorUIExtensionControllerProxy::WebInspectorUIExtensionControllerProxy): 91 (WebKit::WebInspectorUIExtensionControllerProxy::~WebInspectorUIExtensionControllerProxy): 92 (WebKit::WebInspectorUIExtensionControllerProxy::whenFrontendHasLoaded): 93 (WebKit::WebInspectorUIExtensionControllerProxy::inspectorFrontendLoaded): 94 (WebKit::WebInspectorUIExtensionControllerProxy::registerExtension): 95 (WebKit::WebInspectorUIExtensionControllerProxy::unregisterExtension): 96 Added. Forward API requests to the Web Inspector's web process to be evaluated in the frontend. 97 98 * WebProcess/Inspector/WebInspectorFrontendAPIDispatcher.h: 99 * WebProcess/Inspector/WebInspectorFrontendAPIDispatcher.cpp: 100 (WebKit::WebInspectorFrontendAPIDispatcher::dispatchCommand): 101 Add a more generic way to encode values to be passed as arguments to InspectorFrontendAPI.dispatch. 102 103 * WebProcess/Inspector/WebInspectorUI.cpp: 104 (WebKit::WebInspectorUI::establishConnection): 105 (WebKit::WebInspectorUI::closeWindow): 106 * WebProcess/Inspector/WebInspectorUI.h: 107 (WebKit::WebInspectorUI::frontendPage const): Added. 108 (WebKit::WebInspectorUI::frontendAPIDispatcher): Added. 109 110 * WebProcess/Inspector/WebInspectorUIExtensionController.h: 111 * WebProcess/Inspector/WebInspectorUIExtensionController.messages.in: Added. 112 * WebProcess/Inspector/WebInspectorUIExtensionController.cpp: Added. 113 (WebKit::WebInspectorUIExtensionController::WebInspectorUIExtensionController): 114 (WebKit::WebInspectorUIExtensionController::~WebInspectorUIExtensionController): 115 (WebKit::WebInspectorUIExtensionController::registerExtension): 116 (WebKit::WebInspectorUIExtensionController::unregisterExtension): 117 (WebKit::WebInspectorUIExtensionController::parseInspectorExtensionErrorFromResult): 118 Handle incoming messages by forwarding the associated command to WI.WebExtensionController 119 via InspectorFrontendAPI evaluations. 120 121 * UIProcess/API/Cocoa/_WKUserStyleSheet.h: 122 * UIProcess/API/Cocoa/_WKUserStyleSheet.mm: 123 Fallout from unified build chunking shifts. 124 125 * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: 126 (WebKit::LocalAuthenticatorInternal::getExistingCredentials): 127 (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification): 128 Fallout from unified build chunking shifts, but more. 129 1 130 2020-11-11 Alex Christensen <achristensen@webkit.org> 2 131 -
trunk/Source/WebKit/DerivedSources-input.xcfilelist
r269524 r269701 96 96 $(PROJECT_DIR)/UIProcess/GPU/GPUProcessProxy.messages.in 97 97 $(PROJECT_DIR)/UIProcess/Inspector/RemoteWebInspectorProxy.messages.in 98 $(PROJECT_DIR)/UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.messages.in 98 99 $(PROJECT_DIR)/UIProcess/Inspector/WebInspectorProxy.messages.in 99 100 $(PROJECT_DIR)/UIProcess/Media/AudioSessionRoutingArbitratorProxy.messages.in … … 143 144 $(PROJECT_DIR)/WebProcess/Inspector/RemoteWebInspectorUI.messages.in 144 145 $(PROJECT_DIR)/WebProcess/Inspector/WebInspector.messages.in 146 $(PROJECT_DIR)/WebProcess/Inspector/WebInspectorUIExtensionController.messages.in 145 147 $(PROJECT_DIR)/WebProcess/Inspector/WebInspectorInterruptDispatcher.messages.in 146 148 $(PROJECT_DIR)/WebProcess/Inspector/WebInspectorUI.messages.in -
trunk/Source/WebKit/DerivedSources-output.xcfilelist
r269524 r269701 349 349 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/WebIDBServerMessages.h 350 350 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/WebIDBServerMessagesReplies.h 351 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/WebInspectorUIExtensionControllerMessageReceiver.cpp 352 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/WebInspectorUIExtensionControllerMessages.h 353 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/WebInspectorUIExtensionControllerMessagesReplies.h 351 354 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/WebInspectorInterruptDispatcherMessageReceiver.cpp 352 355 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/WebInspectorInterruptDispatcherMessages.h -
trunk/Source/WebKit/DerivedSources.make
r269524 r269701 185 185 WebProcess/Inspector/WebInspectorInterruptDispatcher \ 186 186 WebProcess/Inspector/WebInspectorUI \ 187 WebProcess/Inspector/WebInspectorUIExtensionController \ 187 188 WebProcess/Inspector/WebInspector \ 188 189 WebProcess/Inspector/RemoteWebInspectorUI \ -
trunk/Source/WebKit/Scripts/webkit/messages.py
r269676 r269701 676 676 'WebKit::GestureRecognizerState': ['"GestureTypes.h"'], 677 677 'WebKit::GestureType': ['"GestureTypes.h"'], 678 'WebKit::InspectorExtensionError': ['"InspectorExtensionTypes.h"'], 678 679 'WebKit::LayerHostingContextID': ['"LayerHostingContext.h"'], 679 680 'WebKit::LayerHostingMode': ['"LayerTreeContext.h"'], -
trunk/Source/WebKit/Shared/API/APIObject.h
r269524 r269701 138 138 Inspector, 139 139 InspectorConfiguration, 140 #if ENABLE(INSPECTOR_EXTENSIONS) 141 InspectorExtension, 142 #endif 140 143 KeyValueStorageManager, 141 144 MediaCacheManager, … … 383 386 API::Object::Type::Inspector, 384 387 API::Object::Type::InspectorConfiguration, 388 #if ENABLE(INSPECTOR_EXTENSIONS) 389 API::Object::Type::InspectorExtension, 390 #endif 385 391 API::Object::Type::KeyValueStorageManager, 386 392 API::Object::Type::MediaCacheManager, -
trunk/Source/WebKit/Shared/Cocoa/APIObject.mm
r269524 r269701 100 100 #endif 101 101 102 #if ENABLE(INSPECTOR_EXTENSIONS) 103 #import "_WKInspectorExtensionInternal.h" 104 #endif 105 102 106 static const size_t minimumObjectAlignment = alignof(std::aligned_storage<std::numeric_limits<size_t>::max()>::type); 103 107 static_assert(minimumObjectAlignment >= alignof(void*), "Objects should always be at least pointer-aligned."); … … 271 275 break; 272 276 277 #if ENABLE(INSPECTOR_EXTENSIONS) 278 case Type::InspectorExtension: 279 wrapper = [_WKInspectorExtension alloc]; 280 break; 281 #endif 282 273 283 case Type::Navigation: 274 284 wrapper = [WKNavigation alloc]; -
trunk/Source/WebKit/Shared/InspectorExtensionTypes.cpp
r269700 r269701 1 1 /* 2 * Copyright (C) 20 18-2020 Apple Inc. All rights reserved.2 * Copyright (C) 2020 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 #i mport <Foundation/Foundation.h>27 #i mport <WebKit/WKFoundation.h>26 #include "config.h" 27 #include "InspectorExtensionTypes.h" 28 28 29 @class WKWebView; 30 @class _WKFrameHandle; 31 @protocol _WKInspectorDelegate; 29 #if ENABLE(INSPECTOR_EXTENSIONS) 32 30 33 NS_ASSUME_NONNULL_BEGIN 31 #include <wtf/text/WTFString.h> 34 32 35 @protocol _WKInspectorExtensionHost 36 - (void)close; 37 @end 33 namespace WebKit { 38 34 39 WK_CLASS_AVAILABLE(macos(10.14.4), ios(12.2)) 40 @interface _WKInspector : NSObject <_WKInspectorExtensionHost> 35 WTF::String inspectorExtensionErrorToString(InspectorExtensionError error) 36 { 37 switch (error) { 38 case InspectorExtensionError::InternalError: 39 return "InternalError"_s; 40 case InspectorExtensionError::InvalidRequest: 41 return "InvalidRequest"_s; 42 case InspectorExtensionError::ContextDestroyed: 43 return "ContextDestroyed"_s; 44 case InspectorExtensionError::RegistrationFailed: 45 return "RegistrationFailed"_s; 46 } 41 47 42 - (instancetype)init NS_UNAVAILABLE; 48 ASSERT_NOT_REACHED(); 49 return "InternalError"; 50 } 43 51 44 @property (nonatomic, weak) id <_WKInspectorDelegate> delegate WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); 52 } // namespace WebKit 45 53 46 @property (nonatomic, readonly) WKWebView *webView; 47 @property (nonatomic, readonly) BOOL isConnected; 48 @property (nonatomic, readonly) BOOL isVisible; 49 @property (nonatomic, readonly) BOOL isFront; 50 @property (nonatomic, readonly) BOOL isProfilingPage; 51 @property (nonatomic, readonly) BOOL isElementSelectionActive; 52 53 - (void)connect; 54 - (void)show; 55 - (void)hide; 56 - (void)showConsole; 57 - (void)showResources; 58 - (void)showMainResourceForFrame:(_WKFrameHandle *)frame; 59 - (void)attach; 60 - (void)detach; 61 - (void)togglePageProfiling; 62 - (void)toggleElementSelection; 63 - (void)printErrorToConsole:(NSString *)error; 64 65 @end 66 67 NS_ASSUME_NONNULL_END 54 #endif // ENABLE(INSPECTOR_EXTENSIONS) -
trunk/Source/WebKit/Shared/InspectorExtensionTypes.h
r269700 r269701 1 1 /* 2 * Copyright (C) 20 18-2020 Apple Inc. All rights reserved.2 * Copyright (C) 2020 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 <Foundation/Foundation.h> 27 #import <WebKit/WKFoundation.h> 26 #pragma once 28 27 29 @class WKWebView; 30 @class _WKFrameHandle; 31 @protocol _WKInspectorDelegate; 28 #include <wtf/Forward.h> 32 29 33 NS_ASSUME_NONNULL_BEGIN 30 #if ENABLE(INSPECTOR_EXTENSIONS) 34 31 35 @protocol _WKInspectorExtensionHost 36 - (void)close; 37 @end 32 namespace WebKit { 38 33 39 WK_CLASS_AVAILABLE(macos(10.14.4), ios(12.2)) 40 @interface _WKInspector : NSObject <_WKInspectorExtensionHost> 34 using InspectorExtensionTabID = WTF::String; 35 using InspectorExtensionID = WTF::String; 41 36 42 - (instancetype)init NS_UNAVAILABLE; 37 enum class InspectorExtensionError : uint8_t { 38 ContextDestroyed, 39 InternalError, 40 InvalidRequest, 41 RegistrationFailed, 42 }; 43 43 44 @property (nonatomic, weak) id <_WKInspectorDelegate> delegate WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));44 WTF::String inspectorExtensionErrorToString(InspectorExtensionError); 45 45 46 @property (nonatomic, readonly) WKWebView *webView; 47 @property (nonatomic, readonly) BOOL isConnected; 48 @property (nonatomic, readonly) BOOL isVisible; 49 @property (nonatomic, readonly) BOOL isFront; 50 @property (nonatomic, readonly) BOOL isProfilingPage; 51 @property (nonatomic, readonly) BOOL isElementSelectionActive; 46 } // namespace WebKit 52 47 53 - (void)connect; 54 - (void)show; 55 - (void)hide; 56 - (void)showConsole; 57 - (void)showResources; 58 - (void)showMainResourceForFrame:(_WKFrameHandle *)frame; 59 - (void)attach; 60 - (void)detach; 61 - (void)togglePageProfiling; 62 - (void)toggleElementSelection; 63 - (void)printErrorToConsole:(NSString *)error; 48 namespace WTF { 64 49 65 @end 50 template<> struct EnumTraits<WebKit::InspectorExtensionError> { 51 using values = EnumValues< 52 WebKit::InspectorExtensionError, 53 WebKit::InspectorExtensionError::InvalidRequest, 54 WebKit::InspectorExtensionError::ContextDestroyed, 55 WebKit::InspectorExtensionError::RegistrationFailed 56 >; 57 }; 66 58 67 NS_ASSUME_NONNULL_END 59 } 60 61 #endif // ENABLE(INSPECTOR_EXTENSIONS) -
trunk/Source/WebKit/Sources.txt
r269682 r269701 163 163 Shared/FontInfo.cpp 164 164 Shared/FrameInfoData.cpp 165 Shared/InspectorExtensionTypes.cpp 165 166 Shared/LayerTreeContext.cpp 166 167 Shared/LoadParameters.cpp … … 439 440 UIProcess/Inspector/RemoteWebInspectorProxy.cpp 440 441 UIProcess/Inspector/WebInspectorProxy.cpp 442 UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp 441 443 UIProcess/Inspector/WebInspectorUtilities.cpp 442 444 UIProcess/Inspector/WebPageDebuggable.cpp … … 553 555 WebProcess/Inspector/WebInspectorInterruptDispatcher.cpp 554 556 WebProcess/Inspector/WebInspectorUI.cpp 557 WebProcess/Inspector/WebInspectorUIExtensionController.cpp 555 558 WebProcess/Inspector/WebPageInspectorTarget.cpp 556 559 WebProcess/Inspector/WebPageInspectorTargetController.cpp -
trunk/Source/WebKit/SourcesCocoa.txt
r269524 r269701 260 260 UIProcess/API/Cocoa/_WKInspectorTesting.mm 261 261 UIProcess/API/Cocoa/_WKInspectorDebuggableInfo.mm 262 UIProcess/API/Cocoa/_WKInspectorExtension.mm 262 263 UIProcess/API/Cocoa/_WKInspectorWindow.mm 263 264 UIProcess/API/Cocoa/_WKInternalDebugFeature.mm -
trunk/Source/WebKit/UIProcess/API/APIInspectorExtension.h
r269700 r269701 1 1 /* 2 * Copyright (C) 20 17Apple Inc. All rights reserved.2 * Copyright (C) 2020 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 WI.NotImplementedError = class NotImplementedError extends Error 27 { 28 constructor(message = "This method is not implemented.") 26 #pragma once 27 28 #if ENABLE(INSPECTOR_EXTENSIONS) 29 30 #include "APIObject.h" 31 #include <wtf/Forward.h> 32 33 namespace API { 34 35 class InspectorExtension final : public API::ObjectImpl<Object::Type::InspectorExtension> { 36 public: 37 static Ref<InspectorExtension> create(const WTF::String& identifier) 29 38 { 30 super(message);39 return adoptRef(*new InspectorExtension(identifier)); 31 40 } 32 41 33 static subclassMustOverride() 42 explicit InspectorExtension(const WTF::String& identifier) 43 : m_identifier(identifier) 34 44 { 35 return new WI.NotImplementedError("This method must be overridden by a subclass.");36 45 } 46 47 const WTF::String& identifier() const { return m_identifier; } 48 49 private: 50 WTF::String m_identifier; 37 51 }; 38 52 39 WI.AppControllerBase = class AppControllerBase 40 { 41 constructor() 42 { 43 this._initialized = false; 44 } 53 } // namespace API 45 54 46 // Public 47 48 get debuggableType() { throw WI.NotImplementedError.subclassMustOverride(); } 49 50 // Since various members of the app controller depend on the global singleton to exist, 51 // some initialization needs to happen after the app controller has been constructed. 52 initialize() 53 { 54 if (this._initialized) 55 throw new Error("App controller is already initialized."); 56 57 this._initialized = true; 58 59 // FIXME: eventually all code within WI.loaded should be distributed elsewhere. 60 WI.loaded(); 61 } 62 63 isWebDebuggable() 64 { 65 return this.debuggableType === WI.DebuggableType.Page 66 || this.debuggableType === WI.DebuggableType.WebPage; 67 } 68 }; 55 #endif // ENABLE(INSPECTOR_EXTENSIONS) -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspector.h
r269524 r269701 26 26 #import <Foundation/Foundation.h> 27 27 #import <WebKit/WKFoundation.h> 28 #import <WebKit/_WKInspectorExtensionHost.h> 29 30 NS_ASSUME_NONNULL_BEGIN 28 31 29 32 @class WKWebView; 30 33 @class _WKFrameHandle; 34 @class _WKInspectorExtension; 31 35 @protocol _WKInspectorDelegate; 32 33 NS_ASSUME_NONNULL_BEGIN34 35 @protocol _WKInspectorExtensionHost36 - (void)close;37 @end38 36 39 37 WK_CLASS_AVAILABLE(macos(10.14.4), ios(12.2)) … … 53 51 - (void)connect; 54 52 - (void)show; 53 - (void)close; 55 54 - (void)hide; 56 55 - (void)showConsole; -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspector.mm
r269529 r269701 28 28 29 29 #import "InspectorDelegate.h" 30 #import "WKError.h" 30 31 #import "WKWebViewInternal.h" 31 32 #import "WebPageProxy.h" … … 39 40 #import <wtf/text/WTFString.h> 40 41 42 #if ENABLE(INSPECTOR_EXTENSIONS) 43 #import "APIInspectorExtension.h" 44 #import "WebInspectorUIExtensionControllerProxy.h" 45 #import "_WKInspectorExtensionInternal.h" 46 #import <wtf/BlockPtr.h> 47 #endif 48 41 49 @implementation _WKInspector 42 50 … … 189 197 } 190 198 199 // MARK: _WKInspectorExtensionHost methods 200 201 - (void)registerExtensionWithID:(NSString *)extensionID displayName:(NSString *)displayName completionHandler:(void(^)(NSError *, _WKInspectorExtension *))completionHandler 202 { 203 #if ENABLE(INSPECTOR_EXTENSIONS) 204 _inspector->extensionController().registerExtension(extensionID, displayName, [protectedExtensionID = retainPtr(extensionID), protectedSelf = retainPtr(self), capturedBlock = makeBlockPtr(completionHandler)] (Expected<bool, WebKit::InspectorExtensionError> result) mutable { 205 if (!result) { 206 capturedBlock([NSError errorWithDomain:WKErrorDomain code:WKErrorUnknown userInfo:@{ NSLocalizedFailureReasonErrorKey: inspectorExtensionErrorToString(result.error())}], nil); 207 return; 208 } 209 210 capturedBlock(nil, [[wrapper(API::InspectorExtension::create(protectedExtensionID.get())) retain] autorelease]); 211 }); 212 #else 213 completionHandler([NSError errorWithDomain:WKErrorDomain code:WKErrorUnknown userInfo:nil], nil); 214 #endif 215 } 216 217 - (void)unregisterExtension:(_WKInspectorExtension *)extension completionHandler:(void(^)(NSError *))completionHandler 218 { 219 #if ENABLE(INSPECTOR_EXTENSIONS) 220 _inspector->extensionController().unregisterExtension(extension.extensionID, [protectedSelf = retainPtr(self), capturedBlock = makeBlockPtr(completionHandler)] (Expected<bool, WebKit::InspectorExtensionError> result) mutable { 221 if (!result) { 222 capturedBlock([NSError errorWithDomain:WKErrorDomain code:WKErrorUnknown userInfo:@{ NSLocalizedFailureReasonErrorKey: inspectorExtensionErrorToString(result.error())}]); 223 return; 224 } 225 226 capturedBlock(nil); 227 }); 228 #else 229 completionHandler([NSError errorWithDomain:WKErrorDomain code:WKErrorUnknown userInfo:nil]); 230 #endif 231 } 232 191 233 @end -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorExtension.h
r269700 r269701 1 1 /* 2 * Copyright (C) 20 18-2020 Apple Inc. All rights reserved.2 * Copyright (C) 2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 27 27 #import <WebKit/WKFoundation.h> 28 28 29 @class WKWebView;30 @class _WKFrameHandle;31 @protocol _WKInspectorDelegate;32 33 29 NS_ASSUME_NONNULL_BEGIN 34 30 35 @protocol _WKInspectorExtensionHost 36 - (void)close; 37 @end 38 39 WK_CLASS_AVAILABLE(macos(10.14.4), ios(12.2)) 40 @interface _WKInspector : NSObject <_WKInspectorExtensionHost> 31 WK_CLASS_AVAILABLE(macos(WK_MAC_TBA)) 32 @interface _WKInspectorExtension : NSObject 41 33 42 34 - (instancetype)init NS_UNAVAILABLE; 43 35 44 @property (nonatomic, weak) id <_WKInspectorDelegate> delegate WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); 45 46 @property (nonatomic, readonly) WKWebView *webView; 47 @property (nonatomic, readonly) BOOL isConnected; 48 @property (nonatomic, readonly) BOOL isVisible; 49 @property (nonatomic, readonly) BOOL isFront; 50 @property (nonatomic, readonly) BOOL isProfilingPage; 51 @property (nonatomic, readonly) BOOL isElementSelectionActive; 52 53 - (void)connect; 54 - (void)show; 55 - (void)hide; 56 - (void)showConsole; 57 - (void)showResources; 58 - (void)showMainResourceForFrame:(_WKFrameHandle *)frame; 59 - (void)attach; 60 - (void)detach; 61 - (void)togglePageProfiling; 62 - (void)toggleElementSelection; 63 - (void)printErrorToConsole:(NSString *)error; 36 @property (readonly, nonatomic) NSString *extensionID; 64 37 65 38 @end -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorExtension.mm
r269700 r269701 1 1 /* 2 * Copyright (C) 20 18-2020 Apple Inc. All rights reserved.2 * Copyright (C) 2020 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 <Foundation/Foundation.h> 27 #import <WebKit/WKFoundation.h> 28 29 @class WKWebView; 30 @class _WKFrameHandle; 31 @protocol _WKInspectorDelegate; 26 #import "config.h" 27 #import "_WKInspectorExtensionInternal.h" 32 28 33 29 NS_ASSUME_NONNULL_BEGIN 34 30 35 @protocol _WKInspectorExtensionHost 36 - (void)close; 37 @end 31 @implementation _WKInspectorExtension 38 32 39 WK_CLASS_AVAILABLE(macos(10.14.4), ios(12.2)) 40 @interface _WKInspector : NSObject <_WKInspectorExtensionHost> 33 #if ENABLE(INSPECTOR_EXTENSIONS) 41 34 42 - (instancetype)init NS_UNAVAILABLE; 35 - (instancetype)initWithIdentifier:(NSString *)extensionID 36 { 37 if (!(self = [super init])) 38 return nil; 43 39 44 @property (nonatomic, weak) id <_WKInspectorDelegate> delegate WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); 40 API::Object::constructInWrapper<API::InspectorExtension>(self, extensionID); 41 42 return self; 43 } 45 44 46 @property (nonatomic, readonly) WKWebView *webView; 47 @property (nonatomic, readonly) BOOL isConnected; 48 @property (nonatomic, readonly) BOOL isVisible; 49 @property (nonatomic, readonly) BOOL isFront; 50 @property (nonatomic, readonly) BOOL isProfilingPage; 51 @property (nonatomic, readonly) BOOL isElementSelectionActive; 45 - (void)dealloc 46 { 47 _extension->API::InspectorExtension::~InspectorExtension(); 52 48 53 - (void)connect; 54 - (void)show; 55 - (void)hide; 56 - (void)showConsole; 57 - (void)showResources; 58 - (void)showMainResourceForFrame:(_WKFrameHandle *)frame; 59 - (void)attach; 60 - (void)detach; 61 - (void)togglePageProfiling; 62 - (void)toggleElementSelection; 63 - (void)printErrorToConsole:(NSString *)error; 49 [super dealloc]; 50 } 51 52 53 - (API::Object&)_apiObject 54 { 55 return *_extension; 56 } 57 58 // MARK: Properties. 59 60 - (NSString *)extensionID 61 { 62 return _extension->identifier(); 63 } 64 65 #endif // ENABLE(INSPECTOR_EXTENSIONS) 64 66 65 67 @end -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorExtensionHost.h
r269700 r269701 1 1 /* 2 * Copyright (C) 20 18-2020 Apple Inc. All rights reserved.2 * Copyright (C) 2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 27 27 #import <WebKit/WKFoundation.h> 28 28 29 @class WKWebView;30 @class _WKFrameHandle;31 @protocol _WKInspectorDelegate;32 33 29 NS_ASSUME_NONNULL_BEGIN 34 30 31 @class _WKInspectorExtension; 32 35 33 @protocol _WKInspectorExtensionHost 34 @optional 35 36 /** 37 * @abstract Registers a Web Extension with the associated Web Inspector. 38 * @param extensionID A unique identifier for the extension. 39 * @param displayName A localized display name for the extension. 40 * @param completionHandler The completion handler to be called when registration succeeds or fails. 41 * 42 * Web Extensions in Web Inspector are active as soon as they are registered. 43 */ 44 - (void)registerExtensionWithID:(NSString *)extensionID displayName:(NSString *)displayName completionHandler:(void(^)(NSError * _Nullable, _WKInspectorExtension * _Nullable))completionHandler; 45 46 /** 47 * @abstract Unregisters a Web Extension with the associated Web Inspector. 48 * @param extensionID A unique identifier for the extension. 49 * @param completionHandler The completion handler to be called when unregistering succeeds or fails. 50 * 51 * Unregistering an extension will automatically close any associated sidebars/tabs. 52 */ 53 - (void)unregisterExtension:(_WKInspectorExtension *)extension completionHandler:(void(^)(NSError * _Nullable))completionHandler; 54 55 /** 56 * @abstract Closes the associated Web Inspector instance. This will cause all 57 * registered _WKInspectorExtensions to be unregistered and invalidated. 58 */ 36 59 - (void)close; 37 60 @end 38 61 39 WK_CLASS_AVAILABLE(macos(10.14.4), ios(12.2))40 @interface _WKInspector : NSObject <_WKInspectorExtensionHost>41 42 - (instancetype)init NS_UNAVAILABLE;43 44 @property (nonatomic, weak) id <_WKInspectorDelegate> delegate WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));45 46 @property (nonatomic, readonly) WKWebView *webView;47 @property (nonatomic, readonly) BOOL isConnected;48 @property (nonatomic, readonly) BOOL isVisible;49 @property (nonatomic, readonly) BOOL isFront;50 @property (nonatomic, readonly) BOOL isProfilingPage;51 @property (nonatomic, readonly) BOOL isElementSelectionActive;52 53 - (void)connect;54 - (void)show;55 - (void)hide;56 - (void)showConsole;57 - (void)showResources;58 - (void)showMainResourceForFrame:(_WKFrameHandle *)frame;59 - (void)attach;60 - (void)detach;61 - (void)togglePageProfiling;62 - (void)toggleElementSelection;63 - (void)printErrorToConsole:(NSString *)error;64 65 @end66 67 62 NS_ASSUME_NONNULL_END -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorExtensionInternal.h
r269700 r269701 1 1 /* 2 * Copyright (C) 20 18-2020 Apple Inc. All rights reserved.2 * Copyright (C) 2020 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 <Foundation/Foundation.h> 27 #import <WebKit/WKFoundation.h> 26 #import "_WKInspectorExtension.h" 28 27 29 @class WKWebView; 30 @class _WKFrameHandle; 31 @protocol _WKInspectorDelegate; 28 #if ENABLE(INSPECTOR_EXTENSIONS) 29 30 #import "APIInspectorExtension.h" 31 #import "WKObject.h" 32 33 namespace WebKit { 34 35 template<> struct WrapperTraits<API::InspectorExtension> { 36 using WrapperClass = _WKInspectorExtension; 37 }; 38 39 } // namespace WebKit 32 40 33 41 NS_ASSUME_NONNULL_BEGIN 34 42 35 @protocol _WKInspectorExtensionHost 36 - (void)close; 37 @end 43 @interface _WKInspectorExtension () <WKObject> { 44 @package 45 API::ObjectStorage<API::InspectorExtension> _extension; 46 } 38 47 39 WK_CLASS_AVAILABLE(macos(10.14.4), ios(12.2)) 40 @interface _WKInspector : NSObject <_WKInspectorExtensionHost> 41 42 - (instancetype)init NS_UNAVAILABLE; 43 44 @property (nonatomic, weak) id <_WKInspectorDelegate> delegate WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); 45 46 @property (nonatomic, readonly) WKWebView *webView; 47 @property (nonatomic, readonly) BOOL isConnected; 48 @property (nonatomic, readonly) BOOL isVisible; 49 @property (nonatomic, readonly) BOOL isFront; 50 @property (nonatomic, readonly) BOOL isProfilingPage; 51 @property (nonatomic, readonly) BOOL isElementSelectionActive; 52 53 - (void)connect; 54 - (void)show; 55 - (void)hide; 56 - (void)showConsole; 57 - (void)showResources; 58 - (void)showMainResourceForFrame:(_WKFrameHandle *)frame; 59 - (void)attach; 60 - (void)detach; 61 - (void)togglePageProfiling; 62 - (void)toggleElementSelection; 63 - (void)printErrorToConsole:(NSString *)error; 48 - (instancetype)initWithIdentifier:(NSString *)extensionIdentifier; 64 49 65 50 @end 66 51 67 52 NS_ASSUME_NONNULL_END 53 54 #endif // ENABLE(INSPECTOR_EXTENSIONS) -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h
r269524 r269701 25 25 26 26 #import <WebKit/WKFoundation.h> 27 #import <WebKit/_WKInspectorExtensionHost.h> 27 28 28 29 #if !TARGET_OS_IPHONE … … 45 46 46 47 WK_CLASS_AVAILABLE(macos(10.12.3), ios(10.3)) 47 @interface _WKRemoteWebInspectorViewController : NSObject 48 @interface _WKRemoteWebInspectorViewController : NSObject <_WKInspectorExtensionHost> 48 49 49 50 @property (nonatomic, assign) id <_WKRemoteWebInspectorViewControllerDelegate> delegate; -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm
r269524 r269701 37 37 #import "_WKInspectorDebuggableInfoInternal.h" 38 38 39 #if ENABLE(INSPECTOR_EXTENSIONS) 40 #import "APIInspectorExtension.h" 41 #import "WKError.h" 42 #import "WebInspectorUIExtensionControllerProxy.h" 43 #import "_WKInspectorExtensionInternal.h" 44 #import <wtf/BlockPtr.h> 45 #endif 46 39 47 NS_ASSUME_NONNULL_BEGIN 40 48 … … 183 191 } 184 192 193 // MARK: _WKInspectorExtensionHost methods 194 195 - (void)registerExtensionWithID:(NSString *)extensionID displayName:(NSString *)displayName completionHandler:(void(^)(NSError *, _WKInspectorExtension *))completionHandler 196 { 197 #if ENABLE(INSPECTOR_EXTENSIONS) 198 m_remoteInspectorProxy->extensionController().registerExtension(extensionID, displayName, [protectedExtensionID = retainPtr(extensionID), protectedSelf = retainPtr(self), capturedBlock = makeBlockPtr(completionHandler)] (Expected<bool, WebKit::InspectorExtensionError> result) mutable { 199 if (!result) { 200 capturedBlock([NSError errorWithDomain:WKErrorDomain code:WKErrorUnknown userInfo:@{ NSLocalizedFailureReasonErrorKey: inspectorExtensionErrorToString(result.error())}], nil); 201 return; 202 } 203 204 capturedBlock(nil, [[wrapper(API::InspectorExtension::create(protectedExtensionID.get())) retain] autorelease]); 205 }); 206 #else 207 completionHandler([NSError errorWithDomain:WKErrorDomain code:WKErrorUnknown userInfo:nil], nil); 208 #endif 209 } 210 211 - (void)unregisterExtension:(_WKInspectorExtension *)extension completionHandler:(void(^)(NSError *))completionHandler 212 { 213 #if ENABLE(INSPECTOR_EXTENSIONS) 214 m_remoteInspectorProxy->extensionController().unregisterExtension(extension.extensionID, [protectedSelf = retainPtr(self), capturedBlock = makeBlockPtr(completionHandler)] (Expected<bool, WebKit::InspectorExtensionError> result) mutable { 215 if (!result) { 216 capturedBlock([NSError errorWithDomain:WKErrorDomain code:WKErrorUnknown userInfo:@{ NSLocalizedFailureReasonErrorKey: inspectorExtensionErrorToString(result.error())}]); 217 return; 218 } 219 220 capturedBlock(nil); 221 }); 222 #else 223 completionHandler([NSError errorWithDomain:WKErrorDomain code:WKErrorUnknown userInfo:nil]); 224 #endif 225 } 226 185 227 @end 186 228 -
trunk/Source/WebKit/UIProcess/Inspector/RemoteWebInspectorProxy.cpp
r269524 r269701 37 37 #include <WebCore/NotImplemented.h> 38 38 39 #if ENABLE(INSPECTOR_EXTENSIONS) 40 #include "WebInspectorUIExtensionControllerProxy.h" 41 #endif 42 39 43 namespace WebKit { 40 44 using namespace WebCore; … … 96 100 } 97 101 102 void RemoteWebInspectorProxy::frontendLoaded() 103 { 104 #if ENABLE(INSPECTOR_EXTENSIONS) 105 m_extensionController->inspectorFrontendLoaded(); 106 #endif 107 } 108 98 109 void RemoteWebInspectorProxy::frontendDidClose() 99 110 { … … 176 187 m_inspectorPage->process().addMessageReceiver(Messages::RemoteWebInspectorProxy::messageReceiverName(), m_inspectorPage->webPageID(), *this); 177 188 m_inspectorPage->process().assumeReadAccessToBaseURL(*m_inspectorPage, WebInspectorProxy::inspectorBaseURL()); 189 190 #if ENABLE(INSPECTOR_EXTENSIONS) 191 m_extensionController = makeUnique<WebInspectorUIExtensionControllerProxy>(*m_inspectorPage); 192 #endif 178 193 } 179 194 -
trunk/Source/WebKit/UIProcess/Inspector/RemoteWebInspectorProxy.h
r269524 r269701 57 57 class WebPageProxy; 58 58 class WebView; 59 #if ENABLE(INSPECTOR_EXTENSIONS) 60 class WebInspectorUIExtensionControllerProxy; 61 #endif 59 62 60 63 class RemoteWebInspectorProxyClient { … … 89 92 void sendMessageToFrontend(const String& message); 90 93 94 #if ENABLE(INSPECTOR_EXTENSIONS) 95 WebInspectorUIExtensionControllerProxy& extensionController() const { return *m_extensionController; } 96 #endif 97 91 98 #if PLATFORM(MAC) 92 99 NSWindow *window() const { return m_window.get(); } … … 118 125 119 126 // RemoteWebInspectorProxy messages. 127 void frontendLoaded(); 120 128 void frontendDidClose(); 121 129 void reopen(); … … 150 158 WebPageProxy* m_inspectorPage { nullptr }; 151 159 160 #if ENABLE(INSPECTOR_EXTENSIONS) 161 std::unique_ptr<WebInspectorUIExtensionControllerProxy> m_extensionController; 162 #endif 163 152 164 Ref<API::DebuggableInfo> m_debuggableInfo; 153 165 String m_backendCommandsURL; -
trunk/Source/WebKit/UIProcess/Inspector/RemoteWebInspectorProxy.messages.in
r269524 r269701 22 22 23 23 messages -> RemoteWebInspectorProxy { 24 FrontendLoaded() 24 25 FrontendDidClose() 25 26 Reopen() -
trunk/Source/WebKit/UIProcess/Inspector/WebInspectorProxy.cpp
r269671 r269701 38 38 #include "WebInspectorMessages.h" 39 39 #include "WebInspectorProxyMessages.h" 40 #include "WebInspectorUIExtensionControllerProxy.h" 40 41 #include "WebInspectorUIMessages.h" 41 42 #include "WebPageGroup.h" … … 422 423 m_inspectorPage->process().addMessageReceiver(Messages::WebInspectorProxy::messageReceiverName(), m_inspectedPage->identifier(), *this); 423 424 m_inspectorPage->process().assumeReadAccessToBaseURL(*m_inspectorPage, WebInspectorProxy::inspectorBaseURL()); 425 426 #if ENABLE(INSPECTOR_EXTENSIONS) 427 m_extensionController = makeUnique<WebInspectorUIExtensionControllerProxy>(*m_inspectorPage); 428 #endif 424 429 } 425 430 … … 547 552 platformDetach(); 548 553 554 #if ENABLE(INSPECTOR_EXTENSIONS) 555 m_extensionController = nullptr; 556 #endif 557 549 558 // Null out m_inspectorPage after platformDetach(), so the views can be cleaned up correctly. 550 559 m_inspectorPage = nullptr; … … 572 581 if (auto* automationSession = m_inspectedPage->process().processPool().automationSession()) 573 582 automationSession->inspectorFrontendLoaded(*m_inspectedPage); 583 584 #if ENABLE(INSPECTOR_EXTENSIONS) 585 m_extensionController->inspectorFrontendLoaded(); 586 #endif 574 587 } 575 588 -
trunk/Source/WebKit/UIProcess/Inspector/WebInspectorProxy.h
r269524 r269701 38 38 #include <wtf/Forward.h> 39 39 #include <wtf/RefPtr.h> 40 #include <wtf/WeakPtr.h> 40 41 #include <wtf/text/WTFString.h> 41 42 … … 70 71 class WebPageProxy; 71 72 class WebPreferences; 73 #if ENABLE(INSPECTOR_EXTENSIONS) 74 class WebInspectorUIExtensionControllerProxy; 75 #endif 72 76 73 77 enum class AttachmentSide { … … 81 85 , public IPC::MessageReceiver 82 86 , public Inspector::FrontendChannel 87 , public CanMakeWeakPtr<WebInspectorProxy> 83 88 #if PLATFORM(WIN) 84 89 , public WebCore::WindowMessageListener … … 102 107 WebPageProxy* inspectedPage() const { return m_inspectedPage; } 103 108 WebPageProxy* inspectorPage() const { return m_inspectorPage; } 109 110 #if ENABLE(INSPECTOR_EXTENSIONS) 111 WebInspectorUIExtensionControllerProxy& extensionController() const { return *m_extensionController; } 112 #endif 104 113 105 114 bool isConnected() const { return !!m_inspectorPage; } … … 287 296 std::unique_ptr<API::InspectorClient> m_inspectorClient; 288 297 298 #if ENABLE(INSPECTOR_EXTENSIONS) 299 std::unique_ptr<WebInspectorUIExtensionControllerProxy> m_extensionController; 300 #endif 301 289 302 bool m_underTest { false }; 290 303 bool m_isVisible { false }; -
trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm
r269534 r269701 150 150 auto& responseMap = decodedResponse->getMap(); 151 151 152 auto it = responseMap.find(CBOR( kEntityIdMapKey));152 auto it = responseMap.find(CBOR(fido::kEntityIdMapKey)); 153 153 if (it == responseMap.end() || !it->second.isByteString()) { 154 154 ASSERT_NOT_REACHED(); … … 157 157 auto& userHandle = it->second.getByteString(); 158 158 159 it = responseMap.find(CBOR( kEntityNameMapKey));159 it = responseMap.find(CBOR(fido::kEntityNameMapKey)); 160 160 if (it == responseMap.end() || !it->second.isString()) { 161 161 ASSERT_NOT_REACHED(); … … 301 301 302 302 cbor::CBORValue::MapValue userEntityMap; 303 userEntityMap[cbor::CBORValue( kEntityIdMapKey)] = cbor::CBORValue(creationOptions.user.idVector);304 userEntityMap[cbor::CBORValue( kEntityNameMapKey)] = cbor::CBORValue(creationOptions.user.name);303 userEntityMap[cbor::CBORValue(fido::kEntityIdMapKey)] = cbor::CBORValue(creationOptions.user.idVector); 304 userEntityMap[cbor::CBORValue(fido::kEntityNameMapKey)] = cbor::CBORValue(creationOptions.user.name); 305 305 auto userEntity = cbor::CBORWriter::write(cbor::CBORValue(WTFMove(userEntityMap))); 306 306 ASSERT(userEntity); -
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
r269682 r269701 1439 1439 9955A6F71C7986E500EB6A93 /* AutomationProtocolObjects.h in Headers */ = {isa = PBXBuildFile; fileRef = 9955A6F31C79866400EB6A93 /* AutomationProtocolObjects.h */; }; 1440 1440 99788ACB1F421DDA00C08000 /* _WKAutomationSessionConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 99788AC91F421DCA00C08000 /* _WKAutomationSessionConfiguration.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1441 9979659E25310A4900B31AE3 /* WebInspectorUIExtensionControllerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 9979659A25310A4800B31AE3 /* WebInspectorUIExtensionControllerMessages.h */; }; 1442 9979659F25310A4900B31AE3 /* WebInspectorUIExtensionControllerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9979659B25310A4800B31AE3 /* WebInspectorUIExtensionControllerMessageReceiver.cpp */; }; 1443 997965A3253128C700B31AE3 /* _WKInspectorExtensionHost.h in Headers */ = {isa = PBXBuildFile; fileRef = 997965A2253128C700B31AE3 /* _WKInspectorExtensionHost.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1441 1444 9979CA58237F49F10039EC05 /* _WKInspectorPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 9979CA57237F49F00039EC05 /* _WKInspectorPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1442 1445 99996A9F25004BCC004F7559 /* _WKInspectorPrivateForTesting.h in Headers */ = {isa = PBXBuildFile; fileRef = 99996A9D25004BCB004F7559 /* _WKInspectorPrivateForTesting.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1446 99B16757252BB7E10073140E /* _WKInspectorExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 99B16754252BB7E00073140E /* _WKInspectorExtension.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1447 99B16758252BB7E10073140E /* _WKInspectorExtensionInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 99B16755252BB7E10073140E /* _WKInspectorExtensionInternal.h */; }; 1448 99B1675B252BBADD0073140E /* WebInspectorUIExtensionControllerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 99B1675A252BBADD0073140E /* WebInspectorUIExtensionControllerProxy.h */; }; 1449 99B16764252BBE620073140E /* WebInspectorUIExtensionController.h in Headers */ = {isa = PBXBuildFile; fileRef = 99B16761252BBE610073140E /* WebInspectorUIExtensionController.h */; }; 1443 1450 99C3AE2D1DADA6AD00AF5C16 /* WebAutomationSessionMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 99C3AE2C1DADA6A700AF5C16 /* WebAutomationSessionMacros.h */; }; 1444 1451 99C81D5A1C20E7E2005C4C82 /* AutomationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 99C81D551C20DFBE005C4C82 /* AutomationClient.h */; }; … … 4582 4589 99788AC91F421DCA00C08000 /* _WKAutomationSessionConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKAutomationSessionConfiguration.h; sourceTree = "<group>"; }; 4583 4590 99788ACA1F421DCA00C08000 /* _WKAutomationSessionConfiguration.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKAutomationSessionConfiguration.mm; sourceTree = "<group>"; }; 4591 9979659A25310A4800B31AE3 /* WebInspectorUIExtensionControllerMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebInspectorUIExtensionControllerMessages.h; path = DerivedSources/WebKit2/WebInspectorUIExtensionControllerMessages.h; sourceTree = BUILT_PRODUCTS_DIR; }; 4592 9979659B25310A4800B31AE3 /* WebInspectorUIExtensionControllerMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebInspectorUIExtensionControllerMessageReceiver.cpp; path = DerivedSources/WebKit2/WebInspectorUIExtensionControllerMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; 4593 997965A2253128C700B31AE3 /* _WKInspectorExtensionHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKInspectorExtensionHost.h; sourceTree = "<group>"; }; 4584 4594 9979CA57237F49F00039EC05 /* _WKInspectorPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKInspectorPrivate.h; sourceTree = "<group>"; }; 4585 4595 99996A9D25004BCB004F7559 /* _WKInspectorPrivateForTesting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKInspectorPrivateForTesting.h; sourceTree = "<group>"; }; 4586 4596 99996A9E25004BCB004F7559 /* _WKInspectorTesting.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKInspectorTesting.mm; sourceTree = "<group>"; }; 4597 999B7ED82550E4A800F450A4 /* InspectorExtensionTypes.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorExtensionTypes.cpp; sourceTree = "<group>"; }; 4598 99B16754252BB7E00073140E /* _WKInspectorExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKInspectorExtension.h; sourceTree = "<group>"; }; 4599 99B16755252BB7E10073140E /* _WKInspectorExtensionInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKInspectorExtensionInternal.h; sourceTree = "<group>"; }; 4600 99B16756252BB7E10073140E /* _WKInspectorExtension.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKInspectorExtension.mm; sourceTree = "<group>"; }; 4601 99B1675A252BBADD0073140E /* WebInspectorUIExtensionControllerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebInspectorUIExtensionControllerProxy.h; sourceTree = "<group>"; }; 4602 99B1675D252BBE0A0073140E /* WebInspectorUIExtensionControllerProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebInspectorUIExtensionControllerProxy.cpp; sourceTree = "<group>"; }; 4603 99B16760252BBE610073140E /* WebInspectorUIExtensionController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebInspectorUIExtensionController.cpp; sourceTree = "<group>"; }; 4604 99B16761252BBE610073140E /* WebInspectorUIExtensionController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebInspectorUIExtensionController.h; sourceTree = "<group>"; }; 4605 99B16762252BBE610073140E /* WebInspectorUIExtensionController.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebInspectorUIExtensionController.messages.in; sourceTree = "<group>"; }; 4606 99BE3B1225422F4100C6551C /* APIInspectorExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIInspectorExtension.h; sourceTree = "<group>"; }; 4607 99BE3B1625433B9400C6551C /* InspectorExtensionTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InspectorExtensionTypes.h; sourceTree = "<group>"; }; 4587 4608 99C3AE231DAD8E3400AF5C16 /* WebAutomationSessionMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebAutomationSessionMac.mm; sourceTree = "<group>"; }; 4588 4609 99C3AE261DAD948500AF5C16 /* WebAutomationSessionCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebAutomationSessionCocoa.mm; sourceTree = "<group>"; }; … … 6165 6186 1AC75A1A1B3368270056745B /* HangDetectionDisabler.h */, 6166 6187 BCCF6B2312C93E7A008F9C35 /* ImageOptions.h */, 6188 999B7ED82550E4A800F450A4 /* InspectorExtensionTypes.cpp */, 6189 99BE3B1625433B9400C6551C /* InspectorExtensionTypes.h */, 6167 6190 1A92DC1212F8BAB90017AF65 /* LayerTreeContext.cpp */, 6168 6191 1A92DC1012F8BA460017AF65 /* LayerTreeContext.h */, … … 7384 7407 99036AE123A949CE0000B06A /* _WKInspectorDebuggableInfoInternal.h */, 7385 7408 9197940B23DBC50300257892 /* _WKInspectorDelegate.h */, 7409 99B16754252BB7E00073140E /* _WKInspectorExtension.h */, 7410 99B16756252BB7E10073140E /* _WKInspectorExtension.mm */, 7411 997965A2253128C700B31AE3 /* _WKInspectorExtensionHost.h */, 7412 99B16755252BB7E10073140E /* _WKInspectorExtensionInternal.h */, 7386 7413 5CAFDE442130843600B1F7E1 /* _WKInspectorInternal.h */, 7387 7414 9979CA57237F49F00039EC05 /* _WKInspectorPrivate.h */, … … 8696 8723 1C8E28321275D73800BC7BD0 /* WebInspectorProxy.h */, 8697 8724 1C77C1951288A872006A742F /* WebInspectorProxy.messages.in */, 8725 99B1675D252BBE0A0073140E /* WebInspectorUIExtensionControllerProxy.cpp */, 8726 99B1675A252BBADD0073140E /* WebInspectorUIExtensionControllerProxy.h */, 8698 8727 A55BA8271BA38E1E007CD33D /* WebInspectorUtilities.cpp */, 8699 8728 A55BA8281BA38E1E007CD33D /* WebInspectorUtilities.h */, … … 8758 8787 1C891D6319B124FF00BA79DD /* WebInspectorUI.h */, 8759 8788 1C891D6419B124FF00BA79DD /* WebInspectorUI.messages.in */, 8789 99B16760252BBE610073140E /* WebInspectorUIExtensionController.cpp */, 8790 99B16761252BBE610073140E /* WebInspectorUIExtensionController.h */, 8791 99B16762252BBE610073140E /* WebInspectorUIExtensionController.messages.in */, 8760 8792 A543E30A215C8A8400279CD9 /* WebPageInspectorTarget.cpp */, 8761 8793 A543E308215C8A8300279CD9 /* WebPageInspectorTarget.h */, … … 9386 9418 994C6048253F820200BDF060 /* APIInspectorConfiguration.cpp */, 9387 9419 994C6046253CACB800BDF060 /* APIInspectorConfiguration.h */, 9420 99BE3B1225422F4100C6551C /* APIInspectorExtension.h */, 9388 9421 31B362902141EABC007BFA53 /* APIInternalDebugFeature.cpp */, 9389 9422 31B3628E2141EA4D007BFA53 /* APIInternalDebugFeature.h */, … … 10416 10449 1CA8B943127C882A00576C2B /* WebInspectorProxyMessageReceiver.cpp */, 10417 10450 1CA8B944127C882A00576C2B /* WebInspectorProxyMessages.h */, 10451 9979659B25310A4800B31AE3 /* WebInspectorUIExtensionControllerMessageReceiver.cpp */, 10452 9979659A25310A4800B31AE3 /* WebInspectorUIExtensionControllerMessages.h */, 10418 10453 1CBBE49E19B66C53006B7D81 /* WebInspectorUIMessageReceiver.cpp */, 10419 10454 1CBBE49F19B66C53006B7D81 /* WebInspectorUIMessages.h */, … … 10831 10866 99036AE223A949CF0000B06A /* _WKInspectorDebuggableInfoInternal.h in Headers */, 10832 10867 9197940C23DBC50300257892 /* _WKInspectorDelegate.h in Headers */, 10868 99B16757252BB7E10073140E /* _WKInspectorExtension.h in Headers */, 10869 997965A3253128C700B31AE3 /* _WKInspectorExtensionHost.h in Headers */, 10870 99B16758252BB7E10073140E /* _WKInspectorExtensionInternal.h in Headers */, 10833 10871 5CAFDE472130846A00B1F7E1 /* _WKInspectorInternal.h in Headers */, 10834 10872 9979CA58237F49F10039EC05 /* _WKInspectorPrivate.h in Headers */, … … 11571 11609 1CA8B946127C882A00576C2B /* WebInspectorProxyMessages.h in Headers */, 11572 11610 1C891D6619B124FF00BA79DD /* WebInspectorUI.h in Headers */, 11611 99B16764252BBE620073140E /* WebInspectorUIExtensionController.h in Headers */, 11612 9979659E25310A4900B31AE3 /* WebInspectorUIExtensionControllerMessages.h in Headers */, 11613 99B1675B252BBADD0073140E /* WebInspectorUIExtensionControllerProxy.h in Headers */, 11573 11614 1CBBE4A119B66C53006B7D81 /* WebInspectorUIMessages.h in Headers */, 11574 11615 A55BA82B1BA38E61007CD33D /* WebInspectorUtilities.h in Headers */, … … 13391 13432 1C8E2A351277852400BC7BD0 /* WebInspectorMessageReceiver.cpp in Sources */, 13392 13433 1CA8B945127C882A00576C2B /* WebInspectorProxyMessageReceiver.cpp in Sources */, 13434 9979659F25310A4900B31AE3 /* WebInspectorUIExtensionControllerMessageReceiver.cpp in Sources */, 13393 13435 1CBBE4A019B66C53006B7D81 /* WebInspectorUIMessageReceiver.cpp in Sources */, 13394 13436 2D92A78A212B6AB100F493FD /* WebKeyboardEvent.cpp in Sources */, -
trunk/Source/WebKit/WebProcess/Inspector/RemoteWebInspectorUI.cpp
r269524 r269701 40 40 #include <WebCore/Settings.h> 41 41 42 #if ENABLE(INSPECTOR_EXTENSIONS) 43 #include "WebInspectorUIExtensionController.h" 44 #endif 45 42 46 #if !PLATFORM(MAC) && !PLATFORM(GTK) && !PLATFORM(WIN) 43 47 #include <WebCore/NotImplemented.h> … … 59 63 } 60 64 65 RemoteWebInspectorUI::~RemoteWebInspectorUI() = default; 66 61 67 void RemoteWebInspectorUI::initialize(DebuggableInfoData&& debuggableInfo, const String& backendCommandsURL) 62 68 { 69 #if ENABLE(INSPECTOR_EXTENSIONS) 70 m_extensionController = makeUnique<WebInspectorUIExtensionController>(*this); 71 #endif 72 63 73 m_debuggableInfo = WTFMove(debuggableInfo); 64 74 m_backendCommandsURL = backendCommandsURL; … … 109 119 110 120 m_frontendAPIDispatcher->dispatchCommandWithResultAsync("setIsVisible"_s, { JSON::Value::create(true) }); 121 122 WebProcess::singleton().parentProcessConnection()->send(Messages::RemoteWebInspectorProxy::FrontendLoaded(), m_page.identifier()); 111 123 112 124 bringToFront(); … … 175 187 m_page.corePage()->inspectorController().setInspectorFrontendClient(nullptr); 176 188 189 #if ENABLE(INSPECTOR_EXTENSIONS) 190 m_extensionController = nullptr; 191 #endif 192 177 193 WebProcess::singleton().parentProcessConnection()->send(Messages::RemoteWebInspectorProxy::FrontendDidClose(), m_page.identifier()); 178 194 } … … 259 275 #endif 260 276 277 WebCore::Page* RemoteWebInspectorUI::frontendPage() 278 { 279 return m_page.corePage(); 280 } 281 282 261 283 #if !PLATFORM(MAC) && !PLATFORM(GTK) && !PLATFORM(WIN) 262 284 String RemoteWebInspectorUI::localizedStringsURL() const -
trunk/Source/WebKit/WebProcess/Inspector/RemoteWebInspectorUI.h
r269524 r269701 40 40 namespace WebKit { 41 41 42 class WebInspectorUIExtensionController; 42 43 class WebPage; 43 44 44 class RemoteWebInspectorUI final : public RefCounted<RemoteWebInspectorUI>, public IPC::MessageReceiver, public WebCore::InspectorFrontendClient { 45 class RemoteWebInspectorUI final 46 : public RefCounted<RemoteWebInspectorUI> 47 , public IPC::MessageReceiver 48 , public WebCore::InspectorFrontendClient { 45 49 public: 46 50 static Ref<RemoteWebInspectorUI> create(WebPage&); 51 ~RemoteWebInspectorUI(); 47 52 48 53 // Implemented in generated RemoteWebInspectorUIMessageReceiver.cpp … … 98 103 void sendMessageToBackend(const String&) override; 99 104 WebCore::InspectorFrontendAPIDispatcher& frontendAPIDispatcher() override { return m_frontendAPIDispatcher; } 105 WebCore::Page* frontendPage() final; 100 106 101 107 #if ENABLE(INSPECTOR_TELEMETRY) … … 118 124 Ref<WebCore::InspectorFrontendAPIDispatcher> m_frontendAPIDispatcher; 119 125 RefPtr<WebCore::InspectorFrontendHost> m_frontendHost; 126 #if ENABLE(INSPECTOR_EXTENSIONS) 127 std::unique_ptr<WebInspectorUIExtensionController> m_extensionController; 128 #endif 129 120 130 DebuggableInfoData m_debuggableInfo; 121 131 String m_backendCommandsURL; -
trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUI.cpp
r269524 r269701 37 37 #include <WebCore/FloatRect.h> 38 38 #include <WebCore/InspectorController.h> 39 #include <WebCore/InspectorFrontendHost.h> 39 40 #include <WebCore/NotImplemented.h> 40 41 #include <WebCore/RuntimeEnabledFeatures.h> 41 42 #include <WebCore/Settings.h> 43 44 #if ENABLE(INSPECTOR_EXTENSIONS) 45 #include "WebInspectorUIExtensionController.h" 46 #endif 42 47 43 48 namespace WebKit { … … 66 71 } 67 72 73 WebInspectorUI::~WebInspectorUI() = default; 74 68 75 void WebInspectorUI::establishConnection(WebPageProxyIdentifier inspectedPageIdentifier, const DebuggableInfoData& debuggableInfo, bool underTest, unsigned inspectionLevel) 69 76 { … … 73 80 m_inspectionLevel = inspectionLevel; 74 81 82 #if ENABLE(INSPECTOR_EXTENSIONS) 83 if (!m_extensionController) 84 m_extensionController = makeUnique<WebInspectorUIExtensionController>(*this); 85 #endif 86 75 87 m_frontendAPIDispatcher->reset(); 76 77 88 m_frontendController = &m_page.corePage()->inspectorController(); 78 89 m_frontendController->setInspectorFrontendClient(this); … … 166 177 m_inspectedPageIdentifier = { }; 167 178 m_underTest = false; 179 180 #if ENABLE(INSPECTOR_EXTENSIONS) 181 m_extensionController = nullptr; 182 #endif 168 183 } 169 184 … … 413 428 } 414 429 430 WebCore::Page* WebInspectorUI::frontendPage() 431 { 432 return m_page.corePage(); 433 } 434 435 415 436 #if !PLATFORM(MAC) && !PLATFORM(GTK) && !PLATFORM(WIN) 416 437 bool WebInspectorUI::canSave() -
trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUI.h
r269524 r269701 32 32 #include <WebCore/InspectorFrontendAPIDispatcher.h> 33 33 #include <WebCore/InspectorFrontendClient.h> 34 #include <WebCore/InspectorFrontendHost.h>35 34 36 35 namespace WebCore { 37 36 class InspectorController; 37 class InspectorFrontendHost; 38 38 class CertificateInfo; 39 39 class FloatRect; … … 43 43 44 44 class WebPage; 45 #if ENABLE(INSPECTOR_EXTENSIONS) 46 class WebInspectorUIExtensionController; 47 #endif 45 48 46 class WebInspectorUI : public RefCounted<WebInspectorUI>, private IPC::Connection::Client, public WebCore::InspectorFrontendClient { 49 class WebInspectorUI final 50 : public RefCounted<WebInspectorUI> 51 , private IPC::Connection::Client 52 , public WebCore::InspectorFrontendClient { 47 53 public: 48 54 static Ref<WebInspectorUI> create(WebPage&); 55 virtual ~WebInspectorUI(); 49 56 50 57 static void enableFrontendFeatures(); … … 144 151 void sendMessageToBackend(const String&) override; 145 152 WebCore::InspectorFrontendAPIDispatcher& frontendAPIDispatcher() final { return m_frontendAPIDispatcher; } 146 153 WebCore::Page* frontendPage() final; 154 147 155 void pagePaused() override; 148 156 void pageUnpaused() override; … … 161 169 WebCore::InspectorController* m_frontendController { nullptr }; 162 170 171 #if ENABLE(INSPECTOR_EXTENSIONS) 172 std::unique_ptr<WebInspectorUIExtensionController> m_extensionController; 173 #endif 174 163 175 WebPageProxyIdentifier m_inspectedPageIdentifier; 164 176 bool m_underTest { false }; -
trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUIExtensionController.messages.in
r269700 r269701 1 # Copyright (C) 20 16-2020 Apple Inc. All rights reserved.1 # Copyright (C) 2020 Apple Inc. All rights reserved. 2 2 # 3 3 # Redistribution and use in source and binary forms, with or without … … 21 21 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 22 23 messages -> RemoteWebInspectorProxy { 24 FrontendDidClose() 25 Reopen() 26 ResetState() 27 BringToFront() 23 #if ENABLE(INSPECTOR_EXTENSIONS) 28 24 29 Save(String filename, String content, bool base64Encoded, bool forceSaveAs) 30 Append(String filename, String content) 25 messages -> WebInspectorUIExtensionController NotRefCounted { 26 RegisterExtension(String extensionID, String displayName) -> (Expected<bool, WebKit::InspectorExtensionError> result) Async 27 UnregisterExtension(String extensionID) -> (Expected<bool, WebKit::InspectorExtensionError> result) Async 28 } 31 29 32 SetForcedAppearance(WebCore::InspectorFrontendClient::Appearance appearance) 33 34 SetSheetRect(WebCore::FloatRect rect) 35 36 StartWindowDrag() 37 38 OpenURLExternally(String url) 39 ShowCertificate(WebCore::CertificateInfo certificateInfo) 40 41 SendMessageToBackend(String message) 42 } 30 #endif // ENABLE(INSPECTOR_EXTENSIONS) -
trunk/Tools/ChangeLog
r269699 r269701 1 2020-11-11 Brian Burg <bburg@apple.com> 2 3 [Cocoa] Inspector Extensions: Add _WKInspectorExtension and related plumbing 4 https://bugs.webkit.org/show_bug.cgi?id=217783 5 <rdar://problem/69968787> 6 7 Reviewed by Devin Rousso. 8 9 Add API tests to exercise new methods of the _WKInspectorExtensionHost protocol. 10 11 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: New test file. 12 * TestWebKitAPI/Tests/WebKitCocoa/WKInspectorExtensionHost.mm: Added. 13 (resetGlobalState): 14 (-[UIDelegateForTestingInspectorExtensionHost _webView:didAttachLocalInspector:]): 15 (TEST): 16 1 17 2020-11-11 Aakash Jain <aakash_jain@apple.com> 2 18 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r269671 r269701 839 839 9984FACE1CFFB090008D198C /* editable-body.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 9984FACD1CFFB038008D198C /* editable-body.html */; }; 840 840 9999108B1F393C96008AD455 /* Copying.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9999108A1F393C8B008AD455 /* Copying.mm */; }; 841 999B7EE32551C63B00F450A4 /* WKInspectorExtensionHost.mm in Sources */ = {isa = PBXBuildFile; fileRef = 999B7EE22551C63B00F450A4 /* WKInspectorExtensionHost.mm */; }; 841 842 99B4F9C624EDED9700022B82 /* WKInspectorDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 99B4F9C524EDED9600022B82 /* WKInspectorDelegate.mm */; }; 842 843 9B02E0D6235FA47D004044B2 /* TextManipulation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9B02E0D5235FA47D004044B2 /* TextManipulation.mm */; }; … … 2457 2458 9984FACD1CFFB038008D198C /* editable-body.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "editable-body.html"; sourceTree = "<group>"; }; 2458 2459 9999108A1F393C8B008AD455 /* Copying.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Copying.mm; sourceTree = "<group>"; }; 2460 999B7EE22551C63B00F450A4 /* WKInspectorExtensionHost.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKInspectorExtensionHost.mm; sourceTree = "<group>"; }; 2459 2461 99B4F9C524EDED9600022B82 /* WKInspectorDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKInspectorDelegate.mm; sourceTree = "<group>"; }; 2460 2462 9B02E0D5235FA47D004044B2 /* TextManipulation.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = TextManipulation.mm; sourceTree = "<group>"; }; … … 3427 3429 51D124971E763AF8002B2820 /* WKHTTPCookieStore.mm */, 3428 3430 99B4F9C524EDED9600022B82 /* WKInspectorDelegate.mm */, 3431 999B7EE22551C63B00F450A4 /* WKInspectorExtensionHost.mm */, 3429 3432 A5A729F01F622A9A00DE5A28 /* WKNavigationResponse.mm */, 3430 3433 DF4B273821A47727009BD1CA /* WKNSDictionaryEmptyDictionaryCrash.mm */, … … 5567 5570 7CCE7F1D1A411AE600447C4C /* WKImageCreateCGImageCrash.cpp in Sources */, 5568 5571 99B4F9C624EDED9700022B82 /* WKInspectorDelegate.mm in Sources */, 5572 999B7EE32551C63B00F450A4 /* WKInspectorExtensionHost.mm in Sources */, 5569 5573 A5A729F11F622AA700DE5A28 /* WKNavigationResponse.mm in Sources */, 5570 5574 DF4B273921A47728009BD1CA /* WKNSDictionaryEmptyDictionaryCrash.mm in Sources */,
Note: See TracChangeset
for help on using the changeset viewer.