Changeset 267411 in webkit
- Timestamp:
- Sep 22, 2020, 9:14:08 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 44 edited
- 2 copied
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/inspector/InspectorFrontendClient.h (modified) (2 diffs)
-
Source/WebCore/inspector/InspectorFrontendClientLocal.cpp (modified) (2 diffs)
-
Source/WebCore/inspector/InspectorFrontendClientLocal.h (modified) (2 diffs)
-
Source/WebCore/inspector/InspectorFrontendHost.cpp (modified) (3 diffs)
-
Source/WebCore/inspector/InspectorFrontendHost.h (modified) (2 diffs)
-
Source/WebCore/inspector/InspectorFrontendHost.idl (modified) (2 diffs)
-
Source/WebInspectorUI/ChangeLog (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Base/Main.js (modified) (3 diffs)
-
Source/WebInspectorUI/UserInterface/Debug/UncaughtExceptionReporter.js (modified) (2 diffs)
-
Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Views/ResourceTreeElement.js (modified) (2 diffs)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/SourcesCocoa.txt (modified) (1 diff)
-
Source/WebKit/UIProcess/API/APIInspectorClient.h (modified) (2 diffs)
-
Source/WebKit/UIProcess/API/Cocoa/_WKInspectorDelegate.h (modified) (1 diff)
-
Source/WebKit/UIProcess/API/Cocoa/_WKInspectorPrivateForTesting.h (copied) (copied from trunk/Source/WebKit/UIProcess/API/APIInspectorClient.h ) (1 diff)
-
Source/WebKit/UIProcess/API/Cocoa/_WKInspectorTesting.mm (copied) (copied from trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorDelegate.h ) (1 diff)
-
Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm (modified) (1 diff)
-
Source/WebKit/UIProcess/Inspector/Cocoa/InspectorDelegate.h (modified) (2 diffs)
-
Source/WebKit/UIProcess/Inspector/Cocoa/InspectorDelegate.mm (modified) (2 diffs)
-
Source/WebKit/UIProcess/Inspector/RemoteWebInspectorProxy.cpp (modified) (3 diffs)
-
Source/WebKit/UIProcess/Inspector/RemoteWebInspectorProxy.h (modified) (3 diffs)
-
Source/WebKit/UIProcess/Inspector/RemoteWebInspectorProxy.messages.in (modified) (2 diffs)
-
Source/WebKit/UIProcess/Inspector/WebInspectorProxy.cpp (modified) (3 diffs)
-
Source/WebKit/UIProcess/Inspector/WebInspectorProxy.h (modified) (5 diffs)
-
Source/WebKit/UIProcess/Inspector/WebInspectorProxy.messages.in (modified) (2 diffs)
-
Source/WebKit/UIProcess/Inspector/gtk/RemoteWebInspectorProxyGtk.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/Inspector/mac/RemoteWebInspectorProxyMac.mm (modified) (2 diffs)
-
Source/WebKit/UIProcess/Inspector/mac/WKInspectorViewController.h (modified) (2 diffs)
-
Source/WebKit/UIProcess/Inspector/mac/WKInspectorViewController.mm (modified) (1 diff)
-
Source/WebKit/UIProcess/Inspector/mac/WebInspectorProxyMac.mm (modified) (2 diffs)
-
Source/WebKit/UIProcess/Inspector/win/RemoteWebInspectorProxyWin.cpp (modified) (1 diff)
-
Source/WebKit/WebKit.xcodeproj/project.pbxproj (modified) (4 diffs)
-
Source/WebKit/WebProcess/Inspector/RemoteWebInspectorUI.cpp (modified) (2 diffs)
-
Source/WebKit/WebProcess/Inspector/RemoteWebInspectorUI.h (modified) (2 diffs)
-
Source/WebKit/WebProcess/Inspector/WebInspector.cpp (modified) (2 diffs)
-
Source/WebKit/WebProcess/Inspector/WebInspector.h (modified) (2 diffs)
-
Source/WebKit/WebProcess/Inspector/WebInspector.messages.in (modified) (2 diffs)
-
Source/WebKit/WebProcess/Inspector/WebInspectorFrontendAPIDispatcher.cpp (modified) (2 diffs)
-
Source/WebKit/WebProcess/Inspector/WebInspectorFrontendAPIDispatcher.h (modified) (2 diffs)
-
Source/WebKit/WebProcess/Inspector/WebInspectorUI.cpp (modified) (6 diffs)
-
Source/WebKit/WebProcess/Inspector/WebInspectorUI.h (modified) (4 diffs)
-
Source/WebKit/WebProcess/Inspector/WebInspectorUI.messages.in (modified) (2 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/WKInspectorDelegate.mm (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r267408 r267411 1 2020-09-22 Brian Burg <bburg@apple.com> 2 3 [Cocoa] _WKInspectorDelegate should handle showing external resources 4 https://bugs.webkit.org/show_bug.cgi?id=216334 5 6 Reviewed by Devin Rousso. 7 8 Adapt to the rename of InspectorFrontendHost.{openInNewTab => openURLExternally}. 9 10 * inspector/InspectorFrontendClient.h: 11 * inspector/InspectorFrontendClientLocal.cpp: 12 (WebCore::InspectorFrontendClientLocal::openURLExternally): 13 (WebCore::InspectorFrontendClientLocal::openInNewTab): Deleted. 14 * inspector/InspectorFrontendClientLocal.h: 15 * inspector/InspectorFrontendHost.cpp: 16 (WebCore::InspectorFrontendHost::openURLExternally): 17 (WebCore::InspectorFrontendHost::openInNewTab): Deleted. 18 * inspector/InspectorFrontendHost.h: 19 * inspector/InspectorFrontendHost.idl: 20 1 21 2020-09-22 Sam Weinig <weinig@apple.com> 2 22 -
trunk/Source/WebCore/inspector/InspectorFrontendClient.h
r257835 r267411 1 1 /* 2 2 * Copyright (C) 2010 Google Inc. All rights reserved. 3 * Copyright (C) 2020 Apple Inc. All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 91 92 WEBCORE_EXPORT virtual void changeSheetRect(const FloatRect&) = 0; 92 93 93 WEBCORE_EXPORT virtual void openInNewTab(const String& url) = 0; 94 94 WEBCORE_EXPORT virtual void openURLExternally(const String& url) = 0; 95 95 virtual bool canSave() = 0; 96 96 virtual void save(const WTF::String& url, const WTF::String& content, bool base64Encoded, bool forceSaveAs) = 0; -
trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp
r260317 r267411 1 1 /* 2 2 * Copyright (C) 2010 Google Inc. All rights reserved. 3 * Copyright (C) 2015 Apple Inc. All rights reserved.3 * Copyright (C) 2015-2020 Apple Inc. All rights reserved. 4 4 * 5 5 * Redistribution and use in source and binary forms, with or without … … 251 251 } 252 252 253 void InspectorFrontendClientLocal::open InNewTab(const String& url)253 void InspectorFrontendClientLocal::openURLExternally(const String& url) 254 254 { 255 255 UserGestureIndicator indicator { ProcessingUserGesture }; -
trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h
r257835 r267411 1 1 /* 2 2 * Copyright (C) 2010 Google Inc. All rights reserved. 3 * Copyright (C) 2015 Apple Inc. All rights reserved.3 * Copyright (C) 2015-2020 Apple Inc. All rights reserved. 4 4 * 5 5 * Redistribution and use in source and binary forms, with or without … … 77 77 WEBCORE_EXPORT void changeAttachedWindowWidth(unsigned) final; 78 78 WEBCORE_EXPORT void changeSheetRect(const FloatRect&) final; 79 WEBCORE_EXPORT void open InNewTab(const String& url) final;79 WEBCORE_EXPORT void openURLExternally(const String& url) final; 80 80 bool canSave() override { return false; } 81 81 void save(const String&, const String&, bool, bool) override { } -
trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp
r267143 r267411 1 1 /* 2 * Copyright (C) 2007-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2007-2020 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> 4 4 * … … 415 415 } 416 416 417 void InspectorFrontendHost::open InNewTab(const String& url)417 void InspectorFrontendHost::openURLExternally(const String& url) 418 418 { 419 419 if (WTF::protocolIsJavaScript(url)) … … 421 421 422 422 if (m_client) 423 m_client->open InNewTab(url);423 m_client->openURLExternally(url); 424 424 } 425 425 -
trunk/Source/WebCore/inspector/InspectorFrontendHost.h
r257835 r267411 1 1 /* 2 * Copyright (C) 2007-20 17Apple Inc. All rights reserved.2 * Copyright (C) 2007-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 103 103 void copyText(const String& text); 104 104 void killText(const String& text, bool shouldPrependToKillRing, bool shouldStartNewSequence); 105 void open InNewTab(const String& url);105 void openURLExternally(const String& url); 106 106 bool canSave(); 107 107 void save(const String& url, const String& content, bool base64Encoded, bool forceSaveAs); -
trunk/Source/WebCore/inspector/InspectorFrontendHost.idl
r266662 r267411 1 1 /* 2 * Copyright (C) 2007-20 17Apple Inc. All rights reserved.2 * Copyright (C) 2007-2020 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> 4 4 * Copyright (C) 2009 Google Inc. All rights reserved. … … 72 72 undefined copyText(DOMString text); 73 73 undefined killText(DOMString text, boolean shouldPrependToKillRing, boolean shouldStartNewSequence); 74 undefined open InNewTab(DOMString url);74 undefined openURLExternally(DOMString url); 75 75 boolean canSave(); 76 76 undefined save(DOMString url, DOMString content, boolean base64Encoded, boolean forceSaveAs); -
trunk/Source/WebInspectorUI/ChangeLog
r267379 r267411 1 2020-09-22 Brian Burg <bburg@apple.com> 2 3 [Cocoa] _WKInspectorDelegate should handle showing external resources 4 https://bugs.webkit.org/show_bug.cgi?id=216334 5 6 Reviewed by Devin Rousso. 7 8 Adapt to the rename of InspectorFrontendHost.{openInNewTab => openURLExternally}. 9 10 * UserInterface/Base/Main.js: 11 * UserInterface/Debug/UncaughtExceptionReporter.js: 12 (sheetElement.innerHTML.div): 13 * UserInterface/Protocol/InspectorFrontendAPI.js: 14 * UserInterface/Views/ResourceTreeElement.js: 15 (WI.ResourceTreeElement.prototype.ondblclick): 16 1 17 2020-09-21 Nikita Vasilyev <nvasilyev@apple.com> 2 18 -
trunk/Source/WebInspectorUI/UserInterface/Base/Main.js
r267031 r267411 1 1 /* 2 * Copyright (C) 2013-20 17Apple Inc. All rights reserved.2 * Copyright (C) 2013-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 1061 1061 1062 1062 if (options.alwaysOpenExternally) { 1063 InspectorFrontendHost.open InNewTab(url);1063 InspectorFrontendHost.openURLExternally(url); 1064 1064 return; 1065 1065 } … … 1088 1088 } 1089 1089 1090 InspectorFrontendHost.open InNewTab(url);1090 InspectorFrontendHost.openURLExternally(url); 1091 1091 }; 1092 1092 -
trunk/Source/WebInspectorUI/UserInterface/Debug/UncaughtExceptionReporter.js
r253172 r267411 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 298 298 299 299 document.getElementById("uncaught-exception-bug-report-link").addEventListener("click", (event) => { 300 InspectorFrontendHost.open InNewTab(prefilledBugReportLink);300 InspectorFrontendHost.openURLExternally(prefilledBugReportLink); 301 301 event.stopImmediatePropagation(); 302 302 event.preventDefault(); -
trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js
r260847 r267411 1 1 /* 2 * Copyright (C) 2013 , 2016Apple Inc. All rights reserved.2 * Copyright (C) 2013-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without -
trunk/Source/WebInspectorUI/UserInterface/Views/ResourceTreeElement.js
r263429 r267411 1 1 /* 2 * Copyright (C) 2013 , 2015Apple Inc. All rights reserved.2 * Copyright (C) 2013-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 122 122 return; 123 123 124 InspectorFrontendHost.openInNewTab(this._resource.url);124 WI.openURL(this._resource.url); 125 125 } 126 126 -
trunk/Source/WebKit/ChangeLog
r267405 r267411 1 2020-09-22 Brian Burg <bburg@apple.com> 2 3 [Cocoa] _WKInspectorDelegate should handle showing external resources 4 https://bugs.webkit.org/show_bug.cgi?id=216334 5 6 Reviewed by Devin Rousso. 7 8 WebKit clients need a way to control the loading and presentation of 9 external resources that are linked in Web Inspector's user interface. 10 11 Rename InspectorFrontendHost.openInNewTab to openURLExternally. Change 12 the implementation to forward the request to UIProcess rather than the 13 inspected WebProcess. 14 15 When a navigation is triggered in WKInspectorViewController's WKWebView, 16 allow the delegate to open the requested resource. Otherwise, redirect 17 the navigation to the inspected WebView or open it using NSWorkspace 18 (for the remote case). 19 20 New API test: WKInspectorDelegate.OpenURLExternally. 21 22 * UIProcess/API/Cocoa/_WKInspectorPrivateForTesting.h: Added. 23 * UIProcess/API/Cocoa/_WKInspectorTesting.mm: Added. 24 (snippetToOpenURLExternally): 25 (-[_WKInspector _openURLExternallyForTesting:useFrontendAPI:]): 26 Add some helpers for writing API tests. 27 28 * UIProcess/API/APIInspectorClient.h: 29 (API::InspectorClient::openURLExternally): 30 * UIProcess/API/Cocoa/_WKInspectorDelegate.h: 31 * UIProcess/Cocoa/PageClientImplCocoa.mm: 32 * UIProcess/Inspector/Cocoa/InspectorDelegate.h: 33 * UIProcess/Inspector/Cocoa/InspectorDelegate.mm: 34 (WebKit::InspectorDelegate::setDelegate): 35 (WebKit::InspectorDelegate::InspectorClient::openURLExternally): 36 Add new delegate method to _WKInspectorDelegate. 37 38 * UIProcess/Inspector/RemoteWebInspectorProxy.messages.in: 39 * UIProcess/Inspector/RemoteWebInspectorProxy.h: 40 * UIProcess/Inspector/RemoteWebInspectorProxy.cpp: 41 (WebKit::RemoteWebInspectorProxy::openURLExternally): 42 (WebKit::RemoteWebInspectorProxy::platformOpenURLExternally): 43 (WebKit::RemoteWebInspectorProxy::openInNewTab): Deleted. 44 (WebKit::RemoteWebInspectorProxy::platformOpenInNewTab): Deleted. 45 * UIProcess/Inspector/gtk/RemoteWebInspectorProxyGtk.cpp: 46 (WebKit::RemoteWebInspectorProxy::platformURLExternally): 47 (WebKit::RemoteWebInspectorProxy::platformOpenInNewTab): Deleted. 48 * UIProcess/Inspector/mac/RemoteWebInspectorProxyMac.mm: 49 (WebKit::RemoteWebInspectorProxy::platformOpenURLExternally): 50 (WebKit::RemoteWebInspectorProxy::platformOpenInNewTab): Deleted. 51 * UIProcess/Inspector/win/RemoteWebInspectorProxyWin.cpp: 52 (WebKit::RemoteWebInspectorProxy::platformOpenURLExternally): 53 (WebKit::RemoteWebInspectorProxy::platformOpenInNewTab): Deleted. 54 Rename openInNewTab to openURLExternally. In some cases the client 55 may not choose to present a new tab, so the name is no longer accurate. 56 57 * UIProcess/Inspector/WebInspectorProxy.messages.in: 58 * UIProcess/Inspector/WebInspectorProxy.h: 59 * UIProcess/Inspector/WebInspectorProxy.cpp: 60 (WebKit::WebInspectorProxy::inspectorWindow const): 61 (WebKit::WebInspectorProxy::openURLExternally): 62 (WebKit::WebInspectorProxy::evaluateInFrontendForTesting): 63 * UIProcess/Inspector/mac/WebInspectorProxyMac.mm: 64 (-[WKWebInspectorProxyObjCAdapter inspectorViewController:openURLExternally:]): 65 Add some helpers for writing API tests. Add an IPC message 66 for evaluating a JavaScript expression in the frontend page. 67 Also, add a message receiver for the OpenURLExternally message 68 which passes the request to the API layer. 69 70 * UIProcess/Inspector/mac/WKInspectorViewController.h: 71 * UIProcess/Inspector/mac/WKInspectorViewController.mm: 72 (-[WKInspectorViewController webView:decidePolicyForNavigationAction:decisionHandler:]): 73 Call the delegate method if a navigation inside the inspector WKWebView is an external URL. 74 Specifically the request is to load something other than the Web Inspector's main HTML page. 75 76 * WebProcess/Inspector/WebInspector.cpp: 77 (WebKit::WebInspector::openInNewTab): Deleted. 78 * WebProcess/Inspector/WebInspector.h: 79 * WebProcess/Inspector/WebInspector.messages.in: 80 No need to handle this message anymore in the inspected WebProcess. 81 82 * WebProcess/Inspector/RemoteWebInspectorUI.h: 83 * WebProcess/Inspector/RemoteWebInspectorUI.cpp: 84 (WebKit::RemoteWebInspectorUI::openURLExternally): 85 (WebKit::RemoteWebInspectorUI::openInNewTab): Deleted. 86 * WebProcess/Inspector/WebInspectorUI.messages.in: 87 * WebProcess/Inspector/WebInspectorUI.h: 88 * WebProcess/Inspector/WebInspectorUI.cpp: 89 (WebKit::WebInspectorUI::updateConnection): 90 (WebKit::WebInspectorUI::closeWindow): 91 (WebKit::WebInspectorUI::openURLExternally): 92 (WebKit::WebInspectorUI::evaluateInFrontendForTesting): 93 (WebKit::WebInspectorUI::openInNewTab): Deleted. 94 When we need to open the URL externally, send an IPC message to UIProcess. 95 The old implementation triggered the navigation from the inspected WebProcess. 96 That approach is no longer desirable. Remove the unneeded IPC connection. 97 98 * WebProcess/Inspector/WebInspectorFrontendAPIDispatcher.h: 99 * WebProcess/Inspector/WebInspectorFrontendAPIDispatcher.cpp: 100 (WebKit::WebInspectorFrontendAPIDispatcher::evaluateExpressionForTesting): 101 Fulfill the request to evaluate the expression in the frontend page. 102 103 * SourcesCocoa.txt: 104 * WebKit.xcodeproj/project.pbxproj: 105 Some files were added. 106 107 1 108 2020-09-22 Per Arne Vollan <pvollan@apple.com> 2 109 -
trunk/Source/WebKit/SourcesCocoa.txt
r267156 r267411 260 260 UIProcess/API/Cocoa/_WKGeolocationPosition.mm 261 261 UIProcess/API/Cocoa/_WKInspector.mm 262 UIProcess/API/Cocoa/_WKInspectorTesting.mm 262 263 UIProcess/API/Cocoa/_WKInspectorDebuggableInfo.mm 263 264 UIProcess/API/Cocoa/_WKInspectorWindow.mm -
trunk/Source/WebKit/UIProcess/API/APIInspectorClient.h
r266890 r267411 26 26 #pragma once 27 27 28 #include <wtf/Forward.h> 29 28 30 namespace WebKit { 29 31 class WebInspectorProxy; … … 39 41 virtual void browserDomainEnabled(WebKit::WebInspectorProxy&) { } 40 42 virtual void browserDomainDisabled(WebKit::WebInspectorProxy&) { } 43 virtual void openURLExternally(WebKit::WebInspectorProxy&, const WTF::String& url) { } 41 44 }; 42 45 -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorDelegate.h
r266890 r267411 42 42 - (void)inspectorDidDisableBrowserDomain:(_WKInspector *)inspector; 43 43 44 /*! @abstract Called when the _WKInspector requests to show a resource externally. This 45 is used to display documentation pages and to show external URLs that are linkified. 46 @param inspector the associated inspector for which an external navigation should be triggered. 47 @param url The resource to be shown. 48 */ 49 - (void)inspector:(_WKInspector *)inspector openURLExternally:(NSURL *)url; 50 44 51 @end -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorPrivateForTesting.h
r267410 r267411 24 24 */ 25 25 26 # pragma once26 #import "_WKInspector.h" 27 27 28 namespace WebKit { 29 class WebInspectorProxy; 30 } 31 32 namespace API { 33 34 class InspectorClient { 35 WTF_MAKE_FAST_ALLOCATED; 36 public: 37 virtual ~InspectorClient() = default; 38 39 virtual void browserDomainEnabled(WebKit::WebInspectorProxy&) { } 40 virtual void browserDomainDisabled(WebKit::WebInspectorProxy&) { } 41 }; 42 43 } // namespace API 28 @interface _WKInspector (WKTesting) 29 - (void)_openURLExternallyForTesting:(NSURL *)url useFrontendAPI:(BOOL)useFrontendAPI; 30 @end -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorTesting.mm
r267410 r267411 24 24 */ 25 25 26 #import <Foundation/Foundation.h> 27 #import <WebKit/WKFoundation.h> 26 #import "config.h" 28 27 29 @class _WKInspector; 28 #import "WKWebView.h" 29 #import "_WKInspectorInternal.h" 30 #import "_WKInspectorPrivateForTesting.h" 30 31 31 @protocol _WKInspectorDelegate <NSObject> 32 @optional 32 // This file exists to centralize all fragile code that is used by _WKInspector API tests. The tests 33 // trigger WebInspectorUI behavior by evaluating JavaScript or by calling internal methods. 33 34 34 /*! @abstract Called when the Browser domain is enabled for the associated _WKInspector. 35 @param inspector the associated _WKInspector for which the Browser domain has been enabled. 36 */37 - (void)inspectorDidEnableBrowserDomain:(_WKInspector *)inspector; 35 static NSString *JavaScriptSnippetToOpenURLExternally(NSURL *url) 36 { 37 return [NSString stringWithFormat:@"InspectorFrontendHost.openURLExternally(\"%@\")", url.absoluteString]; 38 } 38 39 39 /*! @abstract Called when the Browser domain is disabled for the associated _WKInspector. 40 @param inspector the associated _WKInspector for which the Browser domain has been disabled. 41 */ 42 - (void)inspectorDidDisableBrowserDomain:(_WKInspector *)inspector; 40 @implementation _WKInspector (WKTesting) 41 42 - (void)_openURLExternallyForTesting:(NSURL *)url useFrontendAPI:(BOOL)useFrontendAPI 43 { 44 if (useFrontendAPI) 45 _inspector->evaluateInFrontendForTesting(JavaScriptSnippetToOpenURLExternally(url)); 46 else { 47 // Force the navigation request to be handled naturally through the 48 // internal NavigationDelegate of WKInspectorViewController. 49 [self.inspectorWebView loadRequest:[NSURLRequest requestWithURL:url]]; 50 } 51 } 43 52 44 53 @end -
trunk/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm
r266265 r267411 39 39 PageClientImplCocoa::PageClientImplCocoa(WKWebView *webView) 40 40 : m_webView { webView } 41 , m_alternativeTextUIController { makeUnique< AlternativeTextUIController>() }41 , m_alternativeTextUIController { makeUnique<WebCore::AlternativeTextUIController>() } 42 42 { 43 43 } -
trunk/Source/WebKit/UIProcess/Inspector/Cocoa/InspectorDelegate.h
r266890 r267411 59 59 void browserDomainEnabled(WebInspectorProxy&); 60 60 void browserDomainDisabled(WebInspectorProxy&); 61 void openURLExternally(WebInspectorProxy&, const String& url); 61 62 62 63 InspectorDelegate& m_inspectorDelegate; … … 69 70 bool inspectorDidEnableBrowserDomain : 1; 70 71 bool inspectorDidDisableBrowserDomain : 1; 72 bool inspectorOpenURLExternally : 1; 71 73 } m_delegateMethods; 72 74 }; -
trunk/Source/WebKit/UIProcess/Inspector/Cocoa/InspectorDelegate.mm
r266890 r267411 55 55 m_delegateMethods.inspectorDidEnableBrowserDomain = [delegate respondsToSelector:@selector(inspectorDidEnableBrowserDomain:)]; 56 56 m_delegateMethods.inspectorDidDisableBrowserDomain = [delegate respondsToSelector:@selector(inspectorDidDisableBrowserDomain:)]; 57 m_delegateMethods.inspectorOpenURLExternally = [delegate respondsToSelector:@selector(inspector:openURLExternally:)]; 57 58 } 58 59 … … 88 89 } 89 90 91 void InspectorDelegate::InspectorClient::openURLExternally(WebInspectorProxy&, const String& url) 92 { 93 if (!m_inspectorDelegate.m_delegateMethods.inspectorOpenURLExternally) 94 return; 95 96 auto& delegate = m_inspectorDelegate.m_delegate; 97 if (!delegate) 98 return; 99 100 [delegate inspector:m_inspectorDelegate.m_inspector.get().get() openURLExternally:[NSURL URLWithString:url]]; 101 } 102 90 103 } // namespace WebKit -
trunk/Source/WebKit/UIProcess/Inspector/RemoteWebInspectorProxy.cpp
r261299 r267411 1 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2016-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 149 149 } 150 150 151 void RemoteWebInspectorProxy::open InNewTab(const String& url)152 { 153 platformOpen InNewTab(url);151 void RemoteWebInspectorProxy::openURLExternally(const String& url) 152 { 153 platformOpenURLExternally(url); 154 154 } 155 155 … … 206 206 void RemoteWebInspectorProxy::platformSetForcedAppearance(InspectorFrontendClient::Appearance) { } 207 207 void RemoteWebInspectorProxy::platformStartWindowDrag() { } 208 void RemoteWebInspectorProxy::platformOpen InNewTab(const String&) { }208 void RemoteWebInspectorProxy::platformOpenURLExternally(const String&) { } 209 209 void RemoteWebInspectorProxy::platformShowCertificate(const CertificateInfo&) { } 210 210 void RemoteWebInspectorProxy::platformCloseFrontendPageAndWindow() { } -
trunk/Source/WebKit/UIProcess/Inspector/RemoteWebInspectorProxy.h
r260847 r267411 1 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2016-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 124 124 void setForcedAppearance(WebCore::InspectorFrontendClient::Appearance); 125 125 void startWindowDrag(); 126 void open InNewTab(const String& url);126 void openURLExternally(const String& url); 127 127 void showCertificate(const WebCore::CertificateInfo&); 128 128 void sendMessageToBackend(const String& message); … … 141 141 void platformSetForcedAppearance(WebCore::InspectorFrontendClient::Appearance); 142 142 void platformStartWindowDrag(); 143 void platformOpen InNewTab(const String& url);143 void platformOpenURLExternally(const String& url); 144 144 void platformShowCertificate(const WebCore::CertificateInfo&); 145 145 -
trunk/Source/WebKit/UIProcess/Inspector/RemoteWebInspectorProxy.messages.in
r257835 r267411 1 # Copyright (C) 2016 Apple Inc. All rights reserved.1 # Copyright (C) 2016-2020 Apple Inc. All rights reserved. 2 2 # 3 3 # Redistribution and use in source and binary forms, with or without … … 36 36 StartWindowDrag() 37 37 38 Open InNewTab(String url)38 OpenURLExternally(String url) 39 39 ShowCertificate(WebCore::CertificateInfo certificateInfo) 40 40 -
trunk/Source/WebKit/UIProcess/Inspector/WebInspectorProxy.cpp
r267031 r267411 1 1 /* 2 * Copyright (C) 2010-20 17Apple Inc. All rights reserved.2 * Copyright (C) 2010-2020 Apple Inc. All rights reserved. 3 3 * Portions Copyright (c) 2011 Motorola Mobility, Inc. All rights reserved. 4 4 * … … 606 606 } 607 607 608 void WebInspectorProxy::openURLExternally(const String& url) 609 { 610 m_inspectorClient->openURLExternally(*this, url); 611 } 612 608 613 void WebInspectorProxy::inspectedURLChanged(const String& urlString) 609 614 { … … 712 717 } 713 718 719 void WebInspectorProxy::evaluateInFrontendForTesting(const String& expression) 720 { 721 if (!m_inspectorPage) 722 return; 723 724 m_inspectorPage->send(Messages::WebInspectorUI::EvaluateInFrontendForTesting(expression)); 725 } 726 714 727 // Unsupported configurations can use the stubs provided here. 715 728 -
trunk/Source/WebKit/UIProcess/Inspector/WebInspectorProxy.h
r266890 r267411 1 1 /* 2 * Copyright (C) 2010 , 2014, 2016Apple Inc. All rights reserved.2 * Copyright (C) 2010-2020 Apple Inc. All rights reserved. 3 3 * Portions Copyright (c) 2011 Motorola Mobility, Inc. All rights reserved. 4 4 * … … 129 129 void windowFrameDidChange(); 130 130 void windowFullScreenDidChange(); 131 NSWindow *inspectorWindow() const { return m_inspectorWindow.get(); }131 NSWindow *inspectorWindow() const { return m_inspectorWindow.get(); } 132 132 133 133 void closeFrontendPage(); … … 149 149 void showResources(); 150 150 void showMainResourceForFrame(WebFrameProxy*); 151 void openURLExternally(const String& url); 151 152 152 153 AttachmentSide attachmentSide() const { return m_attachmentSide; } … … 191 192 static const unsigned initialWindowWidth; 192 193 static const unsigned initialWindowHeight; 194 195 // Testing methods. 196 void evaluateInFrontendForTesting(const String&); 193 197 194 198 private: … … 216 220 void platformAttachAvailabilityChanged(bool); 217 221 void platformSetForcedAppearance(WebCore::InspectorFrontendClient::Appearance); 222 void platformOpenURLExternally(const String&); 218 223 void platformInspectedURLChanged(const String&); 219 224 void platformShowCertificate(const WebCore::CertificateInfo&); -
trunk/Source/WebKit/UIProcess/Inspector/WebInspectorProxy.messages.in
r261103 r267411 1 # Copyright (C) 2010 , 2014Apple Inc. All rights reserved.1 # Copyright (C) 2010-2020 Apple Inc. All rights reserved. 2 2 # 3 3 # Redistribution and use in source and binary forms, with or without … … 35 35 36 36 SetForcedAppearance(WebCore::InspectorFrontendClient::Appearance appearance) 37 OpenURLExternally(String url) 37 38 38 39 InspectedURLChanged(String urlString) -
trunk/Source/WebKit/UIProcess/Inspector/gtk/RemoteWebInspectorProxyGtk.cpp
r262371 r267411 173 173 } 174 174 175 void RemoteWebInspectorProxy::platformOpen InNewTab(const String&)175 void RemoteWebInspectorProxy::platformOpenURLExternally(const String&) 176 176 { 177 177 } -
trunk/Source/WebKit/UIProcess/Inspector/mac/RemoteWebInspectorProxyMac.mm
r261299 r267411 1 1 /* 2 * Copyright (C) 2010-20 16Apple Inc. All rights reserved.2 * Copyright (C) 2010-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 262 262 } 263 263 264 void RemoteWebInspectorProxy::platformOpen InNewTab(const String& url)264 void RemoteWebInspectorProxy::platformOpenURLExternally(const String& url) 265 265 { 266 266 [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:url]]; -
trunk/Source/WebKit/UIProcess/Inspector/mac/WKInspectorViewController.h
r260847 r267411 1 1 /* 2 * Copyright (C) 2017 Apple Inc. All rights reserved.2 * Copyright (C) 2017-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 57 57 - (void)inspectorViewController:(WKInspectorViewController *)inspectorViewController willMoveToWindow:(NSWindow *)newWindow; 58 58 - (void)inspectorViewControllerDidMoveToWindow:(WKInspectorViewController *)inspectorViewController; 59 - (void)inspectorViewController:(WKInspectorViewController *)inspectorViewController openURLExternally:(NSURL *)url; 59 60 @end 60 61 -
trunk/Source/WebKit/UIProcess/Inspector/mac/WKInspectorViewController.mm
r260847 r267411 228 228 // Prevent everything else. 229 229 decisionHandler(WKNavigationActionPolicyCancel); 230 231 // And instead load it in the inspected page. 230 231 if (!!_delegate && [_delegate respondsToSelector:@selector(inspectorViewController:openURLExternally:)]) { 232 [_delegate inspectorViewController:self openURLExternally:navigationAction.request.URL]; 233 return; 234 } 235 236 // Try to load the request in the inspected page if the delegate can't handle it. 232 237 if (_inspectedPage) 233 238 _inspectedPage->loadRequest(navigationAction.request); -
trunk/Source/WebKit/UIProcess/Inspector/mac/WebInspectorProxyMac.mm
r264999 r267411 1 1 /* 2 * Copyright (C) 2010-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2010-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 194 194 } 195 195 196 - (void)inspectorViewController:(WKInspectorViewController *)inspectorViewController openURLExternally:(NSURL *)url 197 { 198 if (_inspectorProxy) 199 _inspectorProxy->openURLExternally(url.absoluteString); 200 } 201 196 202 @end 197 203 -
trunk/Source/WebKit/UIProcess/Inspector/win/RemoteWebInspectorProxyWin.cpp
r257835 r267411 138 138 void RemoteWebInspectorProxy::platformSetForcedAppearance(WebCore::InspectorFrontendClient::Appearance) { } 139 139 void RemoteWebInspectorProxy::platformStartWindowDrag() { } 140 void RemoteWebInspectorProxy::platformOpen InNewTab(const String&) { }140 void RemoteWebInspectorProxy::platformOpenURLExternally(const String&) { } 141 141 void RemoteWebInspectorProxy::platformShowCertificate(const WebCore::CertificateInfo&) { } 142 142 -
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
r267326 r267411 1407 1407 99788ACB1F421DDA00C08000 /* _WKAutomationSessionConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 99788AC91F421DCA00C08000 /* _WKAutomationSessionConfiguration.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1408 1408 9979CA58237F49F10039EC05 /* _WKInspectorPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 9979CA57237F49F00039EC05 /* _WKInspectorPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1409 99996A9F25004BCC004F7559 /* _WKInspectorPrivateForTesting.h in Headers */ = {isa = PBXBuildFile; fileRef = 99996A9D25004BCB004F7559 /* _WKInspectorPrivateForTesting.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1409 1410 99C3AE2D1DADA6AD00AF5C16 /* WebAutomationSessionMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 99C3AE2C1DADA6A700AF5C16 /* WebAutomationSessionMacros.h */; }; 1410 1411 99C81D5A1C20E7E2005C4C82 /* AutomationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 99C81D551C20DFBE005C4C82 /* AutomationClient.h */; }; … … 4479 4480 99788ACA1F421DCA00C08000 /* _WKAutomationSessionConfiguration.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKAutomationSessionConfiguration.mm; sourceTree = "<group>"; }; 4480 4481 9979CA57237F49F00039EC05 /* _WKInspectorPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKInspectorPrivate.h; sourceTree = "<group>"; }; 4482 99996A9D25004BCB004F7559 /* _WKInspectorPrivateForTesting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKInspectorPrivateForTesting.h; sourceTree = "<group>"; }; 4483 99996A9E25004BCB004F7559 /* _WKInspectorTesting.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKInspectorTesting.mm; sourceTree = "<group>"; }; 4481 4484 99C3AE231DAD8E3400AF5C16 /* WebAutomationSessionMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebAutomationSessionMac.mm; sourceTree = "<group>"; }; 4482 4485 99C3AE261DAD948500AF5C16 /* WebAutomationSessionCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebAutomationSessionCocoa.mm; sourceTree = "<group>"; }; … … 7254 7257 5CAFDE442130843600B1F7E1 /* _WKInspectorInternal.h */, 7255 7258 9979CA57237F49F00039EC05 /* _WKInspectorPrivate.h */, 7259 99996A9D25004BCB004F7559 /* _WKInspectorPrivateForTesting.h */, 7260 99996A9E25004BCB004F7559 /* _WKInspectorTesting.mm */, 7256 7261 A5C0F0AA2000656E00536536 /* _WKInspectorWindow.h */, 7257 7262 A5C0F0A92000656E00536536 /* _WKInspectorWindow.mm */, … … 10619 10624 5CAFDE472130846A00B1F7E1 /* _WKInspectorInternal.h in Headers */, 10620 10625 9979CA58237F49F10039EC05 /* _WKInspectorPrivate.h in Headers */, 10626 99996A9F25004BCC004F7559 /* _WKInspectorPrivateForTesting.h in Headers */, 10621 10627 A5C0F0AB2000658200536536 /* _WKInspectorWindow.h in Headers */, 10622 10628 31B362952141EBCD007BFA53 /* _WKInternalDebugFeature.h in Headers */, -
trunk/Source/WebKit/WebProcess/Inspector/RemoteWebInspectorUI.cpp
r261671 r267411 1 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2016-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 180 180 } 181 181 182 void RemoteWebInspectorUI::open InNewTab(const String& url)183 { 184 WebProcess::singleton().parentProcessConnection()->send(Messages::RemoteWebInspectorProxy::Open InNewTab(url), m_page.identifier());182 void RemoteWebInspectorUI::openURLExternally(const String& url) 183 { 184 WebProcess::singleton().parentProcessConnection()->send(Messages::RemoteWebInspectorProxy::OpenURLExternally(url), m_page.identifier()); 185 185 } 186 186 -
trunk/Source/WebKit/WebProcess/Inspector/RemoteWebInspectorUI.h
r260847 r267411 1 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2016-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 87 87 void resetState() override; 88 88 89 void open InNewTab(const String& url) override;89 void openURLExternally(const String& url) override; 90 90 void save(const String& url, const String& content, bool base64Encoded, bool forceSaveAs) override; 91 91 void append(const String& url, const String& content) override; -
trunk/Source/WebKit/WebProcess/Inspector/WebInspector.cpp
r261103 r267411 1 1 /* 2 * Copyright (C) 2010 , 2014-2018Apple Inc. All rights reserved.2 * Copyright (C) 2010-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 159 159 } 160 160 161 void WebInspector::openInNewTab(const String& urlString)162 {163 UserGestureIndicator indicator { ProcessingUserGesture };164 165 Page* inspectedPage = m_page->corePage();166 if (!inspectedPage)167 return;168 169 Frame& inspectedMainFrame = inspectedPage->mainFrame();170 FrameLoadRequest frameLoadRequest { *inspectedMainFrame.document(), inspectedMainFrame.document()->securityOrigin(), ResourceRequest { urlString }, "_blank"_s, InitiatedByMainFrame::Unknown };171 172 NavigationAction action { *inspectedMainFrame.document(), frameLoadRequest.resourceRequest(), frameLoadRequest.initiatedByMainFrame(), NavigationType::LinkClicked };173 Page* newPage = inspectedPage->chrome().createWindow(inspectedMainFrame, { }, action);174 if (!newPage)175 return;176 177 newPage->mainFrame().loader().load(WTFMove(frameLoadRequest));178 }179 180 161 void WebInspector::evaluateScriptForTest(const String& script) 181 162 { -
trunk/Source/WebKit/WebProcess/Inspector/WebInspector.h
r261254 r267411 1 1 /* 2 * Copyright (C) 2010 , 2014, 2015Apple Inc. All rights reserved.2 * Copyright (C) 2010-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 56 56 void close(); 57 57 58 void openInNewTab(const String& urlString);59 60 58 void canAttachWindow(bool& result); 61 59 -
trunk/Source/WebKit/WebProcess/Inspector/WebInspector.messages.in
r255214 r267411 1 # Copyright (C) 2010 , 2014Apple Inc. All rights reserved.1 # Copyright (C) 2010-2020 Apple Inc. All rights reserved. 2 2 # 3 3 # Redistribution and use in source and binary forms, with or without … … 32 32 ShowMainResourceForFrame(WebCore::FrameIdentifier frameIdentifier) 33 33 34 OpenInNewTab(String url)35 36 34 StartPageProfiling() 37 35 StopPageProfiling() -
trunk/Source/WebKit/WebProcess/Inspector/WebInspectorFrontendAPIDispatcher.cpp
r255214 r267411 1 1 /* 2 * Copyright (C) 2014 , 2015Apple Inc. All rights reserved.2 * Copyright (C) 2014-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 116 116 } 117 117 118 void WebInspectorFrontendAPIDispatcher::evaluateExpressionForTesting(const String& expression) 119 { 120 evaluateOrQueueExpression(expression); 121 } 122 118 123 } // namespace WebKit -
trunk/Source/WebKit/WebProcess/Inspector/WebInspectorFrontendAPIDispatcher.h
r255214 r267411 1 1 /* 2 * Copyright (C) 2014 , 2015Apple Inc. All rights reserved.2 * Copyright (C) 2014-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 48 48 void dispatchMessageAsync(const String& message); 49 49 50 void evaluateExpressionForTesting(const String&); 50 51 private: 51 52 void evaluateOrQueueExpression(const String&); -
trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUI.cpp
r261671 r267411 1 1 /* 2 * Copyright (C) 2014-20 18Apple Inc. All rights reserved.2 * Copyright (C) 2014-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 83 83 void WebInspectorUI::updateConnection() 84 84 { 85 if (m_backendConnection) {86 m_backendConnection->invalidate();87 m_backendConnection = nullptr;88 }89 90 85 #if USE(UNIX_DOMAIN_SOCKETS) 91 86 IPC::Connection::SocketPair socketPair = IPC::Connection::createPlatformConnection(); … … 111 106 #endif 112 107 113 #if USE(UNIX_DOMAIN_SOCKETS) || OS(DARWIN) || PLATFORM(WIN)114 m_backendConnection = IPC::Connection::createServerConnection(connectionIdentifier, *this);115 m_backendConnection->open();116 #endif117 118 108 WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::SetFrontendConnection(connectionClientPort), m_inspectedPageIdentifier); 119 109 } … … 163 153 { 164 154 WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::DidClose(), m_inspectedPageIdentifier); 165 166 if (m_backendConnection) {167 m_backendConnection->invalidate();168 m_backendConnection = nullptr;169 }170 155 171 156 if (m_frontendController) { … … 297 282 } 298 283 299 void WebInspectorUI::openInNewTab(const String& url) 300 { 301 if (m_backendConnection) { 302 m_backendConnection->send(Messages::WebInspector::OpenInNewTab(url), 0); 303 WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::BringInspectedPageToFront(), m_inspectedPageIdentifier); 304 } 284 void WebInspectorUI::openURLExternally(const String& url) 285 { 286 WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::OpenURLExternally(url), m_inspectedPageIdentifier); 305 287 } 306 288 … … 396 378 } 397 379 380 void WebInspectorUI::evaluateInFrontendForTesting(const String& expression) 381 { 382 m_frontendAPIDispatcher.evaluateExpressionForTesting(expression); 383 } 384 398 385 void WebInspectorUI::pagePaused() 399 386 { -
trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUI.h
r261671 r267411 1 1 /* 2 * Copyright (C) 2014-20 16Apple Inc. All rights reserved.2 * Copyright (C) 2014-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 87 87 void didAppend(const String& url); 88 88 89 void sendMessageToFrontend(const String&); 89 void sendMessageToFrontend(const String& message); 90 void evaluateInFrontendForTesting(const String& expression); 90 91 91 92 #if ENABLE(INSPECTOR_TELEMETRY) 92 void setDiagnosticLoggingAvailable(bool avaliable);93 void setDiagnosticLoggingAvailable(bool); 93 94 #endif 94 95 … … 126 127 void changeSheetRect(const WebCore::FloatRect&) override; 127 128 128 void open InNewTab(const String& url) override;129 void openURLExternally(const String& url) override; 129 130 130 131 bool canSave() override; … … 154 155 WebInspectorFrontendAPIDispatcher m_frontendAPIDispatcher; 155 156 RefPtr<WebCore::InspectorFrontendHost> m_frontendHost; 156 RefPtr<IPC::Connection> m_backendConnection;157 157 158 158 // Keep a pointer to the frontend's inspector controller rather than going through -
trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUI.messages.in
r260847 r267411 1 # Copyright (C) 2014 , 2016Apple Inc. All rights reserved.1 # Copyright (C) 2014-2020 Apple Inc. All rights reserved. 2 2 # 3 3 # Redistribution and use in source and binary forms, with or without … … 52 52 53 53 SendMessageToFrontend(String message) 54 EvaluateInFrontendForTesting(String expression) 54 55 } -
trunk/Tools/ChangeLog
r267410 r267411 1 2020-09-22 Brian Burg <bburg@apple.com> 2 3 [Cocoa] _WKInspectorDelegate should handle showing external resources 4 https://bugs.webkit.org/show_bug.cgi?id=216334 5 6 Reviewed by Devin Rousso. 7 8 Test the delegate using WebKit API and using InspectorFrontendHost API. 9 10 * TestWebKitAPI/Tests/WebKitCocoa/WKInspectorDelegate.mm: 11 (-[InspectorDelegate inspector:openURLExternally:]): Added. 12 (TEST): 13 1 14 2020-09-22 Truitt Savell <tsavell@apple.com> 2 15 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKInspectorDelegate.mm
r266890 r267411 33 33 #import <WebKit/_WKInspector.h> 34 34 #import <WebKit/_WKInspectorDelegate.h> 35 #import <WebKit/_WKInspectorPrivateForTesting.h> 35 36 #import <wtf/RetainPtr.h> 36 37 … … 42 43 static bool browserDomainEnabledForInspectorCalled = false; 43 44 static bool browserDomainDisabledForInspectorCalled = false; 44 static RetainPtr<InspectorDelegate> sharedInspectorDelegate; 45 static bool openURLExternallyCalled = false; 46 static RetainPtr<id <_WKInspectorDelegate>> sharedInspectorDelegate; 47 static RetainPtr<NSURL> urlToOpen; 45 48 46 49 @interface InspectorDelegate : NSObject <_WKInspectorDelegate> … … 61 64 { 62 65 browserDomainDisabledForInspectorCalled = true; 66 } 67 68 - (void)inspector:(_WKInspector *)inspector openURLExternally:(NSURL *)url 69 { 70 EXPECT_STREQ(url.absoluteString.UTF8String, urlToOpen.get().absoluteString.UTF8String); 71 openURLExternallyCalled = true; 63 72 } 64 73 … … 86 95 @end 87 96 88 TEST(W ebKit_WKInspectorDelegate, DidNotifyForLocalInspector)97 TEST(WKInspectorDelegate, DidNotifyForLocalInspector) 89 98 { 90 99 auto webViewConfiguration = adoptNS([WKWebViewConfiguration new]); … … 105 114 } 106 115 116 TEST(WKInspectorDelegate, ShowURLExternally) 117 { 118 auto webViewConfiguration = adoptNS([WKWebViewConfiguration new]); 119 webViewConfiguration.get().preferences._developerExtrasEnabled = YES; 120 auto webView = adoptNS([[WKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600) configuration:webViewConfiguration.get()]); 121 auto uiDelegate = adoptNS([UIDelegate new]); 122 123 [webView setUIDelegate:uiDelegate.get()]; 124 [webView loadHTMLString:@"<head><title>Test page to be inspected</title></head><body><p>Filler content</p></body>" baseURL:[NSURL URLWithString:@"http://example.com/"]]; 125 126 [[webView _inspector] show]; 127 TestWebKitAPI::Util::run(&didAttachLocalInspectorCalled); 128 129 urlToOpen = [NSURL URLWithString:@"https://www.webkit.org/"]; 130 131 // Check the case where the load is intercepted by the navigation delegate. 132 [[webView _inspector] _openURLExternallyForTesting:urlToOpen.get() useFrontendAPI:NO]; 133 TestWebKitAPI::Util::run(&openURLExternallyCalled); 134 135 // Check the case where the frontend calls InspectorFrontendHost.openURLExternally(). 136 [[webView _inspector] _openURLExternallyForTesting:urlToOpen.get() useFrontendAPI:YES]; 137 TestWebKitAPI::Util::run(&openURLExternallyCalled); 138 } 139 107 140 #endif // PLATFORM(MAC)
Note:
See TracChangeset
for help on using the changeset viewer.