Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (286328 => 286329)
--- trunk/Source/WebInspectorUI/ChangeLog 2021-11-30 22:30:24 UTC (rev 286328)
+++ trunk/Source/WebInspectorUI/ChangeLog 2021-11-30 22:58:27 UTC (rev 286329)
@@ -1,3 +1,50 @@
+2021-11-30 BJ Burg <[email protected]>
+
+ Web Inspector: add ExtensionTabActivation diagnostic event
+ https://bugs.webkit.org/show_bug.cgi?id=233101
+ <rdar://85264921>
+
+ Reviewed by Devin Rousso.
+
+ Add new diagnostic event that reports the first activation of
+ an extension tab. Also report the number of active extension tabs.
+
+ * UserInterface/Controllers/ExtensionTabActivationDiagnosticEventRecorder.js: Added.
+ (WI.ExtensionTabActivationDiagnosticEventRecorder):
+ (WI.ExtensionTabActivationDiagnosticEventRecorder.prototype.setup):
+ (WI.ExtensionTabActivationDiagnosticEventRecorder.prototype.teardown):
+ (WI.ExtensionTabActivationDiagnosticEventRecorder.prototype._selectedTabContentViewDidChange):
+ Report only the first activation. The extension tab iframe does not load until
+ the first time that the tab is selected and shown.
+
+ * UserInterface/Base/Main.js:
+ (WI.contentLoaded): Add diagnostic event recorder if extensions are supported.
+
+ * UserInterface/Controllers/WebInspectorExtensionController.js:
+ (WI.WebInspectorExtensionController.prototype.registerExtension):
+ Pass along the new extensionBundleIdentifier argument to the model object.
+
+ (WI.WebInspectorExtensionController.prototype.activeExtensionTabContentViews):
+ Added. This is a helper method for collecting diagnostic event data.
+
+ * UserInterface/Debug/Bootstrap.js:
+ (updateMockWebExtensionTab):
+ (WI.runBootstrapOperations):
+ Pass new extensionBundleIdentifier argument for the Mock Extension.
+
+ * UserInterface/Main.html: Add new file.
+ * UserInterface/Models/WebInspectorExtension.js:
+ (WI.WebInspectorExtension):
+ (WI.WebInspectorExtension.prototype.get extensionBundleIdentifier):
+ Store the extension bundle identifier on the model object. Add a getter.
+
+ * UserInterface/Protocol/InspectorFrontendAPI.js:
+ (InspectorFrontendAPI.registerExtension):
+ Pass new extensionBundleIdentifier argument.
+
+ * UserInterface/Views/WebInspectorExtensionTabContentView.js:
+ (WI.WebInspectorExtensionTabContentView.prototype.get extension): Added.
+
2021-11-29 Simon Fraser <[email protected]>
Remove some unused event names
Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (286328 => 286329)
--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js 2021-11-30 22:30:24 UTC (rev 286328)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js 2021-11-30 22:58:27 UTC (rev 286329)
@@ -608,6 +608,9 @@
WI.diagnosticController.addRecorder(new WI.GridOverlayDiagnosticEventRecorder(WI.diagnosticController));
WI.diagnosticController.addRecorder(new WI.GridOverlayConfigurationDiagnosticEventRecorder(WI.diagnosticController));
}
+
+ if (InspectorFrontendHost.supportsWebExtensions)
+ WI.diagnosticController.addRecorder(new WI.ExtensionTabActivationDiagnosticEventRecorder(WI.diagnosticController));
}
};
Added: trunk/Source/WebInspectorUI/UserInterface/Controllers/ExtensionTabActivationDiagnosticEventRecorder.js (0 => 286329)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/ExtensionTabActivationDiagnosticEventRecorder.js (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/ExtensionTabActivationDiagnosticEventRecorder.js 2021-11-30 22:58:27 UTC (rev 286329)
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WI.ExtensionTabActivationDiagnosticEventRecorder = class ExtensionTabActivationDiagnosticEventRecorder extends WI.DiagnosticEventRecorder
+{
+ constructor(controller)
+ {
+ super("ExtensionTabActivation", controller);
+
+ this._reportedExtensionTabIDs = new Set;
+ }
+
+ // Protected
+
+ setup()
+ {
+ WI.tabBrowser.addEventListener(WI.TabBrowser.Event.SelectedTabContentViewDidChange, this._selectedTabContentViewDidChange, this);
+ }
+
+ teardown()
+ {
+ WI.tabBrowser.removeEventListener(WI.TabBrowser.Event.SelectedTabContentViewDidChange, this._selectedTabContentViewDidChange, this);
+ }
+
+ // Private
+
+ _selectedTabContentViewDidChange(event)
+ {
+ let selectedTab = event.data.incomingTab;
+ if (!(selectedTab instanceof WI.WebInspectorExtensionTabContentView))
+ return;
+
+ let extension = selectedTab.extension;
+ console.assert(extension instanceof WI.WebInspectorExtension, "Extension tab should have an associated extension.");
+
+ // Only report the first selection of an extension tab.
+ if (this._reportedExtensionTabIDs.has(selectedTab.extensionTabID))
+ return;
+
+ this._reportedExtensionTabIDs.add(selectedTab.extensionTabID);
+
+ this.logDiagnosticEvent(this.name, {
+ extensionBundleIdentifier: extension.extensionBundleIdentifier,
+ extensionTabName: selectedTab.tabInfo().displayName,
+ activeExtensionTabCount: WI.sharedApp.extensionController.activeExtensionTabContentViews().length,
+ });
+ }
+};
+
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/WebInspectorExtensionController.js (286328 => 286329)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/WebInspectorExtensionController.js 2021-11-30 22:30:24 UTC (rev 286328)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/WebInspectorExtensionController.js 2021-11-30 22:58:27 UTC (rev 286329)
@@ -44,7 +44,7 @@
return new Set(this._extensionForExtensionIDMap.keys());
}
- registerExtension(extensionID, displayName)
+ registerExtension(extensionID, extensionBundleIdentifier, displayName)
{
if (this._extensionForExtensionIDMap.has(extensionID)) {
WI.reportInternalError("Unable to register extension, it's already registered: " + extensionID);
@@ -51,7 +51,7 @@
return WI.WebInspectorExtension.ErrorCode.RegistrationFailed;
}
- let extension = new WI.WebInspectorExtension(extensionID, displayName);
+ let extension = new WI.WebInspectorExtension(extensionID, extensionBundleIdentifier, displayName);
this._extensionForExtensionIDMap.set(extensionID, extension);
this.dispatchEventToListeners(WI.WebInspectorExtensionController.Event.ExtensionAdded, {extension});
@@ -232,6 +232,11 @@
}
}
+ activeExtensionTabContentViews()
+ {
+ return Array.from(this._extensionTabContentViewForExtensionTabIDMap.values()).filter((tab) => tab.visible || tab.tabBarItem.parentTabBar);
+ }
+
evaluateScriptInExtensionTab(extensionTabID, scriptSource)
{
let tabContentView = this._extensionTabContentViewForExtensionTabIDMap.get(extensionTabID);
Modified: trunk/Source/WebInspectorUI/UserInterface/Debug/Bootstrap.js (286328 => 286329)
--- trunk/Source/WebInspectorUI/UserInterface/Debug/Bootstrap.js 2021-11-30 22:30:24 UTC (rev 286328)
+++ trunk/Source/WebInspectorUI/UserInterface/Debug/Bootstrap.js 2021-11-30 22:58:27 UTC (rev 286329)
@@ -143,6 +143,7 @@
function updateMockWebExtensionTab() {
let mockData = {
extensionID: "1234567890ABCDEF",
+ extensionBundleIdentifier: "org.webkit.WebInspector.MockExtension",
displayName: WI.unlocalizedString("Mock Extension"),
tabName: WI.unlocalizedString("Mock"),
tabIconURL: "Images/Info.svg",
@@ -157,7 +158,7 @@
return;
}
- let error = InspectorFrontendAPI.registerExtension(mockData.extensionID, mockData.displayName);
+ let error = InspectorFrontendAPI.registerExtension(mockData.extensionID, mockData.extensionBundleIdentifier, mockData.displayName);
if (error) {
WI.reportInternalError("Problem creating mock web extension: " + error);
return;
Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (286328 => 286329)
--- trunk/Source/WebInspectorUI/UserInterface/Main.html 2021-11-30 22:30:24 UTC (rev 286328)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html 2021-11-30 22:58:27 UTC (rev 286329)
@@ -937,6 +937,7 @@
<script src=""
<script src=""
+ <script src=""
<script src=""
<script src=""
<script src=""
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/WebInspectorExtension.js (286328 => 286329)
--- trunk/Source/WebInspectorUI/UserInterface/Models/WebInspectorExtension.js 2021-11-30 22:30:24 UTC (rev 286328)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/WebInspectorExtension.js 2021-11-30 22:58:27 UTC (rev 286329)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2020-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -25,12 +25,14 @@
WI.WebInspectorExtension = class WebInspectorExtension
{
- constructor(extensionID, displayName)
+ constructor(extensionID, extensionBundleIdentifier, displayName)
{
console.assert(typeof extensionID === "string", extensionID);
+ console.assert(typeof extensionBundleIdentifier === "string", extensionBundleIdentifier);
console.assert(typeof displayName === "string", displayName);
this._extensionID = extensionID;
+ this._extensionBundleIdentifier = extensionBundleIdentifier;
this._displayName = displayName;
}
@@ -37,6 +39,7 @@
// Public
get extensionID() { return this._extensionID; }
+ get extensionBundleIdentifier() { return this._extensionBundleIdentifier; }
get displayName() { return this._displayName; }
};
Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js (286328 => 286329)
--- trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js 2021-11-30 22:30:24 UTC (rev 286328)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js 2021-11-30 22:58:27 UTC (rev 286329)
@@ -199,9 +199,9 @@
},
// Returns a WI.WebInspectorExtension.ErrorCode if an error occurred, otherwise nothing.
- registerExtension(extensionID, displayName)
+ registerExtension(extensionID, extensionBundleIdentifier, displayName)
{
- return WI.sharedApp.extensionController.registerExtension(extensionID, displayName);
+ return WI.sharedApp.extensionController.registerExtension(extensionID, extensionBundleIdentifier, displayName);
},
// Returns a WI.WebInspectorExtension.ErrorCode if an error occurred, otherwise nothing.
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/WebInspectorExtensionTabContentView.js (286328 => 286329)
--- trunk/Source/WebInspectorUI/UserInterface/Views/WebInspectorExtensionTabContentView.js 2021-11-30 22:30:24 UTC (rev 286328)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/WebInspectorExtensionTabContentView.js 2021-11-30 22:58:27 UTC (rev 286329)
@@ -59,6 +59,7 @@
// Public
+ get extension() { return this._extension; }
get extensionTabID() { return this._extensionTabID; }
get iframeElement() { return this._iframeElement; }
Modified: trunk/Source/WebKit/ChangeLog (286328 => 286329)
--- trunk/Source/WebKit/ChangeLog 2021-11-30 22:30:24 UTC (rev 286328)
+++ trunk/Source/WebKit/ChangeLog 2021-11-30 22:58:27 UTC (rev 286329)
@@ -1,3 +1,29 @@
+2021-11-30 BJ Burg <[email protected]>
+
+ Web Inspector: add ExtensionTabActivation diagnostic event
+ https://bugs.webkit.org/show_bug.cgi?id=233101
+ <rdar://85264921>
+
+ Reviewed by Devin Rousso.
+
+ Add plumbing for new argument 'extensionBundleIdentifier' that's
+ passed to WebInspectorUI when registering an extension.
+
+ * UIProcess/API/Cocoa/_WKInspector.mm:
+ (-[_WKInspector registerExtensionWithID:extensionBundleIdentifier:displayName:completionHandler:]):
+ (-[_WKInspector registerExtensionWithID:displayName:completionHandler:]): Deleted.
+ * UIProcess/API/Cocoa/_WKInspectorExtensionHost.h:
+ * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm:
+ (-[_WKRemoteWebInspectorViewController registerExtensionWithID:extensionBundleIdentifier:displayName:completionHandler:]):
+ (-[_WKRemoteWebInspectorViewController registerExtensionWithID:displayName:completionHandler:]): Deleted.
+ * UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp:
+ (WebKit::WebInspectorUIExtensionControllerProxy::registerExtension):
+ * UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.h:
+ * WebProcess/Inspector/WebInspectorUIExtensionController.cpp:
+ (WebKit::WebInspectorUIExtensionController::registerExtension):
+ * WebProcess/Inspector/WebInspectorUIExtensionController.h:
+ * WebProcess/Inspector/WebInspectorUIExtensionController.messages.in:
+
2021-11-30 Myles C. Maxfield <[email protected]>
[WebGPU] Hook up StreamServerConnection to Remote*** classes
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspector.mm (286328 => 286329)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspector.mm 2021-11-30 22:30:24 UTC (rev 286328)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspector.mm 2021-11-30 22:58:27 UTC (rev 286329)
@@ -226,7 +226,7 @@
return self.inspectorWebView;
}
-- (void)registerExtensionWithID:(NSString *)extensionID displayName:(NSString *)displayName completionHandler:(void(^)(NSError *, _WKInspectorExtension *))completionHandler
+- (void)registerExtensionWithID:(NSString *)extensionID extensionBundleIdentifier:(NSString *)extensionBundleIdentifier displayName:(NSString *)displayName completionHandler:(void(^)(NSError *, _WKInspectorExtension *))completionHandler
{
#if ENABLE(INSPECTOR_EXTENSIONS)
// It is an error to call this method prior to creating a frontend (i.e., with -connect or -show).
@@ -235,7 +235,7 @@
return;
}
- _inspector->extensionController()->registerExtension(extensionID, displayName, [protectedSelf = retainPtr(self), capturedBlock = makeBlockPtr(completionHandler)] (Expected<RefPtr<API::InspectorExtension>, Inspector::ExtensionError> result) mutable {
+ _inspector->extensionController()->registerExtension(extensionID, extensionBundleIdentifier, displayName, [protectedSelf = retainPtr(self), capturedBlock = makeBlockPtr(completionHandler)] (Expected<RefPtr<API::InspectorExtension>, Inspector::ExtensionError> result) mutable {
if (!result) {
capturedBlock([NSError errorWithDomain:WKErrorDomain code:WKErrorUnknown userInfo:@{ NSLocalizedFailureReasonErrorKey: Inspector::extensionErrorToString(result.error())}], nil);
return;
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorExtensionHost.h (286328 => 286329)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorExtensionHost.h 2021-11-30 22:30:24 UTC (rev 286328)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorExtensionHost.h 2021-11-30 22:58:27 UTC (rev 286329)
@@ -37,12 +37,13 @@
/**
* @abstract Registers a Web Extension with the associated Web Inspector.
* @param extensionID A unique identifier for the extension.
+ * @param extensionBundleIdentifier A bundle identifier for the extension.
* @param displayName A localized display name for the extension.
* @param completionHandler The completion handler to be called when registration succeeds or fails.
*
* Web Extensions in Web Inspector are active as soon as they are registered.
*/
-- (void)registerExtensionWithID:(NSString *)extensionID displayName:(NSString *)displayName completionHandler:(void(^)(NSError * _Nullable, _WKInspectorExtension * _Nullable))completionHandler;
+- (void)registerExtensionWithID:(NSString *)extensionID extensionBundleIdentifier:(NSString *)extensionBundleIdentifier displayName:(NSString *)displayName completionHandler:(void(^)(NSError * _Nullable, _WKInspectorExtension * _Nullable))completionHandler;
/**
* @abstract Unregisters a Web Extension with the associated Web Inspector.
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm (286328 => 286329)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm 2021-11-30 22:30:24 UTC (rev 286328)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm 2021-11-30 22:58:27 UTC (rev 286329)
@@ -170,7 +170,7 @@
return self.webView;
}
-- (void)registerExtensionWithID:(NSString *)extensionID displayName:(NSString *)displayName completionHandler:(void(^)(NSError *, _WKInspectorExtension * _Nullable))completionHandler
+- (void)registerExtensionWithID:(NSString *)extensionID extensionBundleIdentifier:(NSString *)extensionBundleIdentifier displayName:(NSString *)displayName completionHandler:(void(^)(NSError *, _WKInspectorExtension * _Nullable))completionHandler
{
#if ENABLE(INSPECTOR_EXTENSIONS)
// If this method is called prior to creating a frontend with -loadForDebuggable:backendCommandsURL:, it will not succeed.
@@ -179,7 +179,7 @@
return;
}
- m_remoteInspectorProxy->extensionController()->registerExtension(extensionID, displayName, [protectedExtensionID = retainPtr(extensionID), protectedSelf = retainPtr(self), capturedBlock = makeBlockPtr(completionHandler)] (Expected<RefPtr<API::InspectorExtension>, Inspector::ExtensionError> result) mutable {
+ m_remoteInspectorProxy->extensionController()->registerExtension(extensionID, extensionBundleIdentifier, displayName, [protectedExtensionID = retainPtr(extensionID), protectedSelf = retainPtr(self), capturedBlock = makeBlockPtr(completionHandler)] (Expected<RefPtr<API::InspectorExtension>, Inspector::ExtensionError> result) mutable {
if (!result) {
capturedBlock([NSError errorWithDomain:WKErrorDomain code:WKErrorUnknown userInfo:@{ NSLocalizedFailureReasonErrorKey: Inspector::extensionErrorToString(result.error()) }], nil);
return;
Modified: trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp (286328 => 286329)
--- trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp 2021-11-30 22:30:24 UTC (rev 286328)
+++ trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp 2021-11-30 22:58:27 UTC (rev 286329)
@@ -92,15 +92,15 @@
// API
-void WebInspectorUIExtensionControllerProxy::registerExtension(const Inspector::ExtensionID& extensionID, const String& displayName, WTF::CompletionHandler<void(Expected<RefPtr<API::InspectorExtension>, Inspector::ExtensionError>)>&& completionHandler)
+void WebInspectorUIExtensionControllerProxy::registerExtension(const Inspector::ExtensionID& extensionID, const String& extensionBundleIdentifier, const String& displayName, WTF::CompletionHandler<void(Expected<RefPtr<API::InspectorExtension>, Inspector::ExtensionError>)>&& completionHandler)
{
- whenFrontendHasLoaded([weakThis = WeakPtr { *this }, extensionID, displayName, completionHandler = WTFMove(completionHandler)] () mutable {
+ whenFrontendHasLoaded([weakThis = WeakPtr { *this }, extensionID, extensionBundleIdentifier, displayName, completionHandler = WTFMove(completionHandler)] () mutable {
if (!weakThis || !weakThis->m_inspectorPage) {
completionHandler(makeUnexpected(Inspector::ExtensionError::InvalidRequest));
return;
}
- weakThis->m_inspectorPage->sendWithAsyncReply(Messages::WebInspectorUIExtensionController::RegisterExtension { extensionID, displayName }, [strongThis = Ref { *weakThis.get() }, extensionID, completionHandler = WTFMove(completionHandler)](Expected<void, Inspector::ExtensionError> result) mutable {
+ weakThis->m_inspectorPage->sendWithAsyncReply(Messages::WebInspectorUIExtensionController::RegisterExtension { extensionID, extensionBundleIdentifier, displayName }, [strongThis = Ref { *weakThis.get() }, extensionID, completionHandler = WTFMove(completionHandler)](Expected<void, Inspector::ExtensionError> result) mutable {
if (!result) {
completionHandler(makeUnexpected(Inspector::ExtensionError::RegistrationFailed));
return;
Modified: trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.h (286328 => 286329)
--- trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.h 2021-11-30 22:30:24 UTC (rev 286328)
+++ trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.h 2021-11-30 22:58:27 UTC (rev 286329)
@@ -55,7 +55,7 @@
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
// API.
- void registerExtension(const Inspector::ExtensionID&, const String& displayName, WTF::CompletionHandler<void(Expected<RefPtr<API::InspectorExtension>, Inspector::ExtensionError>)>&&);
+ void registerExtension(const Inspector::ExtensionID&, const String& extensionBundleIdentifier, const String& displayName, WTF::CompletionHandler<void(Expected<RefPtr<API::InspectorExtension>, Inspector::ExtensionError>)>&&);
void unregisterExtension(const Inspector::ExtensionID&, WTF::CompletionHandler<void(Expected<void, Inspector::ExtensionError>)>&&);
void createTabForExtension(const Inspector::ExtensionID&, const String& tabName, const URL& tabIconURL, const URL& sourceURL, WTF::CompletionHandler<void(Expected<Inspector::ExtensionTabID, Inspector::ExtensionError>)>&&);
void evaluateScriptForExtension(const Inspector::ExtensionID&, const String& scriptSource, const std::optional<URL>& frameURL, const std::optional<URL>& contextSecurityOrigin, const std::optional<bool>& useContentScriptContext, WTF::CompletionHandler<void(Inspector::ExtensionEvaluationResult)>&&);
Modified: trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUIExtensionController.cpp (286328 => 286329)
--- trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUIExtensionController.cpp 2021-11-30 22:30:24 UTC (rev 286328)
+++ trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUIExtensionController.cpp 2021-11-30 22:58:27 UTC (rev 286329)
@@ -109,7 +109,7 @@
// WebInspectorUIExtensionController IPC messages.
-void WebInspectorUIExtensionController::registerExtension(const Inspector::ExtensionID& extensionID, const String& displayName, CompletionHandler<void(Expected<void, Inspector::ExtensionError>)>&& completionHandler)
+void WebInspectorUIExtensionController::registerExtension(const Inspector::ExtensionID& extensionID, const String& extensionBundleIdentifier, const String& displayName, CompletionHandler<void(Expected<void, Inspector::ExtensionError>)>&& completionHandler)
{
if (!m_frontendClient) {
completionHandler(makeUnexpected(Inspector::ExtensionError::InvalidRequest));
@@ -118,6 +118,7 @@
Vector<Ref<JSON::Value>> arguments {
JSON::Value::create(extensionID),
+ JSON::Value::create(extensionBundleIdentifier),
JSON::Value::create(displayName),
};
m_frontendClient->frontendAPIDispatcher().dispatchCommandWithResultAsync("registerExtension"_s, WTFMove(arguments), [weakThis = WeakPtr { *this }, completionHandler = WTFMove(completionHandler)](WebCore::InspectorFrontendAPIDispatcher::EvaluationResult&& result) mutable {
Modified: trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUIExtensionController.h (286328 => 286329)
--- trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUIExtensionController.h 2021-11-30 22:30:24 UTC (rev 286328)
+++ trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUIExtensionController.h 2021-11-30 22:58:27 UTC (rev 286329)
@@ -63,7 +63,7 @@
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
// WebInspectorUIExtensionController IPC messages.
- void registerExtension(const Inspector::ExtensionID&, const String& displayName, CompletionHandler<void(Expected<void, Inspector::ExtensionError>)>&&);
+ void registerExtension(const Inspector::ExtensionID&, const String& extensionBundleIdentifier, const String& displayName, CompletionHandler<void(Expected<void, Inspector::ExtensionError>)>&&);
void unregisterExtension(const Inspector::ExtensionID&, CompletionHandler<void(Expected<void, Inspector::ExtensionError>)>&&);
void createTabForExtension(const Inspector::ExtensionID&, const String& tabName, const URL& tabIconURL, const URL& sourceURL, CompletionHandler<void(Expected<Inspector::ExtensionTabID, Inspector::ExtensionError>)>&&);
void evaluateScriptForExtension(const Inspector::ExtensionID&, const String& scriptSource, const std::optional<URL>& frameURL, const std::optional<URL>& contextSecurityOrigin, const std::optional<bool>& useContentScriptContext, CompletionHandler<void(const IPC::DataReference&, const std::optional<WebCore::ExceptionDetails>&, const std::optional<Inspector::ExtensionError>&)>&&);
Modified: trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUIExtensionController.messages.in (286328 => 286329)
--- trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUIExtensionController.messages.in 2021-11-30 22:30:24 UTC (rev 286328)
+++ trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUIExtensionController.messages.in 2021-11-30 22:58:27 UTC (rev 286329)
@@ -23,7 +23,7 @@
#if ENABLE(INSPECTOR_EXTENSIONS)
messages -> WebInspectorUIExtensionController NotRefCounted {
- RegisterExtension(String extensionID, String displayName) -> (Expected<void, Inspector::ExtensionError> result) Async
+ RegisterExtension(String extensionID, String extensionBundleIdentifier, String displayName) -> (Expected<void, Inspector::ExtensionError> result) Async
UnregisterExtension(String extensionID) -> (Expected<void, Inspector::ExtensionError> result) Async
CreateTabForExtension(String extensionID, String tabName, URL tabIconURL, URL sourceURL) -> (Expected<String, Inspector::ExtensionError> result) Async
Modified: trunk/Tools/ChangeLog (286328 => 286329)
--- trunk/Tools/ChangeLog 2021-11-30 22:30:24 UTC (rev 286328)
+++ trunk/Tools/ChangeLog 2021-11-30 22:58:27 UTC (rev 286329)
@@ -1,3 +1,19 @@
+2021-11-30 BJ Burg <[email protected]>
+
+ Web Inspector: add ExtensionTabActivation diagnostic event
+ https://bugs.webkit.org/show_bug.cgi?id=233101
+ <rdar://85264921>
+
+ Reviewed by Devin Rousso.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/WKInspectorExtension.mm:
+ (TEST):
+ * TestWebKitAPI/Tests/WebKitCocoa/WKInspectorExtensionDelegate.mm:
+ (TEST):
+ * TestWebKitAPI/Tests/WebKitCocoa/WKInspectorExtensionHost.mm:
+ (TEST):
+ Start using new method parameter 'extensionBundleIdentifier'.
+
2021-11-30 Brent Fulgham <[email protected]>
Correct serialization error in _WKApplicationManifestIcon
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKInspectorExtension.mm (286328 => 286329)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKInspectorExtension.mm 2021-11-30 22:30:24 UTC (rev 286328)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKInspectorExtension.mm 2021-11-30 22:58:27 UTC (rev 286329)
@@ -100,11 +100,12 @@
TestWebKitAPI::Util::run(&didAttachLocalInspectorCalled);
auto extensionID = [NSUUID UUID].UUIDString;
+ auto extensionBundleIdentifier = @"org.webkit.TestWebKitAPI.FirstExtension";
auto extensionDisplayName = @"FirstExtension";
// Register the test extension.
pendingCallbackWasCalled = false;
- [[webView _inspector] registerExtensionWithID:extensionID displayName:extensionDisplayName completionHandler:^(NSError * _Nullable error, _WKInspectorExtension * _Nullable extension) {
+ [[webView _inspector] registerExtensionWithID:extensionID extensionBundleIdentifier:extensionBundleIdentifier displayName:extensionDisplayName completionHandler:^(NSError * _Nullable error, _WKInspectorExtension * _Nullable extension) {
EXPECT_NULL(error);
EXPECT_NOT_NULL(extension);
sharedInspectorExtension = extension;
@@ -190,11 +191,12 @@
TestWebKitAPI::Util::run(&didAttachLocalInspectorCalled);
auto extensionID = [NSUUID UUID].UUIDString;
+ auto extensionBundleIdentifier = @"org.webkit.TestWebKitAPI.SecondExtension";
auto extensionDisplayName = @"SecondExtension";
// Register the test extension.
pendingCallbackWasCalled = false;
- [[webView _inspector] registerExtensionWithID:extensionID displayName:extensionDisplayName completionHandler:^(NSError * _Nullable error, _WKInspectorExtension * _Nullable extension) {
+ [[webView _inspector] registerExtensionWithID:extensionID extensionBundleIdentifier:extensionBundleIdentifier displayName:extensionDisplayName completionHandler:^(NSError * _Nullable error, _WKInspectorExtension * _Nullable extension) {
EXPECT_NULL(error);
EXPECT_NOT_NULL(extension);
sharedInspectorExtension = extension;
@@ -307,11 +309,12 @@
TestWebKitAPI::Util::run(&didAttachLocalInspectorCalled);
auto extensionID = [NSUUID UUID].UUIDString;
+ auto extensionBundleIdentifier = @"org.webkit.TestWebKitAPI.ThirdExtension";
auto extensionDisplayName = @"ThirdExtension";
// Register the test extension.
pendingCallbackWasCalled = false;
- [[webView _inspector] registerExtensionWithID:extensionID displayName:extensionDisplayName completionHandler:^(NSError * _Nullable error, _WKInspectorExtension * _Nullable extension) {
+ [[webView _inspector] registerExtensionWithID:extensionID extensionBundleIdentifier:extensionBundleIdentifier displayName:extensionDisplayName completionHandler:^(NSError * _Nullable error, _WKInspectorExtension * _Nullable extension) {
EXPECT_NULL(error);
EXPECT_NOT_NULL(extension);
sharedInspectorExtension = extension;
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKInspectorExtensionDelegate.mm (286328 => 286329)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKInspectorExtensionDelegate.mm 2021-11-30 22:30:24 UTC (rev 286328)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKInspectorExtensionDelegate.mm 2021-11-30 22:58:27 UTC (rev 286329)
@@ -108,11 +108,12 @@
TestWebKitAPI::Util::run(&didAttachLocalInspectorCalled);
auto extensionID = [NSUUID UUID].UUIDString;
+ auto extensionBundleIdentifier = @"com.apple.webkit.FirstExtension";
auto extensionDisplayName = @"FirstExtension";
// Register the test extension.
pendingCallbackWasCalled = false;
- [[webView _inspector] registerExtensionWithID:extensionID displayName:extensionDisplayName completionHandler:^(NSError * _Nullable error, _WKInspectorExtension * _Nullable extension) {
+ [[webView _inspector] registerExtensionWithID:extensionID extensionBundleIdentifier:extensionBundleIdentifier displayName:extensionDisplayName completionHandler:^(NSError * _Nullable error, _WKInspectorExtension * _Nullable extension) {
EXPECT_NULL(error);
EXPECT_NOT_NULL(extension);
sharedInspectorExtension = extension;
@@ -187,9 +188,10 @@
// Register the test extension.
auto extensionID = [NSUUID UUID].UUIDString;
+ auto extensionBundleIdentifier = @"com.apple.webkit.SecondExtension";
auto extensionDisplayName = @"SecondExtension";
pendingCallbackWasCalled = false;
- [[webView _inspector] registerExtensionWithID:extensionID displayName:extensionDisplayName completionHandler:^(NSError * _Nullable error, _WKInspectorExtension * _Nullable extension) {
+ [[webView _inspector] registerExtensionWithID:extensionID extensionBundleIdentifier:extensionBundleIdentifier displayName:extensionDisplayName completionHandler:^(NSError * _Nullable error, _WKInspectorExtension * _Nullable extension) {
EXPECT_NULL(error);
EXPECT_NOT_NULL(extension);
sharedInspectorExtension = extension;
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKInspectorExtensionHost.mm (286328 => 286329)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKInspectorExtensionHost.mm 2021-11-30 22:30:24 UTC (rev 286328)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKInspectorExtensionHost.mm 2021-11-30 22:58:27 UTC (rev 286329)
@@ -69,7 +69,7 @@
// Normal registration.
pendingCallbackWasCalled = false;
- [[webView _inspector] registerExtensionWithID:firstID displayName:@"FirstExtension" completionHandler:^(NSError * _Nullable error, _WKInspectorExtension * _Nullable extension) {
+ [[webView _inspector] registerExtensionWithID:firstID extensionBundleIdentifier:@"com.apple.webkit.FirstExtension" displayName:@"FirstExtension" completionHandler:^(NSError * _Nullable error, _WKInspectorExtension * _Nullable extension) {
EXPECT_NULL(error);
EXPECT_NOT_NULL(extension);
@@ -79,7 +79,7 @@
// Double registration.
pendingCallbackWasCalled = false;
- [[webView _inspector] registerExtensionWithID:firstID displayName:@"FirstExtension" completionHandler:^(NSError * _Nullable error, _WKInspectorExtension * _Nullable extension) {
+ [[webView _inspector] registerExtensionWithID:firstID extensionBundleIdentifier:@"com.apple.webkit.FirstExtension" displayName:@"FirstExtension" completionHandler:^(NSError * _Nullable error, _WKInspectorExtension * _Nullable extension) {
EXPECT_NOT_NULL(error);
EXPECT_NULL(extension);
EXPECT_TRUE([error.localizedFailureReason containsString:@"RegistrationFailed"]);
@@ -90,7 +90,7 @@
// Two registrations.
pendingCallbackWasCalled = false;
- [[webView _inspector] registerExtensionWithID:secondID displayName:@"SecondExtension" completionHandler:^(NSError * _Nullable error, _WKInspectorExtension * _Nullable extension) {
+ [[webView _inspector] registerExtensionWithID:secondID extensionBundleIdentifier:@"com.apple.webkit.SecondExtension" displayName:@"SecondExtension" completionHandler:^(NSError * _Nullable error, _WKInspectorExtension * _Nullable extension) {
EXPECT_NULL(error);
EXPECT_NOT_NULL(extension);
@@ -119,7 +119,7 @@
// Unregister a known extension.
pendingCallbackWasCalled = false;
- [[webView _inspector] registerExtensionWithID:firstID displayName:@"FirstExtension" completionHandler:^(NSError * _Nullable error, _WKInspectorExtension * _Nullable extension) {
+ [[webView _inspector] registerExtensionWithID:firstID extensionBundleIdentifier:@"com.apple.webkit.FirstExtension" displayName:@"FirstExtension" completionHandler:^(NSError * _Nullable error, _WKInspectorExtension * _Nullable extension) {
EXPECT_NULL(error);
EXPECT_NOT_NULL(extension);
foundExtension = extension;
@@ -135,7 +135,7 @@
// Re-register an extension.
pendingCallbackWasCalled = false;
- [[webView _inspector] registerExtensionWithID:firstID displayName:@"FirstExtension" completionHandler:^(NSError * _Nullable error, _WKInspectorExtension * _Nullable extension) {
+ [[webView _inspector] registerExtensionWithID:firstID extensionBundleIdentifier:@"com.apple.webkit.FirstExtension" displayName:@"FirstExtension" completionHandler:^(NSError * _Nullable error, _WKInspectorExtension * _Nullable extension) {
EXPECT_NULL(error);
EXPECT_NOT_NULL(extension);
foundExtension = extension;