Diff
Modified: trunk/Source/WebCore/ChangeLog (283856 => 283857)
--- trunk/Source/WebCore/ChangeLog 2021-10-09 00:41:29 UTC (rev 283856)
+++ trunk/Source/WebCore/ChangeLog 2021-10-09 01:38:43 UTC (rev 283857)
@@ -1,3 +1,23 @@
+2021-10-08 BJ Burg <bb...@apple.com>
+
+ [Cocoa] Web Inspector: provide a way for _WKInspectorExtension clients to be notified when the inspected page navigates
+ https://bugs.webkit.org/show_bug.cgi?id=231338
+ <rdar://71200338>
+
+ Reviewed by Devin Rousso.
+
+ New API test: WKInspectorExtensionDelegate.InspectedPageNavigatedCallbacks
+
+ Add plumbing for new event.
+
+ * inspector/InspectorFrontendClient.h:
+ (WebCore::InspectorFrontendClient::inspectedPageDidNavigate):
+
+ * inspector/InspectorFrontendHost.h:
+ * inspector/InspectorFrontendHost.idl:
+ * inspector/InspectorFrontendHost.cpp:
+ (WebCore::InspectorFrontendHost::inspectedPageDidNavigate):
+
2021-10-08 Chris Dumez <cdu...@apple.com>
Vectorize EqualPowerPanner::pan()
Modified: trunk/Source/WebCore/inspector/InspectorFrontendClient.h (283856 => 283857)
--- trunk/Source/WebCore/inspector/InspectorFrontendClient.h 2021-10-09 00:41:29 UTC (rev 283856)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClient.h 2021-10-09 01:38:43 UTC (rev 283857)
@@ -122,6 +122,7 @@
virtual bool supportsWebExtensions() { return false; }
virtual void didShowExtensionTab(const Inspector::ExtensionID&, const Inspector::ExtensionTabID&) { }
virtual void didHideExtensionTab(const Inspector::ExtensionID&, const Inspector::ExtensionTabID&) { }
+ virtual void inspectedPageDidNavigate(const URL&) { }
#endif
WEBCORE_EXPORT virtual void sendMessageToBackend(const String&) = 0;
Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp (283856 => 283857)
--- trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp 2021-10-09 00:41:29 UTC (rev 283856)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp 2021-10-09 01:38:43 UTC (rev 283857)
@@ -707,6 +707,14 @@
m_client->didHideExtensionTab(extensionID, extensionTabID);
}
+void InspectorFrontendHost::inspectedPageDidNavigate(const String& newURLString)
+{
+ if (!m_client)
+ return;
+
+ m_client->inspectedPageDidNavigate({ URL(), newURLString });
+}
+
ExceptionOr<JSC::JSValue> InspectorFrontendHost::evaluateScriptInExtensionTab(HTMLIFrameElement& extensionFrameElement, const String& scriptSource)
{
Frame* frame = extensionFrameElement.contentFrame();
Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.h (283856 => 283857)
--- trunk/Source/WebCore/inspector/InspectorFrontendHost.h 2021-10-09 00:41:29 UTC (rev 283856)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.h 2021-10-09 01:38:43 UTC (rev 283857)
@@ -143,6 +143,7 @@
#if ENABLE(INSPECTOR_EXTENSIONS)
void didShowExtensionTab(const String& extensionID, const String& extensionTabID);
void didHideExtensionTab(const String& extensionID, const String& extensionTabID);
+ void inspectedPageDidNavigate(const String& url);
ExceptionOr<JSC::JSValue> evaluateScriptInExtensionTab(HTMLIFrameElement& extensionFrame, const String& scriptSource);
#endif
Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.idl (283856 => 283857)
--- trunk/Source/WebCore/inspector/InspectorFrontendHost.idl 2021-10-09 00:41:29 UTC (rev 283856)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.idl 2021-10-09 01:38:43 UTC (rev 283857)
@@ -100,6 +100,7 @@
readonly attribute boolean supportsWebExtensions;
[Conditional=INSPECTOR_EXTENSIONS] undefined didShowExtensionTab(DOMString extensionID, DOMString extensionTabID);
[Conditional=INSPECTOR_EXTENSIONS] undefined didHideExtensionTab(DOMString extensionID, DOMString extensionTabID);
+ [Conditional=INSPECTOR_EXTENSIONS] undefined inspectedPageDidNavigate(DOMString newURL);
[Conditional=INSPECTOR_EXTENSIONS] any evaluateScriptInExtensionTab(HTMLIFrameElement extensionFrame, DOMString scriptSource);
};
Modified: trunk/Source/WebInspectorUI/ChangeLog (283856 => 283857)
--- trunk/Source/WebInspectorUI/ChangeLog 2021-10-09 00:41:29 UTC (rev 283856)
+++ trunk/Source/WebInspectorUI/ChangeLog 2021-10-09 01:38:43 UTC (rev 283857)
@@ -1,3 +1,23 @@
+2021-10-08 BJ Burg <bb...@apple.com>
+
+ [Cocoa] Web Inspector: provide a way for _WKInspectorExtension clients to be notified when the inspected page navigates
+ https://bugs.webkit.org/show_bug.cgi?id=231338
+ <rdar://71200338>
+
+ Reviewed by Devin Rousso.
+
+ Pass along an onNavigated event to InspectorFrontendHost when the WI.Frame.MainResourceDidChange
+ event fires at a main frame target.
+
+ * UserInterface/Controllers/WebInspectorExtensionController.js:
+ (WI.WebInspectorExtensionController):
+ (WI.WebInspectorExtensionController.prototype.registerExtension):
+ (WI.WebInspectorExtensionController.prototype.unregisterExtension):
+ Do not add this global listener unless at least one WI.WebInspectorExtension
+ is currently registered.
+
+ (WI.WebInspectorExtensionController.prototype._handleMainResourceDidChange):
+
2021-10-07 BJ Burg <bb...@apple.com>
Web Inspector: WebInspectorExtensionTabContentView should not reload its iframe when detached
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/WebInspectorExtensionController.js (283856 => 283857)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/WebInspectorExtensionController.js 2021-10-09 00:41:29 UTC (rev 283856)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/WebInspectorExtensionController.js 2021-10-09 01:38:43 UTC (rev 283857)
@@ -33,6 +33,8 @@
this._extensionTabContentViewForExtensionTabIDMap = new Map;
this._tabIDsForExtensionIDMap = new Multimap;
this._nextExtensionTabID = 1;
+
+ WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._handleMainResourceDidChange, this);
}
// Public
@@ -196,6 +198,20 @@
return {error: error.message};
}
}
+
+ // Private
+
+ _handleMainResourceDidChange(event)
+ {
+ if (!event.target.isMainFrame())
+ return;
+
+ // Don't fire the event unless one or more extensions are registered.
+ if (!this._extensionForExtensionIDMap.size)
+ return;
+
+ InspectorFrontendHost.inspectedPageDidNavigate(WI.networkManager.mainFrame.url);
+ }
};
WI.WebInspectorExtensionController.Event = {
Copied: trunk/Source/WebInspectorUI/UserInterface/Controllers/WebInspectorExtensionController.js.orig (from rev 283856, trunk/Source/WebInspectorUI/UserInterface/Controllers/WebInspectorExtensionController.js) (0 => 283857)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/WebInspectorExtensionController.js.orig (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/WebInspectorExtensionController.js.orig 2021-10-09 01:38:43 UTC (rev 283857)
@@ -0,0 +1,252 @@
+/*
+ * 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
+ * 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.WebInspectorExtensionController = class WebInspectorExtensionController extends WI.Object
+{
+ constructor()
+ {
+ super();
+
+ this._extensionForExtensionIDMap = new Map;
+ this._extensionTabContentViewForExtensionTabIDMap = new Map;
+ this._tabIDsForExtensionIDMap = new Multimap;
+ this._nextExtensionTabID = 1;
+ }
+
+ // Public
+
+ get registeredExtensionIDs()
+ {
+ return new Set(this._extensionForExtensionIDMap.keys());
+ }
+
+ registerExtension(extensionID, displayName)
+ {
+ if (this._extensionForExtensionIDMap.has(extensionID)) {
+ WI.reportInternalError("Unable to register extension, it's already registered: " + extensionID);
+ return WI.WebInspectorExtension.ErrorCode.RegistrationFailed;
+ }
+
+ let extension = new WI.WebInspectorExtension(extensionID, displayName);
+ this._extensionForExtensionIDMap.set(extensionID, extension);
+
+ this.dispatchEventToListeners(WI.WebInspectorExtensionController.Event.ExtensionAdded, {extension});
+ }
+
+ unregisterExtension(extensionID)
+ {
+ let extension = this._extensionForExtensionIDMap.take(extensionID);
+ if (!extension) {
+ WI.reportInternalError("Unable to unregister extension with unknown ID: " + extensionID);
+ return WI.WebInspectorExtension.ErrorCode.InvalidRequest;
+ }
+
+ let extensionTabIDsToRemove = this._tabIDsForExtensionIDMap.take(extensionID) || [];
+ for (let extensionTabID of extensionTabIDsToRemove) {
+ let tabContentView = this._extensionTabContentViewForExtensionTabIDMap.take(extensionTabID);
+ WI.tabBrowser.closeTabForContentView(tabContentView, {suppressAnimations: true});
+ }
+
+ this.dispatchEventToListeners(WI.WebInspectorExtensionController.Event.ExtensionRemoved, {extension});
+ }
+
+ createTabForExtension(extensionID, tabName, tabIconURL, sourceURL)
+ {
+ let extension = this._extensionForExtensionIDMap.get(extensionID);
+ if (!extension) {
+ WI.reportInternalError("Unable to create tab for extension with unknown ID: " + extensionID + " sourceURL: " + sourceURL);
+ return WI.WebInspectorExtension.ErrorCode.InvalidRequest;
+ }
+
+ let extensionTabID = `WebExtensionTab-${extensionID}-${this._nextExtensionTabID++}`;
+ let tabContentView = new WI.WebInspectorExtensionTabContentView(extension, extensionTabID, tabName, tabIconURL, sourceURL);
+
+ this._tabIDsForExtensionIDMap.add(extensionID, extensionTabID);
+ this._extensionTabContentViewForExtensionTabIDMap.set(extensionTabID, tabContentView);
+ WI.tabBrowser.addTabForContentView(tabContentView, {suppressAnimations: true});
+
+ // The calling convention is to return an error string or a result object.
+ return {extensionTabID};
+ }
+
+ evaluateScriptForExtension(extensionID, scriptSource, {frameURL, contextSecurityOrigin, useContentScriptContext} = {})
+ {
+ let extension = this._extensionForExtensionIDMap.get(extensionID);
+ if (!extension) {
+ WI.reportInternalError("Unable to evaluate script for extension with unknown ID: " + extensionID);
+ return WI.WebInspectorExtension.ErrorCode.InvalidRequest;
+ }
+
+ // FIXME: <rdar://problem/74180355> implement execution context selection options
+ if (frameURL) {
+ WI.reportInternalError("evaluateScriptForExtension: the 'frameURL' option is not yet implemented.");
+ return WI.WebInspectorExtension.ErrorCode.NotImplemented;
+ }
+
+ if (contextSecurityOrigin) {
+ WI.reportInternalError("evaluateScriptForExtension: the 'contextSecurityOrigin' option is not yet implemented.");
+ return WI.WebInspectorExtension.ErrorCode.NotImplemented;
+ }
+
+ if (useContentScriptContext) {
+ WI.reportInternalError("evaluateScriptForExtension: the 'useContentScriptContext' option is not yet implemented.");
+ return WI.WebInspectorExtension.ErrorCode.NotImplemented;
+ }
+
+ let evaluationContext = WI.runtimeManager.activeExecutionContext;
+ return evaluationContext.target.RuntimeAgent.evaluate.invoke({
+ _expression_: scriptSource,
+ objectGroup: "extension-evaluation",
+ includeCommandLineAPI: true,
+ returnByValue: true,
+ generatePreview: false,
+ saveResult: false,
+ contextId: evaluationContext.id,
+ }).then((payload) => {
+ let resultOrError = payload.result;
+ let wasThrown = payload.wasThrown;
+ let {type, value} = resultOrError;
+ return wasThrown ? {"error": resultOrError.description} : {"result": value};
+ }).catch((error) => error.description);
+ }
+
+ reloadForExtension(extensionID, {ignoreCache, userAgent, injectedScript} = {})
+ {
+ let extension = this._extensionForExtensionIDMap.get(extensionID);
+ if (!extension) {
+ WI.reportInternalError("Unable to evaluate script for extension with unknown ID: " + extensionID);
+ return WI.WebInspectorExtension.ErrorCode.InvalidRequest;
+ }
+
+ // FIXME: <webkit.org/b/222328> Implement `userAgent` and `injectedScript` options for `devtools.inspectedWindow.reload` command
+ if (userAgent) {
+ WI.reportInternalError("reloadForExtension: the 'userAgent' option is not yet implemented.");
+ return WI.WebInspectorExtension.ErrorCode.NotImplemented;
+ }
+
+ if (injectedScript) {
+ WI.reportInternalError("reloadForExtension: the 'injectedScript' option is not yet implemented.");
+ return WI.WebInspectorExtension.ErrorCode.NotImplemented;
+ }
+
+ let target = WI.assumingMainTarget();
+ if (!target.hasCommand("Page.reload"))
+ return WI.WebInspectorExtension.ErrorCode.InvalidRequest;
+
+ return target.PageAgent.reload.invoke({ignoreCache});
+ }
+
+ showExtensionTab(extensionTabID)
+ {
+ let tabContentView = this._extensionTabContentViewForExtensionTabIDMap.get(extensionTabID);
+ if (!tabContentView) {
+ WI.reportInternalError("Unable to show extension tab with unknown extensionTabID: " + extensionTabID);
+ return WI.WebInspectorExtension.ErrorCode.InvalidRequest;
+ }
+
+ tabContentView.visible = true;
+ let success = WI.tabBrowser.showTabForContentView(tabContentView, {
+ initiatorHint: WI.TabBrowser.TabNavigationInitiator.FrontendAPI,
+ });
+
+ if (!success) {
+ WI.reportInternalError("Unable to show extension tab with extensionTabID: " + extensionTabID);
+ return WI.WebInspectorExtension.ErrorCode.InternalError;
+ }
+ }
+
+ hideExtensionTab(extensionTabID, options = {})
+ {
+ let tabContentView = this._extensionTabContentViewForExtensionTabIDMap.get(extensionTabID);
+ if (!tabContentView) {
+ WI.reportInternalError("Unable to show extension tab with unknown extensionTabID: " + extensionTabID);
+ return WI.WebInspectorExtension.ErrorCode.InvalidRequest;
+ }
+
+ tabContentView.visible = false;
+ WI.tabBrowser.closeTabForContentView(tabContentView, options);
+
+ console.assert(!tabContentView.visible);
+ console.assert(!tabContentView.isClosed);
+ }
+
+ addContextMenuItemsForClosedExtensionTabs(contextMenu)
+ {
+ contextMenu.appendSeparator();
+
+ for (let tabContentView of this._extensionTabContentViewForExtensionTabIDMap.values()) {
+ // If the extension tab has been unchecked in the TabBar context menu, then the tabBarItem
+ // for the extension tab will not be connected to a parent TabBar.
+ let shouldIncludeTab = !tabContentView.visible || !tabContentView.tabBarItem.parentTabBar;
+ if (!shouldIncludeTab)
+ continue;
+
+ contextMenu.appendItem(tabContentView.tabInfo().displayName, () => {
+ this.showExtensionTab(tabContentView.extensionTabID);
+ });
+ }
+ }
+
+ addContextMenuItemsForAllExtensionTabs(contextMenu)
+ {
+ contextMenu.appendSeparator();
+
+ for (let tabContentView of this._extensionTabContentViewForExtensionTabIDMap.values()) {
+ let checked = tabContentView.visible || !!tabContentView.tabBarItem.parentTabBar;
+ contextMenu.appendCheckboxItem(tabContentView.tabInfo().displayName, () => {
+ if (!checked)
+ this.showExtensionTab(tabContentView.extensionTabID);
+ else
+ this.hideExtensionTab(tabContentView.extensionTabID);
+ }, checked);
+ }
+ }
+
+ evaluateScriptInExtensionTab(extensionTabID, scriptSource)
+ {
+ let tabContentView = this._extensionTabContentViewForExtensionTabIDMap.get(extensionTabID);
+ if (!tabContentView) {
+ WI.reportInternalError("Unable to evaluate with unknown extensionTabID: " + extensionTabID);
+ return WI.WebInspectorExtension.ErrorCode.InvalidRequest;
+ }
+
+ let iframe = tabContentView.iframeElement;
+ if (!(iframe instanceof HTMLIFrameElement)) {
+ WI.reportInternalError("Unable to evaluate without an <iframe> for extensionTabID: " + extensionTabID);
+ return WI.WebInspectorExtension.ErrorCode.InvalidRequest;
+ }
+
+ try {
+ return {result: InspectorFrontendHost.evaluateScriptInExtensionTab(iframe, scriptSource)};
+ } catch (error) {
+ return {error: error.message};
+ }
+ }
+};
+
+WI.WebInspectorExtensionController.Event = {
+ ExtensionAdded: "extension-added",
+ ExtensionRemoved: "extension-removed",
+};
Modified: trunk/Source/WebKit/ChangeLog (283856 => 283857)
--- trunk/Source/WebKit/ChangeLog 2021-10-09 00:41:29 UTC (rev 283856)
+++ trunk/Source/WebKit/ChangeLog 2021-10-09 01:38:43 UTC (rev 283857)
@@ -1,3 +1,41 @@
+2021-10-08 BJ Burg <bb...@apple.com>
+
+ [Cocoa] Web Inspector: provide a way for _WKInspectorExtension clients to be notified when the inspected page navigates
+ https://bugs.webkit.org/show_bug.cgi?id=231338
+ <rdar://71200338>
+
+ Reviewed by Devin Rousso.
+
+ Add plumbing for a new event to pass from WebInspectorUI out to _WKInspectorExtensionDelegate.
+
+ * UIProcess/API/APIInspectorExtensionClient.h:
+ (API::InspectorExtensionClient::inspectedPageDidNavigate):
+
+ * UIProcess/API/Cocoa/_WKInspectorExtensionDelegate.h:
+ * UIProcess/Inspector/Cocoa/InspectorExtensionDelegate.h:
+ * UIProcess/Inspector/Cocoa/InspectorExtensionDelegate.mm:
+ (WebKit::InspectorExtensionDelegate::InspectorExtensionDelegate):
+ (WebKit::InspectorExtensionDelegate::InspectorExtensionClient::inspectedPageDidNavigate):
+
+ * UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.h:
+ * UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.messages.in:
+ * UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp:
+ (WebKit::WebInspectorUIExtensionControllerProxy::inspectedPageDidNavigate):
+ Call the delegate method for all _WKInspectorExtensions associated with this
+ id<_WKInspectorExtensionHost>. Clients can map from extension to inspector if needed.
+
+ * WebProcess/Inspector/RemoteWebInspectorUI.h:
+ * WebProcess/Inspector/RemoteWebInspectorUI.cpp:
+ (WebKit::RemoteWebInspectorUI::inspectedPageDidNavigate):
+
+ * WebProcess/Inspector/WebInspectorUI.h:
+ * WebProcess/Inspector/WebInspectorUI.cpp:
+ (WebKit::WebInspectorUI::inspectedPageDidNavigate):
+
+ * WebProcess/Inspector/WebInspectorUIExtensionController.h:
+ * WebProcess/Inspector/WebInspectorUIExtensionController.cpp:
+ (WebKit::WebInspectorUIExtensionController::inspectedPageDidNavigate):
+
2021-10-08 Jer Noble <jer.no...@apple.com>
[Build-time perf] Forward-declare more things in Element.h
Modified: trunk/Source/WebKit/UIProcess/API/APIInspectorExtensionClient.h (283856 => 283857)
--- trunk/Source/WebKit/UIProcess/API/APIInspectorExtensionClient.h 2021-10-09 00:41:29 UTC (rev 283856)
+++ trunk/Source/WebKit/UIProcess/API/APIInspectorExtensionClient.h 2021-10-09 01:38:43 UTC (rev 283857)
@@ -37,6 +37,7 @@
virtual void didShowExtensionTab(const Inspector::ExtensionTabID&) { }
virtual void didHideExtensionTab(const Inspector::ExtensionTabID&) { }
+ virtual void inspectedPageDidNavigate(const WTF::URL&) { }
};
} // namespace API
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorExtensionDelegate.h (283856 => 283857)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorExtensionDelegate.h 2021-10-09 00:41:29 UTC (rev 283856)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorExtensionDelegate.h 2021-10-09 01:38:43 UTC (rev 283857)
@@ -52,6 +52,12 @@
*/
- (void)inspectorExtension:(_WKInspectorExtension *)extension didHideTabWithIdentifier:(NSString *)tabIdentifier;
+/**
+ * @abstract Called when the inspected page has navigated to a new URL.
+ * @param url The new URL for the inspected page.
+ */
+- (void)inspectorExtension:(_WKInspectorExtension *)extension inspectedPageDidNavigate:(NSURL *)url;
+
@end
NS_ASSUME_NONNULL_END
Modified: trunk/Source/WebKit/UIProcess/Inspector/Cocoa/InspectorExtensionDelegate.h (283856 => 283857)
--- trunk/Source/WebKit/UIProcess/Inspector/Cocoa/InspectorExtensionDelegate.h 2021-10-09 00:41:29 UTC (rev 283856)
+++ trunk/Source/WebKit/UIProcess/Inspector/Cocoa/InspectorExtensionDelegate.h 2021-10-09 01:38:43 UTC (rev 283857)
@@ -56,6 +56,7 @@
// API::InspectorExtensionClient
void didShowExtensionTab(const Inspector::ExtensionTabID&) override;
void didHideExtensionTab(const Inspector::ExtensionTabID&) override;
+ void inspectedPageDidNavigate(const URL&) override;
InspectorExtensionDelegate& m_inspectorExtensionDelegate;
};
@@ -66,6 +67,7 @@
struct {
bool inspectorExtensionDidShowTabWithIdentifier : 1;
bool inspectorExtensionDidHideTabWithIdentifier : 1;
+ bool inspectorExtensionInspectedPageDidNavigate : 1;
} m_delegateMethods;
};
Modified: trunk/Source/WebKit/UIProcess/Inspector/Cocoa/InspectorExtensionDelegate.mm (283856 => 283857)
--- trunk/Source/WebKit/UIProcess/Inspector/Cocoa/InspectorExtensionDelegate.mm 2021-10-09 00:41:29 UTC (rev 283856)
+++ trunk/Source/WebKit/UIProcess/Inspector/Cocoa/InspectorExtensionDelegate.mm 2021-10-09 01:38:43 UTC (rev 283857)
@@ -41,6 +41,7 @@
{
m_delegateMethods.inspectorExtensionDidShowTabWithIdentifier = [delegate respondsToSelector:@selector(inspectorExtension:didShowTabWithIdentifier:)];
m_delegateMethods.inspectorExtensionDidHideTabWithIdentifier = [delegate respondsToSelector:@selector(inspectorExtension:didHideTabWithIdentifier:)];
+ m_delegateMethods.inspectorExtensionInspectedPageDidNavigate = [delegate respondsToSelector:@selector(inspectorExtension:inspectedPageDidNavigate:)];
inspectorExtension->_extension->setClient(makeUniqueRef<InspectorExtensionClient>(*this));
}
@@ -85,6 +86,18 @@
[delegate inspectorExtension:m_inspectorExtensionDelegate.m_inspectorExtension.get().get() didHideTabWithIdentifier:extensionTabID];
}
+void InspectorExtensionDelegate::InspectorExtensionClient::inspectedPageDidNavigate(const WTF::URL& newURL)
+{
+ if (!m_inspectorExtensionDelegate.m_delegateMethods.inspectorExtensionInspectedPageDidNavigate)
+ return;
+
+ auto& delegate = m_inspectorExtensionDelegate.m_delegate;
+ if (!delegate)
+ return;
+
+ [delegate inspectorExtension:m_inspectorExtensionDelegate.m_inspectorExtension.get().get() inspectedPageDidNavigate:newURL];
+}
+
} // namespace WebKit
#endif // ENABLE(INSPECTOR_EXTENSIONS)
Modified: trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp (283856 => 283857)
--- trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp 2021-10-09 00:41:29 UTC (rev 283856)
+++ trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp 2021-10-09 01:38:43 UTC (rev 283857)
@@ -29,6 +29,7 @@
#if ENABLE(INSPECTOR_EXTENSIONS)
#include "APIInspectorExtension.h"
+#include "APIURL.h"
#include "WebInspectorUIExtensionControllerMessages.h"
#include "WebInspectorUIExtensionControllerProxyMessages.h"
#include "WebPageProxy.h"
@@ -255,6 +256,17 @@
extensionClient->didHideExtensionTab(extensionTabID);
}
+void WebInspectorUIExtensionControllerProxy::inspectedPageDidNavigate(const URL& newURL)
+{
+ for (auto& extension : copyToVector(m_extensionAPIObjectMap.values())) {
+ auto extensionClient = extension->client();
+ if (!extensionClient)
+ continue;
+
+ extensionClient->inspectedPageDidNavigate(newURL);
+ }
+}
+
} // namespace WebKit
#endif // ENABLE(INSPECTOR_EXTENSIONS)
Modified: trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.h (283856 => 283857)
--- trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.h 2021-10-09 00:41:29 UTC (rev 283856)
+++ trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.h 2021-10-09 01:38:43 UTC (rev 283857)
@@ -68,6 +68,7 @@
// WebInspectorUIExtensionControllerProxy IPC messages.
void didShowExtensionTab(const Inspector::ExtensionID&, const Inspector::ExtensionTabID&);
void didHideExtensionTab(const Inspector::ExtensionID&, const Inspector::ExtensionTabID&);
+ void inspectedPageDidNavigate(const URL&);
// Notifications.
void inspectorFrontendLoaded();
Modified: trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.messages.in (283856 => 283857)
--- trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.messages.in 2021-10-09 00:41:29 UTC (rev 283856)
+++ trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.messages.in 2021-10-09 01:38:43 UTC (rev 283857)
@@ -25,6 +25,7 @@
messages -> WebInspectorUIExtensionControllerProxy {
DidShowExtensionTab(String extensionID, String extensionTabID)
DidHideExtensionTab(String extensionID, String extensionTabID)
+ InspectedPageDidNavigate(URL newURL)
}
#endif // ENABLE(INSPECTOR_EXTENSIONS)
Modified: trunk/Source/WebKit/WebProcess/Inspector/RemoteWebInspectorUI.cpp (283856 => 283857)
--- trunk/Source/WebKit/WebProcess/Inspector/RemoteWebInspectorUI.cpp 2021-10-09 00:41:29 UTC (rev 283856)
+++ trunk/Source/WebKit/WebProcess/Inspector/RemoteWebInspectorUI.cpp 2021-10-09 01:38:43 UTC (rev 283857)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016-2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-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
@@ -305,6 +305,14 @@
m_extensionController->didHideExtensionTab(extensionID, extensionTabID);
}
+
+void RemoteWebInspectorUI::inspectedPageDidNavigate(const URL& newURL)
+{
+ if (!m_extensionController)
+ return;
+
+ m_extensionController->inspectedPageDidNavigate(newURL);
+}
#endif // ENABLE(INSPECTOR_EXTENSIONS)
WebCore::Page* RemoteWebInspectorUI::frontendPage()
Modified: trunk/Source/WebKit/WebProcess/Inspector/RemoteWebInspectorUI.h (283856 => 283857)
--- trunk/Source/WebKit/WebProcess/Inspector/RemoteWebInspectorUI.h 2021-10-09 00:41:29 UTC (rev 283856)
+++ trunk/Source/WebKit/WebProcess/Inspector/RemoteWebInspectorUI.h 2021-10-09 01:38:43 UTC (rev 283857)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016-2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-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
@@ -122,6 +122,7 @@
bool supportsWebExtensions() override;
void didShowExtensionTab(const Inspector::ExtensionID&, const Inspector::ExtensionTabID&) override;
void didHideExtensionTab(const Inspector::ExtensionID&, const Inspector::ExtensionTabID&) override;
+ void inspectedPageDidNavigate(const URL&) override;
#endif
bool canSave() override { return true; }
Modified: trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUI.cpp (283856 => 283857)
--- trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUI.cpp 2021-10-09 00:41:29 UTC (rev 283856)
+++ trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUI.cpp 2021-10-09 01:38:43 UTC (rev 283857)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014-2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-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
@@ -379,6 +379,14 @@
m_extensionController->didHideExtensionTab(extensionID, extensionTabID);
}
+
+void WebInspectorUI::inspectedPageDidNavigate(const URL& newURL)
+{
+ if (!m_extensionController)
+ return;
+
+ m_extensionController->inspectedPageDidNavigate(newURL);
+}
#endif // ENABLE(INSPECTOR_EXTENSIONS)
void WebInspectorUI::showConsole()
Modified: trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUI.h (283856 => 283857)
--- trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUI.h 2021-10-09 00:41:29 UTC (rev 283856)
+++ trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUI.h 2021-10-09 01:38:43 UTC (rev 283857)
@@ -156,6 +156,7 @@
bool supportsWebExtensions() override;
void didShowExtensionTab(const Inspector::ExtensionID&, const Inspector::ExtensionTabID&) override;
void didHideExtensionTab(const Inspector::ExtensionID&, const Inspector::ExtensionTabID&) override;
+ void inspectedPageDidNavigate(const URL&) override;
#endif
void sendMessageToBackend(const String&) override;
Modified: trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUIExtensionController.cpp (283856 => 283857)
--- trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUIExtensionController.cpp 2021-10-09 00:41:29 UTC (rev 283856)
+++ trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUIExtensionController.cpp 2021-10-09 01:38:43 UTC (rev 283857)
@@ -437,6 +437,11 @@
WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorUIExtensionControllerProxy::DidHideExtensionTab { extensionID, extensionTabID }, m_inspectorPageIdentifier);
}
+void WebInspectorUIExtensionController::inspectedPageDidNavigate(const URL& newURL)
+{
+ WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorUIExtensionControllerProxy::InspectedPageDidNavigate { newURL }, m_inspectorPageIdentifier);
+}
+
} // namespace WebKit
#endif // ENABLE(INSPECTOR_EXTENSIONS)
Modified: trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUIExtensionController.h (283856 => 283857)
--- trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUIExtensionController.h 2021-10-09 00:41:29 UTC (rev 283856)
+++ trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUIExtensionController.h 2021-10-09 01:38:43 UTC (rev 283857)
@@ -76,6 +76,7 @@
// Callbacks from the frontend.
void didShowExtensionTab(const Inspector::ExtensionID&, const Inspector::ExtensionTabID&);
void didHideExtensionTab(const Inspector::ExtensionID&, const Inspector::ExtensionTabID&);
+ void inspectedPageDidNavigate(const URL&);
private:
JSC::JSObject* unwrapEvaluationResultAsObject(WebCore::InspectorFrontendAPIDispatcher::EvaluationResult) const;
Modified: trunk/Tools/ChangeLog (283856 => 283857)
--- trunk/Tools/ChangeLog 2021-10-09 00:41:29 UTC (rev 283856)
+++ trunk/Tools/ChangeLog 2021-10-09 01:38:43 UTC (rev 283857)
@@ -1,3 +1,20 @@
+2021-10-08 BJ Burg <bb...@apple.com>
+
+ [Cocoa] Web Inspector: provide a way for _WKInspectorExtension clients to be notified when the inspected page navigates
+ https://bugs.webkit.org/show_bug.cgi?id=231338
+ <rdar://71200338>
+
+ Reviewed by Devin Rousso.
+
+ Add a new test to verify that triggering a navigation on the inspected WKWebView
+ causes the -extension:inspectedPageDidNavigate: method of _WKInspectorExtensionDelegate
+ to fire.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/WKInspectorExtensionDelegate.mm:
+ (resetGlobalState):
+ (-[InspectorExtensionDelegateForTesting inspectorExtension:inspectedPageDidNavigate:]):
+ (TEST):
+
2021-10-08 Tadeu Zagallo <tzaga...@apple.com>
Implement the WebAssembly exception handling proposal
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (283856 => 283857)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2021-10-09 00:41:29 UTC (rev 283856)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2021-10-09 01:38:43 UTC (rev 283857)
@@ -895,6 +895,7 @@
958B70E126C46EDC00B2022B /* NSAttributedStringWebKitAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 958B70E026C46EDC00B2022B /* NSAttributedStringWebKitAdditions.mm */; };
95A524952581A10D00461FE9 /* WKWebViewThemeColor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 95A524942581A10D00461FE9 /* WKWebViewThemeColor.mm */; };
95B6B3B7251EBF2F00FC4382 /* MediaDocument.mm in Sources */ = {isa = PBXBuildFile; fileRef = 95B6B3B6251EBF2F00FC4382 /* MediaDocument.mm */; };
+ 996EDCCB270E70D7006DF175 /* InspectorExtension-basic-page.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 996EDCCA270E70AB006DF175 /* InspectorExtension-basic-page.html */; };
9984FACC1CFFAF60008D198C /* WKWebViewTextInput.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9984FACA1CFFAEEE008D198C /* WKWebViewTextInput.mm */; };
9984FACE1CFFB090008D198C /* editable-body.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 9984FACD1CFFB038008D198C /* editable-body.html */; };
9999108B1F393C96008AD455 /* Copying.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9999108A1F393C8B008AD455 /* Copying.mm */; };
@@ -1584,6 +1585,7 @@
2EFF06CD1D8A429A0004BB30 /* input-field-in-scrollable-document.html in Copy Resources */,
CE3524FA1B1443890028A7C5 /* input-focus-blur.html in Copy Resources */,
CE6D0EE32426B932002AD901 /* insert-text.html in Copy Resources */,
+ 996EDCCB270E70D7006DF175 /* InspectorExtension-basic-page.html in Copy Resources */,
99E2846826F941540003F1FA /* InspectorExtension-basic-tab.html in Copy Resources */,
99E2846626F93DB50003F1FA /* InspectorExtension-TabIcon-30x30.png in Copy Resources */,
074994421EA5034B000DA44D /* invalidDeviceIDHashSalts in Copy Resources */,
@@ -2638,6 +2640,7 @@
958B70E026C46EDC00B2022B /* NSAttributedStringWebKitAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NSAttributedStringWebKitAdditions.mm; sourceTree = "<group>"; };
95A524942581A10D00461FE9 /* WKWebViewThemeColor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewThemeColor.mm; sourceTree = "<group>"; };
95B6B3B6251EBF2F00FC4382 /* MediaDocument.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MediaDocument.mm; sourceTree = "<group>"; };
+ 996EDCCA270E70AB006DF175 /* InspectorExtension-basic-page.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "InspectorExtension-basic-page.html"; sourceTree = "<group>"; };
9984FACA1CFFAEEE008D198C /* WKWebViewTextInput.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewTextInput.mm; sourceTree = "<group>"; };
9984FACD1CFFB038008D198C /* editable-body.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "editable-body.html"; sourceTree = "<group>"; };
9999108A1F393C8B008AD455 /* Copying.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Copying.mm; sourceTree = "<group>"; };
@@ -4129,6 +4132,7 @@
93A274A1252163D600A1B6D4 /* IndexUpgradeWithMultipleIndices.sqlite3 */,
93A274A4252241D000A1B6D4 /* IndexUpgradeWithMultipleIndicesHaveSameID.sqlite3 */,
2EFF06CC1D8A42910004BB30 /* input-field-in-scrollable-document.html */,
+ 996EDCCA270E70AB006DF175 /* InspectorExtension-basic-page.html */,
99E2846726F9413B0003F1FA /* InspectorExtension-basic-tab.html */,
99E2846526F93D760003F1FA /* InspectorExtension-TabIcon-30x30.png */,
937A6C8824357BF300C3A6B0 /* KillWebProcessWithOpenConnection-1.html */,
Added: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/InspectorExtension-basic-page.html (0 => 283857)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/InspectorExtension-basic-page.html (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/InspectorExtension-basic-page.html 2021-10-09 01:38:43 UTC (rev 283857)
@@ -0,0 +1,9 @@
+<html>
+<head>
+<script>
+</script>
+<body>
+<h1>This is a test page.</h1>
+<p>Nothing interesting to see here, move along.</p>
+</body>
+</html>
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKInspectorExtensionDelegate.mm (283856 => 283857)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKInspectorExtensionDelegate.mm 2021-10-09 00:41:29 UTC (rev 283856)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKInspectorExtensionDelegate.mm 2021-10-09 01:38:43 UTC (rev 283857)
@@ -28,7 +28,9 @@
#if ENABLE(INSPECTOR_EXTENSIONS)
#import "Test.h"
+#import "TestCocoa.h"
#import "TestInspectorURLSchemeHandler.h"
+#import "TestNavigationDelegate.h"
#import "Utilities.h"
#import <WebKit/WKPreferencesPrivate.h>
#import <WebKit/WKWebViewPrivate.h>
@@ -42,10 +44,12 @@
static bool didAttachLocalInspectorCalled = false;
static bool didShowExtensionTabWasCalled = false;
static bool didHideExtensionTabWasCalled = false;
+static bool inspectedPageDidNavigateWasCalled = false;
static bool pendingCallbackWasCalled = false;
static RetainPtr<TestInspectorURLSchemeHandler> sharedURLSchemeHandler;
static RetainPtr<_WKInspectorExtension> sharedInspectorExtension;
static RetainPtr<NSString> sharedExtensionTabIdentifier;
+static RetainPtr<NSURL> sharedNewURLAfterNavigation;
static void resetGlobalState()
{
@@ -52,6 +56,7 @@
didAttachLocalInspectorCalled = false;
didShowExtensionTabWasCalled = false;
didHideExtensionTabWasCalled = false;
+ inspectedPageDidNavigateWasCalled = false;
pendingCallbackWasCalled = false;
}
@@ -95,6 +100,12 @@
didHideExtensionTabWasCalled = true;
}
+- (void)inspectorExtension:(_WKInspectorExtension *)extension inspectedPageDidNavigate:(NSURL *)newURL
+{
+ inspectedPageDidNavigateWasCalled = true;
+ sharedNewURLAfterNavigation = newURL;
+}
+
@end
TEST(WKInspectorExtensionDelegate, ShowAndHideTabCallbacks)
@@ -165,4 +176,71 @@
TestWebKitAPI::Util::run(&pendingCallbackWasCalled);
}
+TEST(WKInspectorExtensionDelegate, InspectedPageNavigatedCallbacks)
+{
+ resetGlobalState();
+
+ // Hook up the test-resource: handler so that we can navigate to a different test file.
+ if (!sharedURLSchemeHandler)
+ sharedURLSchemeHandler = adoptNS([[TestInspectorURLSchemeHandler alloc] init]);
+
+ auto webViewConfiguration = adoptNS([WKWebViewConfiguration new]);
+ webViewConfiguration.get().preferences._developerExtrasEnabled = YES;
+ [webViewConfiguration setURLSchemeHandler:sharedURLSchemeHandler.get() forURLScheme:@"test-resource"];
+
+ auto webView = adoptNS([[WKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
+ auto uiDelegate = adoptNS([UIDelegateForTestingInspectorExtensionDelegate new]);
+
+ [webView setUIDelegate:uiDelegate.get()];
+
+ [[webView _inspector] show];
+ TestWebKitAPI::Util::run(&didAttachLocalInspectorCalled);
+
+ // Register the test extension.
+ auto extensionID = [NSUUID UUID].UUIDString;
+ auto extensionDisplayName = @"SecondExtension";
+ pendingCallbackWasCalled = false;
+ [[webView _inspector] registerExtensionWithID:extensionID displayName:extensionDisplayName completionHandler:^(NSError * _Nullable error, _WKInspectorExtension * _Nullable extension) {
+ EXPECT_NULL(error);
+ EXPECT_NOT_NULL(extension);
+ sharedInspectorExtension = extension;
+
+ pendingCallbackWasCalled = true;
+ }];
+ TestWebKitAPI::Util::run(&pendingCallbackWasCalled);
+
+ auto extensionDelegate = adoptNS([InspectorExtensionDelegateForTesting new]);
+ [sharedInspectorExtension setDelegate:extensionDelegate.get()];
+
+ [webView loadHTMLString:@"<head><title>Test page to be inspected</title></head><body><p>Filler content</p></body>" baseURL:[NSURL URLWithString:@"http://example.com/"]];
+ [webView _test_waitForDidFinishNavigation];
+
+ inspectedPageDidNavigateWasCalled = false;
+ TestWebKitAPI::Util::run(&inspectedPageDidNavigateWasCalled);
+ EXPECT_NS_EQUAL(sharedNewURLAfterNavigation.get().absoluteString, @"http://example.com/");
+ inspectedPageDidNavigateWasCalled = false;
+
+ // Initiate a navigation in the inspected WKWebView to a test-resource:// URL.
+ auto newURL = [NSURL URLWithString:@"test-resource://SecondExtension/InspectorExtension-basic-page.html"];
+ auto result = [webView loadRequest:[NSURLRequest requestWithURL:newURL]];
+ EXPECT_NOT_NULL(result);
+
+ inspectedPageDidNavigateWasCalled = false;
+ TestWebKitAPI::Util::run(&inspectedPageDidNavigateWasCalled);
+ EXPECT_NS_EQUAL(sharedNewURLAfterNavigation.get().absoluteString, @"about:blank");
+
+ inspectedPageDidNavigateWasCalled = false;
+ TestWebKitAPI::Util::run(&inspectedPageDidNavigateWasCalled);
+ EXPECT_NS_EQUAL(sharedNewURLAfterNavigation.get().absoluteString, newURL.absoluteString);
+
+ // Unregister the test extension.
+ pendingCallbackWasCalled = false;
+ [[webView _inspector] unregisterExtension:sharedInspectorExtension.get() completionHandler:^(NSError * _Nullable error) {
+ EXPECT_NULL(error);
+
+ pendingCallbackWasCalled = true;
+ }];
+ TestWebKitAPI::Util::run(&pendingCallbackWasCalled);
+}
+
#endif // ENABLE(INSPECTOR_EXTENSIONS)