mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-15 22:22:53 +03:00
5891 lines
250 KiB
Diff
5891 lines
250 KiB
Diff
From 23d352fbff5f65f02eec92327a5c839b9f6c6fca Mon Sep 17 00:00:00 2001
|
|
From: Andrey Lushnikov <lushnikov@chromium.org>
|
|
Date: Fri, 15 Nov 2019 18:07:34 -0800
|
|
Subject: [PATCH xserver] chore: bootstrap
|
|
|
|
---
|
|
Source/JavaScriptCore/CMakeLists.txt | 3 +
|
|
Source/JavaScriptCore/DerivedSources.make | 3 +
|
|
.../inspector/InspectorBackendDispatcher.cpp | 21 +-
|
|
.../inspector/InspectorBackendDispatcher.h | 5 +-
|
|
.../inspector/InspectorTarget.h | 3 +
|
|
.../inspector/agents/InspectorTargetAgent.cpp | 46 +++-
|
|
.../inspector/agents/InspectorTargetAgent.h | 6 +-
|
|
.../inspector/protocol/Browser.json | 40 +++
|
|
.../inspector/protocol/DOM.json | 21 ++
|
|
.../inspector/protocol/Emulation.json | 14 +
|
|
.../inspector/protocol/Input.json | 160 +++++++++++
|
|
.../inspector/protocol/Page.json | 18 +-
|
|
.../inspector/protocol/Target.json | 18 +-
|
|
.../inspector/InspectorInstrumentation.cpp | 6 +
|
|
.../inspector/InspectorInstrumentation.h | 9 +
|
|
.../inspector/agents/InspectorDOMAgent.cpp | 57 ++++
|
|
.../inspector/agents/InspectorDOMAgent.h | 1 +
|
|
.../inspector/agents/InspectorPageAgent.cpp | 18 +-
|
|
.../inspector/agents/InspectorPageAgent.h | 3 +-
|
|
Source/WebCore/loader/FrameLoader.cpp | 1 +
|
|
Source/WebCore/page/History.cpp | 1 +
|
|
.../WebCore/platform/PlatformKeyboardEvent.h | 2 +
|
|
.../platform/gtk/PlatformKeyboardEventGtk.cpp | 242 +++++++++++++++++
|
|
.../libwpe/PlatformKeyboardEventLibWPE.cpp | 240 ++++++++++++++++
|
|
Source/WebKit/Shared/API/c/wpe/WebKit.h | 1 +
|
|
Source/WebKit/Shared/NativeWebKeyboardEvent.h | 5 +
|
|
Source/WebKit/Shared/NativeWebMouseEvent.h | 4 +
|
|
Source/WebKit/Shared/WebEvent.h | 6 +-
|
|
Source/WebKit/Shared/WebKeyboardEvent.cpp | 22 ++
|
|
.../Shared/gtk/NativeWebKeyboardEventGtk.cpp | 2 +-
|
|
.../Shared/gtk/NativeWebMouseEventGtk.cpp | 4 +-
|
|
Source/WebKit/Sources.txt | 8 +
|
|
Source/WebKit/SourcesCocoa.txt | 1 +
|
|
Source/WebKit/SourcesGTK.txt | 5 +
|
|
Source/WebKit/SourcesWPE.txt | 6 +-
|
|
Source/WebKit/UIProcess/API/APIAttachment.cpp | 1 +
|
|
Source/WebKit/UIProcess/API/C/WKPage.cpp | 2 +
|
|
.../UIProcess/API/Cocoa/_WKBrowserInspector.h | 50 ++++
|
|
.../API/Cocoa/_WKBrowserInspector.mm | 52 ++++
|
|
.../API/glib/WebKitBrowserInspector.cpp | 141 ++++++++++
|
|
.../API/glib/WebKitBrowserInspectorPrivate.h | 36 +++
|
|
.../UIProcess/API/glib/WebKitWebContext.cpp | 5 +
|
|
.../UIProcess/API/gtk/PageClientImpl.cpp | 2 +
|
|
.../API/gtk/WebKitBrowserInspector.h | 84 ++++++
|
|
Source/WebKit/UIProcess/API/gtk/webkit2.h | 1 +
|
|
.../API/wpe/WebKitBrowserInspector.h | 81 ++++++
|
|
Source/WebKit/UIProcess/API/wpe/webkit.h | 1 +
|
|
.../UIProcess/BrowserInspectorController.cpp | 128 +++++++++
|
|
.../UIProcess/BrowserInspectorController.h | 74 +++++
|
|
.../WebKit/UIProcess/BrowserInspectorPipe.cpp | 62 +++++
|
|
.../WebKit/UIProcess/BrowserInspectorPipe.h | 43 +++
|
|
.../UIProcess/BrowserInspectorTargetAgent.cpp | 110 ++++++++
|
|
.../UIProcess/BrowserInspectorTargetAgent.h | 62 +++++
|
|
.../PopUpSOAuthorizationSession.h | 4 +
|
|
.../PopUpSOAuthorizationSession.mm | 1 +
|
|
.../UIProcess/InspectorBrowserAgent.cpp | 101 +++++++
|
|
.../WebKit/UIProcess/InspectorBrowserAgent.h | 81 ++++++
|
|
.../UIProcess/InspectorBrowserAgentClient.h | 52 ++++
|
|
.../WebKit/UIProcess/InspectorTargetProxy.cpp | 18 +-
|
|
.../WebKit/UIProcess/InspectorTargetProxy.h | 11 +-
|
|
.../WebKit/UIProcess/RemoteInspectorPipe.cpp | 159 +++++++++++
|
|
Source/WebKit/UIProcess/RemoteInspectorPipe.h | 70 +++++
|
|
.../AuthenticatorManager.cpp | 1 +
|
|
.../UIProcess/WebPageInspectorController.cpp | 56 +++-
|
|
.../UIProcess/WebPageInspectorController.h | 8 +
|
|
.../WebPageInspectorEmulationAgent.cpp | 61 +++++
|
|
.../WebPageInspectorEmulationAgent.h | 63 +++++
|
|
.../UIProcess/WebPageInspectorInputAgent.cpp | 257 ++++++++++++++++++
|
|
.../UIProcess/WebPageInspectorInputAgent.h | 76 ++++++
|
|
.../UIProcess/WebPageInspectorTargetProxy.cpp | 129 +++++++++
|
|
.../UIProcess/WebPageInspectorTargetProxy.h | 67 +++++
|
|
Source/WebKit/UIProcess/WebPageProxy.cpp | 12 +-
|
|
Source/WebKit/UIProcess/WebPageProxy.h | 9 +
|
|
.../glib/InspectorBrowserAgentClientGLib.cpp | 130 +++++++++
|
|
.../glib/InspectorBrowserAgentClientGLib.h | 63 +++++
|
|
.../gtk/WebPageInspectorEmulationAgentGtk.cpp | 58 ++++
|
|
.../gtk/WebPageInspectorInputAgentGtk.cpp | 108 ++++++++
|
|
.../gtk/WebPageInspectorTargetProxyGtk.cpp | 45 +++
|
|
.../WebKit/UIProcess/ios/PageClientImplIOS.mm | 2 +
|
|
.../mac/InspectorBrowserAgentClientMac.h | 56 ++++
|
|
.../mac/InspectorBrowserAgentClientMac.mm | 95 +++++++
|
|
.../WebKit/UIProcess/mac/PageClientImplMac.mm | 5 +
|
|
.../mac/WebPageInspectorEmulationAgentMac.mm | 42 +++
|
|
.../mac/WebPageInspectorInputAgentMac.mm | 37 +++
|
|
.../mac/WebPageInspectorTargetProxyMac.mm | 41 +++
|
|
.../wpe/WebPageInspectorEmulationAgentWPE.cpp | 41 +++
|
|
.../wpe/WebPageInspectorInputAgentWPE.cpp | 99 +++++++
|
|
.../wpe/WebPageInspectorTargetProxyWPE.cpp | 41 +++
|
|
.../WebKit/WebKit.xcodeproj/project.pbxproj | 54 ++++
|
|
.../WebPage/WebPageInspectorTarget.cpp | 7 +
|
|
.../WebPage/WebPageInspectorTarget.h | 1 +
|
|
Source/WebKit/WebProcess/WebProcess.cpp | 3 +-
|
|
Tools/MiniBrowser/gtk/main.c | 28 ++
|
|
Tools/MiniBrowser/mac/AppDelegate.h | 4 +-
|
|
Tools/MiniBrowser/mac/AppDelegate.m | 25 +-
|
|
.../mac/WK2BrowserWindowController.h | 3 +
|
|
.../mac/WK2BrowserWindowController.m | 17 +-
|
|
Tools/MiniBrowser/wpe/main.cpp | 37 +++
|
|
98 files changed, 4162 insertions(+), 53 deletions(-)
|
|
create mode 100644 Source/JavaScriptCore/inspector/protocol/Browser.json
|
|
create mode 100644 Source/JavaScriptCore/inspector/protocol/Emulation.json
|
|
create mode 100644 Source/JavaScriptCore/inspector/protocol/Input.json
|
|
create mode 100644 Source/WebKit/UIProcess/API/Cocoa/_WKBrowserInspector.h
|
|
create mode 100644 Source/WebKit/UIProcess/API/Cocoa/_WKBrowserInspector.mm
|
|
create mode 100644 Source/WebKit/UIProcess/API/glib/WebKitBrowserInspector.cpp
|
|
create mode 100644 Source/WebKit/UIProcess/API/glib/WebKitBrowserInspectorPrivate.h
|
|
create mode 100644 Source/WebKit/UIProcess/API/gtk/WebKitBrowserInspector.h
|
|
create mode 100644 Source/WebKit/UIProcess/API/wpe/WebKitBrowserInspector.h
|
|
create mode 100644 Source/WebKit/UIProcess/BrowserInspectorController.cpp
|
|
create mode 100644 Source/WebKit/UIProcess/BrowserInspectorController.h
|
|
create mode 100644 Source/WebKit/UIProcess/BrowserInspectorPipe.cpp
|
|
create mode 100644 Source/WebKit/UIProcess/BrowserInspectorPipe.h
|
|
create mode 100644 Source/WebKit/UIProcess/BrowserInspectorTargetAgent.cpp
|
|
create mode 100644 Source/WebKit/UIProcess/BrowserInspectorTargetAgent.h
|
|
create mode 100644 Source/WebKit/UIProcess/InspectorBrowserAgent.cpp
|
|
create mode 100644 Source/WebKit/UIProcess/InspectorBrowserAgent.h
|
|
create mode 100644 Source/WebKit/UIProcess/InspectorBrowserAgentClient.h
|
|
create mode 100644 Source/WebKit/UIProcess/RemoteInspectorPipe.cpp
|
|
create mode 100644 Source/WebKit/UIProcess/RemoteInspectorPipe.h
|
|
create mode 100644 Source/WebKit/UIProcess/WebPageInspectorEmulationAgent.cpp
|
|
create mode 100644 Source/WebKit/UIProcess/WebPageInspectorEmulationAgent.h
|
|
create mode 100644 Source/WebKit/UIProcess/WebPageInspectorInputAgent.cpp
|
|
create mode 100644 Source/WebKit/UIProcess/WebPageInspectorInputAgent.h
|
|
create mode 100644 Source/WebKit/UIProcess/WebPageInspectorTargetProxy.cpp
|
|
create mode 100644 Source/WebKit/UIProcess/WebPageInspectorTargetProxy.h
|
|
create mode 100644 Source/WebKit/UIProcess/glib/InspectorBrowserAgentClientGLib.cpp
|
|
create mode 100644 Source/WebKit/UIProcess/glib/InspectorBrowserAgentClientGLib.h
|
|
create mode 100644 Source/WebKit/UIProcess/gtk/WebPageInspectorEmulationAgentGtk.cpp
|
|
create mode 100644 Source/WebKit/UIProcess/gtk/WebPageInspectorInputAgentGtk.cpp
|
|
create mode 100644 Source/WebKit/UIProcess/gtk/WebPageInspectorTargetProxyGtk.cpp
|
|
create mode 100644 Source/WebKit/UIProcess/mac/InspectorBrowserAgentClientMac.h
|
|
create mode 100644 Source/WebKit/UIProcess/mac/InspectorBrowserAgentClientMac.mm
|
|
create mode 100644 Source/WebKit/UIProcess/mac/WebPageInspectorEmulationAgentMac.mm
|
|
create mode 100644 Source/WebKit/UIProcess/mac/WebPageInspectorInputAgentMac.mm
|
|
create mode 100644 Source/WebKit/UIProcess/mac/WebPageInspectorTargetProxyMac.mm
|
|
create mode 100644 Source/WebKit/UIProcess/wpe/WebPageInspectorEmulationAgentWPE.cpp
|
|
create mode 100644 Source/WebKit/UIProcess/wpe/WebPageInspectorInputAgentWPE.cpp
|
|
create mode 100644 Source/WebKit/UIProcess/wpe/WebPageInspectorTargetProxyWPE.cpp
|
|
|
|
diff --git a/Source/JavaScriptCore/CMakeLists.txt b/Source/JavaScriptCore/CMakeLists.txt
|
|
index f25ff61db99..a7085df58f8 100644
|
|
--- a/Source/JavaScriptCore/CMakeLists.txt
|
|
+++ b/Source/JavaScriptCore/CMakeLists.txt
|
|
@@ -1142,6 +1142,7 @@ set(JavaScriptCore_INSPECTOR_DOMAINS
|
|
${JAVASCRIPTCORE_DIR}/inspector/protocol/Animation.json
|
|
${JAVASCRIPTCORE_DIR}/inspector/protocol/ApplicationCache.json
|
|
${JAVASCRIPTCORE_DIR}/inspector/protocol/Audit.json
|
|
+ ${JAVASCRIPTCORE_DIR}/inspector/protocol/Browser.json
|
|
${JAVASCRIPTCORE_DIR}/inspector/protocol/CSS.json
|
|
${JAVASCRIPTCORE_DIR}/inspector/protocol/Canvas.json
|
|
${JAVASCRIPTCORE_DIR}/inspector/protocol/Console.json
|
|
@@ -1150,8 +1151,10 @@ set(JavaScriptCore_INSPECTOR_DOMAINS
|
|
${JAVASCRIPTCORE_DIR}/inspector/protocol/DOMStorage.json
|
|
${JAVASCRIPTCORE_DIR}/inspector/protocol/Database.json
|
|
${JAVASCRIPTCORE_DIR}/inspector/protocol/Debugger.json
|
|
+ ${JAVASCRIPTCORE_DIR}/inspector/protocol/Emulation.json
|
|
${JAVASCRIPTCORE_DIR}/inspector/protocol/GenericTypes.json
|
|
${JAVASCRIPTCORE_DIR}/inspector/protocol/Heap.json
|
|
+ ${JAVASCRIPTCORE_DIR}/inspector/protocol/Input.json
|
|
${JAVASCRIPTCORE_DIR}/inspector/protocol/Inspector.json
|
|
${JAVASCRIPTCORE_DIR}/inspector/protocol/LayerTree.json
|
|
${JAVASCRIPTCORE_DIR}/inspector/protocol/Network.json
|
|
diff --git a/Source/JavaScriptCore/DerivedSources.make b/Source/JavaScriptCore/DerivedSources.make
|
|
index f59212ff01c..c1fb126e017 100644
|
|
--- a/Source/JavaScriptCore/DerivedSources.make
|
|
+++ b/Source/JavaScriptCore/DerivedSources.make
|
|
@@ -238,6 +238,7 @@ INSPECTOR_DOMAINS := \
|
|
$(JavaScriptCore)/inspector/protocol/Animation.json \
|
|
$(JavaScriptCore)/inspector/protocol/ApplicationCache.json \
|
|
$(JavaScriptCore)/inspector/protocol/Audit.json \
|
|
+ $(JavaScriptCore)/inspector/protocol/Browser.json \
|
|
$(JavaScriptCore)/inspector/protocol/CSS.json \
|
|
$(JavaScriptCore)/inspector/protocol/Canvas.json \
|
|
$(JavaScriptCore)/inspector/protocol/Console.json \
|
|
@@ -246,8 +247,10 @@ INSPECTOR_DOMAINS := \
|
|
$(JavaScriptCore)/inspector/protocol/DOMStorage.json \
|
|
$(JavaScriptCore)/inspector/protocol/Database.json \
|
|
$(JavaScriptCore)/inspector/protocol/Debugger.json \
|
|
+ $(JavaScriptCore)/inspector/protocol/Emulation.json \
|
|
$(JavaScriptCore)/inspector/protocol/GenericTypes.json \
|
|
$(JavaScriptCore)/inspector/protocol/Heap.json \
|
|
+ $(JavaScriptCore)/inspector/protocol/Input.json \
|
|
$(JavaScriptCore)/inspector/protocol/Inspector.json \
|
|
$(JavaScriptCore)/inspector/protocol/LayerTree.json \
|
|
$(JavaScriptCore)/inspector/protocol/Network.json \
|
|
diff --git a/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp b/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp
|
|
index 038cb646d31..8a01d7679bf 100644
|
|
--- a/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp
|
|
+++ b/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp
|
|
@@ -102,7 +102,7 @@ void BackendDispatcher::registerDispatcherForDomain(const String& domain, Supple
|
|
m_dispatchers.set(domain, dispatcher);
|
|
}
|
|
|
|
-void BackendDispatcher::dispatch(const String& message)
|
|
+BackendDispatcher::DispatchResult BackendDispatcher::dispatch(const String& message, Mode mode)
|
|
{
|
|
Ref<BackendDispatcher> protect(*this);
|
|
|
|
@@ -120,26 +120,26 @@ void BackendDispatcher::dispatch(const String& message)
|
|
if (!JSON::Value::parseJSON(message, parsedMessage)) {
|
|
reportProtocolError(ParseError, "Message must be in JSON format"_s);
|
|
sendPendingErrors();
|
|
- return;
|
|
+ return DispatchResult::Finished;
|
|
}
|
|
|
|
if (!parsedMessage->asObject(messageObject)) {
|
|
reportProtocolError(InvalidRequest, "Message must be a JSONified object"_s);
|
|
sendPendingErrors();
|
|
- return;
|
|
+ return DispatchResult::Finished;
|
|
}
|
|
|
|
RefPtr<JSON::Value> requestIdValue;
|
|
if (!messageObject->getValue("id"_s, requestIdValue)) {
|
|
reportProtocolError(InvalidRequest, "'id' property was not found"_s);
|
|
sendPendingErrors();
|
|
- return;
|
|
+ return DispatchResult::Finished;
|
|
}
|
|
|
|
if (!requestIdValue->asInteger(requestId)) {
|
|
reportProtocolError(InvalidRequest, "The type of 'id' property must be integer"_s);
|
|
sendPendingErrors();
|
|
- return;
|
|
+ return DispatchResult::Finished;
|
|
}
|
|
}
|
|
|
|
@@ -151,29 +151,31 @@ void BackendDispatcher::dispatch(const String& message)
|
|
if (!messageObject->getValue("method"_s, methodValue)) {
|
|
reportProtocolError(InvalidRequest, "'method' property wasn't found"_s);
|
|
sendPendingErrors();
|
|
- return;
|
|
+ return DispatchResult::Finished;
|
|
}
|
|
|
|
String methodString;
|
|
if (!methodValue->asString(methodString)) {
|
|
reportProtocolError(InvalidRequest, "The type of 'method' property must be string"_s);
|
|
sendPendingErrors();
|
|
- return;
|
|
+ return DispatchResult::Finished;
|
|
}
|
|
|
|
Vector<String> domainAndMethod = methodString.splitAllowingEmptyEntries('.');
|
|
if (domainAndMethod.size() != 2 || !domainAndMethod[0].length() || !domainAndMethod[1].length()) {
|
|
reportProtocolError(InvalidRequest, "The 'method' property was formatted incorrectly. It should be 'Domain.method'"_s);
|
|
sendPendingErrors();
|
|
- return;
|
|
+ return DispatchResult::Finished;
|
|
}
|
|
|
|
String domain = domainAndMethod[0];
|
|
SupplementalBackendDispatcher* domainDispatcher = m_dispatchers.get(domain);
|
|
if (!domainDispatcher) {
|
|
+ if (mode == Mode::ContinueIfDomainIsMissing)
|
|
+ return DispatchResult::Continue;
|
|
reportProtocolError(MethodNotFound, "'" + domain + "' domain was not found");
|
|
sendPendingErrors();
|
|
- return;
|
|
+ return DispatchResult::Finished;
|
|
}
|
|
|
|
String method = domainAndMethod[1];
|
|
@@ -182,6 +184,7 @@ void BackendDispatcher::dispatch(const String& message)
|
|
if (m_protocolErrors.size())
|
|
sendPendingErrors();
|
|
}
|
|
+ return DispatchResult::Finished;
|
|
}
|
|
|
|
// FIXME: remove this function when legacy InspectorObject symbols are no longer needed <http://webkit.org/b/179847>.
|
|
diff --git a/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h b/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h
|
|
index 95d9d81188e..6f96f174dff 100644
|
|
--- a/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h
|
|
+++ b/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h
|
|
@@ -82,7 +82,10 @@ public:
|
|
};
|
|
|
|
void registerDispatcherForDomain(const String& domain, SupplementalBackendDispatcher*);
|
|
- void dispatch(const String& message);
|
|
+
|
|
+ enum class DispatchResult { Finished, Continue };
|
|
+ enum class Mode { FailIfDomainIsMissing, ContinueIfDomainIsMissing };
|
|
+ DispatchResult dispatch(const String& message, Mode mode = Mode::FailIfDomainIsMissing);
|
|
|
|
// Note that 'unused' is a workaround so the compiler can pick the right sendResponse based on arity.
|
|
// When <http://webkit.org/b/179847> is fixed or this class is renamed for the JSON::Object case,
|
|
diff --git a/Source/JavaScriptCore/inspector/InspectorTarget.h b/Source/JavaScriptCore/inspector/InspectorTarget.h
|
|
index a9f04b8a0c9..045b9ecd39a 100644
|
|
--- a/Source/JavaScriptCore/inspector/InspectorTarget.h
|
|
+++ b/Source/JavaScriptCore/inspector/InspectorTarget.h
|
|
@@ -45,6 +45,7 @@ public:
|
|
// State.
|
|
virtual String identifier() const = 0;
|
|
virtual InspectorTargetType type() const = 0;
|
|
+ virtual String url() const = 0;
|
|
|
|
virtual bool isProvisional() const { return false; }
|
|
|
|
@@ -52,6 +53,8 @@ public:
|
|
virtual void connect(FrontendChannel::ConnectionType) = 0;
|
|
virtual void disconnect() = 0;
|
|
virtual void sendMessageToTargetBackend(const String&) = 0;
|
|
+ virtual void activate(String& error) { error = "Target cannot be activated"; }
|
|
+ virtual void close(String& error) { error = "Target cannot be closed"; }
|
|
};
|
|
|
|
} // namespace Inspector
|
|
diff --git a/Source/JavaScriptCore/inspector/agents/InspectorTargetAgent.cpp b/Source/JavaScriptCore/inspector/agents/InspectorTargetAgent.cpp
|
|
index 1177090fc18..764b62c727c 100644
|
|
--- a/Source/JavaScriptCore/inspector/agents/InspectorTargetAgent.cpp
|
|
+++ b/Source/JavaScriptCore/inspector/agents/InspectorTargetAgent.cpp
|
|
@@ -30,11 +30,12 @@
|
|
|
|
namespace Inspector {
|
|
|
|
-InspectorTargetAgent::InspectorTargetAgent(FrontendRouter& frontendRouter, BackendDispatcher& backendDispatcher)
|
|
+InspectorTargetAgent::InspectorTargetAgent(FrontendRouter& frontendRouter, BackendDispatcher& backendDispatcher, const String& browserContextID)
|
|
: InspectorAgentBase("Target"_s)
|
|
, m_router(frontendRouter)
|
|
, m_frontendDispatcher(makeUnique<TargetFrontendDispatcher>(frontendRouter))
|
|
, m_backendDispatcher(TargetBackendDispatcher::create(backendDispatcher, this))
|
|
+ , m_browserContextID(browserContextID)
|
|
{
|
|
}
|
|
|
|
@@ -65,6 +66,28 @@ void InspectorTargetAgent::sendMessageToTarget(ErrorString& errorString, const S
|
|
target->sendMessageToTargetBackend(message);
|
|
}
|
|
|
|
+void InspectorTargetAgent::activate(ErrorString& errorString, const String& targetId)
|
|
+{
|
|
+ InspectorTarget* target = m_targets.get(targetId);
|
|
+ if (!target) {
|
|
+ errorString = "Missing target for given targetId"_s;
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ target->activate(errorString);
|
|
+}
|
|
+
|
|
+void InspectorTargetAgent::close(ErrorString& errorString, const String& targetId)
|
|
+{
|
|
+ InspectorTarget* target = m_targets.get(targetId);
|
|
+ if (!target) {
|
|
+ errorString = "Missing target for given targetId"_s;
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ target->close(errorString);
|
|
+}
|
|
+
|
|
void InspectorTargetAgent::sendMessageFromTargetToFrontend(const String& targetId, const String& message)
|
|
{
|
|
ASSERT_WITH_MESSAGE(m_targets.get(targetId), "Sending a message from an untracked target to the frontend.");
|
|
@@ -87,14 +110,17 @@ static Protocol::Target::TargetInfo::Type targetTypeToProtocolType(InspectorTarg
|
|
return Protocol::Target::TargetInfo::Type::Page;
|
|
}
|
|
|
|
-static Ref<Protocol::Target::TargetInfo> buildTargetInfoObject(const InspectorTarget& target)
|
|
+static Ref<Protocol::Target::TargetInfo> buildTargetInfoObject(const InspectorTarget& target, const String& browserContextID)
|
|
{
|
|
auto result = Protocol::Target::TargetInfo::create()
|
|
.setTargetId(target.identifier())
|
|
.setType(targetTypeToProtocolType(target.type()))
|
|
+ .setUrl(target.url())
|
|
.release();
|
|
if (target.isProvisional())
|
|
result->setIsProvisional(true);
|
|
+ if (!browserContextID.isEmpty())
|
|
+ result->setBrowserContextId(browserContextID);
|
|
return result;
|
|
}
|
|
|
|
@@ -108,7 +134,7 @@ void InspectorTargetAgent::targetCreated(InspectorTarget& target)
|
|
|
|
target.connect(connectionType());
|
|
|
|
- m_frontendDispatcher->targetCreated(buildTargetInfoObject(target));
|
|
+ m_frontendDispatcher->targetCreated(buildTargetInfoObject(target, m_browserContextID));
|
|
}
|
|
|
|
void InspectorTargetAgent::targetDestroyed(InspectorTarget& target)
|
|
@@ -135,6 +161,18 @@ void InspectorTargetAgent::didCommitProvisionalTarget(const String& oldTargetID,
|
|
m_frontendDispatcher->didCommitProvisionalTarget(oldTargetID, committedTargetID);
|
|
}
|
|
|
|
+void InspectorTargetAgent::ensureConnected(const String& targetID)
|
|
+{
|
|
+ if (!m_isConnected)
|
|
+ return;
|
|
+
|
|
+ auto* target = m_targets.get(targetID);
|
|
+ if (!target)
|
|
+ return;
|
|
+
|
|
+ target->connect(connectionType());
|
|
+}
|
|
+
|
|
FrontendChannel::ConnectionType InspectorTargetAgent::connectionType() const
|
|
{
|
|
return m_router.hasLocalFrontend() ? Inspector::FrontendChannel::ConnectionType::Local : Inspector::FrontendChannel::ConnectionType::Remote;
|
|
@@ -144,7 +182,7 @@ void InspectorTargetAgent::connectToTargets()
|
|
{
|
|
for (InspectorTarget* target : m_targets.values()) {
|
|
target->connect(connectionType());
|
|
- m_frontendDispatcher->targetCreated(buildTargetInfoObject(*target));
|
|
+ m_frontendDispatcher->targetCreated(buildTargetInfoObject(*target, m_browserContextID));
|
|
}
|
|
}
|
|
|
|
diff --git a/Source/JavaScriptCore/inspector/agents/InspectorTargetAgent.h b/Source/JavaScriptCore/inspector/agents/InspectorTargetAgent.h
|
|
index 38cb318986b..4287e05e559 100644
|
|
--- a/Source/JavaScriptCore/inspector/agents/InspectorTargetAgent.h
|
|
+++ b/Source/JavaScriptCore/inspector/agents/InspectorTargetAgent.h
|
|
@@ -41,7 +41,7 @@ class JS_EXPORT_PRIVATE InspectorTargetAgent : public InspectorAgentBase, public
|
|
WTF_MAKE_NONCOPYABLE(InspectorTargetAgent);
|
|
WTF_MAKE_FAST_ALLOCATED;
|
|
public:
|
|
- InspectorTargetAgent(FrontendRouter&, BackendDispatcher&);
|
|
+ InspectorTargetAgent(FrontendRouter&, BackendDispatcher&, const String& browserContextID);
|
|
~InspectorTargetAgent() override;
|
|
|
|
// InspectorAgentBase
|
|
@@ -50,11 +50,14 @@ public:
|
|
|
|
// TargetBackendDispatcherHandler
|
|
void sendMessageToTarget(ErrorString&, const String& targetId, const String& message) final;
|
|
+ void activate(ErrorString&, const String& targetId) override;
|
|
+ void close(ErrorString&, const String& targetId) override;
|
|
|
|
// Target lifecycle.
|
|
void targetCreated(InspectorTarget&);
|
|
void targetDestroyed(InspectorTarget&);
|
|
void didCommitProvisionalTarget(const String& oldTargetID, const String& committedTargetID);
|
|
+ void ensureConnected(const String& targetID);
|
|
|
|
// Target messages.
|
|
void sendMessageFromTargetToFrontend(const String& targetId, const String& message);
|
|
@@ -68,6 +71,7 @@ private:
|
|
Inspector::FrontendRouter& m_router;
|
|
std::unique_ptr<TargetFrontendDispatcher> m_frontendDispatcher;
|
|
Ref<TargetBackendDispatcher> m_backendDispatcher;
|
|
+ const String m_browserContextID;
|
|
HashMap<String, InspectorTarget*> m_targets;
|
|
bool m_isConnected { false };
|
|
};
|
|
diff --git a/Source/JavaScriptCore/inspector/protocol/Browser.json b/Source/JavaScriptCore/inspector/protocol/Browser.json
|
|
new file mode 100644
|
|
index 00000000000..bed4a3bfe6f
|
|
--- /dev/null
|
|
+++ b/Source/JavaScriptCore/inspector/protocol/Browser.json
|
|
@@ -0,0 +1,40 @@
|
|
+{
|
|
+ "domain": "Browser",
|
|
+ "availability": ["web"],
|
|
+ "types": [
|
|
+ {
|
|
+ "id": "ContextID",
|
|
+ "type": "string",
|
|
+ "description": "Id of Browser context."
|
|
+ }
|
|
+ ],
|
|
+ "commands": [
|
|
+ {
|
|
+ "name": "close",
|
|
+ "description": "Close browser."
|
|
+ },
|
|
+ {
|
|
+ "name": "createContext",
|
|
+ "description": "Creates new ephemeral browser context.",
|
|
+ "returns": [
|
|
+ { "name": "browserContextId", "$ref": "ContextID", "description": "Unique identifier of the context." }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "name": "deleteContext",
|
|
+ "description": "Deletes browser context previously created with createContect. The command will automatically close all pages that use the context.",
|
|
+ "parameters": [
|
|
+ { "name": "browserContextId", "$ref": "ContextID", "description": "Identifier of the context to delete." }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "name": "createPage",
|
|
+ "parameters": [
|
|
+ { "name": "browserContextId", "$ref": "ContextID", "optional": true, "description": "JSON Inspector Protocol message (command) to be dispatched on the backend." }
|
|
+ ],
|
|
+ "returns": [
|
|
+ { "name": "targetId", "type": "string", "description": "Unique identifier for the page target." }
|
|
+ ]
|
|
+ }
|
|
+ ]
|
|
+}
|
|
diff --git a/Source/JavaScriptCore/inspector/protocol/DOM.json b/Source/JavaScriptCore/inspector/protocol/DOM.json
|
|
index 38cb48bedf2..285027ae5d7 100644
|
|
--- a/Source/JavaScriptCore/inspector/protocol/DOM.json
|
|
+++ b/Source/JavaScriptCore/inspector/protocol/DOM.json
|
|
@@ -542,6 +542,27 @@
|
|
"parameters": [
|
|
{ "name": "allow", "type": "boolean" }
|
|
]
|
|
+ },
|
|
+ {
|
|
+ "name": "getContentQuads",
|
|
+ "description": "Returns quads that describe node position on the page. This method\nmight return multiple quads for inline nodes.",
|
|
+ "parameters": [
|
|
+ {
|
|
+ "name": "objectId",
|
|
+ "description": "JavaScript object id of the node wrapper.",
|
|
+ "$ref": "Runtime.RemoteObjectId"
|
|
+ }
|
|
+ ],
|
|
+ "returns": [
|
|
+ {
|
|
+ "name": "quads",
|
|
+ "description": "Quads that describe node layout relative to viewport.",
|
|
+ "type": "array",
|
|
+ "items": {
|
|
+ "$ref": "Quad"
|
|
+ }
|
|
+ }
|
|
+ ]
|
|
}
|
|
],
|
|
"events": [
|
|
diff --git a/Source/JavaScriptCore/inspector/protocol/Emulation.json b/Source/JavaScriptCore/inspector/protocol/Emulation.json
|
|
new file mode 100644
|
|
index 00000000000..168e3f2b93d
|
|
--- /dev/null
|
|
+++ b/Source/JavaScriptCore/inspector/protocol/Emulation.json
|
|
@@ -0,0 +1,14 @@
|
|
+{
|
|
+ "domain": "Emulation",
|
|
+ "availability": ["web"],
|
|
+ "commands": [
|
|
+ {
|
|
+ "name": "setDeviceMetricsOverride",
|
|
+ "description": "Overrides device metrics with provided values.",
|
|
+ "parameters": [
|
|
+ { "name": "width", "type": "integer" },
|
|
+ { "name": "height", "type": "integer" }
|
|
+ ]
|
|
+ }
|
|
+ ]
|
|
+}
|
|
diff --git a/Source/JavaScriptCore/inspector/protocol/Input.json b/Source/JavaScriptCore/inspector/protocol/Input.json
|
|
new file mode 100644
|
|
index 00000000000..79bbe73b0df
|
|
--- /dev/null
|
|
+++ b/Source/JavaScriptCore/inspector/protocol/Input.json
|
|
@@ -0,0 +1,160 @@
|
|
+{
|
|
+ "domain": "Input",
|
|
+ "availability": ["web"],
|
|
+ "types": [
|
|
+ {
|
|
+ "id": "TimeSinceEpoch",
|
|
+ "description": "UTC time in seconds, counted from January 1, 1970.",
|
|
+ "type": "number"
|
|
+ }
|
|
+ ],
|
|
+ "commands": [
|
|
+ {
|
|
+ "name": "goBack",
|
|
+ "description": "FIXME: move this to Page domain."
|
|
+ },
|
|
+ {
|
|
+ "name": "dispatchKeyEvent",
|
|
+ "description": "Dispatches a key event to the page.",
|
|
+ "async": true,
|
|
+ "parameters": [
|
|
+ {
|
|
+ "name": "type",
|
|
+ "description": "Type of the key event.",
|
|
+ "type": "string",
|
|
+ "enum": [
|
|
+ "keyDown",
|
|
+ "keyUp"
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "name": "modifiers",
|
|
+ "description": "Bit field representing pressed modifier keys. (default: 0).",
|
|
+ "optional": true,
|
|
+ "type": "integer"
|
|
+ },
|
|
+ {
|
|
+ "name": "text",
|
|
+ "description": "Text as generated by processing a virtual key code with a keyboard layout. Not needed for\nfor `keyUp` and `rawKeyDown` events (default: \"\")",
|
|
+ "optional": true,
|
|
+ "type": "string"
|
|
+ },
|
|
+ {
|
|
+ "name": "unmodifiedText",
|
|
+ "description": "Text that would have been generated by the keyboard if no modifiers were pressed (except for\nshift). Useful for shortcut (accelerator) key handling (default: \"\").",
|
|
+ "optional": true,
|
|
+ "type": "string"
|
|
+ },
|
|
+ {
|
|
+ "name": "code",
|
|
+ "description": "Unique DOM defined string value for each physical key (e.g., 'KeyA') (default: \"\").",
|
|
+ "optional": true,
|
|
+ "type": "string"
|
|
+ },
|
|
+ {
|
|
+ "name": "key",
|
|
+ "description": "Unique DOM defined string value describing the meaning of the key in the context of active\nmodifiers, keyboard layout, etc (e.g., 'AltGr') (default: \"\").",
|
|
+ "optional": true,
|
|
+ "type": "string"
|
|
+ },
|
|
+ {
|
|
+ "name": "windowsVirtualKeyCode",
|
|
+ "description": "Windows virtual key code (default: 0).",
|
|
+ "optional": true,
|
|
+ "type": "integer"
|
|
+ },
|
|
+ {
|
|
+ "name": "nativeVirtualKeyCode",
|
|
+ "description": "Native virtual key code (default: 0).",
|
|
+ "optional": true,
|
|
+ "type": "integer"
|
|
+ },
|
|
+ {
|
|
+ "name": "autoRepeat",
|
|
+ "description": "Whether the event was generated from auto repeat (default: false).",
|
|
+ "optional": true,
|
|
+ "type": "boolean"
|
|
+ },
|
|
+ {
|
|
+ "name": "isKeypad",
|
|
+ "description": "Whether the event was generated from the keypad (default: false).",
|
|
+ "optional": true,
|
|
+ "type": "boolean"
|
|
+ },
|
|
+ {
|
|
+ "name": "isSystemKey",
|
|
+ "description": "Whether the event was a system key event (default: false).",
|
|
+ "optional": true,
|
|
+ "type": "boolean"
|
|
+ }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "name": "dispatchMouseEvent",
|
|
+ "description": "Dispatches a mouse event to the page.",
|
|
+ "async": true,
|
|
+ "parameters": [
|
|
+ {
|
|
+ "name": "type",
|
|
+ "description": "Type of the mouse event.",
|
|
+ "type": "string",
|
|
+ "enum": [ "move", "down", "up", "wheel"]
|
|
+ },
|
|
+ {
|
|
+ "name": "x",
|
|
+ "description": "X coordinate of the event relative to the main frame's viewport in CSS pixels.",
|
|
+ "type": "integer"
|
|
+ },
|
|
+ {
|
|
+ "name": "y",
|
|
+ "description": "Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to\nthe top of the viewport and Y increases as it proceeds towards the bottom of the viewport.",
|
|
+ "type": "integer"
|
|
+ },
|
|
+ {
|
|
+ "name": "modifiers",
|
|
+ "description": "Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8\n(default: 0).",
|
|
+ "optional": true,
|
|
+ "type": "integer"
|
|
+ },
|
|
+ {
|
|
+ "name": "button",
|
|
+ "description": "Mouse button (default: \"none\").",
|
|
+ "optional": true,
|
|
+ "type": "string",
|
|
+ "enum": [
|
|
+ "none",
|
|
+ "left",
|
|
+ "middle",
|
|
+ "right",
|
|
+ "back",
|
|
+ "forward"
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "name": "buttons",
|
|
+ "description": "A number indicating which buttons are pressed on the mouse when a mouse event is triggered.\nLeft=1, Right=2, Middle=4, Back=8, Forward=16, None=0.",
|
|
+ "optional": true,
|
|
+ "type": "integer"
|
|
+ },
|
|
+ {
|
|
+ "name": "clickCount",
|
|
+ "description": "Number of times the mouse button was clicked (default: 0).",
|
|
+ "optional": true,
|
|
+ "type": "integer"
|
|
+ },
|
|
+ {
|
|
+ "name": "deltaX",
|
|
+ "description": "X delta in CSS pixels for mouse wheel event (default: 0).",
|
|
+ "optional": true,
|
|
+ "type": "integer"
|
|
+ },
|
|
+ {
|
|
+ "name": "deltaY",
|
|
+ "description": "Y delta in CSS pixels for mouse wheel event (default: 0).",
|
|
+ "optional": true,
|
|
+ "type": "integer"
|
|
+ }
|
|
+ ]
|
|
+ }
|
|
+ ]
|
|
+}
|
|
diff --git a/Source/JavaScriptCore/inspector/protocol/Page.json b/Source/JavaScriptCore/inspector/protocol/Page.json
|
|
index 367d1f235a8..62321e6c893 100644
|
|
--- a/Source/JavaScriptCore/inspector/protocol/Page.json
|
|
+++ b/Source/JavaScriptCore/inspector/protocol/Page.json
|
|
@@ -131,7 +131,8 @@
|
|
"name": "navigate",
|
|
"description": "Navigates current page to the given URL.",
|
|
"parameters": [
|
|
- { "name": "url", "type": "string", "description": "URL to navigate the page to." }
|
|
+ { "name": "url", "type": "string", "description": "URL to navigate the page to." },
|
|
+ { "name": "frameId", "$ref": "Network.FrameId", "optional": true, "description": "Id of the frame to navigate."}
|
|
]
|
|
},
|
|
{
|
|
@@ -347,6 +348,21 @@
|
|
]
|
|
},
|
|
{
|
|
+ "name": "navigatedWithinDocument",
|
|
+ "description": "Fired when same-document navigation happens, e.g. due to history API usage or anchor navigation.",
|
|
+ "parameters": [
|
|
+ {
|
|
+ "name": "frameId",
|
|
+ "description": "Id of the frame.",
|
|
+ "$ref": "Network.FrameId"
|
|
+ },
|
|
+ {
|
|
+ "name": "url",
|
|
+ "description": "Frame's new url.",
|
|
+ "type": "string"
|
|
+ }
|
|
+ ]
|
|
+ }, {
|
|
"name": "defaultAppearanceDidChange",
|
|
"description": "Fired when page's default appearance changes, even if there is a forced appearance.",
|
|
"parameters": [
|
|
diff --git a/Source/JavaScriptCore/inspector/protocol/Target.json b/Source/JavaScriptCore/inspector/protocol/Target.json
|
|
index 240cd42e67e..f635c67ef3f 100644
|
|
--- a/Source/JavaScriptCore/inspector/protocol/Target.json
|
|
+++ b/Source/JavaScriptCore/inspector/protocol/Target.json
|
|
@@ -10,7 +10,9 @@
|
|
"properties": [
|
|
{ "name": "targetId", "type": "string", "description": "Unique identifier for the target." },
|
|
{ "name": "type", "type": "string", "enum": ["page", "service-worker", "worker"] },
|
|
- { "name": "isProvisional", "type": "boolean", "optional": true, "description": "True value indicates that this is a provisional page target i.e. Such target may be created when current page starts cross-origin navigation. Eventually each provisional target is either committed and swaps with the current target or gets destroyed, e.g. in case of load request failure." }
|
|
+ { "name": "url", "type": "string" },
|
|
+ { "name": "isProvisional", "type": "boolean", "optional": true, "description": "True value indicates that this is a provisional page target i.e. Such target may be created when current page starts cross-origin navigation. Eventually each provisional target is either committed and swaps with the current target or gets destroyed, e.g. in case of load request failure." },
|
|
+ { "name": "browserContextId", "$ref": "Browser.ContextID", "optional": true }
|
|
]
|
|
}
|
|
],
|
|
@@ -22,6 +24,20 @@
|
|
{ "name": "targetId", "type": "string" },
|
|
{ "name": "message", "type": "string", "description": "JSON Inspector Protocol message (command) to be dispatched on the backend." }
|
|
]
|
|
+ },
|
|
+ {
|
|
+ "name": "activate",
|
|
+ "description": "Reveals the target on screen.",
|
|
+ "parameters": [
|
|
+ { "name": "targetId", "type": "string" }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "name": "close",
|
|
+ "description": "Closes the target.",
|
|
+ "parameters": [
|
|
+ { "name": "targetId", "type": "string" }
|
|
+ ]
|
|
}
|
|
],
|
|
"events": [
|
|
diff --git a/Source/WebCore/inspector/InspectorInstrumentation.cpp b/Source/WebCore/inspector/InspectorInstrumentation.cpp
|
|
index 4b7bec1b460..97fb3543d40 100644
|
|
--- a/Source/WebCore/inspector/InspectorInstrumentation.cpp
|
|
+++ b/Source/WebCore/inspector/InspectorInstrumentation.cpp
|
|
@@ -782,6 +782,12 @@ void InspectorInstrumentation::frameClearedScheduledNavigationImpl(Instrumenting
|
|
inspectorPageAgent->frameClearedScheduledNavigation(frame);
|
|
}
|
|
|
|
+void InspectorInstrumentation::didNavigateWithinPageImpl(InstrumentingAgents& instrumentingAgents, Frame& frame)
|
|
+{
|
|
+ if (InspectorPageAgent* inspectorPageAgent = instrumentingAgents.inspectorPageAgent())
|
|
+ inspectorPageAgent->didNavigateWithinPage(frame);
|
|
+}
|
|
+
|
|
void InspectorInstrumentation::defaultAppearanceDidChangeImpl(InstrumentingAgents& instrumentingAgents, bool useDarkAppearance)
|
|
{
|
|
if (InspectorPageAgent* inspectorPageAgent = instrumentingAgents.inspectorPageAgent())
|
|
diff --git a/Source/WebCore/inspector/InspectorInstrumentation.h b/Source/WebCore/inspector/InspectorInstrumentation.h
|
|
index 6698431f316..40dd67f43e9 100644
|
|
--- a/Source/WebCore/inspector/InspectorInstrumentation.h
|
|
+++ b/Source/WebCore/inspector/InspectorInstrumentation.h
|
|
@@ -228,6 +228,7 @@ public:
|
|
static void frameStoppedLoading(Frame&);
|
|
static void frameScheduledNavigation(Frame&, Seconds delay);
|
|
static void frameClearedScheduledNavigation(Frame&);
|
|
+ static void didNavigateWithinPage(Frame&);
|
|
static void defaultAppearanceDidChange(Page&, bool useDarkAppearance);
|
|
static void willDestroyCachedResource(CachedResource&);
|
|
|
|
@@ -428,6 +429,7 @@ private:
|
|
static void frameStoppedLoadingImpl(InstrumentingAgents&, Frame&);
|
|
static void frameScheduledNavigationImpl(InstrumentingAgents&, Frame&, Seconds delay);
|
|
static void frameClearedScheduledNavigationImpl(InstrumentingAgents&, Frame&);
|
|
+ static void didNavigateWithinPageImpl(InstrumentingAgents&, Frame&);
|
|
static void defaultAppearanceDidChangeImpl(InstrumentingAgents&, bool useDarkAppearance);
|
|
static void willDestroyCachedResourceImpl(CachedResource&);
|
|
|
|
@@ -1219,6 +1221,13 @@ inline void InspectorInstrumentation::frameClearedScheduledNavigation(Frame& fra
|
|
frameClearedScheduledNavigationImpl(*instrumentingAgents, frame);
|
|
}
|
|
|
|
+inline void InspectorInstrumentation::didNavigateWithinPage(Frame& frame)
|
|
+{
|
|
+ FAST_RETURN_IF_NO_FRONTENDS(void());
|
|
+ if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
|
|
+ didNavigateWithinPageImpl(*instrumentingAgents, frame);
|
|
+}
|
|
+
|
|
inline void InspectorInstrumentation::defaultAppearanceDidChange(Page& page, bool useDarkAppearance)
|
|
{
|
|
FAST_RETURN_IF_NO_FRONTENDS(void());
|
|
diff --git a/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp b/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp
|
|
index 19bd04b805c..21745502b3e 100644
|
|
--- a/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp
|
|
+++ b/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp
|
|
@@ -61,6 +61,7 @@
|
|
#include "FrameTree.h"
|
|
#include "FrameView.h"
|
|
#include "FullscreenManager.h"
|
|
+#include "FloatQuad.h"
|
|
#include "HTMLElement.h"
|
|
#include "HTMLFrameOwnerElement.h"
|
|
#include "HTMLMediaElement.h"
|
|
@@ -89,6 +90,7 @@
|
|
#include "Page.h"
|
|
#include "Pasteboard.h"
|
|
#include "PseudoElement.h"
|
|
+#include "RenderObject.h"
|
|
#include "RenderStyle.h"
|
|
#include "RenderStyleConstants.h"
|
|
#include "ScriptState.h"
|
|
@@ -1417,6 +1419,61 @@ void InspectorDOMAgent::setInspectedNode(ErrorString& errorString, int nodeId)
|
|
m_suppressEventListenerChangedEvent = false;
|
|
}
|
|
|
|
+static void frameQuadToViewport(const FrameView* containingView, FloatQuad& quad)
|
|
+{
|
|
+ quad.setP1(containingView->contentsToRootView(quad.p1()));
|
|
+ quad.setP2(containingView->contentsToRootView(quad.p2()));
|
|
+ quad.setP3(containingView->contentsToRootView(quad.p3()));
|
|
+ quad.setP4(containingView->contentsToRootView(quad.p4()));
|
|
+}
|
|
+
|
|
+static RefPtr<Inspector::Protocol::DOM::Quad> buildObjectForQuad(const FloatQuad& quad)
|
|
+{
|
|
+ auto result = Inspector::Protocol::DOM::Quad::create();
|
|
+ result->addItem(quad.p1().x());
|
|
+ result->addItem(quad.p1().y());
|
|
+ result->addItem(quad.p2().x());
|
|
+ result->addItem(quad.p2().y());
|
|
+ result->addItem(quad.p3().x());
|
|
+ result->addItem(quad.p3().y());
|
|
+ result->addItem(quad.p4().x());
|
|
+ result->addItem(quad.p4().y());
|
|
+ return result;
|
|
+}
|
|
+
|
|
+static RefPtr<JSON::ArrayOf<Inspector::Protocol::DOM::Quad>> buildArrayOfQuads(const Vector<FloatQuad>& quads)
|
|
+{
|
|
+ auto result = JSON::ArrayOf<Inspector::Protocol::DOM::Quad>::create();
|
|
+ for (const auto& quad : quads)
|
|
+ result->addItem(buildObjectForQuad(quad));
|
|
+ return result;
|
|
+}
|
|
+
|
|
+void InspectorDOMAgent::getContentQuads(ErrorString& error, const String& objectId, RefPtr<JSON::ArrayOf<Inspector::Protocol::DOM::Quad>>& out_quads)
|
|
+{
|
|
+ Node* node = nodeForObjectId(objectId);
|
|
+ if (!node) {
|
|
+ error = "Node not found";
|
|
+ return;
|
|
+ }
|
|
+ RenderObject* renderer = node->renderer();
|
|
+ if (!renderer) {
|
|
+ error = "Node doesn't have renderer";
|
|
+ return;
|
|
+ }
|
|
+ Frame* containingFrame = renderer->document().frame();
|
|
+ if (!containingFrame) {
|
|
+ error = "No containing frame";
|
|
+ return;
|
|
+ }
|
|
+ FrameView* containingView = containingFrame->view();
|
|
+ Vector<FloatQuad> quads;
|
|
+ renderer->absoluteQuads(quads);
|
|
+ for (auto& quad : quads)
|
|
+ frameQuadToViewport(containingView, quad);
|
|
+ out_quads = buildArrayOfQuads(quads);
|
|
+}
|
|
+
|
|
void InspectorDOMAgent::resolveNode(ErrorString& errorString, int nodeId, const String* objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result)
|
|
{
|
|
String objectGroupName = objectGroup ? *objectGroup : emptyString();
|
|
diff --git a/Source/WebCore/inspector/agents/InspectorDOMAgent.h b/Source/WebCore/inspector/agents/InspectorDOMAgent.h
|
|
index 51639abeb84..fbb7773978d 100644
|
|
--- a/Source/WebCore/inspector/agents/InspectorDOMAgent.h
|
|
+++ b/Source/WebCore/inspector/agents/InspectorDOMAgent.h
|
|
@@ -148,6 +148,7 @@ public:
|
|
void focus(ErrorString&, int nodeId) override;
|
|
void setInspectedNode(ErrorString&, int nodeId) override;
|
|
void setAllowEditingUserAgentShadowTrees(ErrorString&, bool allow) final;
|
|
+ void getContentQuads(ErrorString&, const String& objectId, RefPtr<JSON::ArrayOf<Inspector::Protocol::DOM::Quad>>& out_quads) override;
|
|
|
|
// InspectorInstrumentation
|
|
int identifierForNode(Node&);
|
|
diff --git a/Source/WebCore/inspector/agents/InspectorPageAgent.cpp b/Source/WebCore/inspector/agents/InspectorPageAgent.cpp
|
|
index f2e228b7f74..77ccbe29ea3 100644
|
|
--- a/Source/WebCore/inspector/agents/InspectorPageAgent.cpp
|
|
+++ b/Source/WebCore/inspector/agents/InspectorPageAgent.cpp
|
|
@@ -412,14 +412,16 @@ void InspectorPageAgent::reload(ErrorString&, const bool* optionalReloadFromOrig
|
|
m_inspectedPage.mainFrame().loader().reload(reloadOptions);
|
|
}
|
|
|
|
-void InspectorPageAgent::navigate(ErrorString&, const String& url)
|
|
+void InspectorPageAgent::navigate(ErrorString& errorString, const String& url, const String* frameId)
|
|
{
|
|
UserGestureIndicator indicator { ProcessingUserGesture };
|
|
- Frame& frame = m_inspectedPage.mainFrame();
|
|
+ Frame* frame = frameId ? assertFrame(errorString, *frameId) : &m_inspectedPage.mainFrame();
|
|
+ if (!frame)
|
|
+ return;
|
|
|
|
- ResourceRequest resourceRequest { frame.document()->completeURL(url) };
|
|
- FrameLoadRequest frameLoadRequest { *frame.document(), frame.document()->securityOrigin(), resourceRequest, "_self"_s, LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow, ShouldOpenExternalURLsPolicy::ShouldNotAllow, InitiatedByMainFrame::Unknown };
|
|
- frame.loader().changeLocation(WTFMove(frameLoadRequest));
|
|
+ ResourceRequest resourceRequest { frame->document()->completeURL(url) };
|
|
+ FrameLoadRequest frameLoadRequest { *frame->document(), frame->document()->securityOrigin(), resourceRequest, "_self"_s, LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow, ShouldOpenExternalURLsPolicy::ShouldNotAllow, InitiatedByMainFrame::Unknown };
|
|
+ frame->loader().changeLocation(WTFMove(frameLoadRequest));
|
|
}
|
|
|
|
void InspectorPageAgent::overrideUserAgent(ErrorString&, const String* value)
|
|
@@ -761,6 +763,12 @@ void InspectorPageAgent::frameClearedScheduledNavigation(Frame& frame)
|
|
m_frontendDispatcher->frameClearedScheduledNavigation(frameId(&frame));
|
|
}
|
|
|
|
+void InspectorPageAgent::didNavigateWithinPage(Frame& frame)
|
|
+{
|
|
+ String url = frame.document()->url().string();
|
|
+ m_frontendDispatcher->navigatedWithinDocument(frameId(&frame), url);
|
|
+}
|
|
+
|
|
void InspectorPageAgent::defaultAppearanceDidChange(bool useDarkAppearance)
|
|
{
|
|
m_frontendDispatcher->defaultAppearanceDidChange(useDarkAppearance ? Inspector::Protocol::Page::Appearance::Dark : Inspector::Protocol::Page::Appearance::Light);
|
|
diff --git a/Source/WebCore/inspector/agents/InspectorPageAgent.h b/Source/WebCore/inspector/agents/InspectorPageAgent.h
|
|
index 4fd8c0b1016..78af692dc09 100644
|
|
--- a/Source/WebCore/inspector/agents/InspectorPageAgent.h
|
|
+++ b/Source/WebCore/inspector/agents/InspectorPageAgent.h
|
|
@@ -96,7 +96,7 @@ public:
|
|
void enable(ErrorString&) override;
|
|
void disable(ErrorString&) override;
|
|
void reload(ErrorString&, const bool* optionalReloadFromOrigin, const bool* optionalRevalidateAllResources) override;
|
|
- void navigate(ErrorString&, const String& url) override;
|
|
+ void navigate(ErrorString&, const String& url, const String* frameId) override;
|
|
void overrideUserAgent(ErrorString&, const String* value) override;
|
|
void overrideSetting(ErrorString&, const String& setting, const bool* value) override;
|
|
void getCookies(ErrorString&, RefPtr<JSON::ArrayOf<Inspector::Protocol::Page::Cookie>>& cookies) override;
|
|
@@ -126,6 +126,7 @@ public:
|
|
void frameStoppedLoading(Frame&);
|
|
void frameScheduledNavigation(Frame&, Seconds delay);
|
|
void frameClearedScheduledNavigation(Frame&);
|
|
+ void didNavigateWithinPage(Frame&);
|
|
void defaultAppearanceDidChange(bool useDarkAppearance);
|
|
void applyUserAgentOverride(String&);
|
|
void applyEmulatedMedia(String&);
|
|
diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp
|
|
index 26246f7deb6..cf215bed32b 100644
|
|
--- a/Source/WebCore/loader/FrameLoader.cpp
|
|
+++ b/Source/WebCore/loader/FrameLoader.cpp
|
|
@@ -1179,6 +1179,7 @@ void FrameLoader::loadInSameDocument(const URL& url, SerializedScriptValue* stat
|
|
}
|
|
|
|
m_client.dispatchDidNavigateWithinPage();
|
|
+ InspectorInstrumentation::didNavigateWithinPage(m_frame);
|
|
|
|
m_frame.document()->statePopped(stateObject ? Ref<SerializedScriptValue> { *stateObject } : SerializedScriptValue::nullValue());
|
|
m_client.dispatchDidPopStateWithinPage();
|
|
diff --git a/Source/WebCore/page/History.cpp b/Source/WebCore/page/History.cpp
|
|
index 9c58b06f4c4..3d624733c36 100644
|
|
--- a/Source/WebCore/page/History.cpp
|
|
+++ b/Source/WebCore/page/History.cpp
|
|
@@ -259,6 +259,7 @@ ExceptionOr<void> History::stateObjectAdded(RefPtr<SerializedScriptValue>&& data
|
|
|
|
if (!urlString.isEmpty())
|
|
frame->document()->updateURLForPushOrReplaceState(fullURL);
|
|
+ InspectorInstrumentation::didNavigateWithinPage(*frame);
|
|
|
|
if (stateObjectType == StateObjectType::Push) {
|
|
frame->loader().history().pushState(WTFMove(data), title, fullURL.string());
|
|
diff --git a/Source/WebCore/platform/PlatformKeyboardEvent.h b/Source/WebCore/platform/PlatformKeyboardEvent.h
|
|
index 4aaf5bde32b..e9c047d4f26 100644
|
|
--- a/Source/WebCore/platform/PlatformKeyboardEvent.h
|
|
+++ b/Source/WebCore/platform/PlatformKeyboardEvent.h
|
|
@@ -147,6 +147,7 @@ namespace WebCore {
|
|
static String keyCodeForHardwareKeyCode(unsigned);
|
|
static String keyIdentifierForGdkKeyCode(unsigned);
|
|
static int windowsKeyCodeForGdkKeyCode(unsigned);
|
|
+ static unsigned gdkKeyCodeForWindowsKeyCode(int);
|
|
static String singleCharacterString(unsigned);
|
|
static bool modifiersContainCapsLock(unsigned);
|
|
#endif
|
|
@@ -156,6 +157,7 @@ namespace WebCore {
|
|
static String keyCodeForHardwareKeyCode(unsigned);
|
|
static String keyIdentifierForWPEKeyCode(unsigned);
|
|
static int windowsKeyCodeForWPEKeyCode(unsigned);
|
|
+ static unsigned WPEKeyCodeForWindowsKeyCode(int);
|
|
static String singleCharacterString(unsigned);
|
|
#endif
|
|
|
|
diff --git a/Source/WebCore/platform/gtk/PlatformKeyboardEventGtk.cpp b/Source/WebCore/platform/gtk/PlatformKeyboardEventGtk.cpp
|
|
index 356b09f2fba..8f0c19b6031 100644
|
|
--- a/Source/WebCore/platform/gtk/PlatformKeyboardEventGtk.cpp
|
|
+++ b/Source/WebCore/platform/gtk/PlatformKeyboardEventGtk.cpp
|
|
@@ -36,8 +36,10 @@
|
|
#include "WindowsKeyboardCodes.h"
|
|
#include <gdk/gdk.h>
|
|
#include <gdk/gdkkeysyms.h>
|
|
+#include <wtf/HashMap.h>
|
|
#include <wtf/HexNumber.h>
|
|
#include <wtf/glib/GUniquePtr.h>
|
|
+#include <mutex>
|
|
|
|
namespace WebCore {
|
|
|
|
@@ -1293,6 +1295,246 @@ int PlatformKeyboardEvent::windowsKeyCodeForGdkKeyCode(unsigned keycode)
|
|
|
|
}
|
|
|
|
+static const HashMap<int, unsigned>& gdkToWindowsKeyCodeMap()
|
|
+{
|
|
+ static HashMap<int, unsigned>* result;
|
|
+ static std::once_flag once;
|
|
+ std::call_once(
|
|
+ once,
|
|
+ [] {
|
|
+ const unsigned gdkKeyCodes[] = {
|
|
+ GDK_KEY_Cancel,
|
|
+ // FIXME: non-keypad keys should take precedence, so we skip GDK_KEY_KP_*
|
|
+ // GDK_KEY_KP_0,
|
|
+ // GDK_KEY_KP_1,
|
|
+ // GDK_KEY_KP_2,
|
|
+ // GDK_KEY_KP_3,
|
|
+ // GDK_KEY_KP_4,
|
|
+ // GDK_KEY_KP_5,
|
|
+ // GDK_KEY_KP_6,
|
|
+ // GDK_KEY_KP_7,
|
|
+ // GDK_KEY_KP_8,
|
|
+ // GDK_KEY_KP_9,
|
|
+ // GDK_KEY_KP_Multiply,
|
|
+ // GDK_KEY_KP_Add,
|
|
+ // GDK_KEY_KP_Subtract,
|
|
+ // GDK_KEY_KP_Decimal,
|
|
+ // GDK_KEY_KP_Divide,
|
|
+ // GDK_KEY_KP_Page_Up,
|
|
+ // GDK_KEY_KP_Page_Down,
|
|
+ // GDK_KEY_KP_End,
|
|
+ // GDK_KEY_KP_Home,
|
|
+ // GDK_KEY_KP_Left,
|
|
+ // GDK_KEY_KP_Up,
|
|
+ // GDK_KEY_KP_Right,
|
|
+ // GDK_KEY_KP_Down,
|
|
+ GDK_KEY_BackSpace,
|
|
+ // GDK_KEY_ISO_Left_Tab,
|
|
+ // GDK_KEY_3270_BackTab,
|
|
+ GDK_KEY_Tab,
|
|
+ GDK_KEY_Clear,
|
|
+ // GDK_KEY_ISO_Enter,
|
|
+ // GDK_KEY_KP_Enter,
|
|
+ GDK_KEY_Return,
|
|
+ GDK_KEY_Menu,
|
|
+ GDK_KEY_Pause,
|
|
+ GDK_KEY_AudioPause,
|
|
+ GDK_KEY_Caps_Lock,
|
|
+ GDK_KEY_Kana_Lock,
|
|
+ GDK_KEY_Kana_Shift,
|
|
+ GDK_KEY_Hangul,
|
|
+ GDK_KEY_Hangul_Hanja,
|
|
+ GDK_KEY_Kanji,
|
|
+ GDK_KEY_Escape,
|
|
+ GDK_KEY_space,
|
|
+ GDK_KEY_Page_Up,
|
|
+ GDK_KEY_Page_Down,
|
|
+ GDK_KEY_End,
|
|
+ GDK_KEY_Home,
|
|
+ GDK_KEY_Left,
|
|
+ GDK_KEY_Up,
|
|
+ GDK_KEY_Right,
|
|
+ GDK_KEY_Down,
|
|
+ GDK_KEY_Select,
|
|
+ GDK_KEY_Print,
|
|
+ GDK_KEY_Execute,
|
|
+ GDK_KEY_Insert,
|
|
+ GDK_KEY_KP_Insert,
|
|
+ GDK_KEY_Delete,
|
|
+ GDK_KEY_KP_Delete,
|
|
+ GDK_KEY_Help,
|
|
+ GDK_KEY_0,
|
|
+ GDK_KEY_parenright,
|
|
+ GDK_KEY_1,
|
|
+ GDK_KEY_exclam,
|
|
+ GDK_KEY_2,
|
|
+ GDK_KEY_at,
|
|
+ GDK_KEY_3,
|
|
+ GDK_KEY_numbersign,
|
|
+ GDK_KEY_4,
|
|
+ GDK_KEY_dollar,
|
|
+ GDK_KEY_5,
|
|
+ GDK_KEY_percent,
|
|
+ GDK_KEY_6,
|
|
+ GDK_KEY_asciicircum,
|
|
+ GDK_KEY_7,
|
|
+ GDK_KEY_ampersand,
|
|
+ GDK_KEY_8,
|
|
+ GDK_KEY_asterisk,
|
|
+ GDK_KEY_9,
|
|
+ GDK_KEY_parenleft,
|
|
+ GDK_KEY_a,
|
|
+ GDK_KEY_A,
|
|
+ GDK_KEY_b,
|
|
+ GDK_KEY_B,
|
|
+ GDK_KEY_c,
|
|
+ GDK_KEY_C,
|
|
+ GDK_KEY_d,
|
|
+ GDK_KEY_D,
|
|
+ GDK_KEY_e,
|
|
+ GDK_KEY_E,
|
|
+ GDK_KEY_f,
|
|
+ GDK_KEY_F,
|
|
+ GDK_KEY_g,
|
|
+ GDK_KEY_G,
|
|
+ GDK_KEY_h,
|
|
+ GDK_KEY_H,
|
|
+ GDK_KEY_i,
|
|
+ GDK_KEY_I,
|
|
+ GDK_KEY_j,
|
|
+ GDK_KEY_J,
|
|
+ GDK_KEY_k,
|
|
+ GDK_KEY_K,
|
|
+ GDK_KEY_l,
|
|
+ GDK_KEY_L,
|
|
+ GDK_KEY_m,
|
|
+ GDK_KEY_M,
|
|
+ GDK_KEY_n,
|
|
+ GDK_KEY_N,
|
|
+ GDK_KEY_o,
|
|
+ GDK_KEY_O,
|
|
+ GDK_KEY_p,
|
|
+ GDK_KEY_P,
|
|
+ GDK_KEY_q,
|
|
+ GDK_KEY_Q,
|
|
+ GDK_KEY_r,
|
|
+ GDK_KEY_R,
|
|
+ GDK_KEY_s,
|
|
+ GDK_KEY_S,
|
|
+ GDK_KEY_t,
|
|
+ GDK_KEY_T,
|
|
+ GDK_KEY_u,
|
|
+ GDK_KEY_U,
|
|
+ GDK_KEY_v,
|
|
+ GDK_KEY_V,
|
|
+ GDK_KEY_w,
|
|
+ GDK_KEY_W,
|
|
+ GDK_KEY_x,
|
|
+ GDK_KEY_X,
|
|
+ GDK_KEY_y,
|
|
+ GDK_KEY_Y,
|
|
+ GDK_KEY_z,
|
|
+ GDK_KEY_Z,
|
|
+ GDK_KEY_Meta_L,
|
|
+ GDK_KEY_Meta_R,
|
|
+ GDK_KEY_Sleep,
|
|
+ GDK_KEY_Num_Lock,
|
|
+ GDK_KEY_Scroll_Lock,
|
|
+ GDK_KEY_Shift_L,
|
|
+ GDK_KEY_Shift_R,
|
|
+ GDK_KEY_Control_L,
|
|
+ GDK_KEY_Control_R,
|
|
+ GDK_KEY_Alt_L,
|
|
+ GDK_KEY_Alt_R,
|
|
+ GDK_KEY_Back,
|
|
+ GDK_KEY_Forward,
|
|
+ GDK_KEY_Refresh,
|
|
+ GDK_KEY_Stop,
|
|
+ GDK_KEY_Search,
|
|
+ GDK_KEY_Favorites,
|
|
+ GDK_KEY_HomePage,
|
|
+ GDK_KEY_AudioMute,
|
|
+ GDK_KEY_AudioLowerVolume,
|
|
+ GDK_KEY_AudioRaiseVolume,
|
|
+ GDK_KEY_AudioNext,
|
|
+ GDK_KEY_AudioPrev,
|
|
+ GDK_KEY_AudioStop,
|
|
+ GDK_KEY_AudioMedia,
|
|
+ GDK_KEY_semicolon,
|
|
+ GDK_KEY_colon,
|
|
+ GDK_KEY_plus,
|
|
+ GDK_KEY_equal,
|
|
+ GDK_KEY_comma,
|
|
+ GDK_KEY_less,
|
|
+ GDK_KEY_minus,
|
|
+ GDK_KEY_underscore,
|
|
+ GDK_KEY_period,
|
|
+ GDK_KEY_greater,
|
|
+ GDK_KEY_slash,
|
|
+ GDK_KEY_question,
|
|
+ GDK_KEY_asciitilde,
|
|
+ GDK_KEY_quoteleft,
|
|
+ GDK_KEY_bracketleft,
|
|
+ GDK_KEY_braceleft,
|
|
+ GDK_KEY_backslash,
|
|
+ GDK_KEY_bar,
|
|
+ GDK_KEY_bracketright,
|
|
+ GDK_KEY_braceright,
|
|
+ GDK_KEY_quoteright,
|
|
+ GDK_KEY_quotedbl,
|
|
+ GDK_KEY_AudioRewind,
|
|
+ GDK_KEY_AudioForward,
|
|
+ GDK_KEY_AudioPlay,
|
|
+ GDK_KEY_F1,
|
|
+ GDK_KEY_F2,
|
|
+ GDK_KEY_F3,
|
|
+ GDK_KEY_F4,
|
|
+ GDK_KEY_F5,
|
|
+ GDK_KEY_F6,
|
|
+ GDK_KEY_F7,
|
|
+ GDK_KEY_F8,
|
|
+ GDK_KEY_F9,
|
|
+ GDK_KEY_F10,
|
|
+ GDK_KEY_F11,
|
|
+ GDK_KEY_F12,
|
|
+ GDK_KEY_F13,
|
|
+ GDK_KEY_F14,
|
|
+ GDK_KEY_F15,
|
|
+ GDK_KEY_F16,
|
|
+ GDK_KEY_F17,
|
|
+ GDK_KEY_F18,
|
|
+ GDK_KEY_F19,
|
|
+ GDK_KEY_F20,
|
|
+ GDK_KEY_F21,
|
|
+ GDK_KEY_F22,
|
|
+ GDK_KEY_F23,
|
|
+ GDK_KEY_F24,
|
|
+ GDK_KEY_VoidSymbol,
|
|
+ GDK_KEY_Red,
|
|
+ GDK_KEY_Green,
|
|
+ GDK_KEY_Yellow,
|
|
+ GDK_KEY_Blue,
|
|
+ GDK_KEY_PowerOff,
|
|
+ GDK_KEY_AudioRecord,
|
|
+ GDK_KEY_Display,
|
|
+ GDK_KEY_Subtitle,
|
|
+ GDK_KEY_Video
|
|
+ };
|
|
+ result = new HashMap<int, unsigned>();
|
|
+ for (unsigned gdkKeyCode : gdkKeyCodes) {
|
|
+ int winKeyCode = PlatformKeyboardEvent::windowsKeyCodeForGdkKeyCode(gdkKeyCode);
|
|
+ // If several gdk key codes map to the same win key code first one is used.
|
|
+ result->add(winKeyCode, gdkKeyCode);
|
|
+ }
|
|
+ });
|
|
+ return *result;
|
|
+}
|
|
+
|
|
+unsigned PlatformKeyboardEvent::gdkKeyCodeForWindowsKeyCode(int keycode)
|
|
+{
|
|
+ return gdkToWindowsKeyCodeMap().get(keycode);
|
|
+}
|
|
+
|
|
String PlatformKeyboardEvent::singleCharacterString(unsigned val)
|
|
{
|
|
switch (val) {
|
|
diff --git a/Source/WebCore/platform/libwpe/PlatformKeyboardEventLibWPE.cpp b/Source/WebCore/platform/libwpe/PlatformKeyboardEventLibWPE.cpp
|
|
index cf46da15083..efbda20f28b 100644
|
|
--- a/Source/WebCore/platform/libwpe/PlatformKeyboardEventLibWPE.cpp
|
|
+++ b/Source/WebCore/platform/libwpe/PlatformKeyboardEventLibWPE.cpp
|
|
@@ -1291,6 +1291,246 @@ int PlatformKeyboardEvent::windowsKeyCodeForWPEKeyCode(unsigned keycode)
|
|
return 0;
|
|
}
|
|
|
|
+static const HashMap<int, unsigned>& WPEToWindowsKeyCodeMap()
|
|
+{
|
|
+ static HashMap<int, unsigned>* result;
|
|
+ static std::once_flag once;
|
|
+ std::call_once(
|
|
+ once,
|
|
+ [] {
|
|
+ const unsigned WPEKeyCodes[] = {
|
|
+ WPE_KEY_Cancel,
|
|
+ // FIXME: non-keypad keys should take precedence, so we skip WPE_KEY_KP_*
|
|
+ // WPE_KEY_KP_0,
|
|
+ // WPE_KEY_KP_1,
|
|
+ // WPE_KEY_KP_2,
|
|
+ // WPE_KEY_KP_3,
|
|
+ // WPE_KEY_KP_4,
|
|
+ // WPE_KEY_KP_5,
|
|
+ // WPE_KEY_KP_6,
|
|
+ // WPE_KEY_KP_7,
|
|
+ // WPE_KEY_KP_8,
|
|
+ // WPE_KEY_KP_9,
|
|
+ // WPE_KEY_KP_Multiply,
|
|
+ // WPE_KEY_KP_Add,
|
|
+ // WPE_KEY_KP_Subtract,
|
|
+ // WPE_KEY_KP_Decimal,
|
|
+ // WPE_KEY_KP_Divide,
|
|
+ // WPE_KEY_KP_Page_Up,
|
|
+ // WPE_KEY_KP_Page_Down,
|
|
+ // WPE_KEY_KP_End,
|
|
+ // WPE_KEY_KP_Home,
|
|
+ // WPE_KEY_KP_Left,
|
|
+ // WPE_KEY_KP_Up,
|
|
+ // WPE_KEY_KP_Right,
|
|
+ // WPE_KEY_KP_Down,
|
|
+ WPE_KEY_BackSpace,
|
|
+ // WPE_KEY_ISO_Left_Tab,
|
|
+ // WPE_KEY_3270_BackTab,
|
|
+ WPE_KEY_Tab,
|
|
+ WPE_KEY_Clear,
|
|
+ // WPE_KEY_ISO_Enter,
|
|
+ // WPE_KEY_KP_Enter,
|
|
+ WPE_KEY_Return,
|
|
+ WPE_KEY_Menu,
|
|
+ WPE_KEY_Pause,
|
|
+ WPE_KEY_AudioPause,
|
|
+ WPE_KEY_Caps_Lock,
|
|
+ WPE_KEY_Kana_Lock,
|
|
+ WPE_KEY_Kana_Shift,
|
|
+ WPE_KEY_Hangul,
|
|
+ WPE_KEY_Hangul_Hanja,
|
|
+ WPE_KEY_Kanji,
|
|
+ WPE_KEY_Escape,
|
|
+ WPE_KEY_space,
|
|
+ WPE_KEY_Page_Up,
|
|
+ WPE_KEY_Page_Down,
|
|
+ WPE_KEY_End,
|
|
+ WPE_KEY_Home,
|
|
+ WPE_KEY_Left,
|
|
+ WPE_KEY_Up,
|
|
+ WPE_KEY_Right,
|
|
+ WPE_KEY_Down,
|
|
+ WPE_KEY_Select,
|
|
+ WPE_KEY_Print,
|
|
+ WPE_KEY_Execute,
|
|
+ WPE_KEY_Insert,
|
|
+ WPE_KEY_KP_Insert,
|
|
+ WPE_KEY_Delete,
|
|
+ WPE_KEY_KP_Delete,
|
|
+ WPE_KEY_Help,
|
|
+ WPE_KEY_0,
|
|
+ WPE_KEY_parenright,
|
|
+ WPE_KEY_1,
|
|
+ WPE_KEY_exclam,
|
|
+ WPE_KEY_2,
|
|
+ WPE_KEY_at,
|
|
+ WPE_KEY_3,
|
|
+ WPE_KEY_numbersign,
|
|
+ WPE_KEY_4,
|
|
+ WPE_KEY_dollar,
|
|
+ WPE_KEY_5,
|
|
+ WPE_KEY_percent,
|
|
+ WPE_KEY_6,
|
|
+ WPE_KEY_asciicircum,
|
|
+ WPE_KEY_7,
|
|
+ WPE_KEY_ampersand,
|
|
+ WPE_KEY_8,
|
|
+ WPE_KEY_asterisk,
|
|
+ WPE_KEY_9,
|
|
+ WPE_KEY_parenleft,
|
|
+ WPE_KEY_a,
|
|
+ WPE_KEY_A,
|
|
+ WPE_KEY_b,
|
|
+ WPE_KEY_B,
|
|
+ WPE_KEY_c,
|
|
+ WPE_KEY_C,
|
|
+ WPE_KEY_d,
|
|
+ WPE_KEY_D,
|
|
+ WPE_KEY_e,
|
|
+ WPE_KEY_E,
|
|
+ WPE_KEY_f,
|
|
+ WPE_KEY_F,
|
|
+ WPE_KEY_g,
|
|
+ WPE_KEY_G,
|
|
+ WPE_KEY_h,
|
|
+ WPE_KEY_H,
|
|
+ WPE_KEY_i,
|
|
+ WPE_KEY_I,
|
|
+ WPE_KEY_j,
|
|
+ WPE_KEY_J,
|
|
+ WPE_KEY_k,
|
|
+ WPE_KEY_K,
|
|
+ WPE_KEY_l,
|
|
+ WPE_KEY_L,
|
|
+ WPE_KEY_m,
|
|
+ WPE_KEY_M,
|
|
+ WPE_KEY_n,
|
|
+ WPE_KEY_N,
|
|
+ WPE_KEY_o,
|
|
+ WPE_KEY_O,
|
|
+ WPE_KEY_p,
|
|
+ WPE_KEY_P,
|
|
+ WPE_KEY_q,
|
|
+ WPE_KEY_Q,
|
|
+ WPE_KEY_r,
|
|
+ WPE_KEY_R,
|
|
+ WPE_KEY_s,
|
|
+ WPE_KEY_S,
|
|
+ WPE_KEY_t,
|
|
+ WPE_KEY_T,
|
|
+ WPE_KEY_u,
|
|
+ WPE_KEY_U,
|
|
+ WPE_KEY_v,
|
|
+ WPE_KEY_V,
|
|
+ WPE_KEY_w,
|
|
+ WPE_KEY_W,
|
|
+ WPE_KEY_x,
|
|
+ WPE_KEY_X,
|
|
+ WPE_KEY_y,
|
|
+ WPE_KEY_Y,
|
|
+ WPE_KEY_z,
|
|
+ WPE_KEY_Z,
|
|
+ WPE_KEY_Meta_L,
|
|
+ WPE_KEY_Meta_R,
|
|
+ WPE_KEY_Sleep,
|
|
+ WPE_KEY_Num_Lock,
|
|
+ WPE_KEY_Scroll_Lock,
|
|
+ WPE_KEY_Shift_L,
|
|
+ WPE_KEY_Shift_R,
|
|
+ WPE_KEY_Control_L,
|
|
+ WPE_KEY_Control_R,
|
|
+ WPE_KEY_Alt_L,
|
|
+ WPE_KEY_Alt_R,
|
|
+ WPE_KEY_Back,
|
|
+ WPE_KEY_Forward,
|
|
+ WPE_KEY_Refresh,
|
|
+ WPE_KEY_Stop,
|
|
+ WPE_KEY_Search,
|
|
+ WPE_KEY_Favorites,
|
|
+ WPE_KEY_HomePage,
|
|
+ WPE_KEY_AudioMute,
|
|
+ WPE_KEY_AudioLowerVolume,
|
|
+ WPE_KEY_AudioRaiseVolume,
|
|
+ WPE_KEY_AudioNext,
|
|
+ WPE_KEY_AudioPrev,
|
|
+ WPE_KEY_AudioStop,
|
|
+ WPE_KEY_AudioMedia,
|
|
+ WPE_KEY_semicolon,
|
|
+ WPE_KEY_colon,
|
|
+ WPE_KEY_plus,
|
|
+ WPE_KEY_equal,
|
|
+ WPE_KEY_comma,
|
|
+ WPE_KEY_less,
|
|
+ WPE_KEY_minus,
|
|
+ WPE_KEY_underscore,
|
|
+ WPE_KEY_period,
|
|
+ WPE_KEY_greater,
|
|
+ WPE_KEY_slash,
|
|
+ WPE_KEY_question,
|
|
+ WPE_KEY_asciitilde,
|
|
+ WPE_KEY_quoteleft,
|
|
+ WPE_KEY_bracketleft,
|
|
+ WPE_KEY_braceleft,
|
|
+ WPE_KEY_backslash,
|
|
+ WPE_KEY_bar,
|
|
+ WPE_KEY_bracketright,
|
|
+ WPE_KEY_braceright,
|
|
+ WPE_KEY_quoteright,
|
|
+ WPE_KEY_quotedbl,
|
|
+ WPE_KEY_AudioRewind,
|
|
+ WPE_KEY_AudioForward,
|
|
+ WPE_KEY_AudioPlay,
|
|
+ WPE_KEY_F1,
|
|
+ WPE_KEY_F2,
|
|
+ WPE_KEY_F3,
|
|
+ WPE_KEY_F4,
|
|
+ WPE_KEY_F5,
|
|
+ WPE_KEY_F6,
|
|
+ WPE_KEY_F7,
|
|
+ WPE_KEY_F8,
|
|
+ WPE_KEY_F9,
|
|
+ WPE_KEY_F10,
|
|
+ WPE_KEY_F11,
|
|
+ WPE_KEY_F12,
|
|
+ WPE_KEY_F13,
|
|
+ WPE_KEY_F14,
|
|
+ WPE_KEY_F15,
|
|
+ WPE_KEY_F16,
|
|
+ WPE_KEY_F17,
|
|
+ WPE_KEY_F18,
|
|
+ WPE_KEY_F19,
|
|
+ WPE_KEY_F20,
|
|
+ WPE_KEY_F21,
|
|
+ WPE_KEY_F22,
|
|
+ WPE_KEY_F23,
|
|
+ WPE_KEY_F24,
|
|
+ WPE_KEY_VoidSymbol,
|
|
+ WPE_KEY_Red,
|
|
+ WPE_KEY_Green,
|
|
+ WPE_KEY_Yellow,
|
|
+ WPE_KEY_Blue,
|
|
+ WPE_KEY_PowerOff,
|
|
+ WPE_KEY_AudioRecord,
|
|
+ WPE_KEY_Display,
|
|
+ WPE_KEY_Subtitle,
|
|
+ WPE_KEY_Video
|
|
+ };
|
|
+ result = new HashMap<int, unsigned>();
|
|
+ for (unsigned WPEKeyCode : WPEKeyCodes) {
|
|
+ int winKeyCode = PlatformKeyboardEvent::windowsKeyCodeForWPEKeyCode(WPEKeyCode);
|
|
+ // If several gdk key codes map to the same win key code first one is used.
|
|
+ result->add(winKeyCode, WPEKeyCode);
|
|
+ }
|
|
+ });
|
|
+ return *result;
|
|
+}
|
|
+
|
|
+unsigned PlatformKeyboardEvent::WPEKeyCodeForWindowsKeyCode(int keycode)
|
|
+{
|
|
+ return WPEToWindowsKeyCodeMap().get(keycode);
|
|
+}
|
|
+
|
|
String PlatformKeyboardEvent::singleCharacterString(unsigned val)
|
|
{
|
|
switch (val) {
|
|
diff --git a/Source/WebKit/Shared/API/c/wpe/WebKit.h b/Source/WebKit/Shared/API/c/wpe/WebKit.h
|
|
index 898e30b370d..74945e06fac 100644
|
|
--- a/Source/WebKit/Shared/API/c/wpe/WebKit.h
|
|
+++ b/Source/WebKit/Shared/API/c/wpe/WebKit.h
|
|
@@ -78,6 +78,7 @@
|
|
// From Source/WebKit/UIProcess/API/C
|
|
#include <WebKit/WKBackForwardListItemRef.h>
|
|
#include <WebKit/WKBackForwardListRef.h>
|
|
+#include <WebKit/WKBrowserInspector.h>
|
|
#include <WebKit/WKContext.h>
|
|
#include <WebKit/WKContextConfigurationRef.h>
|
|
#include <WebKit/WKCredential.h>
|
|
diff --git a/Source/WebKit/Shared/NativeWebKeyboardEvent.h b/Source/WebKit/Shared/NativeWebKeyboardEvent.h
|
|
index 6f4e29b7c65..9dd287efc40 100644
|
|
--- a/Source/WebKit/Shared/NativeWebKeyboardEvent.h
|
|
+++ b/Source/WebKit/Shared/NativeWebKeyboardEvent.h
|
|
@@ -34,6 +34,7 @@
|
|
#if USE(APPKIT)
|
|
#include <wtf/RetainPtr.h>
|
|
OBJC_CLASS NSView;
|
|
+OBJC_CLASS NSEvent;
|
|
|
|
namespace WebCore {
|
|
struct KeypressCommand;
|
|
@@ -70,6 +71,10 @@ public:
|
|
enum class HandledByInputMethod : bool { No, Yes };
|
|
enum class FakedForComposition : bool { No, Yes };
|
|
NativeWebKeyboardEvent(GdkEvent*, const String&, HandledByInputMethod, FakedForComposition, Vector<String>&& commands);
|
|
+ NativeWebKeyboardEvent(Type type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet<Modifier> modifiers, WallTime timestamp, Vector<String>&& commands)
|
|
+ : WebKeyboardEvent(type, text, unmodifiedText, key, code, keyIdentifier, windowsVirtualKeyCode, nativeVirtualKeyCode, isAutoRepeat, isKeypad, isSystemKey, modifiers, timestamp, WTFMove(commands))
|
|
+ {
|
|
+ }
|
|
#elif PLATFORM(IOS_FAMILY)
|
|
enum class HandledByInputMethod : bool { No, Yes };
|
|
NativeWebKeyboardEvent(::WebEvent *, HandledByInputMethod);
|
|
diff --git a/Source/WebKit/Shared/NativeWebMouseEvent.h b/Source/WebKit/Shared/NativeWebMouseEvent.h
|
|
index ba7f93c924f..d19eb2f2932 100644
|
|
--- a/Source/WebKit/Shared/NativeWebMouseEvent.h
|
|
+++ b/Source/WebKit/Shared/NativeWebMouseEvent.h
|
|
@@ -61,6 +61,10 @@ public:
|
|
#elif PLATFORM(GTK)
|
|
NativeWebMouseEvent(const NativeWebMouseEvent&);
|
|
NativeWebMouseEvent(GdkEvent*, int);
|
|
+ NativeWebMouseEvent(Type type, Button button, unsigned short buttons, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, OptionSet<Modifier> modifiers, WallTime timestamp)
|
|
+ : WebMouseEvent(type, button, buttons, position, globalPosition, deltaX, deltaY, deltaZ, clickCount, modifiers, timestamp)
|
|
+ {
|
|
+ }
|
|
#elif PLATFORM(IOS_FAMILY)
|
|
NativeWebMouseEvent(::WebEvent *);
|
|
NativeWebMouseEvent(Type, Button, unsigned short buttons, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, OptionSet<Modifier>, WallTime timestamp, double force);
|
|
diff --git a/Source/WebKit/Shared/WebEvent.h b/Source/WebKit/Shared/WebEvent.h
|
|
index c36100cf5c4..216402f0a24 100644
|
|
--- a/Source/WebKit/Shared/WebEvent.h
|
|
+++ b/Source/WebKit/Shared/WebEvent.h
|
|
@@ -35,6 +35,7 @@
|
|
#include <WebCore/IntSize.h>
|
|
#include <WebCore/KeypressCommand.h>
|
|
#include <wtf/OptionSet.h>
|
|
+#include <wtf/RefCounted.h>
|
|
#include <wtf/WallTime.h>
|
|
#include <wtf/text/WTFString.h>
|
|
|
|
@@ -138,7 +139,7 @@ public:
|
|
WebMouseEvent();
|
|
|
|
#if PLATFORM(MAC)
|
|
- WebMouseEvent(Type, Button, unsigned short buttons, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, OptionSet<Modifier>, WallTime timestamp, double force, SyntheticClickType = NoTap, int eventNumber = -1, int menuType = 0);
|
|
+ WebMouseEvent(Type, Button, unsigned short buttons, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, OptionSet<Modifier>, WallTime timestamp, double force = 0, SyntheticClickType = NoTap, int eventNumber = -1, int menuType = 0);
|
|
#else
|
|
WebMouseEvent(Type, Button, unsigned short buttons, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, OptionSet<Modifier>, WallTime timestamp, double force = 0, SyntheticClickType = NoTap);
|
|
#endif
|
|
@@ -258,6 +259,7 @@ public:
|
|
WebKeyboardEvent(Type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool handledByInputMethod, const Vector<WebCore::KeypressCommand>&, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet<Modifier>, WallTime timestamp);
|
|
#elif PLATFORM(GTK)
|
|
WebKeyboardEvent(Type, const String& text, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool handledByInputMethod, Vector<String>&& commands, bool isKeypad, OptionSet<Modifier>, WallTime timestamp);
|
|
+ WebKeyboardEvent(Type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet<Modifier>, WallTime timestamp, Vector<String>&& commands);
|
|
#elif PLATFORM(IOS_FAMILY)
|
|
WebKeyboardEvent(Type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool handledByInputMethod, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet<Modifier>, WallTime timestamp);
|
|
#elif USE(LIBWPE)
|
|
@@ -309,7 +311,7 @@ private:
|
|
int32_t m_nativeVirtualKeyCode;
|
|
int32_t m_macCharCode;
|
|
#if USE(APPKIT) || USE(UIKIT_KEYBOARD_ADDITIONS) || PLATFORM(GTK)
|
|
- bool m_handledByInputMethod;
|
|
+ bool m_handledByInputMethod = false;
|
|
#endif
|
|
#if USE(APPKIT)
|
|
Vector<WebCore::KeypressCommand> m_commands;
|
|
diff --git a/Source/WebKit/Shared/WebKeyboardEvent.cpp b/Source/WebKit/Shared/WebKeyboardEvent.cpp
|
|
index a5a23cf148e..390eaf847b6 100644
|
|
--- a/Source/WebKit/Shared/WebKeyboardEvent.cpp
|
|
+++ b/Source/WebKit/Shared/WebKeyboardEvent.cpp
|
|
@@ -81,6 +81,28 @@ WebKeyboardEvent::WebKeyboardEvent(Type type, const String& text, const String&
|
|
ASSERT(isKeyboardEventType(type));
|
|
}
|
|
|
|
+WebKeyboardEvent::WebKeyboardEvent(Type type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet<Modifier> modifiers, WallTime timestamp, Vector<String>&& commands)
|
|
+ : WebEvent(type, modifiers, timestamp)
|
|
+ , m_text(text)
|
|
+ , m_unmodifiedText(text)
|
|
+#if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
|
|
+ , m_key(key)
|
|
+#endif
|
|
+#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
|
|
+ , m_code(code)
|
|
+#endif
|
|
+ , m_keyIdentifier(keyIdentifier)
|
|
+ , m_windowsVirtualKeyCode(windowsVirtualKeyCode)
|
|
+ , m_nativeVirtualKeyCode(nativeVirtualKeyCode)
|
|
+ , m_macCharCode(0)
|
|
+ , m_commands(WTFMove(commands))
|
|
+ , m_isAutoRepeat(isAutoRepeat)
|
|
+ , m_isKeypad(isKeypad)
|
|
+ , m_isSystemKey(isSystemKey)
|
|
+{
|
|
+ ASSERT(isKeyboardEventType(type));
|
|
+}
|
|
+
|
|
#elif PLATFORM(IOS_FAMILY)
|
|
|
|
WebKeyboardEvent::WebKeyboardEvent(Type type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool handledByInputMethod, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet<Modifier> modifiers, WallTime timestamp)
|
|
diff --git a/Source/WebKit/Shared/gtk/NativeWebKeyboardEventGtk.cpp b/Source/WebKit/Shared/gtk/NativeWebKeyboardEventGtk.cpp
|
|
index 45aa449644b..3a6b4169194 100644
|
|
--- a/Source/WebKit/Shared/gtk/NativeWebKeyboardEventGtk.cpp
|
|
+++ b/Source/WebKit/Shared/gtk/NativeWebKeyboardEventGtk.cpp
|
|
@@ -43,7 +43,7 @@ NativeWebKeyboardEvent::NativeWebKeyboardEvent(GdkEvent* event, const String& te
|
|
}
|
|
|
|
NativeWebKeyboardEvent::NativeWebKeyboardEvent(const NativeWebKeyboardEvent& event)
|
|
- : WebKeyboardEvent(WebEventFactory::createWebKeyboardEvent(event.nativeEvent(), event.text(), event.handledByInputMethod(), Vector<String>(event.commands())))
|
|
+ : WebKeyboardEvent(event)
|
|
, m_nativeEvent(gdk_event_copy(event.nativeEvent()))
|
|
, m_text(event.text())
|
|
, m_handledByInputMethod(event.handledByInputMethod() ? HandledByInputMethod::Yes : HandledByInputMethod::No)
|
|
diff --git a/Source/WebKit/Shared/gtk/NativeWebMouseEventGtk.cpp b/Source/WebKit/Shared/gtk/NativeWebMouseEventGtk.cpp
|
|
index 28d00f0e6fd..23a013e754e 100644
|
|
--- a/Source/WebKit/Shared/gtk/NativeWebMouseEventGtk.cpp
|
|
+++ b/Source/WebKit/Shared/gtk/NativeWebMouseEventGtk.cpp
|
|
@@ -38,8 +38,8 @@ NativeWebMouseEvent::NativeWebMouseEvent(GdkEvent* event, int eventClickCount)
|
|
}
|
|
|
|
NativeWebMouseEvent::NativeWebMouseEvent(const NativeWebMouseEvent& event)
|
|
- : WebMouseEvent(WebEventFactory::createWebMouseEvent(event.nativeEvent(), event.clickCount()))
|
|
- , m_nativeEvent(gdk_event_copy(event.nativeEvent()))
|
|
+ : WebMouseEvent(event)
|
|
+ , m_nativeEvent(event.nativeEvent() ? gdk_event_copy(event.nativeEvent()) : nullptr)
|
|
{
|
|
}
|
|
|
|
diff --git a/Source/WebKit/Sources.txt b/Source/WebKit/Sources.txt
|
|
index edbfb56e49b..623f393da74 100644
|
|
--- a/Source/WebKit/Sources.txt
|
|
+++ b/Source/WebKit/Sources.txt
|
|
@@ -240,17 +240,22 @@ Shared/WebsiteData/WebsiteData.cpp
|
|
|
|
UIProcess/AuxiliaryProcessProxy.cpp
|
|
UIProcess/BackgroundProcessResponsivenessTimer.cpp
|
|
+UIProcess/BrowserInspectorController.cpp
|
|
+UIProcess/BrowserInspectorPipe.cpp
|
|
+UIProcess/BrowserInspectorTargetAgent.cpp
|
|
UIProcess/DeviceIdHashSaltStorage.cpp
|
|
UIProcess/DrawingAreaProxy.cpp
|
|
UIProcess/FrameLoadState.cpp
|
|
UIProcess/GeolocationPermissionRequestManagerProxy.cpp
|
|
UIProcess/GeolocationPermissionRequestProxy.cpp
|
|
+UIProcess/InspectorBrowserAgent.cpp
|
|
UIProcess/InspectorTargetProxy.cpp
|
|
UIProcess/LegacyGlobalSettings.cpp
|
|
UIProcess/PageLoadState.cpp
|
|
UIProcess/ProcessAssertion.cpp
|
|
UIProcess/ProcessThrottler.cpp
|
|
UIProcess/ProvisionalPageProxy.cpp
|
|
+UIProcess/RemoteInspectorPipe.cpp
|
|
UIProcess/RemoteWebInspectorProxy.cpp
|
|
UIProcess/ResponsivenessTimer.cpp
|
|
UIProcess/StatisticsRequest.cpp
|
|
@@ -292,6 +297,9 @@ UIProcess/WebPageDiagnosticLoggingClient.cpp
|
|
UIProcess/WebPageGroup.cpp
|
|
UIProcess/WebPageInjectedBundleClient.cpp
|
|
UIProcess/WebPageInspectorController.cpp
|
|
+UIProcess/WebPageInspectorEmulationAgent.cpp
|
|
+UIProcess/WebPageInspectorInputAgent.cpp
|
|
+UIProcess/WebPageInspectorTargetProxy.cpp
|
|
UIProcess/WebPageProxy.cpp
|
|
UIProcess/WebPasteboardProxy.cpp
|
|
UIProcess/WebPreferences.cpp
|
|
diff --git a/Source/WebKit/SourcesCocoa.txt b/Source/WebKit/SourcesCocoa.txt
|
|
index a22aaba0310..386dd8586c4 100644
|
|
--- a/Source/WebKit/SourcesCocoa.txt
|
|
+++ b/Source/WebKit/SourcesCocoa.txt
|
|
@@ -243,6 +243,7 @@ UIProcess/API/Cocoa/_WKApplicationManifest.mm
|
|
UIProcess/API/Cocoa/_WKAttachment.mm
|
|
UIProcess/API/Cocoa/_WKAutomationSession.mm
|
|
UIProcess/API/Cocoa/_WKAutomationSessionConfiguration.mm
|
|
+UIProcess/API/Cocoa/_WKBrowserInspector.mm
|
|
UIProcess/API/Cocoa/_WKContentRuleListAction.mm
|
|
UIProcess/API/Cocoa/_WKContextMenuElementInfo.mm
|
|
UIProcess/API/Cocoa/_WKCustomHeaderFields.mm @no-unify
|
|
diff --git a/Source/WebKit/SourcesGTK.txt b/Source/WebKit/SourcesGTK.txt
|
|
index c9e153d6a2c..70788976bee 100644
|
|
--- a/Source/WebKit/SourcesGTK.txt
|
|
+++ b/Source/WebKit/SourcesGTK.txt
|
|
@@ -129,6 +129,7 @@ UIProcess/API/glib/WebKitAuthenticationRequest.cpp @no-unify
|
|
UIProcess/API/glib/WebKitAutomationSession.cpp @no-unify
|
|
UIProcess/API/glib/WebKitBackForwardList.cpp @no-unify
|
|
UIProcess/API/glib/WebKitBackForwardListItem.cpp @no-unify
|
|
+UIProcess/API/glib/WebKitBrowserInspector.cpp @no-unify
|
|
UIProcess/API/glib/WebKitContextMenuClient.cpp @no-unify
|
|
UIProcess/API/glib/WebKitCookieManager.cpp @no-unify
|
|
UIProcess/API/glib/WebKitCredential.cpp @no-unify
|
|
@@ -224,6 +225,7 @@ UIProcess/WebsiteData/unix/WebsiteDataStoreUnix.cpp
|
|
|
|
UIProcess/cairo/BackingStoreCairo.cpp @no-unify
|
|
|
|
+UIProcess/glib/InspectorBrowserAgentClientGLib.cpp
|
|
UIProcess/glib/RemoteInspectorClient.cpp
|
|
UIProcess/glib/WebProcessPoolGLib.cpp
|
|
UIProcess/glib/WebProcessProxyGLib.cpp
|
|
@@ -249,6 +251,9 @@ UIProcess/gtk/WebColorPickerGtk.cpp
|
|
UIProcess/gtk/WebContextMenuProxyGtk.cpp
|
|
UIProcess/gtk/WebDataListSuggestionsDropdownGtk.cpp
|
|
UIProcess/gtk/WebInspectorProxyGtk.cpp
|
|
+UIProcess/gtk/WebPageInspectorEmulationAgentGtk.cpp
|
|
+UIProcess/gtk/WebPageInspectorInputAgentGtk.cpp
|
|
+UIProcess/gtk/WebPageInspectorTargetProxyGtk.cpp
|
|
UIProcess/gtk/WebKitInspectorWindow.cpp
|
|
UIProcess/gtk/WebPageProxyGtk.cpp @no-unify
|
|
UIProcess/gtk/WebPasteboardProxyGtk.cpp
|
|
diff --git a/Source/WebKit/SourcesWPE.txt b/Source/WebKit/SourcesWPE.txt
|
|
index 5b514d5216e..75bd77c7614 100644
|
|
--- a/Source/WebKit/SourcesWPE.txt
|
|
+++ b/Source/WebKit/SourcesWPE.txt
|
|
@@ -118,6 +118,7 @@ UIProcess/API/glib/WebKitAuthenticationRequest.cpp @no-unify
|
|
UIProcess/API/glib/WebKitAutomationSession.cpp @no-unify
|
|
UIProcess/API/glib/WebKitBackForwardList.cpp @no-unify
|
|
UIProcess/API/glib/WebKitBackForwardListItem.cpp @no-unify
|
|
+UIProcess/API/glib/WebKitBrowserInspector.cpp @no-unify
|
|
UIProcess/API/glib/WebKitContextMenuClient.cpp @no-unify
|
|
UIProcess/API/glib/WebKitCookieManager.cpp @no-unify
|
|
UIProcess/API/glib/WebKitCredential.cpp @no-unify
|
|
@@ -186,7 +187,7 @@ UIProcess/Automation/wpe/WebAutomationSessionWPE.cpp
|
|
UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp
|
|
|
|
UIProcess/geoclue/GeoclueGeolocationProvider.cpp
|
|
-
|
|
+UIProcess/glib/InspectorBrowserAgentClientGLib.cpp
|
|
UIProcess/glib/WebProcessPoolGLib.cpp
|
|
UIProcess/glib/WebProcessProxyGLib.cpp
|
|
UIProcess/glib/WebsiteDataStoreGLib.cpp @no-unify
|
|
@@ -211,6 +212,9 @@ UIProcess/soup/WebProcessPoolSoup.cpp
|
|
UIProcess/wpe/TextCheckerWPE.cpp
|
|
UIProcess/wpe/WebInspectorProxyWPE.cpp
|
|
UIProcess/wpe/WebPageProxyWPE.cpp
|
|
+UIProcess/wpe/WebPageInspectorEmulationAgentWPE.cpp
|
|
+UIProcess/wpe/WebPageInspectorInputAgentWPE.cpp
|
|
+UIProcess/wpe/WebPageInspectorTargetProxyWPE.cpp
|
|
UIProcess/wpe/WebPasteboardProxyWPE.cpp
|
|
UIProcess/wpe/WebPreferencesWPE.cpp
|
|
|
|
diff --git a/Source/WebKit/UIProcess/API/APIAttachment.cpp b/Source/WebKit/UIProcess/API/APIAttachment.cpp
|
|
index f9a4cadfae1..1386ed63eca 100644
|
|
--- a/Source/WebKit/UIProcess/API/APIAttachment.cpp
|
|
+++ b/Source/WebKit/UIProcess/API/APIAttachment.cpp
|
|
@@ -28,6 +28,7 @@
|
|
|
|
#if ENABLE(ATTACHMENT_ELEMENT)
|
|
|
|
+#include "WebPageProxy.h"
|
|
#include <WebCore/SharedBuffer.h>
|
|
#include <wtf/text/WTFString.h>
|
|
|
|
diff --git a/Source/WebKit/UIProcess/API/C/WKPage.cpp b/Source/WebKit/UIProcess/API/C/WKPage.cpp
|
|
index 44637251dff..1e64b9f34fe 100644
|
|
--- a/Source/WebKit/UIProcess/API/C/WKPage.cpp
|
|
+++ b/Source/WebKit/UIProcess/API/C/WKPage.cpp
|
|
@@ -1734,6 +1734,8 @@ void WKPageSetPageUIClient(WKPageRef pageRef, const WKPageUIClientBase* wkClient
|
|
{
|
|
if (!m_client.didNotHandleKeyEvent)
|
|
return;
|
|
+ if (!event.nativeEvent())
|
|
+ return;
|
|
m_client.didNotHandleKeyEvent(toAPI(page), event.nativeEvent(), m_client.base.clientInfo);
|
|
}
|
|
|
|
diff --git a/Source/WebKit/UIProcess/API/Cocoa/_WKBrowserInspector.h b/Source/WebKit/UIProcess/API/Cocoa/_WKBrowserInspector.h
|
|
new file mode 100644
|
|
index 00000000000..812c2913e4f
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/API/Cocoa/_WKBrowserInspector.h
|
|
@@ -0,0 +1,50 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions are
|
|
+ *
|
|
+ * met:
|
|
+ * * Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * * 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.
|
|
+ * * Neither the name of Microsoft Corporation nor the names of its
|
|
+ * contributors may be used to endorse or promote products derived from
|
|
+ * this software without specific prior written permission.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
|
|
+ * OWNER OR 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.
|
|
+ */
|
|
+
|
|
+#import <WebKit/WKFoundation.h>
|
|
+#import <Foundation/Foundation.h>
|
|
+
|
|
+NS_ASSUME_NONNULL_BEGIN
|
|
+
|
|
+@class WKWebView;
|
|
+
|
|
+@protocol _WKBrowserInspectorDelegate <NSObject>
|
|
+- (WKWebView *)createNewPage;
|
|
+- (void)quit;
|
|
+@end
|
|
+
|
|
+WK_CLASS_AVAILABLE(macos(10.15.0))
|
|
+@interface _WKBrowserInspector : NSObject
|
|
++ (void)initializeRemoteInspectorPipe:(id<_WKBrowserInspectorDelegate>)delegate;
|
|
+@end
|
|
+
|
|
+
|
|
+NS_ASSUME_NONNULL_END
|
|
+
|
|
diff --git a/Source/WebKit/UIProcess/API/Cocoa/_WKBrowserInspector.mm b/Source/WebKit/UIProcess/API/Cocoa/_WKBrowserInspector.mm
|
|
new file mode 100644
|
|
index 00000000000..2c9aead1b47
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/API/Cocoa/_WKBrowserInspector.mm
|
|
@@ -0,0 +1,52 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions are
|
|
+ *
|
|
+ * met:
|
|
+ * * Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * * 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.
|
|
+ * * Neither the name of Microsoft Corporation nor the names of its
|
|
+ * contributors may be used to endorse or promote products derived from
|
|
+ * this software without specific prior written permission.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
|
|
+ * OWNER OR 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.
|
|
+ */
|
|
+
|
|
+#include "config.h"
|
|
+#include "_WKBrowserInspector.h"
|
|
+
|
|
+#include "BrowserInspectorPipe.h"
|
|
+#include "InspectorBrowserAgentClientMac.h"
|
|
+#include "WebKit2Initialize.h"
|
|
+
|
|
+#import "WKWebView.h"
|
|
+
|
|
+using namespace WebKit;
|
|
+
|
|
+@implementation _WKBrowserInspector
|
|
+
|
|
++ (void)initializeRemoteInspectorPipe:(id<_WKBrowserInspectorDelegate>)delegate
|
|
+{
|
|
+#if ENABLE(REMOTE_INSPECTOR)
|
|
+ InitializeWebKit2();
|
|
+ initializeBrowserInspectorPipe(makeUnique<InspectorBrowserAgentClientMac>(delegate));
|
|
+#endif
|
|
+}
|
|
+
|
|
+@end
|
|
diff --git a/Source/WebKit/UIProcess/API/glib/WebKitBrowserInspector.cpp b/Source/WebKit/UIProcess/API/glib/WebKitBrowserInspector.cpp
|
|
new file mode 100644
|
|
index 00000000000..a893558f98b
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/API/glib/WebKitBrowserInspector.cpp
|
|
@@ -0,0 +1,141 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions are
|
|
+ * met:
|
|
+ *
|
|
+ * * Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * * 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.
|
|
+ * * Neither the name of Microsoft Corporation nor the names of its
|
|
+ * contributors may be used to endorse or promote products derived from
|
|
+ * this software without specific prior written permission.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
|
|
+ * OWNER OR 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.
|
|
+ */
|
|
+
|
|
+#include "config.h"
|
|
+#include "WebKitBrowserInspector.h"
|
|
+
|
|
+#include "BrowserInspectorPipe.h"
|
|
+#include "InspectorBrowserAgentClientGLib.h"
|
|
+#include "WebKitBrowserInspectorPrivate.h"
|
|
+#include "WebKitWebViewPrivate.h"
|
|
+#include <wtf/glib/GRefPtr.h>
|
|
+#include <wtf/glib/WTFGType.h>
|
|
+
|
|
+/**
|
|
+ * SECTION: WebKitBrowserInspector
|
|
+ * @Short_description: Access to the WebKit browser inspector
|
|
+ * @Title: WebKitBrowserInspector
|
|
+ *
|
|
+ * The WebKit Browser Inspector is an experimental API that provides
|
|
+ * access to the inspector via the remote debugging protocol. The protocol
|
|
+ * allows to create ephemeral contexts and create pages in them and then
|
|
+ * manipulate them using the inspector commands. This may be useful for
|
|
+ * the browser automation or remote debugging.
|
|
+ *
|
|
+ * Currently the protocol can be exposed to the parent process via a unix
|
|
+ * pipe.
|
|
+ */
|
|
+
|
|
+enum {
|
|
+ CREATE_NEW_PAGE,
|
|
+
|
|
+ LAST_SIGNAL
|
|
+};
|
|
+
|
|
+struct _WebKitBrowserInspectorPrivate {
|
|
+ int unused { 0 };
|
|
+};
|
|
+
|
|
+WEBKIT_DEFINE_TYPE(WebKitBrowserInspector, webkit_browser_inspector, G_TYPE_OBJECT)
|
|
+
|
|
+static guint signals[LAST_SIGNAL] = { 0, };
|
|
+
|
|
+static void webkit_browser_inspector_class_init(WebKitBrowserInspectorClass* findClass)
|
|
+{
|
|
+ GObjectClass* gObjectClass = G_OBJECT_CLASS(findClass);
|
|
+
|
|
+ /**
|
|
+ * WebKitBrowserInspector::create-new-page:
|
|
+ * @inspector: the #WebKitBrowserInspector on which the signal is emitted
|
|
+ *
|
|
+ * Emitted when the inspector is requested to create a new page in the provided
|
|
+ * #WebKitWebContext.
|
|
+ *
|
|
+ * This signal is emitted when inspector receives 'Browser.createPage' command
|
|
+ * from its remote client. If the signla is not handled the command will fail.
|
|
+ *
|
|
+ * Returns: %WebKitWebView that contains created page.
|
|
+ */
|
|
+ signals[CREATE_NEW_PAGE] = g_signal_new(
|
|
+ "create-new-page",
|
|
+ G_TYPE_FROM_CLASS(gObjectClass),
|
|
+ G_SIGNAL_RUN_LAST,
|
|
+ G_STRUCT_OFFSET(WebKitBrowserInspectorClass, create_new_page),
|
|
+ nullptr, nullptr,
|
|
+ g_cclosure_marshal_generic,
|
|
+#if PLATFORM(GTK)
|
|
+ GTK_TYPE_WIDGET,
|
|
+#else
|
|
+ WEBKIT_TYPE_WEB_VIEW,
|
|
+#endif
|
|
+ 1,
|
|
+ WEBKIT_TYPE_WEB_CONTEXT);
|
|
+}
|
|
+
|
|
+WebKit::WebPageProxy* webkitBrowserInspectorCreateNewPageInContext(WebKitWebContext* context)
|
|
+{
|
|
+ WebKitWebView* newWebView;
|
|
+ g_signal_emit(webkit_browser_inspector_get_default(), signals[CREATE_NEW_PAGE], 0, context, &newWebView);
|
|
+ if (!newWebView)
|
|
+ return nullptr;
|
|
+ return &webkitWebViewGetPage(newWebView);
|
|
+}
|
|
+
|
|
+static gpointer createWebKitBrowserInspector(gpointer)
|
|
+{
|
|
+ static GRefPtr<WebKitBrowserInspector> browserInspector = adoptGRef(WEBKIT_BROWSER_INSPECTOR(g_object_new(WEBKIT_TYPE_BROWSER_INSPECTOR, nullptr)));
|
|
+ return browserInspector.get();
|
|
+}
|
|
+
|
|
+/**
|
|
+ * webkit_browser_inspector_get_default:
|
|
+ *
|
|
+ * Gets the default instance of the browser inspector.
|
|
+ *
|
|
+ * Returns: (transfer none): a #WebKitBrowserInspector
|
|
+ */
|
|
+WebKitBrowserInspector* webkit_browser_inspector_get_default(void)
|
|
+{
|
|
+ static GOnce onceInit = G_ONCE_INIT;
|
|
+ return WEBKIT_BROWSER_INSPECTOR(g_once(&onceInit, createWebKitBrowserInspector, 0));
|
|
+}
|
|
+
|
|
+/**
|
|
+ * webkit_browser_inspector_initialize_pipe:
|
|
+ *
|
|
+ * Creates browser inspector and configures pipe handler to communicate with
|
|
+ * the parent process.
|
|
+ */
|
|
+void webkit_browser_inspector_initialize_pipe(void)
|
|
+{
|
|
+#if ENABLE(REMOTE_INSPECTOR)
|
|
+ WebKit::initializeBrowserInspectorPipe(makeUnique<WebKit::InspectorBrowserAgentClientGlib>());
|
|
+#endif
|
|
+}
|
|
diff --git a/Source/WebKit/UIProcess/API/glib/WebKitBrowserInspectorPrivate.h b/Source/WebKit/UIProcess/API/glib/WebKitBrowserInspectorPrivate.h
|
|
new file mode 100644
|
|
index 00000000000..6e9afeac99a
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/API/glib/WebKitBrowserInspectorPrivate.h
|
|
@@ -0,0 +1,36 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions are
|
|
+ * met:
|
|
+ *
|
|
+ * * Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * * 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.
|
|
+ * * Neither the name of Microsoft Corporation nor the names of its
|
|
+ * contributors may be used to endorse or promote products derived from
|
|
+ * this software without specific prior written permission.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
|
|
+ * OWNER OR 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.
|
|
+ */
|
|
+
|
|
+#pragma once
|
|
+
|
|
+#include "WebKitBrowserInspector.h"
|
|
+#include "WebPageProxy.h"
|
|
+
|
|
+WebKit::WebPageProxy* webkitBrowserInspectorCreateNewPageInContext(WebKitWebContext*);
|
|
diff --git a/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp b/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp
|
|
index 126bccf1314..a095db63bc5 100644
|
|
--- a/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp
|
|
+++ b/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp
|
|
@@ -373,6 +373,11 @@ static void webkitWebContextConstructed(GObject* object)
|
|
if (!webkit_website_data_manager_is_ephemeral(priv->websiteDataManager.get()))
|
|
WebKit::LegacyGlobalSettings::singleton().setHSTSStorageDirectory(FileSystem::stringFromFileSystemRepresentation(webkit_website_data_manager_get_hsts_cache_directory(priv->websiteDataManager.get())));
|
|
|
|
+ const gchar *singleprocess = g_getenv("MINIBROWSER_SINGLEPROCESS");
|
|
+ if (singleprocess && *singleprocess) {
|
|
+ // processModel is not set at this point, force single process.
|
|
+ configuration.setUsesSingleWebProcess(true);
|
|
+ }
|
|
priv->processPool = WebProcessPool::create(configuration);
|
|
priv->processPool->setPrimaryDataStore(webkitWebsiteDataManagerGetDataStore(priv->websiteDataManager.get()));
|
|
priv->processPool->setUserMessageHandler([webContext](UserMessage&& message, CompletionHandler<void(UserMessage&&)>&& completionHandler) {
|
|
diff --git a/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp b/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp
|
|
index 00b7c6bbc46..c3a6cf416e1 100644
|
|
--- a/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp
|
|
+++ b/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp
|
|
@@ -226,6 +226,8 @@ void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent& event, bool
|
|
return;
|
|
if (event.fakedForComposition())
|
|
return;
|
|
+ if (!event.nativeEvent())
|
|
+ return;
|
|
|
|
WebKitWebViewBase* webkitWebViewBase = WEBKIT_WEB_VIEW_BASE(m_viewWidget);
|
|
webkitWebViewBaseForwardNextKeyEvent(webkitWebViewBase);
|
|
diff --git a/Source/WebKit/UIProcess/API/gtk/WebKitBrowserInspector.h b/Source/WebKit/UIProcess/API/gtk/WebKitBrowserInspector.h
|
|
new file mode 100644
|
|
index 00000000000..4ee8204a9b8
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/API/gtk/WebKitBrowserInspector.h
|
|
@@ -0,0 +1,84 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions are
|
|
+ * met:
|
|
+ *
|
|
+ * * Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * * 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.
|
|
+ * * Neither the name of Microsoft Corporation nor the names of its
|
|
+ * contributors may be used to endorse or promote products derived from
|
|
+ * this software without specific prior written permission.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
|
|
+ * OWNER OR 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.
|
|
+ */
|
|
+
|
|
+#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
|
|
+#error "Only <webkit2/webkit2.h> can be included directly."
|
|
+#endif
|
|
+
|
|
+#ifndef WebKitBrowserInspector_h
|
|
+#define WebKitBrowserInspector_h
|
|
+
|
|
+#include <glib-object.h>
|
|
+#include <webkit2/WebKitDefines.h>
|
|
+#include <webkit2/WebKitWebView.h>
|
|
+
|
|
+G_BEGIN_DECLS
|
|
+
|
|
+#define WEBKIT_TYPE_BROWSER_INSPECTOR (webkit_browser_inspector_get_type())
|
|
+#define WEBKIT_BROWSER_INSPECTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_BROWSER_INSPECTOR, WebKitBrowserInspector))
|
|
+#define WEBKIT_IS_BROWSER_INSPECTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_BROWSER_INSPECTOR))
|
|
+#define WEBKIT_BROWSER_INSPECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_BROWSER_INSPECTOR, WebKitBrowserInspectorClass))
|
|
+#define WEBKIT_IS_BROWSER_INSPECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_BROWSER_INSPECTOR))
|
|
+#define WEBKIT_BROWSER_INSPECTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_BROWSER_INSPECTOR, WebKitBrowserInspectorClass))
|
|
+
|
|
+typedef struct _WebKitBrowserInspector WebKitBrowserInspector;
|
|
+typedef struct _WebKitBrowserInspectorClass WebKitBrowserInspectorClass;
|
|
+typedef struct _WebKitBrowserInspectorPrivate WebKitBrowserInspectorPrivate;
|
|
+
|
|
+struct _WebKitBrowserInspector {
|
|
+ GObject parent;
|
|
+
|
|
+ WebKitBrowserInspectorPrivate *priv;
|
|
+};
|
|
+
|
|
+struct _WebKitBrowserInspectorClass {
|
|
+ GObjectClass parent_class;
|
|
+
|
|
+ WebKitWebView *(* create_new_page) (WebKitBrowserInspector *browser_inspector,
|
|
+ WebKitWebContext *context);
|
|
+
|
|
+ void (*_webkit_reserved0) (void);
|
|
+ void (*_webkit_reserved1) (void);
|
|
+ void (*_webkit_reserved2) (void);
|
|
+ void (*_webkit_reserved3) (void);
|
|
+};
|
|
+
|
|
+WEBKIT_API GType
|
|
+webkit_browser_inspector_get_type (void);
|
|
+
|
|
+WEBKIT_API WebKitBrowserInspector *
|
|
+webkit_browser_inspector_get_default (void);
|
|
+
|
|
+WEBKIT_API void
|
|
+webkit_browser_inspector_initialize_pipe (void);
|
|
+
|
|
+G_END_DECLS
|
|
+
|
|
+#endif
|
|
diff --git a/Source/WebKit/UIProcess/API/gtk/webkit2.h b/Source/WebKit/UIProcess/API/gtk/webkit2.h
|
|
index 16ef7eb6d42..eb3759b05bb 100644
|
|
--- a/Source/WebKit/UIProcess/API/gtk/webkit2.h
|
|
+++ b/Source/WebKit/UIProcess/API/gtk/webkit2.h
|
|
@@ -32,6 +32,7 @@
|
|
#include <webkit2/WebKitAutomationSession.h>
|
|
#include <webkit2/WebKitBackForwardList.h>
|
|
#include <webkit2/WebKitBackForwardListItem.h>
|
|
+#include <webkit2/WebKitBrowserInspector.h>
|
|
#include <webkit2/WebKitContextMenu.h>
|
|
#include <webkit2/WebKitContextMenuActions.h>
|
|
#include <webkit2/WebKitContextMenuItem.h>
|
|
diff --git a/Source/WebKit/UIProcess/API/wpe/WebKitBrowserInspector.h b/Source/WebKit/UIProcess/API/wpe/WebKitBrowserInspector.h
|
|
new file mode 100644
|
|
index 00000000000..675e517596b
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/API/wpe/WebKitBrowserInspector.h
|
|
@@ -0,0 +1,81 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions are
|
|
+ * met:
|
|
+ *
|
|
+ * * Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * * 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.
|
|
+ * * Neither the name of Microsoft Corporation nor the names of its
|
|
+ * contributors may be used to endorse or promote products derived from
|
|
+ * this software without specific prior written permission.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
|
|
+ * OWNER OR 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.
|
|
+ */
|
|
+
|
|
+#if !defined(__WEBKIT_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
|
|
+#error "Only <wpe/webkit.h> can be included directly."
|
|
+#endif
|
|
+
|
|
+#ifndef WebKitBrowserInspector_h
|
|
+#define WebKitBrowserInspector_h
|
|
+
|
|
+#include <glib-object.h>
|
|
+#include <wpe/WebKitDefines.h>
|
|
+#include <wpe/WebKitWebView.h>
|
|
+
|
|
+G_BEGIN_DECLS
|
|
+
|
|
+#define WEBKIT_TYPE_BROWSER_INSPECTOR (webkit_browser_inspector_get_type())
|
|
+#define WEBKIT_BROWSER_INSPECTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_BROWSER_INSPECTOR, WebKitBrowserInspector))
|
|
+#define WEBKIT_IS_BROWSER_INSPECTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_BROWSER_INSPECTOR))
|
|
+#define WEBKIT_BROWSER_INSPECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_BROWSER_INSPECTOR, WebKitBrowserInspectorClass))
|
|
+#define WEBKIT_IS_BROWSER_INSPECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_BROWSER_INSPECTOR))
|
|
+#define WEBKIT_BROWSER_INSPECTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_BROWSER_INSPECTOR, WebKitBrowserInspectorClass))
|
|
+
|
|
+typedef struct _WebKitBrowserInspector WebKitBrowserInspector;
|
|
+typedef struct _WebKitBrowserInspectorClass WebKitBrowserInspectorClass;
|
|
+typedef struct _WebKitBrowserInspectorPrivate WebKitBrowserInspectorPrivate;
|
|
+
|
|
+struct _WebKitBrowserInspector {
|
|
+ GObject parent;
|
|
+
|
|
+ WebKitBrowserInspectorPrivate *priv;
|
|
+};
|
|
+
|
|
+struct _WebKitBrowserInspectorClass {
|
|
+ GObjectClass parent_class;
|
|
+
|
|
+ WebKitWebView *(* create_new_page) (WebKitBrowserInspector *browser_inspector,
|
|
+ WebKitWebContext *context);
|
|
+
|
|
+ void (*_webkit_reserved0) (void);
|
|
+ void (*_webkit_reserved1) (void);
|
|
+ void (*_webkit_reserved2) (void);
|
|
+ void (*_webkit_reserved3) (void);
|
|
+};
|
|
+
|
|
+WEBKIT_API GType
|
|
+webkit_browser_inspector_get_type (void);
|
|
+
|
|
+WEBKIT_API WebKitBrowserInspector *
|
|
+webkit_browser_inspector_get_default (void);
|
|
+
|
|
+G_END_DECLS
|
|
+
|
|
+#endif
|
|
diff --git a/Source/WebKit/UIProcess/API/wpe/webkit.h b/Source/WebKit/UIProcess/API/wpe/webkit.h
|
|
index 9cc31cb4968..930499e65b6 100644
|
|
--- a/Source/WebKit/UIProcess/API/wpe/webkit.h
|
|
+++ b/Source/WebKit/UIProcess/API/wpe/webkit.h
|
|
@@ -32,6 +32,7 @@
|
|
#include <wpe/WebKitAutomationSession.h>
|
|
#include <wpe/WebKitBackForwardList.h>
|
|
#include <wpe/WebKitBackForwardListItem.h>
|
|
+#include <wpe/WebKitBrowserInspector.h>
|
|
#include <wpe/WebKitContextMenu.h>
|
|
#include <wpe/WebKitContextMenuActions.h>
|
|
#include <wpe/WebKitContextMenuItem.h>
|
|
diff --git a/Source/WebKit/UIProcess/BrowserInspectorController.cpp b/Source/WebKit/UIProcess/BrowserInspectorController.cpp
|
|
new file mode 100644
|
|
index 00000000000..b4e14cb4390
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/BrowserInspectorController.cpp
|
|
@@ -0,0 +1,128 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions are
|
|
+ * met:
|
|
+ *
|
|
+ * * Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * * 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.
|
|
+ * * Neither the name of Microsoft Corporation nor the names of its
|
|
+ * contributors may be used to endorse or promote products derived from
|
|
+ * this software without specific prior written permission.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
|
|
+ * OWNER OR 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.
|
|
+ */
|
|
+
|
|
+#include "config.h"
|
|
+#include "BrowserInspectorController.h"
|
|
+
|
|
+#if ENABLE(REMOTE_INSPECTOR)
|
|
+
|
|
+#include "BrowserInspectorTargetAgent.h"
|
|
+#include "InspectorBrowserAgent.h"
|
|
+#include "InspectorBrowserAgentClient.h"
|
|
+#include "WebPageInspectorController.h"
|
|
+#include "WebPageProxy.h"
|
|
+#include "WebProcessPool.h"
|
|
+#include "WebProcessProxy.h"
|
|
+#include <JavaScriptCore/InspectorBackendDispatcher.h>
|
|
+#include <JavaScriptCore/InspectorBackendDispatchers.h>
|
|
+#include <JavaScriptCore/InspectorFrontendChannel.h>
|
|
+#include <JavaScriptCore/InspectorFrontendRouter.h>
|
|
+#include <JavaScriptCore/InspectorTarget.h>
|
|
+#include <wtf/Ref.h>
|
|
+#include <wtf/RefPtr.h>
|
|
+
|
|
+using namespace Inspector;
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+static Vector<WebPageProxy*> allPages()
|
|
+{
|
|
+ ASSERT(isMainThread());
|
|
+ Vector<WebPageProxy*> result;
|
|
+ for (WebProcessPool* pool : WebProcessPool::allProcessPools()) {
|
|
+ for (auto& process : pool->processes()) {
|
|
+ result.appendRange(process->pages().begin(), process->pages().end());
|
|
+ }
|
|
+ }
|
|
+ return result;
|
|
+}
|
|
+
|
|
+BrowserInspectorController::BrowserInspectorController(std::unique_ptr<InspectorBrowserAgentClient> client)
|
|
+ : m_frontendChannel(nullptr)
|
|
+ , m_frontendRouter(FrontendRouter::create())
|
|
+ , m_backendDispatcher(BackendDispatcher::create(m_frontendRouter.copyRef()))
|
|
+ , m_browserAgentClient(std::move(client))
|
|
+{
|
|
+ m_agents.append(makeUnique<InspectorBrowserAgent>(m_backendDispatcher, m_browserAgentClient.get()));
|
|
+ m_agents.append(makeUnique<BrowserInspectorTargetAgent>(m_backendDispatcher));
|
|
+}
|
|
+
|
|
+BrowserInspectorController::~BrowserInspectorController() = default;
|
|
+
|
|
+void BrowserInspectorController::connectFrontend(FrontendChannel& frontendChannel)
|
|
+{
|
|
+ ASSERT(!m_frontendChannel);
|
|
+ m_frontendChannel = &frontendChannel;
|
|
+ // Auto-connect to all new pages.
|
|
+ WebPageInspectorController::setCreationListener([this](WebPageInspectorController& inspectorController) {
|
|
+ inspectorController.connectFrontend(*m_frontendChannel);
|
|
+ });
|
|
+
|
|
+ bool connectingFirstFrontend = !m_frontendRouter->hasFrontends();
|
|
+ m_frontendRouter->connectFrontend(frontendChannel);
|
|
+ if (connectingFirstFrontend)
|
|
+ m_agents.didCreateFrontendAndBackend(&m_frontendRouter.get(), &m_backendDispatcher.get());
|
|
+
|
|
+ connectToAllPages();
|
|
+}
|
|
+
|
|
+void BrowserInspectorController::disconnectFrontend()
|
|
+{
|
|
+ ASSERT(m_frontendChannel);
|
|
+ disconnectFromAllPages();
|
|
+
|
|
+ m_frontendRouter->disconnectFrontend(*m_frontendChannel);
|
|
+ if (!m_frontendRouter->hasFrontends())
|
|
+ m_agents.willDestroyFrontendAndBackend(DisconnectReason::InspectorDestroyed);
|
|
+
|
|
+ WebPageInspectorController::setCreationListener(nullptr);
|
|
+ m_frontendChannel = nullptr;
|
|
+}
|
|
+
|
|
+void BrowserInspectorController::dispatchMessageFromFrontend(const String& message)
|
|
+{
|
|
+ m_backendDispatcher->dispatch(message);
|
|
+}
|
|
+
|
|
+void BrowserInspectorController::connectToAllPages()
|
|
+{
|
|
+ for (auto* page : allPages())
|
|
+ page->inspectorController().connectFrontend(*m_frontendChannel);
|
|
+}
|
|
+
|
|
+void BrowserInspectorController::disconnectFromAllPages()
|
|
+{
|
|
+ for (auto* page : allPages())
|
|
+ page->inspectorController().disconnectFrontend(*m_frontendChannel);
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
+
|
|
+#endif // ENABLE(REMOTE_INSPECTOR)
|
|
diff --git a/Source/WebKit/UIProcess/BrowserInspectorController.h b/Source/WebKit/UIProcess/BrowserInspectorController.h
|
|
new file mode 100644
|
|
index 00000000000..d1e7ea17002
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/BrowserInspectorController.h
|
|
@@ -0,0 +1,74 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions are
|
|
+ * met:
|
|
+ *
|
|
+ * * Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * * 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.
|
|
+ * * Neither the name of Microsoft Corporation nor the names of its
|
|
+ * contributors may be used to endorse or promote products derived from
|
|
+ * this software without specific prior written permission.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
|
|
+ * OWNER OR 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.
|
|
+ */
|
|
+
|
|
+#pragma once
|
|
+
|
|
+#if ENABLE(REMOTE_INSPECTOR)
|
|
+
|
|
+#include <JavaScriptCore/InspectorAgentRegistry.h>
|
|
+#include <wtf/Forward.h>
|
|
+#include <wtf/Noncopyable.h>
|
|
+
|
|
+namespace Inspector {
|
|
+class BackendDispatcher;
|
|
+class FrontendChannel;
|
|
+class FrontendRouter;
|
|
+}
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+class InspectorBrowserAgentClient;
|
|
+
|
|
+class BrowserInspectorController {
|
|
+ WTF_MAKE_NONCOPYABLE(BrowserInspectorController);
|
|
+ WTF_MAKE_FAST_ALLOCATED;
|
|
+public:
|
|
+ BrowserInspectorController(std::unique_ptr<InspectorBrowserAgentClient> client);
|
|
+ ~BrowserInspectorController();
|
|
+
|
|
+ void connectFrontend(Inspector::FrontendChannel&);
|
|
+ void disconnectFrontend();
|
|
+ void dispatchMessageFromFrontend(const String& message);
|
|
+
|
|
+private:
|
|
+ class TargetHandler;
|
|
+ void connectToAllPages();
|
|
+ void disconnectFromAllPages();
|
|
+
|
|
+ Inspector::FrontendChannel* m_frontendChannel { nullptr };
|
|
+ Ref<Inspector::FrontendRouter> m_frontendRouter;
|
|
+ Ref<Inspector::BackendDispatcher> m_backendDispatcher;
|
|
+ std::unique_ptr<InspectorBrowserAgentClient> m_browserAgentClient;
|
|
+ Inspector::AgentRegistry m_agents;
|
|
+};
|
|
+
|
|
+} // namespace WebKit
|
|
+
|
|
+#endif // ENABLE(REMOTE_INSPECTOR)
|
|
diff --git a/Source/WebKit/UIProcess/BrowserInspectorPipe.cpp b/Source/WebKit/UIProcess/BrowserInspectorPipe.cpp
|
|
new file mode 100644
|
|
index 00000000000..483b4e46c98
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/BrowserInspectorPipe.cpp
|
|
@@ -0,0 +1,62 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions are
|
|
+ * met:
|
|
+ *
|
|
+ * * Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * * 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.
|
|
+ * * Neither the name of Microsoft Corporation nor the names of its
|
|
+ * contributors may be used to endorse or promote products derived from
|
|
+ * this software without specific prior written permission.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
|
|
+ * OWNER OR 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.
|
|
+ */
|
|
+
|
|
+#include "config.h"
|
|
+#include "BrowserInspectorPipe.h"
|
|
+
|
|
+#if ENABLE(REMOTE_INSPECTOR)
|
|
+
|
|
+#include "BrowserInspectorController.h"
|
|
+#include "RemoteInspectorPipe.h"
|
|
+#include <wtf/NeverDestroyed.h>
|
|
+#include "InspectorBrowserAgentClient.h"
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+void initializeBrowserInspectorPipe(std::unique_ptr<InspectorBrowserAgentClient> client)
|
|
+{
|
|
+ class BrowserInspectorPipe {
|
|
+ public:
|
|
+ BrowserInspectorPipe(std::unique_ptr<InspectorBrowserAgentClient> client)
|
|
+ : m_browserInspectorController(std::move(client))
|
|
+ , m_remoteInspectorPipe(m_browserInspectorController)
|
|
+ {
|
|
+ }
|
|
+
|
|
+ BrowserInspectorController m_browserInspectorController;
|
|
+ RemoteInspectorPipe m_remoteInspectorPipe;
|
|
+ };
|
|
+
|
|
+ static NeverDestroyed<BrowserInspectorPipe> pipe(std::move(client));
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
+
|
|
+#endif // ENABLE(REMOTE_INSPECTOR)
|
|
diff --git a/Source/WebKit/UIProcess/BrowserInspectorPipe.h b/Source/WebKit/UIProcess/BrowserInspectorPipe.h
|
|
new file mode 100644
|
|
index 00000000000..a0088a43590
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/BrowserInspectorPipe.h
|
|
@@ -0,0 +1,43 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions are
|
|
+ * met:
|
|
+ *
|
|
+ * * Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * * 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.
|
|
+ * * Neither the name of Microsoft Corporation nor the names of its
|
|
+ * contributors may be used to endorse or promote products derived from
|
|
+ * this software without specific prior written permission.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
|
|
+ * OWNER OR 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.
|
|
+ */
|
|
+
|
|
+#pragma once
|
|
+
|
|
+#if ENABLE(REMOTE_INSPECTOR)
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+class InspectorBrowserAgentClient;
|
|
+
|
|
+void initializeBrowserInspectorPipe(std::unique_ptr<InspectorBrowserAgentClient> client);
|
|
+
|
|
+} // namespace WebKit
|
|
+
|
|
+#endif // ENABLE(REMOTE_INSPECTOR)
|
|
diff --git a/Source/WebKit/UIProcess/BrowserInspectorTargetAgent.cpp b/Source/WebKit/UIProcess/BrowserInspectorTargetAgent.cpp
|
|
new file mode 100644
|
|
index 00000000000..0d1f5d75c3a
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/BrowserInspectorTargetAgent.cpp
|
|
@@ -0,0 +1,110 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions are
|
|
+ * met:
|
|
+ *
|
|
+ * * Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * * 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.
|
|
+ * * Neither the name of Microsoft Corporation nor the names of its
|
|
+ * contributors may be used to endorse or promote products derived from
|
|
+ * this software without specific prior written permission.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
|
|
+ * OWNER OR 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.
|
|
+ */
|
|
+
|
|
+#include "config.h"
|
|
+#include "BrowserInspectorTargetAgent.h"
|
|
+
|
|
+#include "WebPageInspectorController.h"
|
|
+#include "WebPageProxy.h"
|
|
+#include "WebProcessPool.h"
|
|
+#include "WebProcessProxy.h"
|
|
+#include <JavaScriptCore/InspectorFrontendRouter.h>
|
|
+#include <JavaScriptCore/InspectorTarget.h>
|
|
+
|
|
+using namespace Inspector;
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+namespace {
|
|
+
|
|
+InspectorTarget* targetForId(const String& targetId)
|
|
+{
|
|
+ ASSERT(isMainThread());
|
|
+ for (auto* pool : WebProcessPool::allProcessPools()) {
|
|
+ for (auto& process : pool->processes()) {
|
|
+ for (auto* page : process->pages()) {
|
|
+ auto* result = page->inspectorController().findTarget(targetId);
|
|
+ if (result != nullptr)
|
|
+ return result;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ return nullptr;
|
|
+}
|
|
+
|
|
+} // namespace
|
|
+
|
|
+BrowserInspectorTargetAgent::BrowserInspectorTargetAgent(BackendDispatcher& backendDispatcher)
|
|
+ : InspectorAgentBase("Target"_s)
|
|
+ , m_backendDispatcher(TargetBackendDispatcher::create(backendDispatcher, this))
|
|
+{
|
|
+}
|
|
+
|
|
+BrowserInspectorTargetAgent::~BrowserInspectorTargetAgent() = default;
|
|
+
|
|
+void BrowserInspectorTargetAgent::didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*)
|
|
+{
|
|
+}
|
|
+
|
|
+void BrowserInspectorTargetAgent::willDestroyFrontendAndBackend(DisconnectReason)
|
|
+{
|
|
+}
|
|
+
|
|
+void BrowserInspectorTargetAgent::sendMessageToTarget(ErrorString& error, const String& in_targetId, const String& in_message)
|
|
+{
|
|
+ auto* target = targetForId(in_targetId);
|
|
+ if (target == nullptr) {
|
|
+ error = "Cannot find target with provided id.";
|
|
+ return;
|
|
+ }
|
|
+ target->sendMessageToTargetBackend(in_message);
|
|
+}
|
|
+
|
|
+void BrowserInspectorTargetAgent::activate(ErrorString& error, const String& targetId)
|
|
+{
|
|
+ auto* target = targetForId(targetId);
|
|
+ if (target == nullptr) {
|
|
+ error = "Cannot find target with provided id.";
|
|
+ return;
|
|
+ }
|
|
+ target->activate(error);
|
|
+}
|
|
+
|
|
+void BrowserInspectorTargetAgent::close(ErrorString& error, const String& targetId)
|
|
+{
|
|
+ auto* target = targetForId(targetId);
|
|
+ if (target == nullptr) {
|
|
+ error = "Cannot find target with provided id.";
|
|
+ return;
|
|
+ }
|
|
+ target->close(error);
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/BrowserInspectorTargetAgent.h b/Source/WebKit/UIProcess/BrowserInspectorTargetAgent.h
|
|
new file mode 100644
|
|
index 00000000000..8b4d9273574
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/BrowserInspectorTargetAgent.h
|
|
@@ -0,0 +1,62 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions are
|
|
+ * met:
|
|
+ *
|
|
+ * * Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * * 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.
|
|
+ * * Neither the name of Microsoft Corporation nor the names of its
|
|
+ * contributors may be used to endorse or promote products derived from
|
|
+ * this software without specific prior written permission.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
|
|
+ * OWNER OR 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.
|
|
+ */
|
|
+
|
|
+#pragma once
|
|
+
|
|
+#include "config.h"
|
|
+
|
|
+#include <JavaScriptCore/InspectorAgentBase.h>
|
|
+#include <JavaScriptCore/InspectorBackendDispatchers.h>
|
|
+#include <wtf/Forward.h>
|
|
+#include <wtf/Noncopyable.h>
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+class BrowserInspectorTargetAgent final : public Inspector::InspectorAgentBase, public Inspector::TargetBackendDispatcherHandler {
|
|
+ WTF_MAKE_NONCOPYABLE(BrowserInspectorTargetAgent);
|
|
+ WTF_MAKE_FAST_ALLOCATED;
|
|
+public:
|
|
+ explicit BrowserInspectorTargetAgent(Inspector::BackendDispatcher&);
|
|
+ ~BrowserInspectorTargetAgent() override;
|
|
+
|
|
+ // InspectorAgentBase
|
|
+ void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) override;
|
|
+ void willDestroyFrontendAndBackend(Inspector::DisconnectReason) override;
|
|
+
|
|
+ // TargetBackendDispatcherHandler
|
|
+ void sendMessageToTarget(Inspector::ErrorString&, const String& targetId, const String& message) final;
|
|
+ void activate(Inspector::ErrorString&, const String& targetId) override;
|
|
+ void close(Inspector::ErrorString&, const String& targetId) override;
|
|
+
|
|
+private:
|
|
+ Ref<Inspector::TargetBackendDispatcher> m_backendDispatcher;
|
|
+};
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.h b/Source/WebKit/UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.h
|
|
index b6694fe906e..4df2ca7d9cc 100644
|
|
--- a/Source/WebKit/UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.h
|
|
+++ b/Source/WebKit/UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.h
|
|
@@ -27,6 +27,8 @@
|
|
|
|
#if HAVE(APP_SSO)
|
|
|
|
+#include <wtf/Forward.h>
|
|
+#include <wtf/CompletionHandler.h>
|
|
#include "SOAuthorizationSession.h"
|
|
|
|
OBJC_CLASS WKSOSecretDelegate;
|
|
@@ -38,6 +40,8 @@ class NavigationAction;
|
|
|
|
namespace WebKit {
|
|
|
|
+class WebPageProxy;
|
|
+
|
|
// FSM: Idle => Active => Completed
|
|
class PopUpSOAuthorizationSession final : public SOAuthorizationSession {
|
|
public:
|
|
diff --git a/Source/WebKit/UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.mm b/Source/WebKit/UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.mm
|
|
index 076cfaa676a..bd20a2b95f9 100644
|
|
--- a/Source/WebKit/UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.mm
|
|
+++ b/Source/WebKit/UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.mm
|
|
@@ -29,6 +29,7 @@
|
|
#if HAVE(APP_SSO)
|
|
|
|
#import "APINavigationAction.h"
|
|
+#import "WebPageProxy.h"
|
|
#import "WKNavigationDelegatePrivate.h"
|
|
#import "WKUIDelegate.h"
|
|
#import "WKWebViewConfigurationPrivate.h"
|
|
diff --git a/Source/WebKit/UIProcess/InspectorBrowserAgent.cpp b/Source/WebKit/UIProcess/InspectorBrowserAgent.cpp
|
|
new file mode 100644
|
|
index 00000000000..5967318c785
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/InspectorBrowserAgent.cpp
|
|
@@ -0,0 +1,101 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions are
|
|
+ * met:
|
|
+ *
|
|
+ * * Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * * 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.
|
|
+ * * Neither the name of Microsoft Corporation nor the names of its
|
|
+ * contributors may be used to endorse or promote products derived from
|
|
+ * this software without specific prior written permission.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
|
|
+ * OWNER OR 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.
|
|
+ */
|
|
+
|
|
+#include "config.h"
|
|
+#include "InspectorBrowserAgent.h"
|
|
+
|
|
+#if ENABLE(REMOTE_INSPECTOR)
|
|
+
|
|
+#include "InspectorBrowserAgentClient.h"
|
|
+#include "WebPageInspectorTarget.h"
|
|
+#include "WebPageProxy.h"
|
|
+#include <JavaScriptCore/InspectorFrontendRouter.h>
|
|
+#include <pal/SessionID.h>
|
|
+#include <wtf/HexNumber.h>
|
|
+
|
|
+using namespace Inspector;
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+InspectorBrowserAgent::InspectorBrowserAgent(Inspector::BackendDispatcher& backendDispatcher, InspectorBrowserAgentClient* client)
|
|
+ : InspectorAgentBase("Browser"_s)
|
|
+ , m_backendDispatcher(BrowserBackendDispatcher::create(backendDispatcher, this))
|
|
+ , m_client(client)
|
|
+{
|
|
+}
|
|
+
|
|
+InspectorBrowserAgent::~InspectorBrowserAgent() = default;
|
|
+
|
|
+void InspectorBrowserAgent::didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*)
|
|
+{
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgent::willDestroyFrontendAndBackend(DisconnectReason)
|
|
+{
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgent::close(ErrorString& error)
|
|
+{
|
|
+ if (m_client == nullptr) {
|
|
+ error = "no platform delegate to close browser";
|
|
+ } else {
|
|
+ m_client->closeAllWindows();
|
|
+ }
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgent::createContext(ErrorString& error, String* browserContextID)
|
|
+{
|
|
+ m_client->createBrowserContext(error, browserContextID);
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgent::deleteContext(ErrorString& error, const String& browserContextID)
|
|
+{
|
|
+ m_client->deleteBrowserContext(error, browserContextID);
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgent::createPage(ErrorString& error, const String* browserContextID, String* targetID)
|
|
+{
|
|
+ RefPtr<WebPageProxy> page = m_client->createPage(error, browserContextID);
|
|
+ if (page == nullptr)
|
|
+ return;
|
|
+
|
|
+ *targetID = WebPageInspectorTarget::toTargetID(page->webPageID());
|
|
+}
|
|
+
|
|
+String InspectorBrowserAgent::toBrowserContextIDProtocolString(const PAL::SessionID& sessionID)
|
|
+{
|
|
+ StringBuilder builder;
|
|
+ appendUnsignedAsHexFixedSize(sessionID.toUInt64(), builder, 16);
|
|
+ return builder.toString();
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
+
|
|
+#endif // ENABLE(REMOTE_INSPECTOR)
|
|
diff --git a/Source/WebKit/UIProcess/InspectorBrowserAgent.h b/Source/WebKit/UIProcess/InspectorBrowserAgent.h
|
|
new file mode 100644
|
|
index 00000000000..f24c655ab39
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/InspectorBrowserAgent.h
|
|
@@ -0,0 +1,81 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions are
|
|
+ * met:
|
|
+ *
|
|
+ * * Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * * 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.
|
|
+ * * Neither the name of Microsoft Corporation nor the names of its
|
|
+ * contributors may be used to endorse or promote products derived from
|
|
+ * this software without specific prior written permission.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
|
|
+ * OWNER OR 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.
|
|
+ */
|
|
+
|
|
+#pragma once
|
|
+
|
|
+#if ENABLE(REMOTE_INSPECTOR)
|
|
+
|
|
+#include <JavaScriptCore/InspectorAgentBase.h>
|
|
+#include <JavaScriptCore/InspectorBackendDispatchers.h>
|
|
+#include <wtf/Forward.h>
|
|
+#include <wtf/Noncopyable.h>
|
|
+
|
|
+namespace Inspector {
|
|
+class BackendDispatcher;
|
|
+class FrontendChannel;
|
|
+class FrontendRouter;
|
|
+}
|
|
+
|
|
+namespace PAL {
|
|
+class SessionID;
|
|
+}
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+class InspectorBrowserAgentClient;
|
|
+class WebPageInspectorController;
|
|
+
|
|
+class InspectorBrowserAgent final : public Inspector::InspectorAgentBase, public Inspector::BrowserBackendDispatcherHandler {
|
|
+ WTF_MAKE_NONCOPYABLE(InspectorBrowserAgent);
|
|
+ WTF_MAKE_FAST_ALLOCATED;
|
|
+public:
|
|
+ InspectorBrowserAgent(Inspector::BackendDispatcher&, InspectorBrowserAgentClient*);
|
|
+ ~InspectorBrowserAgent() override;
|
|
+
|
|
+ // InspectorAgentBase
|
|
+ void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) override;
|
|
+ void willDestroyFrontendAndBackend(Inspector::DisconnectReason) override;
|
|
+
|
|
+ // BrowserBackendDispatcherHandler
|
|
+ void close(Inspector::ErrorString&) override;
|
|
+ void createContext(Inspector::ErrorString&, String* browserContextID) override;
|
|
+ void deleteContext(Inspector::ErrorString&, const String& browserContextID) override;
|
|
+ void createPage(Inspector::ErrorString&, const String* browserContextID, String* targetId) override;
|
|
+
|
|
+ static String toBrowserContextIDProtocolString(const PAL::SessionID&);
|
|
+
|
|
+private:
|
|
+ Ref<Inspector::BrowserBackendDispatcher> m_backendDispatcher;
|
|
+ InspectorBrowserAgentClient* m_client;
|
|
+};
|
|
+
|
|
+} // namespace WebKit
|
|
+
|
|
+#endif // ENABLE(REMOTE_INSPECTOR)
|
|
diff --git a/Source/WebKit/UIProcess/InspectorBrowserAgentClient.h b/Source/WebKit/UIProcess/InspectorBrowserAgentClient.h
|
|
new file mode 100644
|
|
index 00000000000..f05cd030bac
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/InspectorBrowserAgentClient.h
|
|
@@ -0,0 +1,52 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions are
|
|
+ * met:
|
|
+ *
|
|
+ * * Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * * 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.
|
|
+ * * Neither the name of Microsoft Corporation nor the names of its
|
|
+ * contributors may be used to endorse or promote products derived from
|
|
+ * this software without specific prior written permission.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
|
|
+ * OWNER OR 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.
|
|
+ */
|
|
+
|
|
+#pragma once
|
|
+
|
|
+#if ENABLE(REMOTE_INSPECTOR)
|
|
+
|
|
+#include <wtf/Forward.h>
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+class WebPageProxy;
|
|
+
|
|
+class InspectorBrowserAgentClient {
|
|
+public:
|
|
+ virtual ~InspectorBrowserAgentClient() = default;
|
|
+ virtual RefPtr<WebKit::WebPageProxy> createPage(WTF::String& error, const WTF::String* browserContextID) = 0;
|
|
+ virtual void closeAllWindows() = 0;
|
|
+ virtual void createBrowserContext(WTF::String& error, WTF::String* browserContextID) = 0;
|
|
+ virtual void deleteBrowserContext(WTF::String& error, const WTF::String& browserContextID) = 0;
|
|
+};
|
|
+
|
|
+} // namespace WebKit
|
|
+
|
|
+#endif // ENABLE(REMOTE_INSPECTOR)
|
|
diff --git a/Source/WebKit/UIProcess/InspectorTargetProxy.cpp b/Source/WebKit/UIProcess/InspectorTargetProxy.cpp
|
|
index 1b37c1ed439..c45d45de342 100644
|
|
--- a/Source/WebKit/UIProcess/InspectorTargetProxy.cpp
|
|
+++ b/Source/WebKit/UIProcess/InspectorTargetProxy.cpp
|
|
@@ -32,6 +32,8 @@
|
|
#include "WebPageMessages.h"
|
|
#include "WebPageProxy.h"
|
|
#include "WebProcessProxy.h"
|
|
+#include "ProvisionalPageProxy.h"
|
|
+
|
|
|
|
namespace WebKit {
|
|
|
|
@@ -39,23 +41,29 @@ using namespace Inspector;
|
|
|
|
std::unique_ptr<InspectorTargetProxy> InspectorTargetProxy::create(WebPageProxy& page, const String& targetId, Inspector::InspectorTargetType type)
|
|
{
|
|
- return makeUnique<InspectorTargetProxy>(page, targetId, type);
|
|
+ return makeUnique<InspectorTargetProxy>(page, nullptr, targetId, type);
|
|
}
|
|
|
|
std::unique_ptr<InspectorTargetProxy> InspectorTargetProxy::create(ProvisionalPageProxy& provisionalPage, const String& targetId, Inspector::InspectorTargetType type)
|
|
{
|
|
- auto target = InspectorTargetProxy::create(provisionalPage.page(), targetId, type);
|
|
- target->m_provisionalPage = makeWeakPtr(provisionalPage);
|
|
- return target;
|
|
+ return makeUnique<InspectorTargetProxy>(provisionalPage.page(), &provisionalPage, targetId, type);
|
|
}
|
|
|
|
-InspectorTargetProxy::InspectorTargetProxy(WebPageProxy& page, const String& targetId, Inspector::InspectorTargetType type)
|
|
+InspectorTargetProxy::InspectorTargetProxy(WebPageProxy& page, ProvisionalPageProxy* provisionalPage, const String& targetId, Inspector::InspectorTargetType type)
|
|
: m_page(page)
|
|
+ , m_provisionalPage(makeWeakPtr(provisionalPage))
|
|
, m_identifier(targetId)
|
|
, m_type(type)
|
|
{
|
|
}
|
|
|
|
+String InspectorTargetProxy::url() const
|
|
+{
|
|
+ if (m_page.provisionalPageProxy())
|
|
+ return m_page.provisionalPageProxy()->provisionalURL().string();
|
|
+ return m_page.pageLoadState().activeURL();
|
|
+}
|
|
+
|
|
void InspectorTargetProxy::connect(Inspector::FrontendChannel::ConnectionType connectionType)
|
|
{
|
|
if (m_provisionalPage) {
|
|
diff --git a/Source/WebKit/UIProcess/InspectorTargetProxy.h b/Source/WebKit/UIProcess/InspectorTargetProxy.h
|
|
index a2239cec8e1..43415afbc77 100644
|
|
--- a/Source/WebKit/UIProcess/InspectorTargetProxy.h
|
|
+++ b/Source/WebKit/UIProcess/InspectorTargetProxy.h
|
|
@@ -37,17 +37,18 @@ class WebPageProxy;
|
|
// NOTE: This UIProcess side InspectorTarget doesn't care about the frontend channel, since
|
|
// any target -> frontend messages will be routed to the WebPageProxy with a targetId.
|
|
|
|
-class InspectorTargetProxy final : public Inspector::InspectorTarget {
|
|
+class InspectorTargetProxy : public Inspector::InspectorTarget {
|
|
WTF_MAKE_FAST_ALLOCATED;
|
|
WTF_MAKE_NONCOPYABLE(InspectorTargetProxy);
|
|
public:
|
|
static std::unique_ptr<InspectorTargetProxy> create(WebPageProxy&, const String& targetId, Inspector::InspectorTargetType);
|
|
static std::unique_ptr<InspectorTargetProxy> create(ProvisionalPageProxy&, const String& targetId, Inspector::InspectorTargetType);
|
|
- InspectorTargetProxy(WebPageProxy&, const String& targetId, Inspector::InspectorTargetType);
|
|
+ InspectorTargetProxy(WebPageProxy&, ProvisionalPageProxy*, const String& targetId, Inspector::InspectorTargetType);
|
|
~InspectorTargetProxy() = default;
|
|
|
|
Inspector::InspectorTargetType type() const final { return m_type; }
|
|
String identifier() const final { return m_identifier; }
|
|
+ String url() const final;
|
|
|
|
void didCommitProvisionalTarget();
|
|
bool isProvisional() const override;
|
|
@@ -56,11 +57,13 @@ public:
|
|
void disconnect() override;
|
|
void sendMessageToTargetBackend(const String&) override;
|
|
|
|
-private:
|
|
+protected:
|
|
WebPageProxy& m_page;
|
|
+
|
|
+private:
|
|
+ WeakPtr<ProvisionalPageProxy> m_provisionalPage;
|
|
String m_identifier;
|
|
Inspector::InspectorTargetType m_type;
|
|
- WeakPtr<ProvisionalPageProxy> m_provisionalPage;
|
|
};
|
|
|
|
} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/RemoteInspectorPipe.cpp b/Source/WebKit/UIProcess/RemoteInspectorPipe.cpp
|
|
new file mode 100644
|
|
index 00000000000..87b426e9fff
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/RemoteInspectorPipe.cpp
|
|
@@ -0,0 +1,159 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions are
|
|
+ * met:
|
|
+ *
|
|
+ * * Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * * 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.
|
|
+ * * Neither the name of Microsoft Corporation nor the names of its
|
|
+ * contributors may be used to endorse or promote products derived from
|
|
+ * this software without specific prior written permission.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
|
|
+ * OWNER OR 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.
|
|
+ */
|
|
+
|
|
+#include "config.h"
|
|
+#include "RemoteInspectorPipe.h"
|
|
+
|
|
+#if ENABLE(REMOTE_INSPECTOR)
|
|
+
|
|
+#include "BrowserInspectorController.h"
|
|
+#include <JavaScriptCore/InspectorFrontendChannel.h>
|
|
+#include <wtf/MainThread.h>
|
|
+#include <wtf/RunLoop.h>
|
|
+#include <wtf/UniqueArray.h>
|
|
+#include <wtf/Vector.h>
|
|
+#include <wtf/WorkQueue.h>
|
|
+
|
|
+#if OS(UNIX)
|
|
+#include <stdio.h>
|
|
+#include <unistd.h>
|
|
+#endif
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+static const int readFD = 3;
|
|
+static const int writeFD = 4;
|
|
+
|
|
+class RemoteInspectorPipe::RemoteFrontendChannel : public Inspector::FrontendChannel {
|
|
+ WTF_MAKE_FAST_ALLOCATED;
|
|
+public:
|
|
+ RemoteFrontendChannel()
|
|
+ : m_senderQueue(WorkQueue::create("Inspector pipe writer"))
|
|
+ {
|
|
+ }
|
|
+
|
|
+ ~RemoteFrontendChannel() override = default;
|
|
+
|
|
+ ConnectionType connectionType() const override
|
|
+ {
|
|
+ return ConnectionType::Remote;
|
|
+ }
|
|
+
|
|
+ void sendMessageToFrontend(const String& message) override
|
|
+ {
|
|
+ m_senderQueue->dispatch([message = message.isolatedCopy()]() {
|
|
+ dprintf(writeFD, "%s%c", message.ascii().data(), '\0');
|
|
+ });
|
|
+ }
|
|
+
|
|
+private:
|
|
+ Ref<WorkQueue> m_senderQueue;
|
|
+};
|
|
+
|
|
+RemoteInspectorPipe::RemoteInspectorPipe(BrowserInspectorController& browserInspectorController)
|
|
+ : m_remoteFrontendChannel(makeUnique<RemoteFrontendChannel>())
|
|
+ , m_browserInspectorController(browserInspectorController)
|
|
+{
|
|
+ start();
|
|
+}
|
|
+
|
|
+RemoteInspectorPipe::~RemoteInspectorPipe()
|
|
+{
|
|
+ stop();
|
|
+}
|
|
+
|
|
+bool RemoteInspectorPipe::start()
|
|
+{
|
|
+ if (m_receiverThread)
|
|
+ return true;
|
|
+
|
|
+ m_browserInspectorController.connectFrontend(*m_remoteFrontendChannel);
|
|
+ m_terminated = false;
|
|
+ m_receiverThread = Thread::create("Inspector pipe reader", [this] {
|
|
+ workerRun();
|
|
+ });
|
|
+ return true;
|
|
+}
|
|
+
|
|
+void RemoteInspectorPipe::stop()
|
|
+{
|
|
+ if (!m_receiverThread)
|
|
+ return;
|
|
+
|
|
+ m_browserInspectorController.disconnectFrontend();
|
|
+
|
|
+ m_terminated = true;
|
|
+ m_receiverThread->waitForCompletion();
|
|
+ m_receiverThread = nullptr;
|
|
+}
|
|
+
|
|
+void RemoteInspectorPipe::workerRun()
|
|
+{
|
|
+ const size_t bufSize = 256 * 1024;
|
|
+ auto buffer = makeUniqueArray<char>(bufSize);
|
|
+ Vector<char> line;
|
|
+ while (!m_terminated) {
|
|
+ ssize_t size = read(readFD, buffer.get(), bufSize);
|
|
+ if (size == 0) {
|
|
+ break;
|
|
+ }
|
|
+ if (size < 0) {
|
|
+ break;
|
|
+ }
|
|
+ size_t start = 0;
|
|
+ size_t end = line.size();
|
|
+ line.append(buffer.get(), size);
|
|
+ while (true) {
|
|
+ for (; end < line.size(); ++end) {
|
|
+ if (line[end] == '\0')
|
|
+ break;
|
|
+ }
|
|
+ if (end == line.size())
|
|
+ break;
|
|
+
|
|
+ if (end > start) {
|
|
+ String message = String::fromUTF8(line.data() + start, end - start);
|
|
+ RunLoop::main().dispatch([this, message] {
|
|
+ if (!m_terminated)
|
|
+ m_browserInspectorController.dispatchMessageFromFrontend(message);
|
|
+ });
|
|
+ }
|
|
+ ++end;
|
|
+ start = end;
|
|
+ }
|
|
+ if (start != 0 && start < line.size())
|
|
+ memmove(line.data(), line.data() + start, line.size() - start);
|
|
+ line.shrink(line.size() - start);
|
|
+ }
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
+
|
|
+#endif // ENABLE(REMOTE_INSPECTOR)
|
|
diff --git a/Source/WebKit/UIProcess/RemoteInspectorPipe.h b/Source/WebKit/UIProcess/RemoteInspectorPipe.h
|
|
new file mode 100644
|
|
index 00000000000..37b0622557c
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/RemoteInspectorPipe.h
|
|
@@ -0,0 +1,70 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions are
|
|
+ * met:
|
|
+ *
|
|
+ * * Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * * 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.
|
|
+ * * Neither the name of Microsoft Corporation nor the names of its
|
|
+ * contributors may be used to endorse or promote products derived from
|
|
+ * this software without specific prior written permission.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
|
|
+ * OWNER OR 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.
|
|
+ */
|
|
+
|
|
+#pragma once
|
|
+
|
|
+#if ENABLE(REMOTE_INSPECTOR)
|
|
+
|
|
+#include <wtf/Ref.h>
|
|
+#include <wtf/RefPtr.h>
|
|
+#include <wtf/Threading.h>
|
|
+
|
|
+namespace Inspector {
|
|
+class FrontendChannel;
|
|
+}
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+class BrowserInspectorController;
|
|
+
|
|
+class RemoteInspectorPipe {
|
|
+ WTF_MAKE_NONCOPYABLE(RemoteInspectorPipe);
|
|
+ WTF_MAKE_FAST_ALLOCATED;
|
|
+public:
|
|
+ explicit RemoteInspectorPipe(BrowserInspectorController&);
|
|
+ ~RemoteInspectorPipe();
|
|
+
|
|
+private:
|
|
+ class RemoteFrontendChannel;
|
|
+
|
|
+ bool start();
|
|
+ void stop();
|
|
+
|
|
+ void workerRun();
|
|
+
|
|
+ RefPtr<Thread> m_receiverThread;
|
|
+ std::atomic<bool> m_terminated { false };
|
|
+ std::unique_ptr<Inspector::FrontendChannel> m_remoteFrontendChannel;
|
|
+ BrowserInspectorController& m_browserInspectorController;
|
|
+};
|
|
+
|
|
+} // namespace WebKit
|
|
+
|
|
+#endif // ENABLE(REMOTE_INSPECTOR)
|
|
diff --git a/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp b/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp
|
|
index cce83796f13..eb019b70e0b 100644
|
|
--- a/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp
|
|
+++ b/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp
|
|
@@ -35,6 +35,7 @@
|
|
#include "NfcService.h"
|
|
#include "WebPageProxy.h"
|
|
#include "WebPreferencesKeys.h"
|
|
+#include "WebProcessProxy.h"
|
|
#include <WebCore/AuthenticatorTransport.h>
|
|
#include <WebCore/PublicKeyCredentialCreationOptions.h>
|
|
#include <WebCore/WebAuthenticationConstants.h>
|
|
diff --git a/Source/WebKit/UIProcess/WebPageInspectorController.cpp b/Source/WebKit/UIProcess/WebPageInspectorController.cpp
|
|
index b9a9469ab59..81129896554 100644
|
|
--- a/Source/WebKit/UIProcess/WebPageInspectorController.cpp
|
|
+++ b/Source/WebKit/UIProcess/WebPageInspectorController.cpp
|
|
@@ -26,9 +26,11 @@
|
|
#include "config.h"
|
|
#include "WebPageInspectorController.h"
|
|
|
|
+#include "InspectorBrowserAgent.h"
|
|
#include "ProvisionalPageProxy.h"
|
|
#include "WebFrameProxy.h"
|
|
#include "WebPageInspectorTarget.h"
|
|
+#include "WebPageInspectorTargetProxy.h"
|
|
#include "WebPageProxy.h"
|
|
#include <JavaScriptCore/InspectorAgentBase.h>
|
|
#include <JavaScriptCore/InspectorBackendDispatcher.h>
|
|
@@ -46,26 +48,59 @@ static String getTargetID(const ProvisionalPageProxy& provisionalPage)
|
|
return WebPageInspectorTarget::toTargetID(provisionalPage.webPageID());
|
|
}
|
|
|
|
+static WebPageInspectorController::CreationListener& creationListener() {
|
|
+ static NeverDestroyed<WebPageInspectorController::CreationListener> listener;
|
|
+ return listener;
|
|
+}
|
|
+
|
|
+void WebPageInspectorController::setCreationListener(CreationListener listener)
|
|
+{
|
|
+ creationListener() = listener;
|
|
+}
|
|
+
|
|
WebPageInspectorController::WebPageInspectorController(WebPageProxy& page)
|
|
: m_page(page)
|
|
, m_frontendRouter(FrontendRouter::create())
|
|
, m_backendDispatcher(BackendDispatcher::create(m_frontendRouter.copyRef()))
|
|
{
|
|
- auto targetAgent = makeUnique<InspectorTargetAgent>(m_frontendRouter.get(), m_backendDispatcher.get());
|
|
+ String browserContextID;
|
|
+#if ENABLE(REMOTE_INSPECTOR)
|
|
+ browserContextID = InspectorBrowserAgent::toBrowserContextIDProtocolString(page.sessionID());
|
|
+#endif
|
|
+ auto targetAgent = makeUnique<InspectorTargetAgent>(m_frontendRouter.get(), m_backendDispatcher.get(), browserContextID);
|
|
|
|
m_targetAgent = targetAgent.get();
|
|
|
|
m_agents.append(WTFMove(targetAgent));
|
|
+
|
|
+ if (creationListener())
|
|
+ creationListener()(*this);
|
|
}
|
|
|
|
void WebPageInspectorController::init()
|
|
{
|
|
+ // window.open will create page with already running process.
|
|
+ if (!m_page.hasRunningProcess())
|
|
+ return;
|
|
String pageTargetId = WebPageInspectorTarget::toTargetID(m_page.webPageID());
|
|
createInspectorTarget(pageTargetId, Inspector::InspectorTargetType::Page);
|
|
}
|
|
|
|
+void WebPageInspectorController::didFinishAttachingToWebProcess()
|
|
+{
|
|
+ String pageTargetID = WebPageInspectorTarget::toTargetID(m_page.webPageID());
|
|
+ // Create target only after attaching to a Web Process first time. Before that
|
|
+ // we cannot event establish frontend connection.
|
|
+ if (m_targets.contains(pageTargetID))
|
|
+ return;
|
|
+ createInspectorTarget(pageTargetID, Inspector::InspectorTargetType::Page);
|
|
+}
|
|
+
|
|
void WebPageInspectorController::pageClosed()
|
|
{
|
|
+ String pageTargetId = WebPageInspectorTarget::toTargetID(m_page.webPageID());
|
|
+ destroyInspectorTarget(pageTargetId);
|
|
+
|
|
disconnectAllFrontends();
|
|
|
|
m_agents.discardValues();
|
|
@@ -134,6 +169,16 @@ void WebPageInspectorController::dispatchMessageFromFrontend(const String& messa
|
|
m_backendDispatcher->dispatch(message);
|
|
}
|
|
|
|
+bool WebPageInspectorController::dispatchMessageToTargetBackend(const String& message)
|
|
+{
|
|
+ return m_backendDispatcher->dispatch(message, BackendDispatcher::Mode::ContinueIfDomainIsMissing) == BackendDispatcher::DispatchResult::Finished;
|
|
+}
|
|
+
|
|
+Inspector::InspectorTarget* WebPageInspectorController::findTarget(const String& targetId)
|
|
+{
|
|
+ return m_targets.get(targetId);
|
|
+}
|
|
+
|
|
#if ENABLE(REMOTE_INSPECTOR)
|
|
void WebPageInspectorController::setIndicating(bool indicating)
|
|
{
|
|
@@ -150,7 +195,12 @@ void WebPageInspectorController::setIndicating(bool indicating)
|
|
|
|
void WebPageInspectorController::createInspectorTarget(const String& targetId, Inspector::InspectorTargetType type)
|
|
{
|
|
- addTarget(InspectorTargetProxy::create(m_page, targetId, type));
|
|
+ std::unique_ptr<InspectorTargetProxy> target;
|
|
+ if (type == Inspector::InspectorTargetType::Page)
|
|
+ target = WebPageInspectorTargetProxy::create(m_page, *m_targetAgent, targetId);
|
|
+ else
|
|
+ target = InspectorTargetProxy::create(m_page, targetId, type);
|
|
+ addTarget(WTFMove(target));
|
|
}
|
|
|
|
void WebPageInspectorController::destroyInspectorTarget(const String& targetId)
|
|
@@ -169,7 +219,7 @@ void WebPageInspectorController::sendMessageToInspectorFrontend(const String& ta
|
|
|
|
void WebPageInspectorController::didCreateProvisionalPage(ProvisionalPageProxy& provisionalPage)
|
|
{
|
|
- addTarget(InspectorTargetProxy::create(provisionalPage, getTargetID(provisionalPage), Inspector::InspectorTargetType::Page));
|
|
+ addTarget(WebPageInspectorTargetProxy::create(provisionalPage, *m_targetAgent, getTargetID(provisionalPage)));
|
|
}
|
|
|
|
void WebPageInspectorController::willDestroyProvisionalPage(const ProvisionalPageProxy& provisionalPage)
|
|
diff --git a/Source/WebKit/UIProcess/WebPageInspectorController.h b/Source/WebKit/UIProcess/WebPageInspectorController.h
|
|
index 828bc3ccc7e..40a333b7004 100644
|
|
--- a/Source/WebKit/UIProcess/WebPageInspectorController.h
|
|
+++ b/Source/WebKit/UIProcess/WebPageInspectorController.h
|
|
@@ -48,7 +48,13 @@ public:
|
|
WebPageInspectorController(WebPageProxy&);
|
|
|
|
void init();
|
|
+ void didFinishAttachingToWebProcess();
|
|
+
|
|
+ using CreationListener = std::function<void(WebPageInspectorController&)>;
|
|
+ static void setCreationListener(CreationListener);
|
|
+
|
|
void pageClosed();
|
|
+ void didProcessAllPendingKeyboardEvents();
|
|
|
|
bool hasLocalFrontend() const;
|
|
|
|
@@ -57,6 +63,8 @@ public:
|
|
void disconnectAllFrontends();
|
|
|
|
void dispatchMessageFromFrontend(const String& message);
|
|
+ Inspector::InspectorTarget* findTarget(const String& targetId);
|
|
+ bool dispatchMessageToTargetBackend(const String&);
|
|
|
|
#if ENABLE(REMOTE_INSPECTOR)
|
|
void setIndicating(bool);
|
|
diff --git a/Source/WebKit/UIProcess/WebPageInspectorEmulationAgent.cpp b/Source/WebKit/UIProcess/WebPageInspectorEmulationAgent.cpp
|
|
new file mode 100644
|
|
index 00000000000..415f36c5647
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/WebPageInspectorEmulationAgent.cpp
|
|
@@ -0,0 +1,61 @@
|
|
+/*
|
|
+ * Copyright (C) 2018 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. ``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
|
|
+ * 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.
|
|
+ */
|
|
+
|
|
+#include "config.h"
|
|
+#include "WebPageInspectorEmulationAgent.h"
|
|
+
|
|
+#include "WebPageProxy.h"
|
|
+#include <JavaScriptCore/InspectorFrontendRouter.h>
|
|
+
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+using namespace Inspector;
|
|
+
|
|
+WebPageInspectorEmulationAgent::WebPageInspectorEmulationAgent(BackendDispatcher& backendDispatcher, WebPageProxy& page)
|
|
+ : InspectorAgentBase("Emulation"_s)
|
|
+ , m_backendDispatcher(EmulationBackendDispatcher::create(backendDispatcher, this))
|
|
+ , m_page(page)
|
|
+{
|
|
+}
|
|
+
|
|
+WebPageInspectorEmulationAgent::~WebPageInspectorEmulationAgent()
|
|
+{
|
|
+}
|
|
+
|
|
+void WebPageInspectorEmulationAgent::didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*)
|
|
+{
|
|
+}
|
|
+
|
|
+void WebPageInspectorEmulationAgent::willDestroyFrontendAndBackend(DisconnectReason)
|
|
+{
|
|
+}
|
|
+
|
|
+void WebPageInspectorEmulationAgent::setDeviceMetricsOverride(ErrorString& error, int in_width, int in_height)
|
|
+{
|
|
+ platformSetSize(error, in_width, in_height);
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/WebPageInspectorEmulationAgent.h b/Source/WebKit/UIProcess/WebPageInspectorEmulationAgent.h
|
|
new file mode 100644
|
|
index 00000000000..2f9b7807e23
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/WebPageInspectorEmulationAgent.h
|
|
@@ -0,0 +1,63 @@
|
|
+/*
|
|
+ * Copyright (C) 2018 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. ``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
|
|
+ * 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.
|
|
+ */
|
|
+
|
|
+#pragma once
|
|
+
|
|
+#include <JavaScriptCore/InspectorAgentBase.h>
|
|
+#include <JavaScriptCore/InspectorBackendDispatchers.h>
|
|
+
|
|
+#include <wtf/Forward.h>
|
|
+#include <wtf/Noncopyable.h>
|
|
+
|
|
+namespace Inspector {
|
|
+class BackendDispatcher;
|
|
+class FrontendChannel;
|
|
+class FrontendRouter;
|
|
+}
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+class WebPageProxy;
|
|
+
|
|
+class WebPageInspectorEmulationAgent : public Inspector::InspectorAgentBase, public Inspector::EmulationBackendDispatcherHandler {
|
|
+ WTF_MAKE_NONCOPYABLE(WebPageInspectorEmulationAgent);
|
|
+ WTF_MAKE_FAST_ALLOCATED;
|
|
+public:
|
|
+ WebPageInspectorEmulationAgent(Inspector::BackendDispatcher& backendDispatcher, WebPageProxy& page);
|
|
+ ~WebPageInspectorEmulationAgent() override;
|
|
+
|
|
+ void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) override;
|
|
+ void willDestroyFrontendAndBackend(Inspector::DisconnectReason) override;
|
|
+
|
|
+ void setDeviceMetricsOverride(Inspector::ErrorString&, int in_width, int in_height) override;
|
|
+
|
|
+private:
|
|
+ void platformSetSize(String& error, int width, int height);
|
|
+
|
|
+ Ref<Inspector::EmulationBackendDispatcher> m_backendDispatcher;
|
|
+ WebPageProxy& m_page;
|
|
+};
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/WebPageInspectorInputAgent.cpp b/Source/WebKit/UIProcess/WebPageInspectorInputAgent.cpp
|
|
new file mode 100644
|
|
index 00000000000..16a05604460
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/WebPageInspectorInputAgent.cpp
|
|
@@ -0,0 +1,257 @@
|
|
+/*
|
|
+ * Copyright (C) 2018 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. ``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
|
|
+ * 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.
|
|
+ */
|
|
+
|
|
+#include "config.h"
|
|
+#include "WebPageInspectorInputAgent.h"
|
|
+
|
|
+#include "APINavigation.h"
|
|
+#include "NativeWebKeyboardEvent.h"
|
|
+#include "NativeWebMouseEvent.h"
|
|
+#include "WebPageProxy.h"
|
|
+#include <JavaScriptCore/InspectorFrontendRouter.h>
|
|
+
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+using namespace Inspector;
|
|
+
|
|
+namespace {
|
|
+
|
|
+template<class T>
|
|
+class CallbackList {
|
|
+ WTF_MAKE_FAST_ALLOCATED;
|
|
+public:
|
|
+ ~CallbackList()
|
|
+ {
|
|
+ for (const auto& callback : m_callbacks)
|
|
+ callback->sendFailure("Page closed");
|
|
+ }
|
|
+
|
|
+ void append(Ref<T>&& callback)
|
|
+ {
|
|
+ m_callbacks.append(WTFMove(callback));
|
|
+ }
|
|
+
|
|
+ void sendSuccess()
|
|
+ {
|
|
+ for (const auto& callback : m_callbacks)
|
|
+ callback->sendSuccess();
|
|
+ m_callbacks.clear();
|
|
+ }
|
|
+
|
|
+private:
|
|
+ Vector<Ref<T>> m_callbacks;
|
|
+};
|
|
+
|
|
+} // namespace
|
|
+
|
|
+class WebPageInspectorInputAgent::InspectorInputObserver : public WebPageProxy::InputProcessingObserver {
|
|
+ WTF_MAKE_FAST_ALLOCATED;
|
|
+public:
|
|
+ using KeyboardCallback = Inspector::InputBackendDispatcherHandler::DispatchKeyEventCallback;
|
|
+ using MouseCallback = Inspector::InputBackendDispatcherHandler::DispatchMouseEventCallback;
|
|
+
|
|
+ ~InspectorInputObserver() override = default;
|
|
+
|
|
+ void didProcessAllPendingKeyboardEvents() override
|
|
+ {
|
|
+ m_keyboardCallbacks.sendSuccess();
|
|
+ }
|
|
+
|
|
+ void didProcessAllPendingMouseEvents() override
|
|
+ {
|
|
+ m_mouseCallbacks.sendSuccess();
|
|
+ }
|
|
+
|
|
+ void addMouseCallback(Ref<MouseCallback>&& callback)
|
|
+ {
|
|
+ m_mouseCallbacks.append(WTFMove(callback));
|
|
+ }
|
|
+
|
|
+ void addKeyboardCallback(Ref<KeyboardCallback>&& callback)
|
|
+ {
|
|
+ m_keyboardCallbacks.append(WTFMove(callback));
|
|
+ }
|
|
+
|
|
+private:
|
|
+ CallbackList<KeyboardCallback> m_keyboardCallbacks;
|
|
+ CallbackList<MouseCallback> m_mouseCallbacks;
|
|
+};
|
|
+
|
|
+WebPageInspectorInputAgent::WebPageInspectorInputAgent(Inspector::BackendDispatcher& backendDispatcher, WebPageProxy& page)
|
|
+ : InspectorAgentBase("Input"_s)
|
|
+ , m_backendDispatcher(InputBackendDispatcher::create(backendDispatcher, this))
|
|
+ , m_page(page)
|
|
+ , m_inputObserver(makeUnique<InspectorInputObserver>())
|
|
+{
|
|
+ m_page.setObserber(m_inputObserver.get());
|
|
+}
|
|
+
|
|
+WebPageInspectorInputAgent::~WebPageInspectorInputAgent()
|
|
+{
|
|
+ m_page.setObserber(nullptr);
|
|
+}
|
|
+
|
|
+void WebPageInspectorInputAgent::didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*)
|
|
+{
|
|
+}
|
|
+
|
|
+void WebPageInspectorInputAgent::willDestroyFrontendAndBackend(Inspector::DisconnectReason)
|
|
+{
|
|
+}
|
|
+
|
|
+void WebPageInspectorInputAgent::dispatchKeyEvent(const String& in_type, const int* opt_in_modifiers, const String* opt_in_text, const String* opt_in_unmodifiedText, const String* opt_in_code, const String* opt_in_key, const int* opt_in_windowsVirtualKeyCode, const int* opt_in_nativeVirtualKeyCode, const bool* opt_in_autoRepeat, const bool* opt_in_isKeypad, const bool* opt_in_isSystemKey, Ref<Inspector::InputBackendDispatcherHandler::DispatchKeyEventCallback>&& callback)
|
|
+{
|
|
+ WebKit::WebEvent::Type type;
|
|
+ if (in_type == "keyDown") {
|
|
+ type = WebKit::WebEvent::KeyDown;
|
|
+ } else if (in_type == "keyUp") {
|
|
+ type = WebKit::WebEvent::KeyUp;
|
|
+ } else {
|
|
+ callback->sendFailure("Unsupported event type.");
|
|
+ return;
|
|
+ }
|
|
+ OptionSet<WebEvent::Modifier> modifiers;
|
|
+ if (opt_in_modifiers)
|
|
+ modifiers = modifiers.fromRaw(*opt_in_modifiers);
|
|
+ String text;
|
|
+ if (opt_in_text)
|
|
+ text = *opt_in_text;
|
|
+ String unmodifiedText;
|
|
+ if (opt_in_unmodifiedText)
|
|
+ unmodifiedText = *opt_in_unmodifiedText;
|
|
+ String code;
|
|
+ if (opt_in_code)
|
|
+ code = *opt_in_code;
|
|
+ String key;
|
|
+ if (opt_in_key)
|
|
+ key = *opt_in_key;
|
|
+ int windowsVirtualKeyCode = 0;
|
|
+ if (opt_in_windowsVirtualKeyCode)
|
|
+ windowsVirtualKeyCode = *opt_in_windowsVirtualKeyCode;
|
|
+ int nativeVirtualKeyCode = 0;
|
|
+ if (opt_in_nativeVirtualKeyCode)
|
|
+ nativeVirtualKeyCode = *opt_in_nativeVirtualKeyCode;
|
|
+ bool isAutoRepeat = false;
|
|
+ if (opt_in_autoRepeat)
|
|
+ isAutoRepeat = *opt_in_autoRepeat;
|
|
+ bool isKeypad = false;
|
|
+ if (opt_in_isKeypad)
|
|
+ isKeypad = *opt_in_isKeypad;
|
|
+ bool isSystemKey = false;
|
|
+ if (opt_in_isSystemKey)
|
|
+ isSystemKey = *opt_in_isSystemKey;
|
|
+ WallTime timestamp = WallTime::now();
|
|
+
|
|
+ m_inputObserver->addKeyboardCallback(WTFMove(callback));
|
|
+ platformDispatchKeyEvent(
|
|
+ type,
|
|
+ text,
|
|
+ unmodifiedText,
|
|
+ key,
|
|
+ code,
|
|
+ windowsVirtualKeyCode,
|
|
+ nativeVirtualKeyCode,
|
|
+ isAutoRepeat,
|
|
+ isKeypad,
|
|
+ isSystemKey,
|
|
+ modifiers,
|
|
+ timestamp);
|
|
+}
|
|
+
|
|
+void WebPageInspectorInputAgent::dispatchMouseEvent(const String& in_type, int in_x, int in_y, const int* opt_in_modifiers, const String* opt_in_button, const int* opt_in_buttons, const int* opt_in_clickCount, const int* opt_in_deltaX, const int* opt_in_deltaY, Ref<DispatchMouseEventCallback>&& callback)
|
|
+{
|
|
+ WebEvent::Type type = WebEvent::NoType;
|
|
+ if (in_type == "down")
|
|
+ type = WebEvent::MouseDown;
|
|
+ else if (in_type == "up")
|
|
+ type = WebEvent::MouseUp;
|
|
+ else if (in_type == "move")
|
|
+ type = WebEvent::MouseMove;
|
|
+ else {
|
|
+ callback->sendFailure("Unsupported event type");
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ OptionSet<WebEvent::Modifier> modifiers;
|
|
+ if (opt_in_modifiers)
|
|
+ modifiers = modifiers.fromRaw(*opt_in_modifiers);
|
|
+
|
|
+ WebMouseEvent::Button button = WebMouseEvent::NoButton;
|
|
+ if (opt_in_button) {
|
|
+ if (*opt_in_button == "left")
|
|
+ button = WebMouseEvent::LeftButton;
|
|
+ else if (*opt_in_button == "middle")
|
|
+ button = WebMouseEvent::MiddleButton;
|
|
+ else if (*opt_in_button == "right")
|
|
+ button = WebMouseEvent::RightButton;
|
|
+ else if (*opt_in_button == "none")
|
|
+ button = WebMouseEvent::NoButton;
|
|
+ else {
|
|
+ callback->sendFailure("Unsupported button");
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ unsigned short buttons = 0;
|
|
+ if (opt_in_buttons)
|
|
+ buttons = *opt_in_buttons;
|
|
+
|
|
+ int clickCount = 0;
|
|
+ if (opt_in_clickCount)
|
|
+ clickCount = *opt_in_clickCount;
|
|
+ int deltaX = 0;
|
|
+ if (opt_in_deltaX)
|
|
+ deltaX = *opt_in_deltaX;
|
|
+ int deltaY = 0;
|
|
+ if (opt_in_deltaY)
|
|
+ deltaY = *opt_in_deltaY;
|
|
+ m_inputObserver->addMouseCallback(WTFMove(callback));
|
|
+#if PLATFORM(WPE)
|
|
+ platformDispatchMouseEvent(type, in_x, in_y, button, modifiers);
|
|
+#elif PLATFORM(GTK)
|
|
+ WallTime timestamp = WallTime::now();
|
|
+ NativeWebMouseEvent event(
|
|
+ type,
|
|
+ button,
|
|
+ buttons,
|
|
+ {in_x, in_y},
|
|
+ WebCore::IntPoint(),
|
|
+ deltaX,
|
|
+ deltaY,
|
|
+ 0,
|
|
+ clickCount,
|
|
+ modifiers,
|
|
+ timestamp);
|
|
+ m_page.handleMouseEvent(event);
|
|
+#endif
|
|
+}
|
|
+
|
|
+void WebPageInspectorInputAgent::goBack(Inspector::ErrorString&)
|
|
+{
|
|
+ auto navigation = m_page.goBack();
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/WebPageInspectorInputAgent.h b/Source/WebKit/UIProcess/WebPageInspectorInputAgent.h
|
|
new file mode 100644
|
|
index 00000000000..9d51a913b23
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/WebPageInspectorInputAgent.h
|
|
@@ -0,0 +1,76 @@
|
|
+/*
|
|
+ * Copyright (C) 2018 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. ``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
|
|
+ * 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.
|
|
+ */
|
|
+
|
|
+#pragma once
|
|
+
|
|
+#include "WebEvent.h"
|
|
+
|
|
+#include <JavaScriptCore/InspectorAgentBase.h>
|
|
+#include <JavaScriptCore/InspectorBackendDispatchers.h>
|
|
+
|
|
+#include <wtf/Forward.h>
|
|
+#include <wtf/Noncopyable.h>
|
|
+
|
|
+namespace Inspector {
|
|
+class BackendDispatcher;
|
|
+class FrontendChannel;
|
|
+class FrontendRouter;
|
|
+}
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+class NativeWebKeyboardEvent;
|
|
+class WebPageProxy;
|
|
+
|
|
+class WebPageInspectorInputAgent : public Inspector::InspectorAgentBase, public Inspector::InputBackendDispatcherHandler {
|
|
+ WTF_MAKE_NONCOPYABLE(WebPageInspectorInputAgent);
|
|
+ WTF_MAKE_FAST_ALLOCATED;
|
|
+public:
|
|
+ WebPageInspectorInputAgent(Inspector::BackendDispatcher& backendDispatcher, WebPageProxy& page);
|
|
+ ~WebPageInspectorInputAgent() override;
|
|
+
|
|
+ void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) override;
|
|
+ void willDestroyFrontendAndBackend(Inspector::DisconnectReason) override;
|
|
+
|
|
+ void dispatchKeyEvent(const String& in_type, const int* opt_in_modifiers, const String* opt_in_text, const String* opt_in_unmodifiedText, const String* opt_in_code, const String* opt_in_key, const int* opt_in_windowsVirtualKeyCode, const int* opt_in_nativeVirtualKeyCode, const bool* opt_in_autoRepeat, const bool* opt_in_isKeypad, const bool* opt_in_isSystemKey, Ref<DispatchKeyEventCallback>&& callback) override;
|
|
+ void dispatchMouseEvent(const String& in_type, int in_x, int in_y, const int* opt_in_modifiers, const String* opt_in_button, const int* opt_in_buttons, const int* opt_in_clickCount, const int* opt_in_deltaX, const int* opt_in_deltaY, Ref<DispatchMouseEventCallback>&& callback) override;
|
|
+ void goBack(Inspector::ErrorString&) override;
|
|
+
|
|
+private:
|
|
+ void platformDispatchKeyEvent(WebKeyboardEvent::Type type, const String& text, const String& unmodifiedText, const String& key, const String& code, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet<WebEvent::Modifier> modifiers, WallTime timestamp);
|
|
+#if PLATFORM(WPE)
|
|
+ void platformDispatchMouseEvent(WebMouseEvent::Type type, int x, int y, WebMouseEvent::Button button, OptionSet<WebEvent::Modifier> modifiers);
|
|
+#endif
|
|
+
|
|
+ Ref<Inspector::InputBackendDispatcher> m_backendDispatcher;
|
|
+ WebPageProxy& m_page;
|
|
+ // Keep track of currently active modifiers across multiple keystrokes.
|
|
+ // Most platforms do not track current modifiers from synthesized events.
|
|
+ unsigned m_currentModifiers { 0 };
|
|
+ class InspectorInputObserver;
|
|
+ std::unique_ptr<InspectorInputObserver> m_inputObserver;
|
|
+};
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/WebPageInspectorTargetProxy.cpp b/Source/WebKit/UIProcess/WebPageInspectorTargetProxy.cpp
|
|
new file mode 100644
|
|
index 00000000000..a697c3f5355
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/WebPageInspectorTargetProxy.cpp
|
|
@@ -0,0 +1,129 @@
|
|
+/*
|
|
+ * Copyright (C) 2018 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. ``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
|
|
+ * 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.
|
|
+ */
|
|
+
|
|
+#include "config.h"
|
|
+#include "WebPageInspectorTargetProxy.h"
|
|
+
|
|
+#include "ProvisionalPageProxy.h"
|
|
+#include "WebPageInspectorController.h"
|
|
+#include "WebPageInspectorEmulationAgent.h"
|
|
+#include "WebPageInspectorInputAgent.h"
|
|
+#include "WebPageMessages.h"
|
|
+#include "WebPageProxy.h"
|
|
+#include "WebProcessProxy.h"
|
|
+#include <JavaScriptCore/InspectorBackendDispatcher.h>
|
|
+#include <JavaScriptCore/InspectorBackendDispatchers.h>
|
|
+#include <JavaScriptCore/InspectorFrontendRouter.h>
|
|
+#include <JavaScriptCore/InspectorTargetAgent.h>
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+using namespace Inspector;
|
|
+
|
|
+namespace {
|
|
+
|
|
+class TargetFrontendChannel final : public FrontendChannel {
|
|
+ WTF_MAKE_NONCOPYABLE(TargetFrontendChannel);
|
|
+public:
|
|
+ TargetFrontendChannel(InspectorTargetAgent& targetAgent, const String& targetId, FrontendChannel::ConnectionType type)
|
|
+ : m_targetAgent(targetAgent)
|
|
+ , m_targetId(targetId)
|
|
+ , m_connectionType(type)
|
|
+ {
|
|
+ }
|
|
+ ~TargetFrontendChannel() override = default;
|
|
+
|
|
+ ConnectionType connectionType() const override { return m_connectionType; }
|
|
+ void sendMessageToFrontend(const String& message) override
|
|
+ {
|
|
+ m_targetAgent.sendMessageFromTargetToFrontend(m_targetId, message);
|
|
+ }
|
|
+
|
|
+private:
|
|
+ InspectorTargetAgent& m_targetAgent;
|
|
+ String m_targetId;
|
|
+ FrontendChannel::ConnectionType m_connectionType;
|
|
+};
|
|
+
|
|
+} // namespace
|
|
+
|
|
+std::unique_ptr<WebPageInspectorTargetProxy> WebPageInspectorTargetProxy::create(WebPageProxy& page, Inspector::InspectorTargetAgent& targetAgent, const String& targetId)
|
|
+{
|
|
+ return makeUnique<WebPageInspectorTargetProxy>(page, nullptr, targetAgent, targetId);
|
|
+}
|
|
+
|
|
+std::unique_ptr<WebPageInspectorTargetProxy> WebPageInspectorTargetProxy::create(ProvisionalPageProxy& provisionalPage, Inspector::InspectorTargetAgent& targetAgent, const String& targetId)
|
|
+{
|
|
+ return makeUnique<WebPageInspectorTargetProxy>(provisionalPage.page(), &provisionalPage, targetAgent, targetId);
|
|
+}
|
|
+
|
|
+WebPageInspectorTargetProxy::WebPageInspectorTargetProxy(WebPageProxy& page, ProvisionalPageProxy* provisionalPage, Inspector::InspectorTargetAgent& targetAgent, const String& targetId)
|
|
+ : InspectorTargetProxy(page, provisionalPage, targetId, Inspector::InspectorTargetType::Page)
|
|
+ , m_frontendRouter(FrontendRouter::create())
|
|
+ , m_backendDispatcher(BackendDispatcher::create(m_frontendRouter.copyRef()))
|
|
+ , m_targetAgent(targetAgent)
|
|
+{
|
|
+ m_agents.append(std::make_unique<WebPageInspectorEmulationAgent>(m_backendDispatcher.get(), page));
|
|
+ m_agents.append(std::make_unique<WebPageInspectorInputAgent>(m_backendDispatcher.get(), page));
|
|
+}
|
|
+
|
|
+void WebPageInspectorTargetProxy::connect(Inspector::FrontendChannel::ConnectionType connectionType)
|
|
+{
|
|
+ InspectorTargetProxy::connect(connectionType);
|
|
+ ASSERT(!m_frontendChannel);
|
|
+ if (m_frontendChannel)
|
|
+ return;
|
|
+ m_frontendChannel = std::make_unique<TargetFrontendChannel>(m_targetAgent, identifier(), connectionType);
|
|
+ m_frontendRouter->connectFrontend(*m_frontendChannel);
|
|
+}
|
|
+
|
|
+void WebPageInspectorTargetProxy::disconnect()
|
|
+{
|
|
+ ASSERT(m_frontendChannel);
|
|
+ m_frontendRouter->disconnectAllFrontends();
|
|
+ m_frontendChannel.reset();
|
|
+ InspectorTargetProxy::disconnect();
|
|
+}
|
|
+
|
|
+void WebPageInspectorTargetProxy::sendMessageToTargetBackend(const String& message)
|
|
+{
|
|
+ if (m_backendDispatcher->dispatch(message, BackendDispatcher::Mode::ContinueIfDomainIsMissing) == BackendDispatcher::DispatchResult::Finished)
|
|
+ return;
|
|
+ if (m_page.inspectorController().dispatchMessageToTargetBackend(message))
|
|
+ return;
|
|
+ InspectorTargetProxy::sendMessageToTargetBackend(message);
|
|
+}
|
|
+
|
|
+void WebPageInspectorTargetProxy::activate(String& error)
|
|
+{
|
|
+ platformActivate(error);
|
|
+}
|
|
+
|
|
+void WebPageInspectorTargetProxy::close(String& error)
|
|
+{
|
|
+ m_page.closePage(false);
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/WebPageInspectorTargetProxy.h b/Source/WebKit/UIProcess/WebPageInspectorTargetProxy.h
|
|
new file mode 100644
|
|
index 00000000000..0550a3d8698
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/WebPageInspectorTargetProxy.h
|
|
@@ -0,0 +1,67 @@
|
|
+/*
|
|
+ * Copyright (C) 2018 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. ``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
|
|
+ * 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.
|
|
+ */
|
|
+
|
|
+#pragma once
|
|
+
|
|
+#include "InspectorTargetProxy.h"
|
|
+#include <JavaScriptCore/InspectorAgentRegistry.h>
|
|
+#include <wtf/Forward.h>
|
|
+#include <wtf/Noncopyable.h>
|
|
+
|
|
+namespace Inspector {
|
|
+class BackendDispatcher;
|
|
+class InspectorTargetAgent;
|
|
+}
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+class WebPageProxy;
|
|
+
|
|
+class WebPageInspectorTargetProxy final : public InspectorTargetProxy {
|
|
+ WTF_MAKE_FAST_ALLOCATED;
|
|
+ WTF_MAKE_NONCOPYABLE(WebPageInspectorTargetProxy);
|
|
+public:
|
|
+ static std::unique_ptr<WebPageInspectorTargetProxy> create(WebPageProxy&, Inspector::InspectorTargetAgent&, const String& targetId);
|
|
+ static std::unique_ptr<WebPageInspectorTargetProxy> create(ProvisionalPageProxy&, Inspector::InspectorTargetAgent&, const String& targetId);
|
|
+ WebPageInspectorTargetProxy(WebPageProxy&, ProvisionalPageProxy*, Inspector::InspectorTargetAgent&, const String& targetId);
|
|
+ ~WebPageInspectorTargetProxy() = default;
|
|
+
|
|
+ void connect(Inspector::FrontendChannel::ConnectionType) override;
|
|
+ void disconnect() override;
|
|
+ void sendMessageToTargetBackend(const String&) override;
|
|
+ void activate(String& error) override;
|
|
+ void close(String& error) override;
|
|
+
|
|
+private:
|
|
+ void platformActivate(String& error) const;
|
|
+
|
|
+ Ref<Inspector::FrontendRouter> m_frontendRouter;
|
|
+ Ref<Inspector::BackendDispatcher> m_backendDispatcher;
|
|
+ Inspector::InspectorTargetAgent& m_targetAgent;
|
|
+ Inspector::AgentRegistry m_agents;
|
|
+ std::unique_ptr<Inspector::FrontendChannel> m_frontendChannel;
|
|
+};
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp
|
|
index c6b66746b18..3bed21548da 100644
|
|
--- a/Source/WebKit/UIProcess/WebPageProxy.cpp
|
|
+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp
|
|
@@ -865,6 +865,7 @@ void WebPageProxy::finishAttachingToWebProcess(ProcessLaunchReason reason)
|
|
m_pageLoadState.didSwapWebProcesses();
|
|
if (reason != ProcessLaunchReason::InitialProcess)
|
|
m_drawingArea->waitForBackingStoreUpdateOnNextPaint();
|
|
+ m_inspectorController->didFinishAttachingToWebProcess();
|
|
}
|
|
|
|
void WebPageProxy::didAttachToRunningProcess()
|
|
@@ -1616,6 +1617,11 @@ void WebPageProxy::setControlledByAutomation(bool controlled)
|
|
m_process->processPool().sendToNetworkingProcess(Messages::NetworkProcess::SetSessionIsControlledByAutomation(m_websiteDataStore->sessionID(), m_controlledByAutomation));
|
|
}
|
|
|
|
+void WebPageProxy::setObserber(InputProcessingObserver* observer)
|
|
+{
|
|
+ m_inputProcessingObserver = observer;
|
|
+}
|
|
+
|
|
void WebPageProxy::createInspectorTarget(const String& targetId, Inspector::InspectorTargetType type)
|
|
{
|
|
m_inspectorController->createInspectorTarget(targetId, type);
|
|
@@ -6509,6 +6515,8 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
|
|
if (auto* automationSession = process().processPool().automationSession())
|
|
automationSession->mouseEventsFlushedForPage(*this);
|
|
pageClient().didFinishProcessingAllPendingMouseEvents();
|
|
+ if (m_inputProcessingObserver)
|
|
+ m_inputProcessingObserver->didProcessAllPendingMouseEvents();
|
|
}
|
|
|
|
break;
|
|
@@ -6535,7 +6543,6 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
|
|
case WebEvent::RawKeyDown:
|
|
case WebEvent::Char: {
|
|
LOG(KeyHandling, "WebPageProxy::didReceiveEvent: %s (queue empty %d)", webKeyboardEventTypeString(type), m_keyEventQueue.isEmpty());
|
|
-
|
|
MESSAGE_CHECK(m_process, !m_keyEventQueue.isEmpty());
|
|
NativeWebKeyboardEvent event = m_keyEventQueue.takeFirst();
|
|
|
|
@@ -6550,7 +6557,6 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
|
|
// The call to doneWithKeyEvent may close this WebPage.
|
|
// Protect against this being destroyed.
|
|
Ref<WebPageProxy> protect(*this);
|
|
-
|
|
pageClient().doneWithKeyEvent(event, handled);
|
|
if (!handled)
|
|
m_uiClient->didNotHandleKeyEvent(this, event);
|
|
@@ -6559,6 +6565,8 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
|
|
if (!canProcessMoreKeyEvents) {
|
|
if (auto* automationSession = process().processPool().automationSession())
|
|
automationSession->keyboardEventsFlushedForPage(*this);
|
|
+ if (m_inputProcessingObserver)
|
|
+ m_inputProcessingObserver->didProcessAllPendingKeyboardEvents();
|
|
}
|
|
break;
|
|
}
|
|
diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h
|
|
index b84fb9e0ef3..9357ec52c83 100644
|
|
--- a/Source/WebKit/UIProcess/WebPageProxy.h
|
|
+++ b/Source/WebKit/UIProcess/WebPageProxy.h
|
|
@@ -534,6 +534,14 @@ public:
|
|
|
|
void setPageLoadStateObserver(std::unique_ptr<PageLoadState::Observer>&&);
|
|
|
|
+ class InputProcessingObserver {
|
|
+ public:
|
|
+ virtual ~InputProcessingObserver() = default;
|
|
+ virtual void didProcessAllPendingKeyboardEvents() = 0;
|
|
+ virtual void didProcessAllPendingMouseEvents() = 0;
|
|
+ };
|
|
+ void setObserber(InputProcessingObserver*);
|
|
+
|
|
void initializeWebPage();
|
|
void setDrawingArea(std::unique_ptr<DrawingAreaProxy>&&);
|
|
|
|
@@ -2569,6 +2577,7 @@ private:
|
|
#if ENABLE(REMOTE_INSPECTOR)
|
|
std::unique_ptr<WebPageDebuggable> m_inspectorDebuggable;
|
|
#endif
|
|
+ InputProcessingObserver* m_inputProcessingObserver { nullptr };
|
|
|
|
Optional<SpellDocumentTag> m_spellDocumentTag;
|
|
|
|
diff --git a/Source/WebKit/UIProcess/glib/InspectorBrowserAgentClientGLib.cpp b/Source/WebKit/UIProcess/glib/InspectorBrowserAgentClientGLib.cpp
|
|
new file mode 100644
|
|
index 00000000000..665265973c3
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/glib/InspectorBrowserAgentClientGLib.cpp
|
|
@@ -0,0 +1,130 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions are
|
|
+ * met:
|
|
+ *
|
|
+ * * Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * * 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.
|
|
+ * * Neither the name of Microsoft Corporation nor the names of its
|
|
+ * contributors may be used to endorse or promote products derived from
|
|
+ * this software without specific prior written permission.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
|
|
+ * OWNER OR 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.
|
|
+ */
|
|
+
|
|
+#include "config.h"
|
|
+#include "InspectorBrowserAgentClientGLib.h"
|
|
+
|
|
+#if ENABLE(REMOTE_INSPECTOR)
|
|
+
|
|
+#include "InspectorBrowserAgent.h"
|
|
+#include "WebKitBrowserInspectorPrivate.h"
|
|
+#include "WebKitWebContextPrivate.h"
|
|
+#include "WebKitWebsiteDataManagerPrivate.h"
|
|
+#include "WebKitWebViewPrivate.h"
|
|
+#include "WebPageProxy.h"
|
|
+#include <wtf/HashMap.h>
|
|
+#include <wtf/RefPtr.h>
|
|
+#include <wtf/text/StringView.h>
|
|
+#include <wtf/text/WTFString.h>
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+static Vector<WebPageProxy*> collectPages(Optional<PAL::SessionID> sessionID)
|
|
+{
|
|
+ Vector<WebPageProxy*> result;
|
|
+ for (WebProcessPool* pool : WebProcessPool::allProcessPools()) {
|
|
+ for (auto& process : pool->processes()) {
|
|
+ for (auto* page : process->pages()) {
|
|
+ if (!sessionID || page->sessionID() == sessionID)
|
|
+ result.append(page);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ return result;
|
|
+}
|
|
+
|
|
+static void closeAllPages(Optional<PAL::SessionID> sessionID)
|
|
+{
|
|
+ Vector<WebPageProxy*> pages = collectPages(sessionID);
|
|
+ for (auto* page : pages)
|
|
+ page->closePage(false);
|
|
+}
|
|
+
|
|
+InspectorBrowserAgentClientGlib::InspectorBrowserAgentClientGlib()
|
|
+{
|
|
+}
|
|
+
|
|
+RefPtr<WebPageProxy> InspectorBrowserAgentClientGlib::createPage(WTF::String& error, const WTF::String* browserContextID)
|
|
+{
|
|
+ WebKitWebContext* context = webkit_web_context_get_default();
|
|
+ if (browserContextID != nullptr) {
|
|
+ context = m_idToContext.get(*browserContextID);
|
|
+ if (context == nullptr) {
|
|
+ error = "Context with provided id not found";
|
|
+ return nullptr;
|
|
+ }
|
|
+ }
|
|
+ RefPtr<WebPageProxy> page = webkitBrowserInspectorCreateNewPageInContext(context);
|
|
+ if (page == nullptr)
|
|
+ error = "Failed to create new page in the context";
|
|
+ return page;
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgentClientGlib::closeAllWindows()
|
|
+{
|
|
+ closeAllPages(Optional<PAL::SessionID>());
|
|
+ m_idToContext.clear();
|
|
+ // FIXME(yurys): call g_main_loop_quit() ?
|
|
+}
|
|
+
|
|
+static PAL::SessionID sessionIDFromContext(WebKitWebContext* context)
|
|
+{
|
|
+ WebKitWebsiteDataManager* data_manager = webkit_web_context_get_website_data_manager(context);
|
|
+ WebsiteDataStore& websiteDataStore = webkitWebsiteDataManagerGetDataStore(data_manager);
|
|
+ return websiteDataStore.sessionID();
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgentClientGlib::createBrowserContext(WTF::String& error, WTF::String* browserContextID)
|
|
+{
|
|
+ GRefPtr<WebKitWebsiteDataManager> manager = adoptGRef(webkit_website_data_manager_new_ephemeral());
|
|
+ GRefPtr<WebKitWebContext> context = adoptGRef(WEBKIT_WEB_CONTEXT(g_object_new(WEBKIT_TYPE_WEB_CONTEXT, "website-data-manager", manager.get(), "process-swap-on-cross-site-navigation-enabled", true, nullptr)));
|
|
+ if (!context) {
|
|
+ error = "Failed to create GLib ephemeral context";
|
|
+ return;
|
|
+ }
|
|
+ PAL::SessionID sessionID = sessionIDFromContext(context.get());
|
|
+ String id = InspectorBrowserAgent::toBrowserContextIDProtocolString(sessionID);
|
|
+ m_idToContext.set(id, WTFMove(context));
|
|
+ *browserContextID = id;
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgentClientGlib::deleteBrowserContext(WTF::String& error, const WTF::String& browserContextID)
|
|
+{
|
|
+ GRefPtr<WebKitWebContext> context = m_idToContext.take(browserContextID);
|
|
+ if (context == nullptr) {
|
|
+ error = "Context with provided id not found";
|
|
+ return;
|
|
+ }
|
|
+ closeAllPages(sessionIDFromContext(context.get()));
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
+
|
|
+#endif // ENABLE(REMOTE_INSPECTOR)
|
|
diff --git a/Source/WebKit/UIProcess/glib/InspectorBrowserAgentClientGLib.h b/Source/WebKit/UIProcess/glib/InspectorBrowserAgentClientGLib.h
|
|
new file mode 100644
|
|
index 00000000000..0fefb4c55b3
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/glib/InspectorBrowserAgentClientGLib.h
|
|
@@ -0,0 +1,63 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions are
|
|
+ * met:
|
|
+ *
|
|
+ * * Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * * 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.
|
|
+ * * Neither the name of Microsoft Corporation nor the names of its
|
|
+ * contributors may be used to endorse or promote products derived from
|
|
+ * this software without specific prior written permission.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
|
|
+ * OWNER OR 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.
|
|
+ */
|
|
+
|
|
+#pragma once
|
|
+
|
|
+#if ENABLE(REMOTE_INSPECTOR)
|
|
+
|
|
+#include "InspectorBrowserAgentClient.h"
|
|
+#include "WebKitWebContext.h"
|
|
+#include <wtf/Forward.h>
|
|
+#include <wtf/HashMap.h>
|
|
+#include <wtf/glib/GRefPtr.h>
|
|
+#include <wtf/text/StringHash.h>
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+class InspectorBrowserAgentClientGlib : public InspectorBrowserAgentClient {
|
|
+ WTF_MAKE_FAST_ALLOCATED;
|
|
+public:
|
|
+ InspectorBrowserAgentClientGlib();
|
|
+ ~InspectorBrowserAgentClientGlib() override = default;
|
|
+
|
|
+ RefPtr<WebPageProxy> createPage(WTF::String& error, const WTF::String* browserContextID) override;
|
|
+ void closeAllWindows() override;
|
|
+ void createBrowserContext(WTF::String& error, WTF::String* browserContextID) override;
|
|
+ void deleteBrowserContext(WTF::String& error, const WTF::String& browserContextID) override;
|
|
+
|
|
+private:
|
|
+ WebKitWebContext* findContext(WTF::String& error, const WTF::String& browserContextID);
|
|
+
|
|
+ HashMap<String, GRefPtr<WebKitWebContext>> m_idToContext;
|
|
+};
|
|
+
|
|
+} // namespace API
|
|
+
|
|
+#endif // ENABLE(REMOTE_INSPECTOR)
|
|
diff --git a/Source/WebKit/UIProcess/gtk/WebPageInspectorEmulationAgentGtk.cpp b/Source/WebKit/UIProcess/gtk/WebPageInspectorEmulationAgentGtk.cpp
|
|
new file mode 100644
|
|
index 00000000000..25df994c053
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/gtk/WebPageInspectorEmulationAgentGtk.cpp
|
|
@@ -0,0 +1,58 @@
|
|
+/*
|
|
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
|
|
+ * Portions Copyright (c) 2010 Motorola Mobility, 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.
|
|
+ */
|
|
+
|
|
+#include "config.h"
|
|
+#include "WebPageInspectorEmulationAgent.h"
|
|
+
|
|
+#include "WebPageProxy.h"
|
|
+#include <gtk/gtk.h>
|
|
+
|
|
+namespace WebKit {
|
|
+void WebPageInspectorEmulationAgent::platformSetSize(String& error, int width, int height)
|
|
+{
|
|
+ GtkWidget* viewWidget = m_page.viewWidget();
|
|
+ GtkWidget* window = gtk_widget_get_toplevel(viewWidget);
|
|
+ if (!window) {
|
|
+ error = "Cannot find parent window";
|
|
+ return;
|
|
+ }
|
|
+ if (!GTK_IS_WINDOW(window)) {
|
|
+ error = "Toplevel is not a window";
|
|
+ return;
|
|
+ }
|
|
+ GtkAllocation viewAllocation;
|
|
+ gtk_widget_get_allocation(viewWidget, &viewAllocation);
|
|
+
|
|
+ GtkAllocation windowAllocation;
|
|
+ gtk_widget_get_allocation(window, &windowAllocation);
|
|
+
|
|
+ width += windowAllocation.width - viewAllocation.width;
|
|
+ height += windowAllocation.height - viewAllocation.height;
|
|
+
|
|
+ gtk_window_resize(GTK_WINDOW(window), width, height);
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/gtk/WebPageInspectorInputAgentGtk.cpp b/Source/WebKit/UIProcess/gtk/WebPageInspectorInputAgentGtk.cpp
|
|
new file mode 100644
|
|
index 00000000000..2427ea22acf
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/gtk/WebPageInspectorInputAgentGtk.cpp
|
|
@@ -0,0 +1,108 @@
|
|
+/*
|
|
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
|
|
+ * Portions Copyright (c) 2010 Motorola Mobility, 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.
|
|
+ */
|
|
+
|
|
+#include "config.h"
|
|
+#include "WebPageInspectorInputAgent.h"
|
|
+
|
|
+#include "KeyBindingTranslator.h"
|
|
+#include "NativeWebKeyboardEvent.h"
|
|
+#include "WebPageProxy.h"
|
|
+#include <WebCore/PlatformKeyboardEvent.h>
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+static Vector<String> commandsForKeyEvent(GdkEventType type, unsigned keyVal, unsigned state)
|
|
+{
|
|
+ ASSERT(type == GDK_KEY_PRESS || type == GDK_KEY_RELEASE);
|
|
+
|
|
+ GUniquePtr<GdkEvent> event(gdk_event_new(type));
|
|
+ event->key.keyval = keyVal;
|
|
+ event->key.time = GDK_CURRENT_TIME;
|
|
+ event->key.state = state;
|
|
+ // When synthesizing an event, an invalid hardware_keycode value can cause it to be badly processed by GTK+.
|
|
+ GUniqueOutPtr<GdkKeymapKey> keys;
|
|
+ int keysCount;
|
|
+ if (gdk_keymap_get_entries_for_keyval(gdk_keymap_get_default(), keyVal, &keys.outPtr(), &keysCount) && keysCount)
|
|
+ event->key.hardware_keycode = keys.get()[0].keycode;
|
|
+ return KeyBindingTranslator().commandsForKeyEvent(&event->key);
|
|
+}
|
|
+
|
|
+static unsigned modifiersToEventState(OptionSet<WebEvent::Modifier> modifiers)
|
|
+{
|
|
+ unsigned state = 0;
|
|
+ if (modifiers.contains(WebEvent::Modifier::ControlKey))
|
|
+ state |= GDK_CONTROL_MASK;
|
|
+ if (modifiers.contains(WebEvent::Modifier::ShiftKey))
|
|
+ state |= GDK_SHIFT_MASK;
|
|
+ if (modifiers.contains(WebEvent::Modifier::AltKey))
|
|
+ state |= GDK_META_MASK;
|
|
+ if (modifiers.contains(WebEvent::Modifier::CapsLockKey))
|
|
+ state |= GDK_LOCK_MASK;
|
|
+ return state;
|
|
+}
|
|
+
|
|
+void WebPageInspectorInputAgent::platformDispatchKeyEvent(WebKeyboardEvent::Type type, const String& text, const String& unmodifiedText, const String& key, const String& code, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet<WebEvent::Modifier> modifiers, WallTime timestamp)
|
|
+{
|
|
+ Vector<String> commands;
|
|
+ const guint keyVal = WebCore::PlatformKeyboardEvent::gdkKeyCodeForWindowsKeyCode(windowsVirtualKeyCode);
|
|
+ String keyIdentifier;
|
|
+ if (keyVal) {
|
|
+ GdkEventType event = GDK_NOTHING;
|
|
+ switch (type)
|
|
+ {
|
|
+ case WebKeyboardEvent::KeyDown:
|
|
+ event = GDK_KEY_PRESS;
|
|
+ break;
|
|
+ case WebKeyboardEvent::KeyUp:
|
|
+ event = GDK_KEY_RELEASE;
|
|
+ break;
|
|
+ default:
|
|
+ fprintf(stderr, "Unsupported event type = %d\n", type);
|
|
+ break;
|
|
+ }
|
|
+ unsigned state = modifiersToEventState(modifiers);
|
|
+ commands = commandsForKeyEvent(event, keyVal, state);
|
|
+ keyIdentifier = WebCore::PlatformKeyboardEvent::keyIdentifierForGdkKeyCode(keyVal);
|
|
+ }
|
|
+ NativeWebKeyboardEvent event(
|
|
+ type,
|
|
+ text,
|
|
+ unmodifiedText,
|
|
+ key,
|
|
+ code,
|
|
+ keyIdentifier,
|
|
+ windowsVirtualKeyCode,
|
|
+ nativeVirtualKeyCode,
|
|
+ isAutoRepeat,
|
|
+ isKeypad,
|
|
+ isSystemKey,
|
|
+ modifiers,
|
|
+ timestamp,
|
|
+ WTFMove(commands));
|
|
+ m_page.handleKeyboardEvent(event);
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/gtk/WebPageInspectorTargetProxyGtk.cpp b/Source/WebKit/UIProcess/gtk/WebPageInspectorTargetProxyGtk.cpp
|
|
new file mode 100644
|
|
index 00000000000..b6981cae157
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/gtk/WebPageInspectorTargetProxyGtk.cpp
|
|
@@ -0,0 +1,45 @@
|
|
+/*
|
|
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
|
|
+ * Portions Copyright (c) 2010 Motorola Mobility, 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.
|
|
+ */
|
|
+
|
|
+#include "config.h"
|
|
+#include "WebPageInspectorTargetProxy.h"
|
|
+
|
|
+#include "WebPageProxy.h"
|
|
+#include <WebCore/GtkUtilities.h>
|
|
+#include <gtk/gtk.h>
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+void WebPageInspectorTargetProxy::platformActivate(String& error) const
|
|
+{
|
|
+ GtkWidget* parent = gtk_widget_get_toplevel(m_page.viewWidget());
|
|
+ if (WebCore::widgetIsOnscreenToplevelWindow(parent))
|
|
+ gtk_window_present(GTK_WINDOW(parent));
|
|
+ else
|
|
+ error = "The view is not on screen";
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm b/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
|
|
index e139968d4f0..98093c684db 100644
|
|
--- a/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
|
|
+++ b/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
|
|
@@ -408,6 +408,8 @@ IntRect PageClientImpl::rootViewToAccessibilityScreen(const IntRect& rect)
|
|
|
|
void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent& event, bool eventWasHandled)
|
|
{
|
|
+ if (!event.nativeEvent())
|
|
+ return;
|
|
[m_contentView _didHandleKeyEvent:event.nativeEvent() eventWasHandled:eventWasHandled];
|
|
}
|
|
|
|
diff --git a/Source/WebKit/UIProcess/mac/InspectorBrowserAgentClientMac.h b/Source/WebKit/UIProcess/mac/InspectorBrowserAgentClientMac.h
|
|
new file mode 100644
|
|
index 00000000000..719a0bb54d7
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/mac/InspectorBrowserAgentClientMac.h
|
|
@@ -0,0 +1,56 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions are
|
|
+ * met:
|
|
+ *
|
|
+ * * Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * * 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.
|
|
+ * * Neither the name of Microsoft Corporation nor the names of its
|
|
+ * contributors may be used to endorse or promote products derived from
|
|
+ * this software without specific prior written permission.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
|
|
+ * OWNER OR 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.
|
|
+ */
|
|
+
|
|
+#pragma once
|
|
+
|
|
+#include "InspectorBrowserAgentClient.h"
|
|
+#include <wtf/Forward.h>
|
|
+
|
|
+OBJC_PROTOCOL(_WKBrowserInspectorDelegate);
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+class InspectorBrowserAgentClientMac : public InspectorBrowserAgentClient {
|
|
+ WTF_MAKE_FAST_ALLOCATED;
|
|
+public:
|
|
+ InspectorBrowserAgentClientMac(_WKBrowserInspectorDelegate* delegate);
|
|
+ ~InspectorBrowserAgentClientMac() override = default;
|
|
+
|
|
+ RefPtr<WebPageProxy> createPage(WTF::String& error, const WTF::String* browserContextID) override;
|
|
+ void closeAllWindows() override;
|
|
+ void createBrowserContext(WTF::String& error, WTF::String* browserContextID) override;
|
|
+ void deleteBrowserContext(WTF::String& error, const WTF::String& browserContextID) override;
|
|
+ private:
|
|
+
|
|
+ _WKBrowserInspectorDelegate* delegate_;
|
|
+};
|
|
+
|
|
+
|
|
+} // namespace API
|
|
diff --git a/Source/WebKit/UIProcess/mac/InspectorBrowserAgentClientMac.mm b/Source/WebKit/UIProcess/mac/InspectorBrowserAgentClientMac.mm
|
|
new file mode 100644
|
|
index 00000000000..8426bd70ba9
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/mac/InspectorBrowserAgentClientMac.mm
|
|
@@ -0,0 +1,95 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions are
|
|
+ * met:
|
|
+ *
|
|
+ * * Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * * 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.
|
|
+ * * Neither the name of Microsoft Corporation nor the names of its
|
|
+ * contributors may be used to endorse or promote products derived from
|
|
+ * this software without specific prior written permission.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
|
|
+ * OWNER OR 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.
|
|
+ */
|
|
+
|
|
+#import "config.h"
|
|
+#import "InspectorBrowserAgentClientMac.h"
|
|
+
|
|
+#import <wtf/RefPtr.h>
|
|
+#import <wtf/text/WTFString.h>
|
|
+#import "WebPageProxy.h"
|
|
+#import "WebProcessPool.h"
|
|
+#import "_WKBrowserInspector.h"
|
|
+#import "WKWebView.h"
|
|
+#import "WKWebViewInternal.h"
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+/*
|
|
+static Vector<WebPageProxy*> collectPages(Optional<PAL::SessionID> sessionID)
|
|
+{
|
|
+ Vector<WebPageProxy*> result;
|
|
+ for (WebProcessPool* pool : WebProcessPool::allProcessPools()) {
|
|
+ for (auto& process : pool->processes()) {
|
|
+ for (auto* page : process->pages()) {
|
|
+ if (!sessionID || page->sessionID() == sessionID)
|
|
+ result.append(page);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ return result;
|
|
+}
|
|
+
|
|
+static void closeAllPages(Optional<PAL::SessionID> sessionID)
|
|
+{
|
|
+ Vector<WebPageProxy*> pages = collectPages(sessionID);
|
|
+ for (auto* page : pages)
|
|
+ page->closePage(false);
|
|
+}
|
|
+*/
|
|
+
|
|
+InspectorBrowserAgentClientMac::InspectorBrowserAgentClientMac(_WKBrowserInspectorDelegate* delegate)
|
|
+ : delegate_(delegate)
|
|
+{
|
|
+}
|
|
+
|
|
+RefPtr<WebPageProxy> InspectorBrowserAgentClientMac::createPage(WTF::String& error, const WTF::String* browserContextID)
|
|
+{
|
|
+ WKWebView *webView = [delegate_ createNewPage];
|
|
+ return [webView _page];
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgentClientMac::closeAllWindows()
|
|
+{
|
|
+ [delegate_ quit];
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgentClientMac::createBrowserContext(WTF::String& error, WTF::String* browserContextID)
|
|
+{
|
|
+ error = "Failed to create Mac ephemeral context";
|
|
+ fprintf(stderr, "InspectorBrowserAgentClientMac::createBrowserContext - NOT IMPLEMENTED\n");
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgentClientMac::deleteBrowserContext(WTF::String& error, const WTF::String& browserContextID)
|
|
+{
|
|
+ error = "Context with provided id not found";
|
|
+ fprintf(stderr, "InspectorBrowserAgentClientMac::deleteBrowserContext - NOT IMPLEMENTED\n");
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/mac/PageClientImplMac.mm b/Source/WebKit/UIProcess/mac/PageClientImplMac.mm
|
|
index 22653d74398..bf27558fdfd 100644
|
|
--- a/Source/WebKit/UIProcess/mac/PageClientImplMac.mm
|
|
+++ b/Source/WebKit/UIProcess/mac/PageClientImplMac.mm
|
|
@@ -455,6 +455,8 @@ IntRect PageClientImpl::rootViewToAccessibilityScreen(const IntRect& rect)
|
|
|
|
void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent& event, bool eventWasHandled)
|
|
{
|
|
+ if (!event.nativeEvent())
|
|
+ return;
|
|
m_impl->doneWithKeyEvent(event.nativeEvent(), eventWasHandled);
|
|
}
|
|
|
|
@@ -930,6 +932,9 @@ void PageClientImpl::didRestoreScrollPosition()
|
|
|
|
bool PageClientImpl::windowIsFrontWindowUnderMouse(const NativeWebMouseEvent& event)
|
|
{
|
|
+ // Simulated event.
|
|
+ if (!event.nativeEvent())
|
|
+ return false;
|
|
return m_impl->windowIsFrontWindowUnderMouse(event.nativeEvent());
|
|
}
|
|
|
|
diff --git a/Source/WebKit/UIProcess/mac/WebPageInspectorEmulationAgentMac.mm b/Source/WebKit/UIProcess/mac/WebPageInspectorEmulationAgentMac.mm
|
|
new file mode 100644
|
|
index 00000000000..857195777b5
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/mac/WebPageInspectorEmulationAgentMac.mm
|
|
@@ -0,0 +1,42 @@
|
|
+/*
|
|
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
|
|
+ * Portions Copyright (c) 2010 Motorola Mobility, 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.
|
|
+ */
|
|
+
|
|
+#include "config.h"
|
|
+#include "WebPageInspectorEmulationAgent.h"
|
|
+
|
|
+#include "WebPageProxy.h"
|
|
+
|
|
+namespace WebKit {
|
|
+void WebPageInspectorEmulationAgent::platformSetSize(String& error, int width, int height)
|
|
+{
|
|
+ NSWindow* window = m_page.platformWindow();
|
|
+ NSRect frame = [window frame];
|
|
+ frame.origin.y += frame.size.height;
|
|
+ frame.origin.y -= height;
|
|
+ frame.size = NSMakeSize(width, height);
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/mac/WebPageInspectorInputAgentMac.mm b/Source/WebKit/UIProcess/mac/WebPageInspectorInputAgentMac.mm
|
|
new file mode 100644
|
|
index 00000000000..0f09fd52ae1
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/mac/WebPageInspectorInputAgentMac.mm
|
|
@@ -0,0 +1,37 @@
|
|
+/*
|
|
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
|
|
+ * Portions Copyright (c) 2010 Motorola Mobility, 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.
|
|
+ */
|
|
+
|
|
+#include "config.h"
|
|
+#include "WebPageInspectorInputAgent.h"
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+void WebPageInspectorInputAgent::platformDispatchKeyEvent(WebKeyboardEvent::Type type, const String& text, const String& unmodifiedText, const String& key, const String& code, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet<WebEvent::Modifier> modifiers, WallTime timestamp)
|
|
+{
|
|
+ fprintf(stderr, "Mac does not support dispatching key events");
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/mac/WebPageInspectorTargetProxyMac.mm b/Source/WebKit/UIProcess/mac/WebPageInspectorTargetProxyMac.mm
|
|
new file mode 100644
|
|
index 00000000000..b0f0172a028
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/mac/WebPageInspectorTargetProxyMac.mm
|
|
@@ -0,0 +1,41 @@
|
|
+/*
|
|
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
|
|
+ * Portions Copyright (c) 2010 Motorola Mobility, 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.
|
|
+ */
|
|
+
|
|
+#include "config.h"
|
|
+#include "WebPageInspectorTargetProxy.h"
|
|
+
|
|
+#if PLATFORM(MAC)
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+void WebPageInspectorTargetProxy::platformActivate(String& error) const
|
|
+{
|
|
+ error = "Not Implemented";
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
+
|
|
+#endif
|
|
diff --git a/Source/WebKit/UIProcess/wpe/WebPageInspectorEmulationAgentWPE.cpp b/Source/WebKit/UIProcess/wpe/WebPageInspectorEmulationAgentWPE.cpp
|
|
new file mode 100644
|
|
index 00000000000..5465c0ae99d
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/wpe/WebPageInspectorEmulationAgentWPE.cpp
|
|
@@ -0,0 +1,41 @@
|
|
+/*
|
|
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
|
|
+ * Portions Copyright (c) 2010 Motorola Mobility, 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.
|
|
+ */
|
|
+
|
|
+#include "config.h"
|
|
+#include "WebPageInspectorEmulationAgent.h"
|
|
+
|
|
+#include "WebPageProxy.h"
|
|
+#include <wpe/wpe.h>
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+void WebPageInspectorEmulationAgent::platformSetSize(String& error, int width, int height)
|
|
+{
|
|
+ struct wpe_view_backend* backend = m_page.viewBackend();
|
|
+ wpe_view_backend_dispatch_set_size(backend, width, height);
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/wpe/WebPageInspectorInputAgentWPE.cpp b/Source/WebKit/UIProcess/wpe/WebPageInspectorInputAgentWPE.cpp
|
|
new file mode 100644
|
|
index 00000000000..772ca6bc674
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/wpe/WebPageInspectorInputAgentWPE.cpp
|
|
@@ -0,0 +1,99 @@
|
|
+/*
|
|
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
|
|
+ * Portions Copyright (c) 2010 Motorola Mobility, 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.
|
|
+ */
|
|
+
|
|
+#include "config.h"
|
|
+#include "WebPageInspectorInputAgent.h"
|
|
+
|
|
+#include "NativeWebKeyboardEvent.h"
|
|
+#include "WebPageProxy.h"
|
|
+#include <WebCore/PlatformKeyboardEvent.h>
|
|
+#include <wpe/wpe.h>
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+void WebPageInspectorInputAgent::platformDispatchKeyEvent(String& error, const String& type, const String& keyRef)
|
|
+{
|
|
+}
|
|
+
|
|
+static unsigned toWPEButton(WebMouseEvent::Button button)
|
|
+{
|
|
+ switch (button) {
|
|
+ case WebMouseEvent::NoButton:
|
|
+ case WebMouseEvent::LeftButton:
|
|
+ return 1;
|
|
+ case WebMouseEvent::MiddleButton:
|
|
+ return 3;
|
|
+ case WebMouseEvent::RightButton:
|
|
+ return 2;
|
|
+ }
|
|
+ return 1;
|
|
+}
|
|
+
|
|
+static unsigned toWPEModifiers(OptionSet<WebEvent::Modifier> modifiers)
|
|
+{
|
|
+ unsigned result = 0;
|
|
+ if (modifiers.contains(WebEvent::Modifier::ControlKey))
|
|
+ result |= wpe_input_keyboard_modifier_control;
|
|
+ if (modifiers.contains(WebEvent::Modifier::ShiftKey))
|
|
+ result |= wpe_input_keyboard_modifier_shift;
|
|
+ if (modifiers.contains(WebEvent::Modifier::AltKey))
|
|
+ result |= wpe_input_keyboard_modifier_alt;
|
|
+ if (modifiers.contains(WebEvent::Modifier::CapsLockKey))
|
|
+ fprintf(stderr, "Unsupported modifier CapsLock will be ignored.\n");
|
|
+ return result;
|
|
+}
|
|
+
|
|
+void WebPageInspectorInputAgent::platformDispatchKeyEvent(WebKeyboardEvent::Type type, const String& text, const String& unmodifiedText, const String& key, const String& code, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet<WebEvent::Modifier> modifiers, WallTime timestamp)
|
|
+{
|
|
+ unsigned keyCode = WebCore::PlatformKeyboardEvent::WPEKeyCodeForWindowsKeyCode(windowsVirtualKeyCode);
|
|
+ struct wpe_input_xkb_keymap_entry* entries;
|
|
+ uint32_t entriesCount;
|
|
+ fprintf(stderr, "platformDispatchKeyEvent %s => %d\n", key.ascii().data(), keyCode);
|
|
+ wpe_input_xkb_context_get_entries_for_key_code(wpe_input_xkb_context_get_default(), keyCode, &entries, &entriesCount);
|
|
+ bool pressed = type == WebKeyboardEvent::KeyDown;
|
|
+ struct wpe_input_keyboard_event event = { 0, keyCode, entriesCount ? entries[0].hardware_key_code : 0, pressed, toWPEModifiers(modifiers) };
|
|
+ // event.time = timestamp.secondsSinceEpoch().milliseconds();
|
|
+ wpe_view_backend_dispatch_keyboard_event(m_page.viewBackend(), &event);
|
|
+ free(entries);
|
|
+}
|
|
+
|
|
+void WebPageInspectorInputAgent::platformDispatchMouseEvent(WebMouseEvent::Type type, int x, int y, WebMouseEvent::Button button, OptionSet<WebEvent::Modifier> modifiers)
|
|
+{
|
|
+ wpe_input_pointer_event_type eventType = wpe_input_pointer_event_type_null;
|
|
+ uint32_t eventButton = 0;
|
|
+ uint32_t state = 0;
|
|
+ if (type == WebEvent::MouseDown || type == WebEvent::MouseUp) {
|
|
+ eventType = wpe_input_pointer_event_type_button;
|
|
+ state = (type == WebEvent::MouseDown);
|
|
+ eventButton = toWPEButton(button);
|
|
+ } else if (type == WebEvent::MouseMove) {
|
|
+ eventType = wpe_input_pointer_event_type_motion;
|
|
+ }
|
|
+ struct wpe_input_pointer_event event { eventType, 0, x, y, eventButton, state, toWPEModifiers(modifiers) };
|
|
+ wpe_view_backend_dispatch_pointer_event(m_page.viewBackend(), &event);
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/wpe/WebPageInspectorTargetProxyWPE.cpp b/Source/WebKit/UIProcess/wpe/WebPageInspectorTargetProxyWPE.cpp
|
|
new file mode 100644
|
|
index 00000000000..d64407d5822
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/wpe/WebPageInspectorTargetProxyWPE.cpp
|
|
@@ -0,0 +1,41 @@
|
|
+/*
|
|
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
|
|
+ * Portions Copyright (c) 2010 Motorola Mobility, 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.
|
|
+ */
|
|
+
|
|
+#include "config.h"
|
|
+#include "WebPageInspectorTargetProxy.h"
|
|
+
|
|
+#include "WebPageProxy.h"
|
|
+#include <wpe/wpe.h>
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+void WebPageInspectorTargetProxy::platformActivate(String& error) const
|
|
+{
|
|
+ struct wpe_view_backend* backend = m_page.viewBackend();
|
|
+ wpe_view_backend_add_activity_state(backend, wpe_view_activity_state_visible | wpe_view_activity_state_focused | wpe_view_activity_state_in_window);
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/WebKit.xcodeproj/project.pbxproj b/Source/WebKit/WebKit.xcodeproj/project.pbxproj
|
|
index 21f3f6ad8cd..d0191b4cafd 100644
|
|
--- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj
|
|
+++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj
|
|
@@ -1663,6 +1663,19 @@
|
|
CEE4AE2B1A5DCF430002F49B /* UIKitSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CEE4AE2A1A5DCF430002F49B /* UIKitSPI.h */; };
|
|
D3B9484711FF4B6500032B39 /* WebPopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = D3B9484311FF4B6500032B39 /* WebPopupMenu.h */; };
|
|
D3B9484911FF4B6500032B39 /* WebSearchPopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = D3B9484511FF4B6500032B39 /* WebSearchPopupMenu.h */; };
|
|
+ D71A94322370E025002C4D9E /* InspectorBrowserAgentClientMac.h in Headers */ = {isa = PBXBuildFile; fileRef = D71A94302370E025002C4D9E /* InspectorBrowserAgentClientMac.h */; };
|
|
+ D71A94342370E07A002C4D9E /* InspectorBrowserAgentClient.h in Headers */ = {isa = PBXBuildFile; fileRef = D71A94332370E07A002C4D9E /* InspectorBrowserAgentClient.h */; };
|
|
+ D71A94382370F032002C4D9E /* BrowserInspectorController.h in Headers */ = {isa = PBXBuildFile; fileRef = D71A94372370F032002C4D9E /* BrowserInspectorController.h */; };
|
|
+ D71A943A2370F061002C4D9E /* RemoteInspectorPipe.h in Headers */ = {isa = PBXBuildFile; fileRef = D71A94392370F060002C4D9E /* RemoteInspectorPipe.h */; };
|
|
+ D71A94412371F67E002C4D9E /* WebPageInspectorTargetProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = D71A943E2371F67E002C4D9E /* WebPageInspectorTargetProxy.h */; };
|
|
+ D71A94422371F67E002C4D9E /* WebPageInspectorEmulationAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = D71A943F2371F67E002C4D9E /* WebPageInspectorEmulationAgent.h */; };
|
|
+ D71A94432371F67E002C4D9E /* WebPageInspectorInputAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = D71A94402371F67E002C4D9E /* WebPageInspectorInputAgent.h */; };
|
|
+ D71A944A2372290B002C4D9E /* _WKBrowserInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = D71A94492372290B002C4D9E /* _WKBrowserInspector.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
|
+ D71A944C237239FB002C4D9E /* BrowserInspectorPipe.h in Headers */ = {isa = PBXBuildFile; fileRef = D71A944B237239FB002C4D9E /* BrowserInspectorPipe.h */; };
|
|
+ D79902B1236E9404005D6F7E /* WebPageInspectorEmulationAgentMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = D79902AE236E9404005D6F7E /* WebPageInspectorEmulationAgentMac.mm */; };
|
|
+ D79902B2236E9404005D6F7E /* WebPageInspectorTargetProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = D79902AF236E9404005D6F7E /* WebPageInspectorTargetProxyMac.mm */; };
|
|
+ D79902B3236E9404005D6F7E /* WebPageInspectorInputAgentMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = D79902B0236E9404005D6F7E /* WebPageInspectorInputAgentMac.mm */; };
|
|
+ D7EB04E72372A73B00F744CE /* InspectorBrowserAgentClientMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = D7EB04E62372A73B00F744CE /* InspectorBrowserAgentClientMac.mm */; };
|
|
E105FE5418D7B9DE008F57A8 /* EditingRange.h in Headers */ = {isa = PBXBuildFile; fileRef = E105FE5318D7B9DE008F57A8 /* EditingRange.h */; };
|
|
E11D35AE16B63D1B006D23D7 /* com.apple.WebProcess.sb in Resources */ = {isa = PBXBuildFile; fileRef = E1967E37150AB5E200C73169 /* com.apple.WebProcess.sb */; };
|
|
E14A954A16E016A40068DE82 /* NetworkProcessPlatformStrategies.h in Headers */ = {isa = PBXBuildFile; fileRef = E14A954816E016A40068DE82 /* NetworkProcessPlatformStrategies.h */; };
|
|
@@ -4692,6 +4705,20 @@
|
|
D3B9484311FF4B6500032B39 /* WebPopupMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPopupMenu.h; sourceTree = "<group>"; };
|
|
D3B9484411FF4B6500032B39 /* WebSearchPopupMenu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSearchPopupMenu.cpp; sourceTree = "<group>"; };
|
|
D3B9484511FF4B6500032B39 /* WebSearchPopupMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSearchPopupMenu.h; sourceTree = "<group>"; };
|
|
+ D71A942C2370DF81002C4D9E /* WKBrowserInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBrowserInspector.h; sourceTree = "<group>"; };
|
|
+ D71A94302370E025002C4D9E /* InspectorBrowserAgentClientMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorBrowserAgentClientMac.h; sourceTree = "<group>"; };
|
|
+ D71A94332370E07A002C4D9E /* InspectorBrowserAgentClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorBrowserAgentClient.h; sourceTree = "<group>"; };
|
|
+ D71A94372370F032002C4D9E /* BrowserInspectorController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BrowserInspectorController.h; sourceTree = "<group>"; };
|
|
+ D71A94392370F060002C4D9E /* RemoteInspectorPipe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteInspectorPipe.h; sourceTree = "<group>"; };
|
|
+ D71A943E2371F67E002C4D9E /* WebPageInspectorTargetProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageInspectorTargetProxy.h; sourceTree = "<group>"; };
|
|
+ D71A943F2371F67E002C4D9E /* WebPageInspectorEmulationAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageInspectorEmulationAgent.h; sourceTree = "<group>"; };
|
|
+ D71A94402371F67E002C4D9E /* WebPageInspectorInputAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageInspectorInputAgent.h; sourceTree = "<group>"; };
|
|
+ D71A94492372290B002C4D9E /* _WKBrowserInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKBrowserInspector.h; sourceTree = "<group>"; };
|
|
+ D71A944B237239FB002C4D9E /* BrowserInspectorPipe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BrowserInspectorPipe.h; sourceTree = "<group>"; };
|
|
+ D79902AE236E9404005D6F7E /* WebPageInspectorEmulationAgentMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPageInspectorEmulationAgentMac.mm; sourceTree = "<group>"; };
|
|
+ D79902AF236E9404005D6F7E /* WebPageInspectorTargetProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPageInspectorTargetProxyMac.mm; sourceTree = "<group>"; };
|
|
+ D79902B0236E9404005D6F7E /* WebPageInspectorInputAgentMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPageInspectorInputAgentMac.mm; sourceTree = "<group>"; };
|
|
+ D7EB04E62372A73B00F744CE /* InspectorBrowserAgentClientMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InspectorBrowserAgentClientMac.mm; sourceTree = "<group>"; };
|
|
DF58C6311371AC5800F9A37C /* NativeWebWheelEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeWebWheelEvent.h; sourceTree = "<group>"; };
|
|
DF58C6351371ACA000F9A37C /* NativeWebWheelEventMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NativeWebWheelEventMac.mm; sourceTree = "<group>"; };
|
|
E105FE5318D7B9DE008F57A8 /* EditingRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditingRange.h; sourceTree = "<group>"; };
|
|
@@ -6294,6 +6321,7 @@
|
|
37C4C08318149C2A003688B9 /* Cocoa */ = {
|
|
isa = PBXGroup;
|
|
children = (
|
|
+ D71A94492372290B002C4D9E /* _WKBrowserInspector.h */,
|
|
1A43E826188F38E2009E4D30 /* Deprecated */,
|
|
37A5E01218BBF937000A081E /* _WKActivatedElementInfo.h */,
|
|
37A5E01118BBF937000A081E /* _WKActivatedElementInfo.mm */,
|
|
@@ -7774,6 +7802,13 @@
|
|
BC032DC310F438260058C15A /* UIProcess */ = {
|
|
isa = PBXGroup;
|
|
children = (
|
|
+ D71A944B237239FB002C4D9E /* BrowserInspectorPipe.h */,
|
|
+ D71A943F2371F67E002C4D9E /* WebPageInspectorEmulationAgent.h */,
|
|
+ D71A94402371F67E002C4D9E /* WebPageInspectorInputAgent.h */,
|
|
+ D71A943E2371F67E002C4D9E /* WebPageInspectorTargetProxy.h */,
|
|
+ D71A94392370F060002C4D9E /* RemoteInspectorPipe.h */,
|
|
+ D71A94372370F032002C4D9E /* BrowserInspectorController.h */,
|
|
+ D71A94332370E07A002C4D9E /* InspectorBrowserAgentClient.h */,
|
|
BC032DC410F4387C0058C15A /* API */,
|
|
512F588D12A8836F00629530 /* Authentication */,
|
|
9955A6E81C79809000EB6A93 /* Automation */,
|
|
@@ -8051,6 +8086,7 @@
|
|
BC0C376610F807660076D7CB /* C */ = {
|
|
isa = PBXGroup;
|
|
children = (
|
|
+ D71A942C2370DF81002C4D9E /* WKBrowserInspector.h */,
|
|
5123CF18133D25E60056F800 /* cg */,
|
|
6EE849C41368D9040038D481 /* mac */,
|
|
BCB63477116BF10600603215 /* WebKit2_C.h */,
|
|
@@ -8646,6 +8682,11 @@
|
|
BCCF085C113F3B7500C650C5 /* mac */ = {
|
|
isa = PBXGroup;
|
|
children = (
|
|
+ D7EB04E62372A73B00F744CE /* InspectorBrowserAgentClientMac.mm */,
|
|
+ D71A94302370E025002C4D9E /* InspectorBrowserAgentClientMac.h */,
|
|
+ D79902AE236E9404005D6F7E /* WebPageInspectorEmulationAgentMac.mm */,
|
|
+ D79902B0236E9404005D6F7E /* WebPageInspectorInputAgentMac.mm */,
|
|
+ D79902AF236E9404005D6F7E /* WebPageInspectorTargetProxyMac.mm */,
|
|
B878B613133428DC006888E9 /* CorrectionPanel.h */,
|
|
B878B614133428DC006888E9 /* CorrectionPanel.mm */,
|
|
C1817362205844A900DFDA65 /* DisplayLink.cpp */,
|
|
@@ -9323,6 +9364,7 @@
|
|
510F59101DDE296900412FF5 /* _WKIconLoadingDelegate.h in Headers */,
|
|
37A64E5518F38E3C00EB30F1 /* _WKInputDelegate.h in Headers */,
|
|
5CAFDE452130846300B1F7E1 /* _WKInspector.h in Headers */,
|
|
+ D71A944A2372290B002C4D9E /* _WKBrowserInspector.h in Headers */,
|
|
5CAFDE472130846A00B1F7E1 /* _WKInspectorInternal.h in Headers */,
|
|
A5C0F0AB2000658200536536 /* _WKInspectorWindow.h in Headers */,
|
|
31B362952141EBCD007BFA53 /* _WKInternalDebugFeature.h in Headers */,
|
|
@@ -9434,6 +9476,7 @@
|
|
7C89D2981A6753B2003A5FDE /* APIPageConfiguration.h in Headers */,
|
|
1AC1336C18565C7A00F3EC05 /* APIPageHandle.h in Headers */,
|
|
1AFDD3151891B54000153970 /* APIPolicyClient.h in Headers */,
|
|
+ D71A94382370F032002C4D9E /* BrowserInspectorController.h in Headers */,
|
|
7CE4D2201A4914CA00C7F152 /* APIProcessPoolConfiguration.h in Headers */,
|
|
F634445612A885C8000612D8 /* APISecurityOrigin.h in Headers */,
|
|
1AFDE6621954E9B100C48FFA /* APISessionState.h in Headers */,
|
|
@@ -9552,6 +9595,7 @@
|
|
BC06F43A12DBCCFB002D78DE /* GeolocationPermissionRequestProxy.h in Headers */,
|
|
2DA944A41884E4F000ED86DB /* GestureTypes.h in Headers */,
|
|
2DA049B8180CCD0A00AAFA9E /* GraphicsLayerCARemote.h in Headers */,
|
|
+ D71A94342370E07A002C4D9E /* InspectorBrowserAgentClient.h in Headers */,
|
|
C0CE72AD1247E78D00BC0EC4 /* HandleMessage.h in Headers */,
|
|
1AC75A1B1B3368270056745B /* HangDetectionDisabler.h in Headers */,
|
|
57AC8F50217FEED90055438C /* HidConnection.h in Headers */,
|
|
@@ -9675,8 +9719,10 @@
|
|
41DC45961E3D6E2200B11F51 /* NetworkRTCProvider.h in Headers */,
|
|
413075AB1DE85F330039EC69 /* NetworkRTCSocket.h in Headers */,
|
|
5C20CBA01BB1ECD800895BB1 /* NetworkSession.h in Headers */,
|
|
+ D71A94422371F67E002C4D9E /* WebPageInspectorEmulationAgent.h in Headers */,
|
|
532159551DBAE7290054AA3C /* NetworkSessionCocoa.h in Headers */,
|
|
417915B92257046F00D6F97E /* NetworkSocketChannel.h in Headers */,
|
|
+ D71A943A2370F061002C4D9E /* RemoteInspectorPipe.h in Headers */,
|
|
570DAAC22303730300E8FC04 /* NfcConnection.h in Headers */,
|
|
570DAAAE23026F5C00E8FC04 /* NfcService.h in Headers */,
|
|
31A2EC5614899C0900810D71 /* NotificationPermissionRequest.h in Headers */,
|
|
@@ -9758,6 +9804,7 @@
|
|
CD2865EE2255562000606AC7 /* ProcessTaskStateObserver.h in Headers */,
|
|
463FD4821EB94EC000A2982C /* ProcessTerminationReason.h in Headers */,
|
|
86E67A251910B9D100004AB7 /* ProcessThrottler.h in Headers */,
|
|
+ D71A944C237239FB002C4D9E /* BrowserInspectorPipe.h in Headers */,
|
|
83048AE61ACA45DC0082C832 /* ProcessThrottlerClient.h in Headers */,
|
|
A1E688701F6E2BAB007006A6 /* QuarantineSPI.h in Headers */,
|
|
57FD318222B3515E008D0E8B /* RedirectSOAuthorizationSession.h in Headers */,
|
|
@@ -9920,6 +9967,7 @@
|
|
F430E94422473DFF005FE053 /* WebContentMode.h in Headers */,
|
|
31A505FA1680025500A930EB /* WebContextClient.h in Headers */,
|
|
BC09B8F9147460F7005F5625 /* WebContextConnectionClient.h in Headers */,
|
|
+ D71A94412371F67E002C4D9E /* WebPageInspectorTargetProxy.h in Headers */,
|
|
BCDE059B11CDA8AE00E41AF1 /* WebContextInjectedBundleClient.h in Headers */,
|
|
51871B5C127CB89D00F76232 /* WebContextMenu.h in Headers */,
|
|
BC032D7710F4378D0058C15A /* WebContextMenuClient.h in Headers */,
|
|
@@ -10153,6 +10201,7 @@
|
|
BCD25F1711D6BDE100169B0E /* WKBundleFrame.h in Headers */,
|
|
BCF049E611FE20F600F86A58 /* WKBundleFramePrivate.h in Headers */,
|
|
BC49862F124D18C100D834E1 /* WKBundleHitTestResult.h in Headers */,
|
|
+ D71A94432371F67E002C4D9E /* WebPageInspectorInputAgent.h in Headers */,
|
|
BC204EF211C83EC8008F3375 /* WKBundleInitialize.h in Headers */,
|
|
65B86F1E12F11DE300B7DD8A /* WKBundleInspector.h in Headers */,
|
|
1A8B66B41BC45B010082DF77 /* WKBundleMac.h in Headers */,
|
|
@@ -10346,6 +10395,7 @@
|
|
1AB8A1F818400BB800E9AE69 /* WKPageContextMenuClient.h in Headers */,
|
|
8372DB251A674C8F00C697C5 /* WKPageDiagnosticLoggingClient.h in Headers */,
|
|
1AB8A1F418400B8F00E9AE69 /* WKPageFindClient.h in Headers */,
|
|
+ D71A94322370E025002C4D9E /* InspectorBrowserAgentClientMac.h in Headers */,
|
|
1AB8A1F618400B9D00E9AE69 /* WKPageFindMatchesClient.h in Headers */,
|
|
1AB8A1F018400B0000E9AE69 /* WKPageFormClient.h in Headers */,
|
|
BC7B633712A45ABA00D174A4 /* WKPageGroup.h in Headers */,
|
|
@@ -11302,6 +11352,7 @@
|
|
2D92A781212B6A7100F493FD /* MessageReceiverMap.cpp in Sources */,
|
|
2D92A782212B6A7100F493FD /* MessageSender.cpp in Sources */,
|
|
2D92A77A212B6A6100F493FD /* Module.cpp in Sources */,
|
|
+ D79902B1236E9404005D6F7E /* WebPageInspectorEmulationAgentMac.mm in Sources */,
|
|
57B826452304F14000B72EB0 /* NearFieldSoftLink.mm in Sources */,
|
|
2D913443212CF9F000128AFD /* NetscapeBrowserFuncs.cpp in Sources */,
|
|
2D913444212CF9F000128AFD /* NetscapePlugin.cpp in Sources */,
|
|
@@ -11326,6 +11377,7 @@
|
|
1A2D8439127F65D5001EB962 /* NPObjectMessageReceiverMessageReceiver.cpp in Sources */,
|
|
2D92A792212B6AD400F493FD /* NPObjectProxy.cpp in Sources */,
|
|
2D92A793212B6AD400F493FD /* NPRemoteObjectMap.cpp in Sources */,
|
|
+ D7EB04E72372A73B00F744CE /* InspectorBrowserAgentClientMac.mm in Sources */,
|
|
2D913447212CF9F000128AFD /* NPRuntimeObjectMap.cpp in Sources */,
|
|
2D913448212CF9F000128AFD /* NPRuntimeUtilities.cpp in Sources */,
|
|
2D92A794212B6AD400F493FD /* NPVariantData.cpp in Sources */,
|
|
@@ -11365,11 +11417,13 @@
|
|
A1ADAFB62368E6A8009CB776 /* SharedMemory.cpp in Sources */,
|
|
2DE6943D18BD2A68005C15E5 /* SmartMagnificationControllerMessageReceiver.cpp in Sources */,
|
|
1A334DED16DE8F88006A8E38 /* StorageAreaMapMessageReceiver.cpp in Sources */,
|
|
+ D79902B3236E9404005D6F7E /* WebPageInspectorInputAgentMac.mm in Sources */,
|
|
9368EEDE2303A90200BDB11A /* StorageManagerSetMessageReceiver.cpp in Sources */,
|
|
2D92A783212B6A7100F493FD /* StringReference.cpp in Sources */,
|
|
2D11B7512126A282006F8878 /* UnifiedSource1-mm.mm in Sources */,
|
|
2D11B7522126A282006F8878 /* UnifiedSource1.cpp in Sources */,
|
|
2D11B7542126A282006F8878 /* UnifiedSource2.cpp in Sources */,
|
|
+ D79902B2236E9404005D6F7E /* WebPageInspectorTargetProxyMac.mm in Sources */,
|
|
2D11B7532126A282006F8878 /* UnifiedSource2-mm.mm in Sources */,
|
|
2D11B7562126A282006F8878 /* UnifiedSource3.cpp in Sources */,
|
|
2D11B7552126A282006F8878 /* UnifiedSource3-mm.mm in Sources */,
|
|
diff --git a/Source/WebKit/WebProcess/WebPage/WebPageInspectorTarget.cpp b/Source/WebKit/WebProcess/WebPage/WebPageInspectorTarget.cpp
|
|
index a70f6fd5209..f02e5c774a4 100644
|
|
--- a/Source/WebKit/WebProcess/WebPage/WebPageInspectorTarget.cpp
|
|
+++ b/Source/WebKit/WebProcess/WebPage/WebPageInspectorTarget.cpp
|
|
@@ -26,6 +26,8 @@
|
|
#include "config.h"
|
|
#include "WebPageInspectorTarget.h"
|
|
|
|
+#include "FrameInfoData.h"
|
|
+#include "WebFrame.h"
|
|
#include "WebPage.h"
|
|
#include "WebPageInspectorTargetFrontendChannel.h"
|
|
#include <WebCore/InspectorController.h>
|
|
@@ -45,6 +47,11 @@ String WebPageInspectorTarget::identifier() const
|
|
return toTargetID(m_page.identifier());
|
|
}
|
|
|
|
+String WebPageInspectorTarget::url() const
|
|
+{
|
|
+ return m_page.mainWebFrame()->info().request.url().string();
|
|
+}
|
|
+
|
|
void WebPageInspectorTarget::connect(Inspector::FrontendChannel::ConnectionType connectionType)
|
|
{
|
|
if (m_channel)
|
|
diff --git a/Source/WebKit/WebProcess/WebPage/WebPageInspectorTarget.h b/Source/WebKit/WebProcess/WebPage/WebPageInspectorTarget.h
|
|
index 6cbd7fad5ff..176c46f186b 100644
|
|
--- a/Source/WebKit/WebProcess/WebPage/WebPageInspectorTarget.h
|
|
+++ b/Source/WebKit/WebProcess/WebPage/WebPageInspectorTarget.h
|
|
@@ -44,6 +44,7 @@ public:
|
|
Inspector::InspectorTargetType type() const final { return Inspector::InspectorTargetType::Page; }
|
|
|
|
String identifier() const final;
|
|
+ String url() const final;
|
|
|
|
void connect(Inspector::FrontendChannel::ConnectionType) override;
|
|
void disconnect() override;
|
|
diff --git a/Source/WebKit/WebProcess/WebProcess.cpp b/Source/WebKit/WebProcess/WebProcess.cpp
|
|
index 6c16fa01df1..2b79bf41601 100644
|
|
--- a/Source/WebKit/WebProcess/WebProcess.cpp
|
|
+++ b/Source/WebKit/WebProcess/WebProcess.cpp
|
|
@@ -625,7 +625,8 @@ void WebProcess::setCacheModel(CacheModel cacheModel)
|
|
unsigned cacheMaxDeadCapacity = 0;
|
|
Seconds deadDecodedDataDeletionInterval;
|
|
unsigned backForwardCacheSize = 0;
|
|
- calculateMemoryCacheSizes(cacheModel, cacheTotalCapacity, cacheMinDeadCapacity, cacheMaxDeadCapacity, deadDecodedDataDeletionInterval, backForwardCacheSize);
|
|
+ // FIXME(yurys): forcefully disable cache becaus it swallows Runtime.executionContextCreated events on goBack navigation.
|
|
+ // calculateMemoryCacheSizes(cacheModel, cacheTotalCapacity, cacheMinDeadCapacity, cacheMaxDeadCapacity, deadDecodedDataDeletionInterval, backForwardCacheSize);
|
|
|
|
auto& memoryCache = MemoryCache::singleton();
|
|
memoryCache.setCapacities(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity);
|
|
diff --git a/Tools/MiniBrowser/gtk/main.c b/Tools/MiniBrowser/gtk/main.c
|
|
index 93d93592bc4..6e27ef37742 100644
|
|
--- a/Tools/MiniBrowser/gtk/main.c
|
|
+++ b/Tools/MiniBrowser/gtk/main.c
|
|
@@ -53,6 +53,7 @@ static const char *cookiesFile;
|
|
static const char *cookiesPolicy;
|
|
static const char *proxy;
|
|
static gboolean darkMode;
|
|
+static gboolean inspectorPipe;
|
|
static gboolean printVersion;
|
|
|
|
typedef enum {
|
|
@@ -121,6 +122,7 @@ static const GOptionEntry commandLineOptions[] =
|
|
{ "ignore-tls-errors", 0, 0, G_OPTION_ARG_NONE, &ignoreTLSErrors, "Ignore TLS errors", NULL },
|
|
{ "content-filter", 0, 0, G_OPTION_ARG_FILENAME, &contentFilter, "JSON with content filtering rules", "FILE" },
|
|
{ "version", 'v', 0, G_OPTION_ARG_NONE, &printVersion, "Print the WebKitGTK version", NULL },
|
|
+ { "inspector-pipe", 0, 0, G_OPTION_ARG_NONE, &inspectorPipe, "Open pipe connection to the remote inspector", NULL },
|
|
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &uriArguments, 0, "[URL…]" },
|
|
{ 0, 0, 0, 0, 0, 0, 0 }
|
|
};
|
|
@@ -492,6 +494,29 @@ static void filterSavedCallback(WebKitUserContentFilterStore *store, GAsyncResul
|
|
g_main_loop_quit(data->mainLoop);
|
|
}
|
|
|
|
+static WebKitWebView *createNewPage(WebKitBrowserInspector *browser_inspector, WebKitWebContext *context)
|
|
+{
|
|
+ WebKitWebView *newWebView = WEBKIT_WEB_VIEW(g_object_new(WEBKIT_TYPE_WEB_VIEW,
|
|
+ "web-context", context,
|
|
+ "is-ephemeral", webkit_web_context_is_ephemeral(context),
|
|
+ "is-controlled-by-automation", TRUE,
|
|
+ NULL));
|
|
+ GtkWidget *newWindow = browser_window_new(NULL, context);
|
|
+ browser_window_append_view(BROWSER_WINDOW(newWindow), newWebView);
|
|
+ gtk_widget_grab_focus(GTK_WIDGET(newWebView));
|
|
+ gtk_widget_show(GTK_WIDGET(newWindow));
|
|
+ webkit_web_view_load_uri(newWebView, "about:blank");
|
|
+ return newWebView;
|
|
+}
|
|
+
|
|
+static void configureBrowserInspectorPipe()
|
|
+{
|
|
+ WebKitBrowserInspector* browserInspector = webkit_browser_inspector_get_default();
|
|
+ g_signal_connect(browserInspector, "create-new-page", G_CALLBACK(createNewPage), NULL);
|
|
+
|
|
+ webkit_browser_inspector_initialize_pipe();
|
|
+}
|
|
+
|
|
int main(int argc, char *argv[])
|
|
{
|
|
#if ENABLE_DEVELOPER_MODE
|
|
@@ -539,6 +564,9 @@ int main(int argc, char *argv[])
|
|
WebKitWebContext *webContext = g_object_new(WEBKIT_TYPE_WEB_CONTEXT, "website-data-manager", manager, "process-swap-on-cross-site-navigation-enabled", TRUE, NULL);
|
|
g_object_unref(manager);
|
|
|
|
+ if (inspectorPipe)
|
|
+ configureBrowserInspectorPipe();
|
|
+
|
|
if (cookiesPolicy) {
|
|
WebKitCookieManager *cookieManager = webkit_web_context_get_cookie_manager(webContext);
|
|
GEnumClass *enumClass = g_type_class_ref(WEBKIT_TYPE_COOKIE_ACCEPT_POLICY);
|
|
diff --git a/Tools/MiniBrowser/mac/AppDelegate.h b/Tools/MiniBrowser/mac/AppDelegate.h
|
|
index 45ef1a6424e..928486be325 100644
|
|
--- a/Tools/MiniBrowser/mac/AppDelegate.h
|
|
+++ b/Tools/MiniBrowser/mac/AppDelegate.h
|
|
@@ -23,9 +23,11 @@
|
|
* THE POSSIBILITY OF SUCH DAMAGE.
|
|
*/
|
|
|
|
+#import <WebKit/_WKBrowserInspector.h>
|
|
+
|
|
@class ExtensionManagerWindowController;
|
|
|
|
-@interface BrowserAppDelegate : NSObject <NSApplicationDelegate> {
|
|
+@interface BrowserAppDelegate : NSObject <NSApplicationDelegate, _WKBrowserInspectorDelegate> {
|
|
NSMutableSet *_browserWindowControllers;
|
|
ExtensionManagerWindowController *_extensionManagerWindowController;
|
|
|
|
diff --git a/Tools/MiniBrowser/mac/AppDelegate.m b/Tools/MiniBrowser/mac/AppDelegate.m
|
|
index b6af4ef724f..46c39768156 100644
|
|
--- a/Tools/MiniBrowser/mac/AppDelegate.m
|
|
+++ b/Tools/MiniBrowser/mac/AppDelegate.m
|
|
@@ -61,7 +61,9 @@ - (id)init
|
|
_browserWindowControllers = [[NSMutableSet alloc] init];
|
|
_extensionManagerWindowController = [[ExtensionManagerWindowController alloc] init];
|
|
}
|
|
-
|
|
+ NSArray *arguments = [[NSProcessInfo processInfo] arguments];
|
|
+ if ([arguments containsObject: @"--inspector-pipe"])
|
|
+ [_WKBrowserInspector initializeRemoteInspectorPipe:self];
|
|
return self;
|
|
}
|
|
|
|
@@ -158,9 +160,9 @@ - (BrowserWindowController *)createBrowserWindowController:(id)sender
|
|
}
|
|
|
|
if (!useWebKit2)
|
|
- controller = [[WK1BrowserWindowController alloc] initWithWindowNibName:@"BrowserWindow"];
|
|
+ controller = [[[WK1BrowserWindowController alloc] initWithWindowNibName:@"BrowserWindow"] autorelease];
|
|
else
|
|
- controller = [[WK2BrowserWindowController alloc] initWithConfiguration:defaultConfiguration()];
|
|
+ controller = [[[WK2BrowserWindowController alloc] initWithConfiguration:defaultConfiguration()] autorelease];
|
|
|
|
if (makeEditable)
|
|
controller.editable = YES;
|
|
@@ -345,4 +347,21 @@ - (IBAction)clearDefaultStoreWebsiteData:(id)sender
|
|
}];
|
|
}
|
|
|
|
+#pragma mark WKBrowserInspectorDelegate
|
|
+
|
|
+- (WKWebView *)createNewPage
|
|
+{
|
|
+ WK2BrowserWindowController *controller = [[[WK2BrowserWindowController alloc] initWithConfiguration:defaultConfiguration()] autorelease];
|
|
+ [_browserWindowControllers addObject:controller];
|
|
+
|
|
+ [[controller window] makeKeyAndOrderFront:self];
|
|
+ [controller loadURLString:[SettingsController shared].defaultURL];
|
|
+ return [controller webView];
|
|
+}
|
|
+
|
|
+- (void)quit
|
|
+{
|
|
+ [NSApp performSelector:@selector(terminate:) withObject:nil afterDelay:0.0];
|
|
+}
|
|
+
|
|
@end
|
|
diff --git a/Tools/MiniBrowser/mac/WK2BrowserWindowController.h b/Tools/MiniBrowser/mac/WK2BrowserWindowController.h
|
|
index 6f0949b0f4a..e774433031a 100644
|
|
--- a/Tools/MiniBrowser/mac/WK2BrowserWindowController.h
|
|
+++ b/Tools/MiniBrowser/mac/WK2BrowserWindowController.h
|
|
@@ -25,8 +25,11 @@
|
|
|
|
#import "BrowserWindowController.h"
|
|
|
|
+@class WKWebView;
|
|
+
|
|
@interface WK2BrowserWindowController : BrowserWindowController
|
|
|
|
- (instancetype)initWithConfiguration:(WKWebViewConfiguration *)configuration;
|
|
+- (WKWebView *)webView;
|
|
|
|
@end
|
|
diff --git a/Tools/MiniBrowser/mac/WK2BrowserWindowController.m b/Tools/MiniBrowser/mac/WK2BrowserWindowController.m
|
|
index 3ca15403d5f..5905526473d 100644
|
|
--- a/Tools/MiniBrowser/mac/WK2BrowserWindowController.m
|
|
+++ b/Tools/MiniBrowser/mac/WK2BrowserWindowController.m
|
|
@@ -105,7 +105,7 @@ - (void)awakeFromNib
|
|
// telling WebKit to load every icon referenced by the page.
|
|
if ([[SettingsController shared] loadsAllSiteIcons])
|
|
_webView._iconLoadingDelegate = self;
|
|
-
|
|
+
|
|
_webView._observedRenderingProgressEvents = _WKRenderingProgressEventFirstLayout
|
|
| _WKRenderingProgressEventFirstVisuallyNonEmptyLayout
|
|
| _WKRenderingProgressEventFirstPaintWithSignificantArea
|
|
@@ -139,14 +139,10 @@ - (instancetype)initWithConfiguration:(WKWebViewConfiguration *)configuration
|
|
|
|
- (void)dealloc
|
|
{
|
|
- [_webView removeObserver:self forKeyPath:@"title"];
|
|
- [_webView removeObserver:self forKeyPath:@"URL"];
|
|
-
|
|
[progressIndicator unbind:NSHiddenBinding];
|
|
[progressIndicator unbind:NSValueBinding];
|
|
|
|
[_textFinder release];
|
|
-
|
|
[_webView release];
|
|
[_configuration release];
|
|
|
|
@@ -369,9 +365,15 @@ - (BOOL)windowShouldClose:(id)sender
|
|
- (void)windowWillClose:(NSNotification *)notification
|
|
{
|
|
[(BrowserAppDelegate *)[[NSApplication sharedApplication] delegate] browserWindowWillClose:self.window];
|
|
+ [_webView removeObserver:self forKeyPath:@"title"];
|
|
+ [_webView removeObserver:self forKeyPath:@"URL"];
|
|
[self autorelease];
|
|
}
|
|
|
|
+- (void)webViewDidClose:(WKWebView *)webView {
|
|
+ [self.window close];
|
|
+}
|
|
+
|
|
#define DefaultMinimumZoomFactor (.5)
|
|
#define DefaultMaximumZoomFactor (3.0)
|
|
#define DefaultZoomFactorRatio (1.2)
|
|
@@ -845,4 +847,9 @@ - (IBAction)saveAsWebArchive:(id)sender
|
|
}];
|
|
}
|
|
|
|
+- (WKWebView *)webView
|
|
+{
|
|
+ return _webView;
|
|
+}
|
|
+
|
|
@end
|
|
diff --git a/Tools/MiniBrowser/wpe/main.cpp b/Tools/MiniBrowser/wpe/main.cpp
|
|
index 2d183d39412..d94d4f06fc5 100644
|
|
--- a/Tools/MiniBrowser/wpe/main.cpp
|
|
+++ b/Tools/MiniBrowser/wpe/main.cpp
|
|
@@ -172,6 +172,41 @@ static WebKitWebView* createWebView(WebKitWebView* webView, WebKitNavigationActi
|
|
return newWebView;
|
|
}
|
|
|
|
+static WebKitWebView *createNewPage(WebKitBrowserInspector*, WebKitWebContext *context)
|
|
+{
|
|
+ auto backend = createViewBackend(1280, 720);
|
|
+ struct wpe_view_backend* wpeBackend = backend->backend();
|
|
+ if (!wpeBackend)
|
|
+ return nullptr;
|
|
+
|
|
+ auto* viewBackend = webkit_web_view_backend_new(wpeBackend,
|
|
+ [](gpointer data) {
|
|
+ delete static_cast<WPEToolingBackends::ViewBackend*>(data);
|
|
+ }, backend.release());
|
|
+
|
|
+ auto* newWebView = webkit_web_view_new_with_context(viewBackend, context);
|
|
+
|
|
+ g_signal_connect(newWebView, "close", G_CALLBACK(webViewClose), nullptr);
|
|
+
|
|
+ webkit_web_view_load_uri(newWebView, "about:blank");
|
|
+
|
|
+ return newWebView;
|
|
+
|
|
+}
|
|
+
|
|
+static void closeAll(WebKitBrowserInspector*, GMainLoop* mainLoop)
|
|
+{
|
|
+ g_main_loop_quit(mainLoop);
|
|
+}
|
|
+
|
|
+static void configureBrowserInspector(GMainLoop* mainLoop, WebKitWebView *firstWebView)
|
|
+{
|
|
+ WebKitBrowserInspector* browserInspector = webkit_browser_inspector_get_default();
|
|
+ g_signal_connect(browserInspector, "create-new-page", G_CALLBACK(createNewPage), NULL);
|
|
+ // FIXME: This signal is received only when closeAll is called. We should not rely on that.
|
|
+ g_signal_connect(firstWebView, "close", G_CALLBACK(closeAll), mainLoop);
|
|
+}
|
|
+
|
|
int main(int argc, char *argv[])
|
|
{
|
|
#if ENABLE_DEVELOPER_MODE
|
|
@@ -301,6 +336,8 @@ int main(int argc, char *argv[])
|
|
g_signal_connect(webView, "permission-request", G_CALLBACK(decidePermissionRequest), nullptr);
|
|
g_signal_connect(webView, "create", G_CALLBACK(createWebView), nullptr);
|
|
|
|
+ configureBrowserInspector(loop, webView);
|
|
+
|
|
if (ignoreTLSErrors)
|
|
webkit_web_context_set_tls_errors_policy(webContext, WEBKIT_TLS_ERRORS_POLICY_IGNORE);
|
|
|
|
--
|
|
2.17.1
|
|
|