mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-15 22:22:53 +03:00
15068 lines
667 KiB
Diff
15068 lines
667 KiB
Diff
diff --git a/Source/JavaScriptCore/CMakeLists.txt b/Source/JavaScriptCore/CMakeLists.txt
|
|
index 91e427c30c51163edd9f106d42f95e09d02be9c4..b7a591467cea135960be9ac4d8fbaadcdcdcaf5b 100644
|
|
--- a/Source/JavaScriptCore/CMakeLists.txt
|
|
+++ b/Source/JavaScriptCore/CMakeLists.txt
|
|
@@ -1144,16 +1144,20 @@ 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
|
|
+ ${JAVASCRIPTCORE_DIR}/inspector/protocol/Dialog.json
|
|
${JAVASCRIPTCORE_DIR}/inspector/protocol/DOM.json
|
|
${JAVASCRIPTCORE_DIR}/inspector/protocol/DOMDebugger.json
|
|
${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 e2a36fa8764909abfd0e1896d3a9a7c361f1b23a..e3ed01ae7cf8ce68a4fd8308e0ea2819638a78d3 100644
|
|
--- a/Source/JavaScriptCore/DerivedSources.make
|
|
+++ b/Source/JavaScriptCore/DerivedSources.make
|
|
@@ -241,16 +241,20 @@ 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 \
|
|
+ $(JavaScriptCore)/inspector/protocol/Dialog.json \
|
|
$(JavaScriptCore)/inspector/protocol/DOM.json \
|
|
$(JavaScriptCore)/inspector/protocol/DOMDebugger.json \
|
|
$(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/bindings/ScriptValue.cpp b/Source/JavaScriptCore/bindings/ScriptValue.cpp
|
|
index dece6ac51e3a85b1e094e405effc6203887ddfd4..9bf7519d894eceb06b40d754c4fb7940399eba84 100644
|
|
--- a/Source/JavaScriptCore/bindings/ScriptValue.cpp
|
|
+++ b/Source/JavaScriptCore/bindings/ScriptValue.cpp
|
|
@@ -81,7 +81,10 @@ static RefPtr<JSON::Value> jsToInspectorValue(JSGlobalObject* globalObject, JSVa
|
|
PropertyNameArray propertyNames(vm, PropertyNameMode::Strings, PrivateSymbolMode::Exclude);
|
|
object.methodTable(vm)->getOwnPropertyNames(&object, globalObject, propertyNames, EnumerationMode());
|
|
for (auto& name : propertyNames) {
|
|
- auto inspectorValue = jsToInspectorValue(globalObject, object.get(globalObject, name), maxDepth);
|
|
+ JSValue childValue = object.get(globalObject, name);
|
|
+ if (childValue.isUndefined())
|
|
+ continue;
|
|
+ auto inspectorValue = jsToInspectorValue(globalObject, childValue, maxDepth);
|
|
if (!inspectorValue)
|
|
return nullptr;
|
|
inspectorObject->setValue(name.string(), WTFMove(inspectorValue));
|
|
diff --git a/Source/JavaScriptCore/inspector/IdentifiersFactory.cpp b/Source/JavaScriptCore/inspector/IdentifiersFactory.cpp
|
|
index 95cd87b01b15cb8667e57bc5bb51a71f06bc3760..0481fa93227f297be9d9cf000c5a72235956a390 100644
|
|
--- a/Source/JavaScriptCore/inspector/IdentifiersFactory.cpp
|
|
+++ b/Source/JavaScriptCore/inspector/IdentifiersFactory.cpp
|
|
@@ -30,14 +30,21 @@
|
|
namespace Inspector {
|
|
|
|
namespace {
|
|
+static uint64_t s_processID = 0;
|
|
static long s_lastUsedIdentifier = 0;
|
|
}
|
|
|
|
static String addPrefixToIdentifier(const String& identifier)
|
|
{
|
|
- return makeString("0.", identifier);
|
|
+ return makeString(s_processID, ".", identifier);
|
|
}
|
|
|
|
+void IdentifiersFactory::initializeWithProcessID(uint64_t processID) {
|
|
+ ASSERT(!s_processID);
|
|
+ s_processID = processID;
|
|
+}
|
|
+
|
|
+
|
|
String IdentifiersFactory::createIdentifier()
|
|
{
|
|
return addPrefixToIdentifier(String::number(++s_lastUsedIdentifier));
|
|
diff --git a/Source/JavaScriptCore/inspector/IdentifiersFactory.h b/Source/JavaScriptCore/inspector/IdentifiersFactory.h
|
|
index eb25aedee4cd9ebe007e06c2515b37ee095b06f4..badf6559595c8377db1089ca3c25008e1be2c8f1 100644
|
|
--- a/Source/JavaScriptCore/inspector/IdentifiersFactory.h
|
|
+++ b/Source/JavaScriptCore/inspector/IdentifiersFactory.h
|
|
@@ -31,6 +31,7 @@ namespace Inspector {
|
|
|
|
class JS_EXPORT_PRIVATE IdentifiersFactory {
|
|
public:
|
|
+ static void initializeWithProcessID(uint64_t);
|
|
static String createIdentifier();
|
|
static String requestId(unsigned long identifier);
|
|
};
|
|
diff --git a/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp b/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp
|
|
index 038cb646d31706905deff8935040d63c0afd00f9..2fca7b043f15a8cce3819cc827912fb719a345db 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, Interceptor&& interceptor)
|
|
{
|
|
Ref<BackendDispatcher> protect(*this);
|
|
|
|
@@ -120,29 +120,32 @@ 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;
|
|
}
|
|
}
|
|
|
|
+ if (interceptor && interceptor(messageObject) == DispatchResult::Finished)
|
|
+ return DispatchResult::Finished;
|
|
+
|
|
{
|
|
// We could be called re-entrantly from a nested run loop, so restore the previous id.
|
|
SetForScope<Optional<long>> scopedRequestId(m_currentRequestId, requestId);
|
|
@@ -151,29 +154,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 +187,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 95d9d81188e735e8f1b70cc0deee2682cb6714f0..4c67ce34302f74e0d07f64ae53a4eaf18df6669a 100644
|
|
--- a/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h
|
|
+++ b/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h
|
|
@@ -82,7 +82,11 @@ public:
|
|
};
|
|
|
|
void registerDispatcherForDomain(const String& domain, SupplementalBackendDispatcher*);
|
|
- void dispatch(const String& message);
|
|
+
|
|
+ enum class DispatchResult { Finished, Continue };
|
|
+ enum class Mode { FailIfDomainIsMissing, ContinueIfDomainIsMissing };
|
|
+ using Interceptor = WTF::Function<DispatchResult(const RefPtr<JSON::Object>&)>;
|
|
+ DispatchResult dispatch(const String& message, Mode mode = Mode::FailIfDomainIsMissing, Interceptor&& interceptor = Interceptor());
|
|
|
|
// 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/InspectorFrontendRouter.cpp b/Source/JavaScriptCore/inspector/InspectorFrontendRouter.cpp
|
|
index d408d364f1986983161f9d44efbc8bc6f6898676..1375ce9990f0c63d7e6f33ee62930051d6cd44cb 100644
|
|
--- a/Source/JavaScriptCore/inspector/InspectorFrontendRouter.cpp
|
|
+++ b/Source/JavaScriptCore/inspector/InspectorFrontendRouter.cpp
|
|
@@ -49,7 +49,7 @@ void FrontendRouter::connectFrontend(FrontendChannel& connection)
|
|
void FrontendRouter::disconnectFrontend(FrontendChannel& connection)
|
|
{
|
|
if (!m_connections.contains(&connection)) {
|
|
- ASSERT_NOT_REACHED();
|
|
+ ASSERT(m_connections.isEmpty());
|
|
return;
|
|
}
|
|
|
|
diff --git a/Source/JavaScriptCore/inspector/InspectorTarget.h b/Source/JavaScriptCore/inspector/InspectorTarget.h
|
|
index 4b95964db4d902b4b7f4b0b4c40afea51654ff2f..78455c32fc5ddb0f1b9a828233a652d4f86b4d90 100644
|
|
--- a/Source/JavaScriptCore/inspector/InspectorTarget.h
|
|
+++ b/Source/JavaScriptCore/inspector/InspectorTarget.h
|
|
@@ -45,8 +45,10 @@ public:
|
|
// State.
|
|
virtual String identifier() const = 0;
|
|
virtual InspectorTargetType type() const = 0;
|
|
+ virtual String url() const = 0;
|
|
|
|
virtual bool isProvisional() const { return false; }
|
|
+ virtual String oldTargetID() const { return String(); }
|
|
bool isPaused() const { return m_isPaused; }
|
|
void pause();
|
|
void resume();
|
|
@@ -56,6 +58,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, bool /* runBeforeUnload */) { error = "Target cannot be closed"; }
|
|
|
|
private:
|
|
WTF::Function<void()> m_resumeCallback;
|
|
diff --git a/Source/JavaScriptCore/inspector/agents/InspectorTargetAgent.cpp b/Source/JavaScriptCore/inspector/agents/InspectorTargetAgent.cpp
|
|
index 8fcb5a1e55750d325a84824d86c49cfe6fb04268..e3006f981fad81d98e09d2118443962cc925f66f 100644
|
|
--- a/Source/JavaScriptCore/inspector/agents/InspectorTargetAgent.cpp
|
|
+++ b/Source/JavaScriptCore/inspector/agents/InspectorTargetAgent.cpp
|
|
@@ -87,6 +87,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, const bool* runBeforeUnload)
|
|
+{
|
|
+ InspectorTarget* target = m_targets.get(targetId);
|
|
+ if (!target) {
|
|
+ errorString = "Missing target for given targetId"_s;
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ target->close(errorString, runBeforeUnload && *runBeforeUnload);
|
|
+}
|
|
+
|
|
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.");
|
|
@@ -114,9 +136,12 @@ static Ref<Protocol::Target::TargetInfo> buildTargetInfoObject(const InspectorTa
|
|
auto result = Protocol::Target::TargetInfo::create()
|
|
.setTargetId(target.identifier())
|
|
.setType(targetTypeToProtocolType(target.type()))
|
|
+ .setUrl(target.url())
|
|
.release();
|
|
- if (target.isProvisional())
|
|
+ if (target.isProvisional()) {
|
|
result->setIsProvisional(true);
|
|
+ result->setOldTargetId(target.oldTargetID());
|
|
+ }
|
|
if (target.isPaused())
|
|
result->setIsPaused(true);
|
|
return result;
|
|
@@ -144,7 +169,17 @@ void InspectorTargetAgent::targetDestroyed(InspectorTarget& target)
|
|
if (!m_isConnected)
|
|
return;
|
|
|
|
- m_frontendDispatcher->targetDestroyed(target.identifier());
|
|
+ m_frontendDispatcher->targetDestroyed(target.identifier(), false);
|
|
+}
|
|
+
|
|
+void InspectorTargetAgent::targetCrashed(InspectorTarget& target)
|
|
+{
|
|
+ m_targets.remove(target.identifier());
|
|
+
|
|
+ if (!m_isConnected)
|
|
+ return;
|
|
+
|
|
+ m_frontendDispatcher->targetDestroyed(target.identifier(), true);
|
|
}
|
|
|
|
void InspectorTargetAgent::didCommitProvisionalTarget(const String& oldTargetID, const String& committedTargetID)
|
|
@@ -159,6 +194,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;
|
|
diff --git a/Source/JavaScriptCore/inspector/agents/InspectorTargetAgent.h b/Source/JavaScriptCore/inspector/agents/InspectorTargetAgent.h
|
|
index 1eb7abb2fa21d7a8ec0833160f53e5c523ec4317..7709bcc2ec69aab0589ca1b954db1fb241bb583b 100644
|
|
--- a/Source/JavaScriptCore/inspector/agents/InspectorTargetAgent.h
|
|
+++ b/Source/JavaScriptCore/inspector/agents/InspectorTargetAgent.h
|
|
@@ -52,15 +52,21 @@ public:
|
|
void setPauseOnStart(ErrorString&, bool pauseOnStart) override;
|
|
void resume(ErrorString&, const String& targetId) override;
|
|
void sendMessageToTarget(ErrorString&, const String& targetId, const String& message) final;
|
|
+ void activate(ErrorString&, const String& targetId) override;
|
|
+ void close(ErrorString&, const String& targetId, const bool* runBeforeUnload) override;
|
|
|
|
// Target lifecycle.
|
|
void targetCreated(InspectorTarget&);
|
|
void targetDestroyed(InspectorTarget&);
|
|
+ void targetCrashed(InspectorTarget&);
|
|
void didCommitProvisionalTarget(const String& oldTargetID, const String& committedTargetID);
|
|
+ void ensureConnected(const String& targetID);
|
|
|
|
// Target messages.
|
|
void sendMessageFromTargetToFrontend(const String& targetId, const String& message);
|
|
|
|
+ bool isConnected() { return m_isConnected; }
|
|
+
|
|
private:
|
|
// FrontendChannel
|
|
FrontendChannel::ConnectionType connectionType() const;
|
|
diff --git a/Source/JavaScriptCore/inspector/protocol/Browser.json b/Source/JavaScriptCore/inspector/protocol/Browser.json
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..c5d94e331f4a0f5a188d38cbb852bdbd6787a33d
|
|
--- /dev/null
|
|
+++ b/Source/JavaScriptCore/inspector/protocol/Browser.json
|
|
@@ -0,0 +1,201 @@
|
|
+{
|
|
+ "domain": "Browser",
|
|
+ "availability": ["web"],
|
|
+ "types": [
|
|
+ {
|
|
+ "id": "ContextID",
|
|
+ "type": "string",
|
|
+ "description": "Id of Browser context."
|
|
+ },
|
|
+ {
|
|
+ "id": "PageProxyID",
|
|
+ "type": "string",
|
|
+ "description": "Id of WebPageProxy."
|
|
+ },
|
|
+ {
|
|
+ "id": "PageProxyInfo",
|
|
+ "type": "object",
|
|
+ "description": "Tab info object",
|
|
+ "properties": [
|
|
+ { "name": "pageProxyId", "$ref": "PageProxyID" },
|
|
+ { "name": "browserContextId", "$ref": "ContextID", "description": "Unique identifier of the context." },
|
|
+ { "name": "openerId", "$ref": "PageProxyID", "optional": true, "description": "Unique identifier of the opening page. Only set for pages created by window.open()." }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "id": "CookieSameSitePolicy",
|
|
+ "type": "string",
|
|
+ "enum": ["None", "Lax", "Strict"],
|
|
+ "description": "Same-Site policy of a cookie."
|
|
+ },
|
|
+ {
|
|
+ "id": "Cookie",
|
|
+ "type": "object",
|
|
+ "description": "Cookie object",
|
|
+ "properties": [
|
|
+ { "name": "name", "type": "string", "description": "Cookie name." },
|
|
+ { "name": "value", "type": "string", "description": "Cookie value." },
|
|
+ { "name": "domain", "type": "string", "description": "Cookie domain." },
|
|
+ { "name": "path", "type": "string", "description": "Cookie path." },
|
|
+ { "name": "expires", "type": "number", "description": "Cookie expires." },
|
|
+ { "name": "httpOnly", "type": "boolean", "description": "True if cookie is http-only." },
|
|
+ { "name": "secure", "type": "boolean", "description": "True if cookie is secure." },
|
|
+ { "name": "session", "type": "boolean", "description": "True if cookie is session cookie." },
|
|
+ { "name": "sameSite", "$ref": "CookieSameSitePolicy", "description": "Cookie Same-Site policy." }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "id": "SetCookieParam",
|
|
+ "type": "object",
|
|
+ "description": "Cookie object",
|
|
+ "properties": [
|
|
+ { "name": "name", "type": "string", "description": "Cookie name." },
|
|
+ { "name": "value", "type": "string", "description": "Cookie value." },
|
|
+ { "name": "domain", "type": "string", "description": "Cookie domain." },
|
|
+ { "name": "path", "type": "string", "description": "Cookie path." },
|
|
+ { "name": "expires", "type": "number", "optional": true, "description": "Cookie expires." },
|
|
+ { "name": "httpOnly", "type": "boolean", "optional": true, "description": "True if cookie is http-only." },
|
|
+ { "name": "secure", "type": "boolean", "optional": true, "description": "True if cookie is secure." },
|
|
+ { "name": "session", "type": "boolean", "optional": true, "description": "True if cookie is session cookie." },
|
|
+ { "name": "sameSite", "$ref": "CookieSameSitePolicy", "optional": true, "description": "Cookie Same-Site policy." }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "id": "Geolocation",
|
|
+ "type": "object",
|
|
+ "description": "Geolocation",
|
|
+ "properties": [
|
|
+ { "name": "timestamp", "type": "number", "description": "Mock latitude" },
|
|
+ { "name": "latitude", "type": "number", "description": "Mock latitude" },
|
|
+ { "name": "longitude", "type": "number", "description": "Mock longitude" },
|
|
+ { "name": "accuracy", "type": "number", "description": "Mock accuracy" }
|
|
+ ]
|
|
+ }
|
|
+ ],
|
|
+ "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": "pageProxyId", "$ref": "PageProxyID", "description": "Unique identifier of the page proxy." }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "name": "navigate",
|
|
+ "async": true,
|
|
+ "description": "Navigates current page to the given URL.",
|
|
+ "parameters": [
|
|
+ { "name": "url", "type": "string", "description": "URL to navigate the page to." },
|
|
+ { "name": "pageProxyId", "$ref": "PageProxyID", "description": "Unique identifier of the page proxy." },
|
|
+ { "name": "frameId", "$ref": "Network.FrameId", "optional": true, "description": "Id of the frame to navigate."},
|
|
+ { "name": "referrer", "type": "string", "optional": true, "description": "Referrer URL." }
|
|
+ ],
|
|
+ "returns": [
|
|
+ { "name": "loaderId", "$ref": "Network.LoaderId", "optional": true, "description": "Identifier of the loader associated with the navigation." }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "name": "setIgnoreCertificateErrors",
|
|
+ "description": "Change whether all certificate errors should be ignored.",
|
|
+ "parameters": [
|
|
+ { "name": "browserContextId", "$ref": "ContextID", "optional": true, "description": "Browser context id." },
|
|
+ { "name": "ignore", "type": "boolean" }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "name": "getAllCookies",
|
|
+ "description": "Returns all cookies in the given browser context.",
|
|
+ "async": true,
|
|
+ "parameters": [
|
|
+ { "name": "browserContextId", "$ref": "ContextID", "optional": true, "description": "Browser context id." }
|
|
+ ],
|
|
+ "returns": [
|
|
+ { "name": "cookies", "type": "array", "items": { "$ref": "Cookie" }, "description": "Cookies." }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "name": "setCookies",
|
|
+ "description": "Sets cookies in the given browser context.",
|
|
+ "async": true,
|
|
+ "parameters": [
|
|
+ { "name": "browserContextId", "$ref": "ContextID", "optional": true, "description": "Browser context id." },
|
|
+ { "name": "cookies", "type": "array", "items": { "$ref": "SetCookieParam" }, "description": "Cookies." }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "name": "deleteAllCookies",
|
|
+ "description": "Deletes cookies in the given browser context.",
|
|
+ "async": true,
|
|
+ "parameters": [
|
|
+ { "name": "browserContextId", "$ref": "ContextID", "optional": true, "description": "Browser context id." }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "name": "setGeolocationOverride",
|
|
+ "parameters": [
|
|
+ { "name": "browserContextId", "$ref": "ContextID", "optional": true, "description": "Browser context id." },
|
|
+ { "name": "geolocation", "$ref": "Geolocation", "optional": true, "description": "Geolocation to set, if missing emulates position unavailable." }
|
|
+ ],
|
|
+ "description": "Overrides the geolocation position or error."
|
|
+ },
|
|
+ {
|
|
+ "name": "grantPermissions",
|
|
+ "parameters": [
|
|
+ { "name": "browserContextId", "$ref": "ContextID", "optional": true, "description": "Browser context id." },
|
|
+ { "name": "origin", "type": "string" },
|
|
+ { "name": "permissions", "type": "array", "items": { "type": "string" } }
|
|
+ ],
|
|
+ "description": "Overrides the permissions."
|
|
+ },
|
|
+ {
|
|
+ "name": "resetPermissions",
|
|
+ "parameters": [
|
|
+ { "name": "browserContextId", "$ref": "ContextID", "optional": true, "description": "Browser context id." }
|
|
+ ],
|
|
+ "description": "Clears permission overrides."
|
|
+ }
|
|
+ ],
|
|
+ "events": [
|
|
+ {
|
|
+ "name": "pageProxyCreated",
|
|
+ "parameters": [
|
|
+ { "name": "pageProxyInfo", "$ref": "PageProxyInfo" }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "name": "pageProxyDestroyed",
|
|
+ "parameters": [
|
|
+ { "name": "pageProxyId", "$ref": "PageProxyID" }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "name": "provisionalLoadFailed",
|
|
+ "description": "Fired when provisional load fails.",
|
|
+ "parameters": [
|
|
+ { "name": "pageProxyId", "$ref": "PageProxyID", "description": "Unique identifier of the page proxy." },
|
|
+ { "name": "loaderId", "$ref": "Network.LoaderId", "description": "Identifier of the loader associated with the navigation." },
|
|
+ { "name": "error", "type": "string", "description": "Localized error string." }
|
|
+ ]
|
|
+ }
|
|
+ ]
|
|
+}
|
|
diff --git a/Source/JavaScriptCore/inspector/protocol/DOM.json b/Source/JavaScriptCore/inspector/protocol/DOM.json
|
|
index 38cb48bedf2b168149ff79423b7fafc1e63ce8b3..3baff411b0a97b27146d130d4b1c77910372bd60 100644
|
|
--- a/Source/JavaScriptCore/inspector/protocol/DOM.json
|
|
+++ b/Source/JavaScriptCore/inspector/protocol/DOM.json
|
|
@@ -167,6 +167,16 @@
|
|
{ "name": "borderColor", "$ref": "RGBAColor", "optional": true, "description": "The border highlight fill color (default: transparent)." },
|
|
{ "name": "marginColor", "$ref": "RGBAColor", "optional": true, "description": "The margin highlight fill color (default: transparent)." }
|
|
]
|
|
+ },
|
|
+ {
|
|
+ "id": "FilePayload",
|
|
+ "type": "object",
|
|
+ "description": "Data to construct File object.",
|
|
+ "properties": [
|
|
+ { "name": "name", "type": "string", "description": "File name." },
|
|
+ { "name": "type", "type": "string", "description": "File type." },
|
|
+ { "name": "data", "type": "string", "description": "Base64-encoded file data." }
|
|
+ ]
|
|
}
|
|
],
|
|
"commands": [
|
|
@@ -481,7 +491,9 @@
|
|
"name": "resolveNode",
|
|
"description": "Resolves JavaScript node object for given node id.",
|
|
"parameters": [
|
|
- { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node to resolve." },
|
|
+ { "name": "nodeId", "$ref": "NodeId", "optional": true, "description": "Id of the node to resolve." },
|
|
+ { "name": "objectId", "$ref": "Runtime.RemoteObjectId", "optional": true, "description": "Source element handle." },
|
|
+ { "name": "executionContextId", "$ref": "Runtime.ExecutionContextId", "optional": true, "description": "Specifies in which execution context to adopt to." },
|
|
{ "name": "objectGroup", "type": "string", "optional": true, "description": "Symbolic group name that can be used to release multiple objects." }
|
|
],
|
|
"returns": [
|
|
@@ -542,6 +554,37 @@
|
|
"parameters": [
|
|
{ "name": "allow", "type": "boolean" }
|
|
]
|
|
+ },
|
|
+ {
|
|
+ "name": "describeNode",
|
|
+ "description": "Returns node description.",
|
|
+ "parameters": [
|
|
+ { "name": "objectId", "$ref": "Runtime.RemoteObjectId", "description": "JavaScript object id of the node wrapper." }
|
|
+ ],
|
|
+ "returns": [
|
|
+ { "name": "contentFrameId", "$ref": "Network.FrameId", "optional": true, "description": "Frame ID for frame owner elements." },
|
|
+ { "name": "ownerFrameId", "$ref": "Network.FrameId", "optional": true, "description": "ID of the owning frame element." }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "name": "getContentQuads",
|
|
+ "description": "Returns quads that describe node position on the page. This method\nmight return multiple quads for inline nodes.",
|
|
+ "parameters": [
|
|
+ { "name": "objectId", "$ref": "Runtime.RemoteObjectId", "description": "JavaScript object id of the node wrapper." }
|
|
+ ],
|
|
+ "returns": [
|
|
+ {
|
|
+ "name": "quads", "type": "array", "items": { "$ref": "Quad" }, "description": "Quads that describe node layout relative to viewport."
|
|
+ }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "name": "setInputFiles",
|
|
+ "description": "Sets input files for given <input type=file>",
|
|
+ "parameters": [
|
|
+ { "name": "objectId", "$ref": "Runtime.RemoteObjectId", "description": "Input element handle." },
|
|
+ { "name": "files", "type": "array", "items": { "$ref": "FilePayload" }, "description": "Files to set" }
|
|
+ ]
|
|
}
|
|
],
|
|
"events": [
|
|
diff --git a/Source/JavaScriptCore/inspector/protocol/Dialog.json b/Source/JavaScriptCore/inspector/protocol/Dialog.json
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..79edea03fed4e9be5da96e1275e182a479cb7a0a
|
|
--- /dev/null
|
|
+++ b/Source/JavaScriptCore/inspector/protocol/Dialog.json
|
|
@@ -0,0 +1,36 @@
|
|
+{
|
|
+ "domain": "Dialog",
|
|
+ "description": "Actions and events related to alert boxes.",
|
|
+ "availability": ["web"],
|
|
+ "types": [
|
|
+ ],
|
|
+ "commands": [
|
|
+ {
|
|
+ "name": "enable",
|
|
+ "description": "Enables dialog domain notifications."
|
|
+ },
|
|
+ {
|
|
+ "name": "disable",
|
|
+ "description": "Disables dialog domain notifications."
|
|
+ },
|
|
+ {
|
|
+ "name": "handleJavaScriptDialog",
|
|
+ "description": "Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).",
|
|
+ "parameters": [
|
|
+ { "name": "accept", "type": "boolean", "description": "Whether to accept or dismiss the dialog."},
|
|
+ { "name": "promptText", "optional": true, "type": "string", "description": "The text to enter into the dialog prompt before accepting. Used only if this is a prompt dialog."}
|
|
+ ]
|
|
+ }
|
|
+ ],
|
|
+ "events": [
|
|
+ {
|
|
+ "name": "javascriptDialogOpening",
|
|
+ "description": "Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) is about to open.",
|
|
+ "parameters": [
|
|
+ { "name": "type", "type": "string", "description": "Dialog type."},
|
|
+ { "name": "message", "type": "string", "description": "Message that will be displayed by the dialog."},
|
|
+ { "name": "defaultPrompt", "optional": true, "type": "string", "description": "Default dialog prompt."}
|
|
+ ]
|
|
+ }
|
|
+ ]
|
|
+}
|
|
diff --git a/Source/JavaScriptCore/inspector/protocol/Emulation.json b/Source/JavaScriptCore/inspector/protocol/Emulation.json
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..bcf863e4bba3b99f66e75dabfc4d8c1289cc2b78
|
|
--- /dev/null
|
|
+++ b/Source/JavaScriptCore/inspector/protocol/Emulation.json
|
|
@@ -0,0 +1,32 @@
|
|
+{
|
|
+ "domain": "Emulation",
|
|
+ "availability": ["web"],
|
|
+ "commands": [
|
|
+ {
|
|
+ "name": "setDeviceMetricsOverride",
|
|
+ "description": "Overrides device metrics with provided values.",
|
|
+ "async": true,
|
|
+ "parameters": [
|
|
+ { "name": "width", "type": "integer" },
|
|
+ { "name": "height", "type": "integer" },
|
|
+ { "name": "deviceScaleFactor", "type": "number" },
|
|
+ { "name": "fixedLayout", "type": "boolean" }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "name": "setJavaScriptEnabled",
|
|
+ "description": "Allows to disable script execution for the page.",
|
|
+ "parameters": [
|
|
+ { "name": "enabled", "type": "boolean" }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "name": "setAuthCredentials",
|
|
+ "description": "Credentials to use during HTTP authentication.",
|
|
+ "parameters": [
|
|
+ { "name": "username", "type": "string", "optional": true },
|
|
+ { "name": "password", "type": "string", "optional": true }
|
|
+ ]
|
|
+ }
|
|
+ ]
|
|
+}
|
|
diff --git a/Source/JavaScriptCore/inspector/protocol/Input.json b/Source/JavaScriptCore/inspector/protocol/Input.json
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..34909cce9f6d8d7c74be4c96e40f80cadb2f931d
|
|
--- /dev/null
|
|
+++ b/Source/JavaScriptCore/inspector/protocol/Input.json
|
|
@@ -0,0 +1,165 @@
|
|
+{
|
|
+ "domain": "Input",
|
|
+ "availability": ["web"],
|
|
+ "types": [
|
|
+ {
|
|
+ "id": "TimeSinceEpoch",
|
|
+ "description": "UTC time in seconds, counted from January 1, 1970.",
|
|
+ "type": "number"
|
|
+ }
|
|
+ ],
|
|
+ "commands": [
|
|
+ {
|
|
+ "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": "macCommands",
|
|
+ "description": "Mac editing commands associated with this key",
|
|
+ "type": "array",
|
|
+ "optional": true,
|
|
+ "items": {
|
|
+ "type": "string"
|
|
+ }
|
|
+ }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "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/Network.json b/Source/JavaScriptCore/inspector/protocol/Network.json
|
|
index 658f14f8af68073b99a01dd7332628223b67fcd7..bf7c6b49ac403a3b877f60b0f2e236971dc3b592 100644
|
|
--- a/Source/JavaScriptCore/inspector/protocol/Network.json
|
|
+++ b/Source/JavaScriptCore/inspector/protocol/Network.json
|
|
@@ -231,7 +231,8 @@
|
|
"name": "setInterceptionEnabled",
|
|
"description": "Enable interception of network requests.",
|
|
"parameters": [
|
|
- { "name": "enabled", "type": "boolean" }
|
|
+ { "name": "enabled", "type": "boolean" },
|
|
+ { "name": "interceptRequests", "type": "boolean", "optional": true }
|
|
]
|
|
},
|
|
{
|
|
@@ -258,7 +259,16 @@
|
|
"name": "interceptContinue",
|
|
"description": "Continue an interception with no modifications.",
|
|
"parameters": [
|
|
- { "name": "requestId", "$ref": "RequestId", "description": "Identifier for the intercepted Network request or response to continue." }
|
|
+ { "name": "requestId", "$ref": "RequestId", "description": "Identifier for the intercepted Network request or response to continue." },
|
|
+ { "name": "headers", "$ref": "Headers", "optional": true, "description": "HTTP response headers. Pass through original values if unmodified." }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "name": "interceptAsError",
|
|
+ "description": "Abort the intercepted request with given reason.",
|
|
+ "parameters": [
|
|
+ { "name": "requestId", "$ref": "RequestId", "description": "Identifier for the intercepted Network request." },
|
|
+ { "name": "reason", "type": "string", "description": "Deliver error reason for the request." }
|
|
]
|
|
},
|
|
{
|
|
@@ -266,13 +276,20 @@
|
|
"description": "Provide response content for an intercepted response.",
|
|
"parameters": [
|
|
{ "name": "requestId", "$ref": "RequestId", "description": "Identifier for the intercepted Network response to modify." },
|
|
- { "name": "content", "type": "string" },
|
|
- { "name": "base64Encoded", "type": "boolean", "description": "True, if content was sent as base64." },
|
|
+ { "name": "content", "type": "string", "optional": true },
|
|
+ { "name": "base64Encoded", "type": "boolean", "optional": true, "description": "True, if content was sent as base64." },
|
|
{ "name": "mimeType", "type": "string", "optional": true, "description": "MIME Type for the data." },
|
|
{ "name": "status", "type": "integer", "optional": true, "description": "HTTP response status code. Pass through original values if unmodified." },
|
|
{ "name": "statusText", "type": "string", "optional": true, "description": "HTTP response status text. Pass through original values if unmodified." },
|
|
{ "name": "headers", "$ref": "Headers", "optional": true, "description": "HTTP response headers. Pass through original values if unmodified." }
|
|
]
|
|
+ },
|
|
+ {
|
|
+ "name": "setEmulateOfflineState",
|
|
+ "description": "Emulate offline state overriding the actual state.",
|
|
+ "parameters": [
|
|
+ { "name": "offline", "type": "boolean", "description": "True to emulate offline." }
|
|
+ ]
|
|
}
|
|
],
|
|
"events": [
|
|
@@ -356,6 +373,14 @@
|
|
{ "name": "response", "$ref": "Response", "description": "Original response content that would proceed if this is continued." }
|
|
]
|
|
},
|
|
+ {
|
|
+ "name": "requestIntercepted",
|
|
+ "description": "Fired when HTTP request has been intercepted. The frontend must response with <code>Network.interceptContinue</code> or <code>Network.interceptWithRespons</code>` to continue this response.",
|
|
+ "parameters": [
|
|
+ { "name": "requestId", "$ref": "RequestId", "description": "Identifier for this intercepted network. Corresponds with an earlier <code>Network.requestWillBeSent</code>." },
|
|
+ { "name": "request", "$ref": "Request", "description": "Original request content that would proceed if this is continued." }
|
|
+ ]
|
|
+ },
|
|
{
|
|
"name": "webSocketWillSendHandshakeRequest",
|
|
"description": "Fired when WebSocket is about to initiate handshake.",
|
|
diff --git a/Source/JavaScriptCore/inspector/protocol/Page.json b/Source/JavaScriptCore/inspector/protocol/Page.json
|
|
index a8fc5332ac92424b00a3dec62152fd3c5f28544e..6dc8ac8e247631d2af6418155f088ea3cc172797 100644
|
|
--- a/Source/JavaScriptCore/inspector/protocol/Page.json
|
|
+++ b/Source/JavaScriptCore/inspector/protocol/Page.json
|
|
@@ -110,6 +110,41 @@
|
|
{ "name": "session", "type": "boolean", "description": "True in case of session cookie." },
|
|
{ "name": "sameSite", "$ref": "CookieSameSitePolicy", "description": "Cookie Same-Site policy." }
|
|
]
|
|
+ },
|
|
+ {
|
|
+ "id": "AXNode",
|
|
+ "type": "object",
|
|
+ "description": "Accessibility Node",
|
|
+ "properties": [
|
|
+ { "name": "role", "type": "string", "description": "The role."},
|
|
+ { "name": "name", "type": "string","optional": true, "description": "A human readable name for the node."},
|
|
+ { "name": "value", "type": "any", "optional": true, "description": "The current value of the node."},
|
|
+ { "name": "description", "type": "string", "optional": true, "description": "An additional human readable description of the node."},
|
|
+ { "name": "keyshortcuts", "type": "string", "optional": true, "description": "Keyboard shortcuts associated with this node."},
|
|
+ { "name": "roledescription", "type": "string", "optional": true, "description": "A human readable alternative to the role."},
|
|
+ { "name": "valuetext", "type": "string", "optional": true, "description": "A description of the current value."},
|
|
+ { "name": "disabled", "type": "boolean", "optional": true, "description": "Whether the node is disabled."},
|
|
+ { "name": "expanded", "type": "boolean", "optional": true, "description": "Whether the node is expanded or collapsed."},
|
|
+ { "name": "focused", "type": "boolean", "optional": true, "description": "Whether the node is focused."},
|
|
+ { "name": "modal", "type": "boolean", "optional": true, "description": "Whether the node is modal."},
|
|
+ { "name": "multiline", "type": "boolean", "optional": true, "description": "Whether the node text input supports multiline."},
|
|
+ { "name": "multiselectable", "type": "boolean", "optional": true, "description": "Whether more than one child can be selected."},
|
|
+ { "name": "readonly", "type": "boolean", "optional": true, "description": "Whether the node is read only."},
|
|
+ { "name": "required", "type": "boolean", "optional": true, "description": "Whether the node is required."},
|
|
+ { "name": "selected", "type": "boolean", "optional": true, "description": "Whether the node is selected in its parent node."},
|
|
+ { "name": "checked", "type": "string", "optional": true, "enum": ["true", "false", "mixed"], "description": "Whether the checkbox is checked, or \"mixed\"."},
|
|
+ { "name": "pressed", "type": "string", "optional": true, "enum": ["true", "false", "mixed"], "description": "Whether the toggle button is checked, or \"mixed\"."},
|
|
+ { "name": "level", "type": "integer", "optional": true, "description": "The level of a heading."},
|
|
+ { "name": "valuemin", "type": "number", "optional": true, "description": "The minimum value in a node."},
|
|
+ { "name": "valuemax", "type": "number", "optional": true, "description": "The maximum value in a node."},
|
|
+ { "name": "autocomplete", "type": "string", "optional": true, "description": "What kind of autocomplete is supported by a control."},
|
|
+ { "name": "haspopup", "type": "string", "optional": true, "description": "What kind of popup is currently being shown for a node."},
|
|
+ { "name": "invalid", "type": "string", "optional": true, "enum": ["true", "false", "grammar", "spelling"], "description": "Whether and in what way this node's value is invalid."},
|
|
+ { "name": "orientation", "type": "string", "optional": true, "description": "Whether the node is oriented horizontally or vertically."},
|
|
+ { "name": "focusable", "type": "boolean", "optional": true, "description": "Whether the node is focusable."},
|
|
+ { "name": "children", "type": "array", "optional": true, "items": { "$ref": "AXNode"}, "description": "Child AXNodes of this node, if any."},
|
|
+ { "name": "found", "type": "boolean", "optional": true, "description": "True if this AXNode corresponds with the ObjectId passed into acessibilitySnapshot."}
|
|
+ ]
|
|
}
|
|
],
|
|
"commands": [
|
|
@@ -129,11 +164,21 @@
|
|
{ "name": "revalidateAllResources", "type": "boolean", "optional": true, "description": "If true, all cached subresources will be revalidated when the main resource loads. Otherwise, only expired cached subresources will be revalidated (the default behavior for most WebKit clients)." }
|
|
]
|
|
},
|
|
+ {
|
|
+ "name": "goBack",
|
|
+ "description": "Goes back in the history."
|
|
+ },
|
|
+ {
|
|
+ "name": "goForward",
|
|
+ "description": "Goes forward in the history."
|
|
+ },
|
|
{
|
|
"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."},
|
|
+ { "name": "referrer", "type": "string", "optional": true, "description": "Referrer URL." }
|
|
]
|
|
},
|
|
{
|
|
@@ -246,6 +291,13 @@
|
|
{ "name": "appearance", "$ref": "Appearance", "description": "Appearance name to force. Empty string disables the override." }
|
|
]
|
|
},
|
|
+ {
|
|
+ "name": "setTouchEmulationEnabled",
|
|
+ "description": "Enables touch events on platforms that lack them.",
|
|
+ "parameters": [
|
|
+ {"name": "enabled", "type": "boolean", "description": "Whether touch should be enabled."}
|
|
+ ]
|
|
+ },
|
|
{
|
|
"name": "snapshotNode",
|
|
"description": "Capture a snapshot of the specified node that does not include unrelated layers.",
|
|
@@ -276,19 +328,71 @@
|
|
"returns": [
|
|
{ "name": "data", "type": "string", "description": "Base64-encoded web archive." }
|
|
]
|
|
+ },
|
|
+ {
|
|
+ "name": "insertText",
|
|
+ "description": "Insert text into the current selection of the page.",
|
|
+ "parameters": [
|
|
+ { "name": "text", "type": "string", "description": "Text to insert." }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "name": "accessibilitySnapshot",
|
|
+ "description": "Serializes and returns all of the accessibility nodes of the page.",
|
|
+ "parameters": [
|
|
+ { "name": "objectId", "type": "string", "optional": true, "description": "Object Id of a node to find in the accessibility tree."}
|
|
+ ],
|
|
+ "returns": [
|
|
+ { "name": "axNode", "$ref": "AXNode", "description": "The root AXNode."}
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "name": "setInterceptFileChooserDialog",
|
|
+ "description": "Intercepts file chooser dialog",
|
|
+ "parameters": [
|
|
+ { "name": "enabled", "type": "boolean", "description": "True to enable." }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "name": "setDefaultBackgroundColorOverride",
|
|
+ "description": "Sets or clears an override of the default background color of the frame. This override is used if the content does not specify one.",
|
|
+ "parameters": [
|
|
+ { "name": "color", "$ref": "DOM.RGBAColor", "optional": true, "description": "RGBA of the default background color. If not specified, any existing override will be cleared." }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "name": "createIsolatedWorld",
|
|
+ "description": "Creates an isolated world for every loaded frame.",
|
|
+ "parameters": [
|
|
+ { "name": "name", "type": "string", "description": "Isolated world name, will be used as an execution context name." },
|
|
+ { "name": "source", "type": "string", "optional": true, "description": "Script to evaluate in the new world." }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "name": "setBypassCSP",
|
|
+ "description": "Enable page Content Security Policy by-passing.",
|
|
+ "parameters": [
|
|
+ { "name": "enabled", "type": "boolean", "description": "Whether to bypass page CSP." }
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "name": "crash",
|
|
+ "description": "Crashes the page process"
|
|
}
|
|
],
|
|
"events": [
|
|
{
|
|
"name": "domContentEventFired",
|
|
"parameters": [
|
|
- { "name": "timestamp", "type": "number" }
|
|
+ { "name": "timestamp", "type": "number" },
|
|
+ { "name": "frameId", "$ref": "Network.FrameId", "description": "Id of the frame that has fired DOMContentLoaded event." }
|
|
]
|
|
},
|
|
{
|
|
"name": "loadEventFired",
|
|
"parameters": [
|
|
- { "name": "timestamp", "type": "number" }
|
|
+ { "name": "timestamp", "type": "number" },
|
|
+ { "name": "frameId", "$ref": "Network.FrameId", "description": "Id of the frame that has fired load event." }
|
|
]
|
|
},
|
|
{
|
|
@@ -298,6 +402,14 @@
|
|
{ "name": "frame", "$ref": "Frame", "description": "Frame object." }
|
|
]
|
|
},
|
|
+ {
|
|
+ "name": "frameAttached",
|
|
+ "description": "Fired when frame has been attached to its parent.",
|
|
+ "parameters": [
|
|
+ { "name": "frameId", "$ref": "Network.FrameId", "description": "Id of the frame that has been detached." },
|
|
+ { "name": "parentFrameId", "$ref": "Network.FrameId", "optional": true, "description": "Parent frame id if non-root." }
|
|
+ ]
|
|
+ },
|
|
{
|
|
"name": "frameDetached",
|
|
"description": "Fired when frame has been detached from its parent.",
|
|
@@ -334,12 +446,36 @@
|
|
{ "name": "frameId", "$ref": "Network.FrameId", "description": "Id of the frame that has cleared its scheduled navigation." }
|
|
]
|
|
},
|
|
+ {
|
|
+ "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": [
|
|
{ "name": "appearance", "$ref": "Appearance", "description": "Name of the appearance that is active (not considering any forced appearance.)" }
|
|
]
|
|
+ },
|
|
+ {
|
|
+ "name": "fileChooserOpened",
|
|
+ "description": "Fired when the page shows file chooser for it's <input type=file>.",
|
|
+ "parameters": [
|
|
+ { "name": "frameId", "$ref": "Network.FrameId", "description": "Frame where file chooser is opened." },
|
|
+ { "name": "element", "$ref": "Runtime.RemoteObject", "description": "Input element." }
|
|
+ ]
|
|
}
|
|
]
|
|
}
|
|
diff --git a/Source/JavaScriptCore/inspector/protocol/Target.json b/Source/JavaScriptCore/inspector/protocol/Target.json
|
|
index 52920cded24a9c6b0ef6fb4e518664955db4f9fa..55b783d9c429117f1e3d8a3234696f99e37c78d7 100644
|
|
--- a/Source/JavaScriptCore/inspector/protocol/Target.json
|
|
+++ b/Source/JavaScriptCore/inspector/protocol/Target.json
|
|
@@ -10,8 +10,10 @@
|
|
"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": "Whether this is a provisional page target." },
|
|
- { "name": "isPaused", "type": "boolean", "optional": true, "description": "Whether the target is paused on start and has to be explicitely resumed by inspector." }
|
|
+ { "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": "oldTargetId", "type": "string", "optional": true, "description": "Unique identifier of the target which is going to be replaced if this target is committed. Only set for provisional targets." },
|
|
+ { "name": "isPaused", "type": "boolean", "optional": true, "description": "Whether the target is paused on start and has to be explicitely resumed by inspector." },
|
|
+ { "name": "url", "type": "string" }
|
|
]
|
|
}
|
|
],
|
|
@@ -37,6 +39,21 @@
|
|
{ "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" },
|
|
+ { "name": "runBeforeUnload", "type": "boolean", "optional": true }
|
|
+ ]
|
|
}
|
|
],
|
|
"events": [
|
|
@@ -49,7 +66,8 @@
|
|
{
|
|
"name": "targetDestroyed",
|
|
"parameters": [
|
|
- { "name": "targetId", "type": "string" }
|
|
+ { "name": "targetId", "type": "string" },
|
|
+ { "name": "crashed", "type": "boolean" }
|
|
]
|
|
},
|
|
{
|
|
diff --git a/Source/WTF/wtf/PlatformHave.h b/Source/WTF/wtf/PlatformHave.h
|
|
index 944025fb4add55074eee3eb915d86fa17dd56d6b..de3020e26037d445c39b6bf549d515788d860633 100644
|
|
--- a/Source/WTF/wtf/PlatformHave.h
|
|
+++ b/Source/WTF/wtf/PlatformHave.h
|
|
@@ -373,7 +373,7 @@
|
|
#define HAVE_NSHTTPCOOKIESTORAGE__INITWITHIDENTIFIER_WITH_INACCURATE_NULLABILITY 1
|
|
#endif
|
|
|
|
-#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) || PLATFORM(IOS) || PLATFORM(MACCATALYST) || PLATFORM(GTK)
|
|
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) || PLATFORM(IOS) || PLATFORM(MACCATALYST) || PLATFORM(GTK) || PLATFORM(WPE) || PLATFORM(WIN)
|
|
#define HAVE_OS_DARK_MODE_SUPPORT 1
|
|
#endif
|
|
|
|
diff --git a/Source/WebCore/Modules/geolocation/Geolocation.cpp b/Source/WebCore/Modules/geolocation/Geolocation.cpp
|
|
index a256d2f8a42548c42ae3c955d9502cc0ad893d91..7e30dfcec151304b21b39286a841e38e35fa3ecf 100644
|
|
--- a/Source/WebCore/Modules/geolocation/Geolocation.cpp
|
|
+++ b/Source/WebCore/Modules/geolocation/Geolocation.cpp
|
|
@@ -355,8 +355,9 @@ bool Geolocation::shouldBlockGeolocationRequests()
|
|
bool isSecure = SecurityOrigin::isSecure(document()->url());
|
|
bool hasMixedContent = !document()->foundMixedContent().isEmpty();
|
|
bool isLocalOrigin = securityOrigin()->isLocal();
|
|
+ bool isPotentiallyTrustworthy = securityOrigin()->isPotentiallyTrustworthy();
|
|
if (securityOrigin()->canRequestGeolocation()) {
|
|
- if (isLocalOrigin || (isSecure && !hasMixedContent) || isRequestFromIBooks())
|
|
+ if (isLocalOrigin || isPotentiallyTrustworthy || (isSecure && !hasMixedContent) || isRequestFromIBooks())
|
|
return false;
|
|
}
|
|
|
|
diff --git a/Source/WebCore/SourcesCocoa.txt b/Source/WebCore/SourcesCocoa.txt
|
|
index 106740d349c4156dbef134ef19d654575cdf0c93..eb92a1092d99bb42246d2c87fde1180e6bf5c1c7 100644
|
|
--- a/Source/WebCore/SourcesCocoa.txt
|
|
+++ b/Source/WebCore/SourcesCocoa.txt
|
|
@@ -643,7 +643,7 @@ WHLSLStandardLibraryFunctionMap.cpp
|
|
|
|
#endif
|
|
|
|
-#if ENABLE_IOS_TOUCH_EVENTS
|
|
+#if ENABLE_TOUCH_EVENTS
|
|
|
|
JSTouch.cpp
|
|
JSTouchEvent.cpp
|
|
diff --git a/Source/WebCore/WebCore.order b/Source/WebCore/WebCore.order
|
|
index 37d245e11e8bf3626523f076ea2b93d2c106e19b..93f4f64f705580535a8d3b077a9a15813647316a 100644
|
|
--- a/Source/WebCore/WebCore.order
|
|
+++ b/Source/WebCore/WebCore.order
|
|
@@ -3094,7 +3094,6 @@ __ZN7WebCore14DocumentLoader23stopLoadingSubresourcesEv
|
|
__ZN7WebCore14DocumentLoader18stopLoadingPlugInsEv
|
|
__ZN7WebCore14DocumentLoader15detachFromFrameEv
|
|
__ZN7WebCore20ApplicationCacheHost22setDOMApplicationCacheEPNS_19DOMApplicationCacheE
|
|
-__ZN7WebCore24InspectorInstrumentation27loaderDetachedFromFrameImplEPNS_19InstrumentingAgentsEPNS_14DocumentLoaderE
|
|
__ZN7WebCore14DocumentLoaderD0Ev
|
|
__ZN7WebCore14DocumentLoaderD2Ev
|
|
__ZN7WebCore14DocumentLoader17clearMainResourceEv
|
|
diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
|
|
index 672f1cf7cdc9b7dbb9a601437cbd21e6701130ab..9ea20cff7697b9b6f7a19b1057da1918d5620cc7 100644
|
|
--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj
|
|
+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
|
|
@@ -4946,6 +4946,14 @@
|
|
EDE3A5000C7A430600956A37 /* ColorMac.h in Headers */ = {isa = PBXBuildFile; fileRef = EDE3A4FF0C7A430600956A37 /* ColorMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
|
EDEC98030AED7E170059137F /* WebCorePrefix.h in Headers */ = {isa = PBXBuildFile; fileRef = EDEC98020AED7E170059137F /* WebCorePrefix.h */; };
|
|
EFCC6C8F20FE914400A2321B /* CanvasActivityRecord.h in Headers */ = {isa = PBXBuildFile; fileRef = EFCC6C8D20FE914000A2321B /* CanvasActivityRecord.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
|
+ F050E16823AC9C080011CE47 /* PlatformTouchEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = F050E16623AC9C070011CE47 /* PlatformTouchEvent.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
|
+ F050E16A23AD660C0011CE47 /* Touch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F050E16923AD660C0011CE47 /* Touch.cpp */; };
|
|
+ F050E16D23AD66630011CE47 /* TouchList.h in Headers */ = {isa = PBXBuildFile; fileRef = F050E16B23AD66620011CE47 /* TouchList.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
|
+ F050E16E23AD66630011CE47 /* TouchList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F050E16C23AD66630011CE47 /* TouchList.cpp */; };
|
|
+ F050E17123AD669F0011CE47 /* TouchEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F050E16F23AD669E0011CE47 /* TouchEvent.cpp */; };
|
|
+ F050E17223AD669F0011CE47 /* TouchEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = F050E17023AD669F0011CE47 /* TouchEvent.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
|
+ F050E17423AD6A800011CE47 /* DocumentTouch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F050E17323AD6A800011CE47 /* DocumentTouch.cpp */; };
|
|
+ F050E17823AD70C50011CE47 /* PlatformTouchPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = F050E17623AD70C40011CE47 /* PlatformTouchPoint.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
|
F12171F516A8CED2000053CA /* WebVTTElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F12171F316A8BC63000053CA /* WebVTTElement.cpp */; };
|
|
F12171F616A8CF0B000053CA /* WebVTTElement.h in Headers */ = {isa = PBXBuildFile; fileRef = F12171F416A8BC63000053CA /* WebVTTElement.h */; };
|
|
F32BDCD92363AACA0073B6AE /* UserGestureEmulationScope.h in Headers */ = {isa = PBXBuildFile; fileRef = F32BDCD72363AACA0073B6AE /* UserGestureEmulationScope.h */; };
|
|
@@ -15444,6 +15452,14 @@
|
|
EDEC98020AED7E170059137F /* WebCorePrefix.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCorePrefix.h; sourceTree = "<group>"; tabWidth = 4; usesTabs = 0; };
|
|
EFB7287B2124C73D005C2558 /* CanvasActivityRecord.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CanvasActivityRecord.cpp; sourceTree = "<group>"; };
|
|
EFCC6C8D20FE914000A2321B /* CanvasActivityRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CanvasActivityRecord.h; sourceTree = "<group>"; };
|
|
+ F050E16623AC9C070011CE47 /* PlatformTouchEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformTouchEvent.h; sourceTree = "<group>"; };
|
|
+ F050E16923AD660C0011CE47 /* Touch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Touch.cpp; path = dom/Touch.cpp; sourceTree = SOURCE_ROOT; };
|
|
+ F050E16B23AD66620011CE47 /* TouchList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TouchList.h; path = dom/TouchList.h; sourceTree = SOURCE_ROOT; };
|
|
+ F050E16C23AD66630011CE47 /* TouchList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TouchList.cpp; path = dom/TouchList.cpp; sourceTree = SOURCE_ROOT; };
|
|
+ F050E16F23AD669E0011CE47 /* TouchEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TouchEvent.cpp; path = dom/TouchEvent.cpp; sourceTree = SOURCE_ROOT; };
|
|
+ F050E17023AD669F0011CE47 /* TouchEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TouchEvent.h; path = dom/TouchEvent.h; sourceTree = SOURCE_ROOT; };
|
|
+ F050E17323AD6A800011CE47 /* DocumentTouch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentTouch.cpp; sourceTree = "<group>"; };
|
|
+ F050E17623AD70C40011CE47 /* PlatformTouchPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformTouchPoint.h; sourceTree = "<group>"; };
|
|
F12171F316A8BC63000053CA /* WebVTTElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebVTTElement.cpp; sourceTree = "<group>"; };
|
|
F12171F416A8BC63000053CA /* WebVTTElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVTTElement.h; sourceTree = "<group>"; };
|
|
F32BDCD52363AAC90073B6AE /* UserGestureEmulationScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserGestureEmulationScope.cpp; sourceTree = "<group>"; };
|
|
@@ -20726,7 +20742,12 @@
|
|
2D2E34A921A4E191004598B5 /* EditableImageReference.h */,
|
|
1AF326770D78B9440068F0C4 /* EditorClient.h */,
|
|
93C09A800B064F00005ABD4D /* EventHandler.cpp */,
|
|
+ F050E16F23AD669E0011CE47 /* TouchEvent.cpp */,
|
|
+ F050E17023AD669F0011CE47 /* TouchEvent.h */,
|
|
93C09A520B064DB3005ABD4D /* EventHandler.h */,
|
|
+ F050E16923AD660C0011CE47 /* Touch.cpp */,
|
|
+ F050E16C23AD66630011CE47 /* TouchList.cpp */,
|
|
+ F050E16B23AD66620011CE47 /* TouchList.h */,
|
|
E0FEF371B27C53EAC1C1FBEE /* EventSource.cpp */,
|
|
E0FEF371B17C53EAC1C1FBEE /* EventSource.h */,
|
|
E0FEF371B07C53EAC1C1FBEE /* EventSource.idl */,
|
|
@@ -25942,7 +25963,9 @@
|
|
B2C3D9EC0D006C1D00EF6F26 /* text */,
|
|
E188235F2031F50F00B42DF3 /* vr */,
|
|
DFDB912CF8E88A6DA1AD264F /* AbortableTaskQueue.h */,
|
|
+ F050E16623AC9C070011CE47 /* PlatformTouchEvent.h */,
|
|
49AE2D94134EE5F90072920A /* CalculationValue.cpp */,
|
|
+ F050E17623AD70C40011CE47 /* PlatformTouchPoint.h */,
|
|
49AE2D95134EE5F90072920A /* CalculationValue.h */,
|
|
C330A22113EC196B0000B45B /* ColorChooser.h */,
|
|
C37CDEBC149EF2030042090D /* ColorChooserClient.h */,
|
|
@@ -28170,6 +28193,7 @@
|
|
BCCFBAE70B5152ED0001F1D7 /* DocumentParser.h */,
|
|
AD6E71AA1668899D00320C13 /* DocumentSharedObjectPool.cpp */,
|
|
AD6E71AB1668899D00320C13 /* DocumentSharedObjectPool.h */,
|
|
+ F050E17323AD6A800011CE47 /* DocumentTouch.cpp */,
|
|
6BDB5DC1227BD3B800919770 /* DocumentStorageAccess.cpp */,
|
|
6BDB5DC0227BD3B800919770 /* DocumentStorageAccess.h */,
|
|
6BDB5DC5227CA0EB00919770 /* DocumentStorageAccess.idl */,
|
|
@@ -29055,6 +29079,7 @@
|
|
93C4F6EB1108F9A50099D0DB /* AccessibilityScrollbar.h in Headers */,
|
|
29489FC712C00F0300D83F0F /* AccessibilityScrollView.h in Headers */,
|
|
0709FC4E1025DEE30059CDBA /* AccessibilitySlider.h in Headers */,
|
|
+ F050E16D23AD66630011CE47 /* TouchList.h in Headers */,
|
|
29D7BCFA1444AF7D0070619C /* AccessibilitySpinButton.h in Headers */,
|
|
69A6CBAD1C6BE42C00B836E9 /* AccessibilitySVGElement.h in Headers */,
|
|
AAC08CF315F941FD00F1E188 /* AccessibilitySVGRoot.h in Headers */,
|
|
@@ -30886,6 +30911,7 @@
|
|
6E4ABCD5138EA0B70071D291 /* JSHTMLUnknownElement.h in Headers */,
|
|
E44614170CD6826900FADA75 /* JSHTMLVideoElement.h in Headers */,
|
|
81BE20D311F4BC3200915DFA /* JSIDBCursor.h in Headers */,
|
|
+ F050E17823AD70C50011CE47 /* PlatformTouchPoint.h in Headers */,
|
|
7C3D8EF01E0B21430023B084 /* JSIDBCursorDirection.h in Headers */,
|
|
C585A68311D4FB08004C3E4B /* JSIDBDatabase.h in Headers */,
|
|
C585A69711D4FB13004C3E4B /* JSIDBFactory.h in Headers */,
|
|
@@ -32800,9 +32826,11 @@
|
|
A7DBF8DE1276919C006B6008 /* TextCheckingHelper.h in Headers */,
|
|
B2C3DA3A0D006C1D00EF6F26 /* TextCodec.h in Headers */,
|
|
26E98A10130A9FCA008EB7B2 /* TextCodecASCIIFastPath.h in Headers */,
|
|
+ F050E16823AC9C080011CE47 /* PlatformTouchEvent.h in Headers */,
|
|
B2C3DA3C0D006C1D00EF6F26 /* TextCodecICU.h in Headers */,
|
|
B2C3DA3E0D006C1D00EF6F26 /* TextCodecLatin1.h in Headers */,
|
|
57EF5E601D20C83900171E60 /* TextCodecReplacement.h in Headers */,
|
|
+ F050E17223AD669F0011CE47 /* TouchEvent.h in Headers */,
|
|
B2C3DA400D006C1D00EF6F26 /* TextCodecUserDefined.h in Headers */,
|
|
B2C3DA420D006C1D00EF6F26 /* TextCodecUTF16.h in Headers */,
|
|
9343CB8212F25E510033C5EE /* TextCodecUTF8.h in Headers */,
|
|
@@ -33690,6 +33718,7 @@
|
|
CDDE02ED18B3ED6D00CF7FF1 /* CDMSessionAVFoundationObjC.mm in Sources */,
|
|
CDDE02F018B5651300CF7FF1 /* CDMSessionAVStreamSession.mm in Sources */,
|
|
CDE5959D1BF2757100A1CBE8 /* CDMSessionMediaSourceAVFObjC.mm in Sources */,
|
|
+ F050E17123AD669F0011CE47 /* TouchEvent.cpp in Sources */,
|
|
A14090FB1AA51E1D0091191A /* ContentFilterUnblockHandlerCocoa.mm in Sources */,
|
|
07AFF4231EFB144900B545B3 /* CoreAudioCaptureSourceIOS.mm in Sources */,
|
|
46C696CC1E7205FC00597937 /* CPUMonitor.cpp in Sources */,
|
|
@@ -33763,6 +33792,7 @@
|
|
51058ADF1D67C229009A538C /* MockGamepad.cpp in Sources */,
|
|
51058AE11D67C229009A538C /* MockGamepadProvider.cpp in Sources */,
|
|
CDF2B0121820540600F2B424 /* MockMediaPlayerMediaSource.cpp in Sources */,
|
|
+ F050E17423AD6A800011CE47 /* DocumentTouch.cpp in Sources */,
|
|
CDF2B0141820540600F2B424 /* MockMediaSourcePrivate.cpp in Sources */,
|
|
CDF2B0161820540700F2B424 /* MockSourceBufferPrivate.cpp in Sources */,
|
|
2D9BF7421DBFDC27007A7D99 /* NavigatorEME.cpp in Sources */,
|
|
@@ -33848,6 +33878,7 @@
|
|
538EC8881F993F9C004D22A8 /* UnifiedSource23.cpp in Sources */,
|
|
DE5F85801FA1ABF4006DB63A /* UnifiedSource24-mm.mm in Sources */,
|
|
538EC8891F993F9D004D22A8 /* UnifiedSource24.cpp in Sources */,
|
|
+ F050E16E23AD66630011CE47 /* TouchList.cpp in Sources */,
|
|
DE5F85811FA1ABF4006DB63A /* UnifiedSource25-mm.mm in Sources */,
|
|
538EC88A1F993F9D004D22A8 /* UnifiedSource25.cpp in Sources */,
|
|
DE5F85821FA1ABF4006DB63A /* UnifiedSource26-mm.mm in Sources */,
|
|
@@ -34380,6 +34411,7 @@
|
|
2D8B92F1203D13E1009C868F /* UnifiedSource516.cpp in Sources */,
|
|
2D8B92F2203D13E1009C868F /* UnifiedSource517.cpp in Sources */,
|
|
2D8B92F3203D13E1009C868F /* UnifiedSource518.cpp in Sources */,
|
|
+ F050E16A23AD660C0011CE47 /* Touch.cpp in Sources */,
|
|
2D8B92F4203D13E1009C868F /* UnifiedSource519.cpp in Sources */,
|
|
2D8B92F5203D13E1009C868F /* UnifiedSource520.cpp in Sources */,
|
|
2D8B92F6203D13E1009C868F /* UnifiedSource521.cpp in Sources */,
|
|
diff --git a/Source/WebCore/html/FileInputType.cpp b/Source/WebCore/html/FileInputType.cpp
|
|
index 4e41fd3f807e8f34bfef3f63f0ba6119a619821e..1f7be602cb2134f8867bf95afe0c9337bce57055 100644
|
|
--- a/Source/WebCore/html/FileInputType.cpp
|
|
+++ b/Source/WebCore/html/FileInputType.cpp
|
|
@@ -36,6 +36,7 @@
|
|
#include "HTMLNames.h"
|
|
#include "Icon.h"
|
|
#include "InputTypeNames.h"
|
|
+#include "InspectorInstrumentation.h"
|
|
#include "LocalizedStrings.h"
|
|
#include "RenderFileUploadControl.h"
|
|
#include "RuntimeEnabledFeatures.h"
|
|
@@ -205,6 +206,11 @@ void FileInputType::handleDOMActivateEvent(Event& event)
|
|
if (input.isDisabledFormControl())
|
|
return;
|
|
|
|
+ bool intercept = false;
|
|
+ InspectorInstrumentation::runOpenPanel(input.document().frame(), element(), &intercept);
|
|
+ if (intercept)
|
|
+ return;
|
|
+
|
|
if (!UserGestureIndicator::processingUserGesture())
|
|
return;
|
|
|
|
diff --git a/Source/WebCore/inspector/InspectorInstrumentation.cpp b/Source/WebCore/inspector/InspectorInstrumentation.cpp
|
|
index 4f18b58c6cd01e0b69a8953ad09a739c3520496a..724fdb3d8e37dfc29069e2e2a65adefb72818cf5 100644
|
|
--- a/Source/WebCore/inspector/InspectorInstrumentation.cpp
|
|
+++ b/Source/WebCore/inspector/InspectorInstrumentation.cpp
|
|
@@ -121,7 +121,7 @@ static Frame* frameForScriptExecutionContext(ScriptExecutionContext& context)
|
|
|
|
void InspectorInstrumentation::didClearWindowObjectInWorldImpl(InstrumentingAgents& instrumentingAgents, Frame& frame, DOMWrapperWorld& world)
|
|
{
|
|
- if (&world != &mainThreadNormalWorld())
|
|
+ if (!world.isNormal())
|
|
return;
|
|
|
|
if (auto* pageDebuggerAgent = instrumentingAgents.pageDebuggerAgent())
|
|
@@ -129,9 +129,6 @@ void InspectorInstrumentation::didClearWindowObjectInWorldImpl(InstrumentingAgen
|
|
|
|
if (auto* pageRuntimeAgent = instrumentingAgents.pageRuntimeAgent())
|
|
pageRuntimeAgent->didClearWindowObjectInWorld(frame);
|
|
-
|
|
- if (auto* pageAgent = instrumentingAgents.inspectorPageAgent())
|
|
- pageAgent->didClearWindowObjectInWorld(frame);
|
|
}
|
|
|
|
bool InspectorInstrumentation::isDebuggerPausedImpl(InstrumentingAgents& instrumentingAgents)
|
|
@@ -624,6 +621,12 @@ void InspectorInstrumentation::didFailLoadingImpl(InstrumentingAgents& instrumen
|
|
consoleAgent->didFailLoading(identifier, error); // This should come AFTER resource notification, front-end relies on this.
|
|
}
|
|
|
|
+void InspectorInstrumentation::didReceiveMainResourceErrorImpl(InstrumentingAgents& instrumentingAgents, Frame& frame, const ResourceError&)
|
|
+{
|
|
+ if (auto* pageRuntimeAgent = instrumentingAgents.pageRuntimeAgent())
|
|
+ pageRuntimeAgent->didReceiveMainResourceError(frame);
|
|
+}
|
|
+
|
|
void InspectorInstrumentation::willLoadXHRSynchronouslyImpl(InstrumentingAgents& instrumentingAgents)
|
|
{
|
|
if (InspectorNetworkAgent* networkAgent = instrumentingAgents.inspectorNetworkAgent())
|
|
@@ -656,20 +659,17 @@ void InspectorInstrumentation::didReceiveScriptResponseImpl(InstrumentingAgents&
|
|
|
|
void InspectorInstrumentation::domContentLoadedEventFiredImpl(InstrumentingAgents& instrumentingAgents, Frame& frame)
|
|
{
|
|
- if (!frame.isMainFrame())
|
|
- return;
|
|
-
|
|
if (InspectorPageAgent* pageAgent = instrumentingAgents.inspectorPageAgent())
|
|
- pageAgent->domContentEventFired();
|
|
+ pageAgent->domContentEventFired(frame);
|
|
}
|
|
|
|
void InspectorInstrumentation::loadEventFiredImpl(InstrumentingAgents& instrumentingAgents, Frame* frame)
|
|
{
|
|
- if (!frame || !frame->isMainFrame())
|
|
+ if (!frame)
|
|
return;
|
|
|
|
if (InspectorPageAgent* pageAgent = instrumentingAgents.inspectorPageAgent())
|
|
- pageAgent->loadEventFired();
|
|
+ pageAgent->loadEventFired(*frame);
|
|
}
|
|
|
|
void InspectorInstrumentation::frameDetachedFromParentImpl(InstrumentingAgents& instrumentingAgents, Frame& frame)
|
|
@@ -744,12 +744,6 @@ void InspectorInstrumentation::frameDocumentUpdatedImpl(InstrumentingAgents& ins
|
|
pageDOMDebuggerAgent->frameDocumentUpdated(frame);
|
|
}
|
|
|
|
-void InspectorInstrumentation::loaderDetachedFromFrameImpl(InstrumentingAgents& instrumentingAgents, DocumentLoader& loader)
|
|
-{
|
|
- if (InspectorPageAgent* inspectorPageAgent = instrumentingAgents.inspectorPageAgent())
|
|
- inspectorPageAgent->loaderDetachedFromFrame(loader);
|
|
-}
|
|
-
|
|
void InspectorInstrumentation::frameStartedLoadingImpl(InstrumentingAgents& instrumentingAgents, Frame& frame)
|
|
{
|
|
if (frame.isMainFrame()) {
|
|
@@ -786,6 +780,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())
|
|
@@ -1266,6 +1266,31 @@ void InspectorInstrumentation::renderLayerDestroyedImpl(InstrumentingAgents& ins
|
|
layerTreeAgent->renderLayerDestroyed(renderLayer);
|
|
}
|
|
|
|
+void InspectorInstrumentation::runOpenPanelImpl(InstrumentingAgents& instrumentingAgents, HTMLInputElement* element, bool* intercept)
|
|
+{
|
|
+ if (InspectorPageAgent* pageAgent = instrumentingAgents.inspectorPageAgent())
|
|
+ pageAgent->runOpenPanel(element, intercept);
|
|
+}
|
|
+
|
|
+void InspectorInstrumentation::frameAttachedImpl(InstrumentingAgents& instrumentingAgents, Frame& frame) {
|
|
+ if (InspectorPageAgent* pageAgent = instrumentingAgents.inspectorPageAgent())
|
|
+ pageAgent->frameAttached(frame);
|
|
+}
|
|
+
|
|
+bool InspectorInstrumentation::shouldBypassCSPImpl(InstrumentingAgents& instrumentingAgents)
|
|
+{
|
|
+ if (InspectorPageAgent* pageAgent = instrumentingAgents.inspectorPageAgent())
|
|
+ return pageAgent->shouldBypassCSP();
|
|
+ return false;
|
|
+}
|
|
+
|
|
+bool InspectorInstrumentation::interceptRequestImpl(InstrumentingAgents& instrumentingAgents, ResourceLoader& loader, Function<void(bool handled)>&& handler)
|
|
+{
|
|
+ if (InspectorNetworkAgent* networkAgent = instrumentingAgents.inspectorNetworkAgent())
|
|
+ return networkAgent->interceptRequest(loader, WTFMove(handler));
|
|
+ return false;
|
|
+}
|
|
+
|
|
InstrumentingAgents& InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope(WorkerGlobalScope& workerGlobalScope)
|
|
{
|
|
return workerGlobalScope.inspectorController().m_instrumentingAgents;
|
|
diff --git a/Source/WebCore/inspector/InspectorInstrumentation.h b/Source/WebCore/inspector/InspectorInstrumentation.h
|
|
index e78183640a299ae4107285ef4c28ac81d940a1d0..ea38ba86dabdc67ca8b05d78ab689f6817794677 100644
|
|
--- a/Source/WebCore/inspector/InspectorInstrumentation.h
|
|
+++ b/Source/WebCore/inspector/InspectorInstrumentation.h
|
|
@@ -45,11 +45,13 @@
|
|
#include "HitTestResult.h"
|
|
#include "InspectorInstrumentationPublic.h"
|
|
#include "Page.h"
|
|
+#include "ResourceLoader.h"
|
|
#include "StorageArea.h"
|
|
#include "WebAnimation.h"
|
|
#include <JavaScriptCore/ConsoleMessage.h>
|
|
#include <initializer_list>
|
|
#include <wtf/CompletionHandler.h>
|
|
+#include <wtf/Function.h>
|
|
#include <wtf/MemoryPressureHandler.h>
|
|
#include <wtf/RefPtr.h>
|
|
|
|
@@ -77,6 +79,7 @@ class DOMWrapperWorld;
|
|
class Document;
|
|
class DocumentLoader;
|
|
class EventListener;
|
|
+class HTMLInputElement;
|
|
class HTTPHeaderMap;
|
|
class InspectorTimelineAgent;
|
|
class InstrumentingAgents;
|
|
@@ -197,6 +200,7 @@ public:
|
|
static void didReceiveData(Frame*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
|
|
static void didFinishLoading(Frame*, DocumentLoader*, unsigned long identifier, const NetworkLoadMetrics&, ResourceLoader*);
|
|
static void didFailLoading(Frame*, DocumentLoader*, unsigned long identifier, const ResourceError&);
|
|
+ static void didReceiveMainResourceError(Frame&, const ResourceError&);
|
|
|
|
static void willSendRequest(WorkerGlobalScope&, unsigned long identifier, ResourceRequest&);
|
|
static void didReceiveResourceResponse(WorkerGlobalScope&, unsigned long identifier, const ResourceResponse&);
|
|
@@ -223,11 +227,11 @@ public:
|
|
static void frameDetachedFromParent(Frame&);
|
|
static void didCommitLoad(Frame&, DocumentLoader*);
|
|
static void frameDocumentUpdated(Frame&);
|
|
- static void loaderDetachedFromFrame(Frame&, DocumentLoader&);
|
|
static void frameStartedLoading(Frame&);
|
|
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&);
|
|
|
|
@@ -314,6 +318,11 @@ public:
|
|
static void layerTreeDidChange(Page*);
|
|
static void renderLayerDestroyed(Page*, const RenderLayer&);
|
|
|
|
+ static void runOpenPanel(Frame*, HTMLInputElement*, bool*);
|
|
+ static void frameAttached(Frame*);
|
|
+ static bool shouldBypassCSP(ScriptExecutionContext*);
|
|
+ static bool interceptRequest(ResourceLoader&, Function<void(bool handled)>&&);
|
|
+
|
|
static void frontendCreated();
|
|
static void frontendDeleted();
|
|
static bool hasFrontends() { return InspectorInstrumentationPublic::hasFrontends(); }
|
|
@@ -414,6 +423,7 @@ private:
|
|
static void didReceiveDataImpl(InstrumentingAgents&, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
|
|
static void didFinishLoadingImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, const NetworkLoadMetrics&, ResourceLoader*);
|
|
static void didFailLoadingImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, const ResourceError&);
|
|
+ static void didReceiveMainResourceErrorImpl(InstrumentingAgents&, Frame&, const ResourceError&);
|
|
static void willLoadXHRSynchronouslyImpl(InstrumentingAgents&);
|
|
static void didLoadXHRSynchronouslyImpl(InstrumentingAgents&);
|
|
static void scriptImportedImpl(InstrumentingAgents&, unsigned long identifier, const String& sourceString);
|
|
@@ -424,11 +434,11 @@ private:
|
|
static void frameDetachedFromParentImpl(InstrumentingAgents&, Frame&);
|
|
static void didCommitLoadImpl(InstrumentingAgents&, Frame&, DocumentLoader*);
|
|
static void frameDocumentUpdatedImpl(InstrumentingAgents&, Frame&);
|
|
- static void loaderDetachedFromFrameImpl(InstrumentingAgents&, DocumentLoader&);
|
|
static void frameStartedLoadingImpl(InstrumentingAgents&, Frame&);
|
|
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&);
|
|
|
|
@@ -511,6 +521,11 @@ private:
|
|
static void layerTreeDidChangeImpl(InstrumentingAgents&);
|
|
static void renderLayerDestroyedImpl(InstrumentingAgents&, const RenderLayer&);
|
|
|
|
+ static void runOpenPanelImpl(InstrumentingAgents&, HTMLInputElement*, bool*);
|
|
+ static void frameAttachedImpl(InstrumentingAgents&, Frame&);
|
|
+ static bool shouldBypassCSPImpl(InstrumentingAgents&);
|
|
+ static bool interceptRequestImpl(InstrumentingAgents&, ResourceLoader&, Function<void(bool handled)>&&);
|
|
+
|
|
static InstrumentingAgents& instrumentingAgentsForPage(Page&);
|
|
static InstrumentingAgents& instrumentingAgentsForWorkerGlobalScope(WorkerGlobalScope&);
|
|
|
|
@@ -1091,6 +1106,13 @@ inline void InspectorInstrumentation::didFailLoading(Frame* frame, DocumentLoade
|
|
didFailLoadingImpl(*instrumentingAgents, identifier, loader, error);
|
|
}
|
|
|
|
+inline void InspectorInstrumentation::didReceiveMainResourceError(Frame& frame, const ResourceError& error)
|
|
+{
|
|
+ FAST_RETURN_IF_NO_FRONTENDS(void());
|
|
+ if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
|
|
+ didReceiveMainResourceErrorImpl(*instrumentingAgents, frame, error);
|
|
+}
|
|
+
|
|
inline void InspectorInstrumentation::didFailLoading(WorkerGlobalScope& workerGlobalScope, unsigned long identifier, const ResourceError& error)
|
|
{
|
|
didFailLoadingImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), identifier, nullptr, error);
|
|
@@ -1186,13 +1208,6 @@ inline void InspectorInstrumentation::frameDocumentUpdated(Frame& frame)
|
|
frameDocumentUpdatedImpl(*instrumentingAgents, frame);
|
|
}
|
|
|
|
-inline void InspectorInstrumentation::loaderDetachedFromFrame(Frame& frame, DocumentLoader& loader)
|
|
-{
|
|
- FAST_RETURN_IF_NO_FRONTENDS(void());
|
|
- if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
|
|
- loaderDetachedFromFrameImpl(*instrumentingAgents, loader);
|
|
-}
|
|
-
|
|
inline void InspectorInstrumentation::frameStartedLoading(Frame& frame)
|
|
{
|
|
FAST_RETURN_IF_NO_FRONTENDS(void());
|
|
@@ -1221,6 +1236,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());
|
|
@@ -1650,6 +1672,36 @@ inline void InspectorInstrumentation::renderLayerDestroyed(Page* page, const Ren
|
|
renderLayerDestroyedImpl(*instrumentingAgents, renderLayer);
|
|
}
|
|
|
|
+inline void InspectorInstrumentation::runOpenPanel(Frame* frame, HTMLInputElement* element, bool* intercept)
|
|
+{
|
|
+ FAST_RETURN_IF_NO_FRONTENDS(void());
|
|
+ if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(*frame))
|
|
+ runOpenPanelImpl(*instrumentingAgents, element, intercept);
|
|
+}
|
|
+
|
|
+inline void InspectorInstrumentation::frameAttached(Frame* frame)
|
|
+{
|
|
+ FAST_RETURN_IF_NO_FRONTENDS(void());
|
|
+ if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
|
|
+ frameAttachedImpl(*instrumentingAgents, *frame);
|
|
+}
|
|
+
|
|
+inline bool InspectorInstrumentation::shouldBypassCSP(ScriptExecutionContext* context)
|
|
+{
|
|
+ FAST_RETURN_IF_NO_FRONTENDS(false);
|
|
+ if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
|
|
+ return shouldBypassCSPImpl(*instrumentingAgents);
|
|
+ return false;
|
|
+}
|
|
+
|
|
+inline bool InspectorInstrumentation::interceptRequest(ResourceLoader& loader, Function<void(bool handled)>&& handler)
|
|
+{
|
|
+ FAST_RETURN_IF_NO_FRONTENDS(false);
|
|
+ if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(loader.frame()))
|
|
+ return interceptRequestImpl(*instrumentingAgents, loader, WTFMove(handler));
|
|
+ return false;
|
|
+}
|
|
+
|
|
inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForContext(ScriptExecutionContext* context)
|
|
{
|
|
return context ? instrumentingAgentsForContext(*context) : nullptr;
|
|
diff --git a/Source/WebCore/inspector/InspectorInstrumentationWebKit.cpp b/Source/WebCore/inspector/InspectorInstrumentationWebKit.cpp
|
|
index 954aaf121a9fa507d83bc10ae37de1f128f7dcfc..9f16be3dbcf4857742ec2ab131e2b2f962a2a47c 100644
|
|
--- a/Source/WebCore/inspector/InspectorInstrumentationWebKit.cpp
|
|
+++ b/Source/WebCore/inspector/InspectorInstrumentationWebKit.cpp
|
|
@@ -30,6 +30,11 @@
|
|
|
|
namespace WebCore {
|
|
|
|
+bool InspectorInstrumentationWebKit::interceptRequestInternal(ResourceLoader& loader, Function<void(bool handled)>&& handler)
|
|
+{
|
|
+ return InspectorInstrumentation::interceptRequest(loader, WTFMove(handler));
|
|
+}
|
|
+
|
|
bool InspectorInstrumentationWebKit::shouldInterceptResponseInternal(const Frame& frame, const ResourceResponse& response)
|
|
{
|
|
return InspectorInstrumentation::shouldInterceptResponse(frame, response);
|
|
diff --git a/Source/WebCore/inspector/InspectorInstrumentationWebKit.h b/Source/WebCore/inspector/InspectorInstrumentationWebKit.h
|
|
index b67e89b80b4e7a8586cac81ade5d58a1bcb0d431..c468bc0981d1fb13272b28095f9f7584840b5861 100644
|
|
--- a/Source/WebCore/inspector/InspectorInstrumentationWebKit.h
|
|
+++ b/Source/WebCore/inspector/InspectorInstrumentationWebKit.h
|
|
@@ -27,6 +27,7 @@
|
|
|
|
#include "InspectorInstrumentationPublic.h"
|
|
#include <wtf/CompletionHandler.h>
|
|
+#include <wtf/Function.h>
|
|
|
|
namespace WebCore {
|
|
|
|
@@ -36,14 +37,22 @@ class SharedBuffer;
|
|
|
|
class WEBCORE_EXPORT InspectorInstrumentationWebKit {
|
|
public:
|
|
+ static bool interceptRequest(ResourceLoader&, Function<void(bool handled)>&&);
|
|
static bool shouldInterceptResponse(const Frame*, const ResourceResponse&);
|
|
static void interceptResponse(const Frame*, const ResourceResponse&, unsigned long identifier, CompletionHandler<void(const ResourceResponse&, RefPtr<SharedBuffer>)>&&);
|
|
|
|
private:
|
|
+ static bool interceptRequestInternal(ResourceLoader&, Function<void(bool handled)>&&);
|
|
static bool shouldInterceptResponseInternal(const Frame&, const ResourceResponse&);
|
|
static void interceptResponseInternal(const Frame&, const ResourceResponse&, unsigned long identifier, CompletionHandler<void(const ResourceResponse&, RefPtr<SharedBuffer>)>&&);
|
|
};
|
|
|
|
+inline bool InspectorInstrumentationWebKit::interceptRequest(ResourceLoader& loader, Function<void(bool handled)>&& handler)
|
|
+{
|
|
+ FAST_RETURN_IF_NO_FRONTENDS(false);
|
|
+ return interceptRequestInternal(loader, WTFMove(handler));
|
|
+}
|
|
+
|
|
inline bool InspectorInstrumentationWebKit::shouldInterceptResponse(const Frame* frame, const ResourceResponse& response)
|
|
{
|
|
FAST_RETURN_IF_NO_FRONTENDS(false);
|
|
diff --git a/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp b/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp
|
|
index aecc79bc0ca56fb65fe0330f08e4ee688bf81e89..7b78b5a90004786aee21161bee739c1270e4ba7c 100644
|
|
--- a/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp
|
|
+++ b/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp
|
|
@@ -61,12 +61,16 @@
|
|
#include "Event.h"
|
|
#include "EventListener.h"
|
|
#include "EventNames.h"
|
|
+#include "File.h"
|
|
+#include "FileList.h"
|
|
#include "Frame.h"
|
|
#include "FrameTree.h"
|
|
#include "FrameView.h"
|
|
#include "FullscreenManager.h"
|
|
+#include "FloatQuad.h"
|
|
#include "HTMLElement.h"
|
|
#include "HTMLFrameOwnerElement.h"
|
|
+#include "HTMLInputElement.h"
|
|
#include "HTMLMediaElement.h"
|
|
#include "HTMLNames.h"
|
|
#include "HTMLParserIdioms.h"
|
|
@@ -93,11 +97,13 @@
|
|
#include "Page.h"
|
|
#include "Pasteboard.h"
|
|
#include "PseudoElement.h"
|
|
+#include "RenderObject.h"
|
|
#include "RenderStyle.h"
|
|
#include "RenderStyleConstants.h"
|
|
#include "ScriptState.h"
|
|
#include "SelectorChecker.h"
|
|
#include "ShadowRoot.h"
|
|
+#include "SharedBuffer.h"
|
|
#include "StaticNodeList.h"
|
|
#include "StyleProperties.h"
|
|
#include "StyleResolver.h"
|
|
@@ -128,7 +134,8 @@ using namespace HTMLNames;
|
|
static const size_t maxTextSize = 10000;
|
|
static const UChar ellipsisUChar[] = { 0x2026, 0 };
|
|
|
|
-static Color parseColor(const JSON::Object* colorObject)
|
|
+// static
|
|
+Color InspectorDOMAgent::parseColor(const JSON::Object* colorObject)
|
|
{
|
|
if (!colorObject)
|
|
return Color::transparent;
|
|
@@ -157,7 +164,7 @@ static Color parseConfigColor(const String& fieldName, const JSON::Object* confi
|
|
RefPtr<JSON::Object> colorObject;
|
|
configObject->getObject(fieldName, colorObject);
|
|
|
|
- return parseColor(colorObject.get());
|
|
+ return InspectorDOMAgent::parseColor(colorObject.get());
|
|
}
|
|
|
|
static bool parseQuad(const JSON::Array& quadArray, FloatQuad* quad)
|
|
@@ -438,6 +445,20 @@ Node* InspectorDOMAgent::assertNode(ErrorString& errorString, int nodeId)
|
|
return node;
|
|
}
|
|
|
|
+Node* InspectorDOMAgent::assertNode(ErrorString& errorString, const int* nodeId, const String* objectId)
|
|
+{
|
|
+ Node* node = nullptr;
|
|
+ if (nodeId) {
|
|
+ node = assertNode(errorString, *nodeId);
|
|
+ } else if (objectId) {
|
|
+ node = nodeForObjectId(*objectId);
|
|
+ if (!node)
|
|
+ errorString = "Missing node for given objectId"_s;
|
|
+ } else
|
|
+ errorString = "Either nodeId or objectId must be specified"_s;
|
|
+ return node;
|
|
+}
|
|
+
|
|
Document* InspectorDOMAgent::assertDocument(ErrorString& errorString, int nodeId)
|
|
{
|
|
Node* node = assertNode(errorString, nodeId);
|
|
@@ -1318,16 +1339,7 @@ void InspectorDOMAgent::highlightSelector(ErrorString& errorString, const JSON::
|
|
|
|
void InspectorDOMAgent::highlightNode(ErrorString& errorString, const JSON::Object& highlightInspectorObject, const int* nodeId, const String* objectId)
|
|
{
|
|
- Node* node = nullptr;
|
|
- if (nodeId)
|
|
- node = assertNode(errorString, *nodeId);
|
|
- else if (objectId) {
|
|
- node = nodeForObjectId(*objectId);
|
|
- if (!node)
|
|
- errorString = "Missing node for given objectId"_s;
|
|
- } else
|
|
- errorString = "Either nodeId or objectId must be specified"_s;
|
|
-
|
|
+ Node* node = assertNode(errorString, nodeId, objectId);
|
|
if (!node)
|
|
return;
|
|
|
|
@@ -1475,18 +1487,103 @@ void InspectorDOMAgent::setInspectedNode(ErrorString& errorString, int nodeId)
|
|
m_suppressEventListenerChangedEvent = false;
|
|
}
|
|
|
|
-void InspectorDOMAgent::resolveNode(ErrorString& errorString, int nodeId, const String* objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result)
|
|
+static FloatPoint contentsToRootView(FrameView& containingView, const FloatPoint& point)
|
|
{
|
|
- String objectGroupName = objectGroup ? *objectGroup : emptyString();
|
|
- Node* node = assertNode(errorString, nodeId);
|
|
+ return containingView.convertToRootView(point - toFloatSize(containingView.documentScrollPositionRelativeToViewOrigin()));
|
|
+}
|
|
+
|
|
+static void frameQuadToViewport(FrameView& containingView, FloatQuad& quad)
|
|
+{
|
|
+ quad.setP1(contentsToRootView(containingView, quad.p1()));
|
|
+ quad.setP2(contentsToRootView(containingView, quad.p2()));
|
|
+ quad.setP3(contentsToRootView(containingView, quad.p3()));
|
|
+ quad.setP4(contentsToRootView(containingView, 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::describeNode(ErrorString& errorString, const String& objectId, Optional<String>& contentFrameId, Optional<String>& ownerFrameId)
|
|
+{
|
|
+ Node* node = nodeForObjectId(objectId);
|
|
+ if (!node) {
|
|
+ errorString = "Node not found"_s;
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
|
|
+ if (!pageAgent) {
|
|
+ errorString = "Page agent must be enabled"_s;
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ String frameId = pageAgent->frameId(node->document().frame());
|
|
+ if (!frameId.isEmpty())
|
|
+ ownerFrameId = frameId;
|
|
+
|
|
+ if (is<HTMLFrameOwnerElement>(*node)) {
|
|
+ const auto& frameOwner = downcast<HTMLFrameOwnerElement>(*node);
|
|
+ String frameId = pageAgent->frameId(frameOwner.contentFrame());
|
|
+ if (!frameId.isEmpty())
|
|
+ contentFrameId = frameId;
|
|
+ }
|
|
+}
|
|
+
|
|
+void InspectorDOMAgent::getContentQuads(ErrorString& errorString, const String& objectId, RefPtr<JSON::ArrayOf<Inspector::Protocol::DOM::Quad>>& contentQuads)
|
|
+{
|
|
+ Node* node = nodeForObjectId(objectId);
|
|
+ if (!node) {
|
|
+ errorString = "Node not found"_s;
|
|
+ return;
|
|
+ }
|
|
+ RenderObject* renderer = node->renderer();
|
|
+ if (!renderer) {
|
|
+ errorString = "Node doesn't have renderer"_s;
|
|
+ return;
|
|
+ }
|
|
+ Frame* containingFrame = renderer->document().frame();
|
|
+ FrameView* containingView = containingFrame ? containingFrame->view() : nullptr;
|
|
+ if (!containingView) {
|
|
+ errorString = "Internal error: no containing view"_s;
|
|
+ return;
|
|
+ }
|
|
+ Vector<FloatQuad> quads;
|
|
+ renderer->absoluteQuads(quads);
|
|
+ for (auto& quad : quads)
|
|
+ frameQuadToViewport(*containingView, quad);
|
|
+ contentQuads = buildArrayOfQuads(quads);
|
|
+}
|
|
+
|
|
+void InspectorDOMAgent::resolveNode(ErrorString& errorString, const int* nodeId, const String* objectId, const int* contextId, const String* objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result)
|
|
+{
|
|
+ Node* node = assertNode(errorString, nodeId, objectId);
|
|
if (!node)
|
|
return;
|
|
- RefPtr<Inspector::Protocol::Runtime::RemoteObject> object = resolveNode(node, objectGroupName);
|
|
- if (!object) {
|
|
+ String objectGroupName = objectGroup ? *objectGroup : emptyString();
|
|
+ result = resolveNode(node, objectGroupName, contextId);
|
|
+ if (!result) {
|
|
errorString = "Missing injected script for given nodeId"_s;
|
|
return;
|
|
}
|
|
- result = object;
|
|
}
|
|
|
|
void InspectorDOMAgent::getAttributes(ErrorString& errorString, int nodeId, RefPtr<JSON::ArrayOf<String>>& result)
|
|
@@ -2651,7 +2748,7 @@ void InspectorDOMAgent::pushNodeByPathToFrontend(ErrorString& errorString, const
|
|
errorString = "Missing node for given path"_s;
|
|
}
|
|
|
|
-RefPtr<Inspector::Protocol::Runtime::RemoteObject> InspectorDOMAgent::resolveNode(Node* node, const String& objectGroup)
|
|
+RefPtr<Inspector::Protocol::Runtime::RemoteObject> InspectorDOMAgent::resolveNode(Node* node, const String& objectGroup, const int* contextId)
|
|
{
|
|
Document* document = &node->document();
|
|
if (auto* templateHost = document->templateDocumentHost())
|
|
@@ -2660,12 +2757,16 @@ RefPtr<Inspector::Protocol::Runtime::RemoteObject> InspectorDOMAgent::resolveNod
|
|
if (!frame)
|
|
return nullptr;
|
|
|
|
- auto& state = *mainWorldExecState(frame);
|
|
- auto injectedScript = m_injectedScriptManager.injectedScriptFor(&state);
|
|
+ InjectedScript injectedScript;
|
|
+ if (contextId) {
|
|
+ injectedScript = m_injectedScriptManager.injectedScriptForId(*contextId);
|
|
+ } else {
|
|
+ injectedScript = m_injectedScriptManager.injectedScriptFor(mainWorldExecState(frame));
|
|
+ }
|
|
if (injectedScript.hasNoValue())
|
|
return nullptr;
|
|
|
|
- return injectedScript.wrapObject(nodeAsScriptValue(state, node), objectGroup);
|
|
+ return injectedScript.wrapObject(nodeAsScriptValue(*injectedScript.globalObject(), node), objectGroup);
|
|
}
|
|
|
|
Node* InspectorDOMAgent::scriptValueAsNode(JSC::JSValue value)
|
|
@@ -2686,4 +2787,46 @@ void InspectorDOMAgent::setAllowEditingUserAgentShadowTrees(ErrorString&, bool a
|
|
m_allowEditingUserAgentShadowTrees = allow;
|
|
}
|
|
|
|
+void InspectorDOMAgent::setInputFiles(ErrorString& errorString, const String& objectId, const JSON::Array& files) {
|
|
+ InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId);
|
|
+ if (injectedScript.hasNoValue()) {
|
|
+ errorString = "Can not find element's context for given id"_s;
|
|
+ return;
|
|
+ }
|
|
+ Node* node = scriptValueAsNode(injectedScript.findObjectById(objectId));
|
|
+ if (!node) {
|
|
+ errorString = "Can not find element for given id"_s;
|
|
+ return;
|
|
+ }
|
|
+ if (node->nodeType() != Node::ELEMENT_NODE || node->nodeName() != "INPUT") {
|
|
+ errorString = "Not an input node"_s;
|
|
+ return;
|
|
+ }
|
|
+ HTMLInputElement* element = static_cast<HTMLInputElement*>(node);
|
|
+ Vector<Ref<File>> fileObjects;
|
|
+ for (unsigned i = 0; i < files.length(); ++i) {
|
|
+ RefPtr<JSON::Value> item = files.get(i);
|
|
+ RefPtr<JSON::Object> obj;
|
|
+ if (!item->asObject(obj)) {
|
|
+ errorString = "Invalid file payload format"_s;
|
|
+ return;
|
|
+ }
|
|
+ String name;
|
|
+ String type;
|
|
+ String data;
|
|
+ if (!obj->getString("name", name) || !obj->getString("type", type) || !obj->getString("data", data)) {
|
|
+ errorString = "Invalid file payload format"_s;
|
|
+ return;
|
|
+ }
|
|
+ Vector<uint8_t> buffer;
|
|
+ if (!base64Decode(data, buffer)) {
|
|
+ errorString = "Unable to decode given content"_s;
|
|
+ return;
|
|
+ }
|
|
+ fileObjects.append(File::create(Blob::create(SharedBuffer::create(WTFMove(buffer)), type), name));
|
|
+ }
|
|
+ RefPtr<FileList> fileList = FileList::create(WTFMove(fileObjects));
|
|
+ element->setFiles(WTFMove(fileList));
|
|
+}
|
|
+
|
|
} // namespace WebCore
|
|
diff --git a/Source/WebCore/inspector/agents/InspectorDOMAgent.h b/Source/WebCore/inspector/agents/InspectorDOMAgent.h
|
|
index 51639abeb84f4d95ded3f4fb6409ad8f62a2894e..b71b5d196f61406152478180d487c179143397e0 100644
|
|
--- a/Source/WebCore/inspector/agents/InspectorDOMAgent.h
|
|
+++ b/Source/WebCore/inspector/agents/InspectorDOMAgent.h
|
|
@@ -54,6 +54,7 @@ namespace WebCore {
|
|
|
|
class AXCoreObject;
|
|
class CharacterData;
|
|
+class Color;
|
|
class DOMEditor;
|
|
class Document;
|
|
class Element;
|
|
@@ -88,6 +89,7 @@ public:
|
|
static String toErrorString(Exception&&);
|
|
|
|
static String documentURLString(Document*);
|
|
+ static Color parseColor(const JSON::Object*);
|
|
|
|
// We represent embedded doms as a part of the same hierarchy. Hence we treat children of frame owners differently.
|
|
// We also skip whitespace text nodes conditionally. Following methods encapsulate these specifics.
|
|
@@ -129,7 +131,7 @@ public:
|
|
void performSearch(ErrorString&, const String& query, const JSON::Array* nodeIds, const bool* caseSensitive, String* searchId, int* resultCount) override;
|
|
void getSearchResults(ErrorString&, const String& searchId, int fromIndex, int toIndex, RefPtr<JSON::ArrayOf<int>>&) override;
|
|
void discardSearchResults(ErrorString&, const String& searchId) override;
|
|
- void resolveNode(ErrorString&, int nodeId, const String* objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result) override;
|
|
+ void resolveNode(ErrorString&, const int* nodeId, const String* objectId, const int* contextId, const String* objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result) override;
|
|
void getAttributes(ErrorString&, int nodeId, RefPtr<JSON::ArrayOf<String>>& result) override;
|
|
void setInspectModeEnabled(ErrorString&, bool enabled, const JSON::Object* highlightConfig, const bool* showRulers) override;
|
|
void requestNode(ErrorString&, const String& objectId, int* nodeId) override;
|
|
@@ -148,6 +150,9 @@ public:
|
|
void focus(ErrorString&, int nodeId) override;
|
|
void setInspectedNode(ErrorString&, int nodeId) override;
|
|
void setAllowEditingUserAgentShadowTrees(ErrorString&, bool allow) final;
|
|
+ void describeNode(ErrorString&, const String& objectId, Optional<String>& contentFrameId, Optional<String>& ownerFrameId) override;
|
|
+ void getContentQuads(ErrorString&, const String& objectId, RefPtr<JSON::ArrayOf<Inspector::Protocol::DOM::Quad>>&) override;
|
|
+ void setInputFiles(ErrorString&, const String& objectId, const JSON::Array& files) override;
|
|
|
|
// InspectorInstrumentation
|
|
int identifierForNode(Node&);
|
|
@@ -183,7 +188,7 @@ public:
|
|
Node* nodeForId(int nodeId);
|
|
int boundNodeId(const Node*);
|
|
|
|
- RefPtr<Inspector::Protocol::Runtime::RemoteObject> resolveNode(Node*, const String& objectGroup);
|
|
+ RefPtr<Inspector::Protocol::Runtime::RemoteObject> resolveNode(Node*, const String& objectGroup, const int* contextId);
|
|
bool handleMousePress();
|
|
void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);
|
|
void inspect(Node*);
|
|
@@ -194,12 +199,15 @@ public:
|
|
void reset();
|
|
|
|
Node* assertNode(ErrorString&, int nodeId);
|
|
+ Node* assertNode(ErrorString&, const int* nodeId, const String* objectId);
|
|
Element* assertElement(ErrorString&, int nodeId);
|
|
Document* assertDocument(ErrorString&, int nodeId);
|
|
|
|
bool hasBreakpointForEventListener(EventTarget&, const AtomString& eventType, EventListener&, bool capture);
|
|
int idForEventListener(EventTarget&, const AtomString& eventType, EventListener&, bool capture);
|
|
|
|
+ Node* nodeForObjectId(const String& objectId);
|
|
+
|
|
private:
|
|
#if ENABLE(VIDEO)
|
|
void mediaMetricsTimerFired();
|
|
@@ -229,7 +237,6 @@ private:
|
|
void processAccessibilityChildren(AXCoreObject&, JSON::ArrayOf<int>&);
|
|
|
|
Node* nodeForPath(const String& path);
|
|
- Node* nodeForObjectId(const String& objectId);
|
|
|
|
void discardBindings();
|
|
|
|
diff --git a/Source/WebCore/inspector/agents/InspectorDOMStorageAgent.h b/Source/WebCore/inspector/agents/InspectorDOMStorageAgent.h
|
|
index b578660fbb3ce176e4e0aeb5a22021dc880e47f0..a7c968bc9f88c7d26e1887bb53106b4af2464753 100644
|
|
--- a/Source/WebCore/inspector/agents/InspectorDOMStorageAgent.h
|
|
+++ b/Source/WebCore/inspector/agents/InspectorDOMStorageAgent.h
|
|
@@ -40,6 +40,7 @@ class DOMStorageFrontendDispatcher;
|
|
|
|
namespace WebCore {
|
|
|
|
+class Color;
|
|
class Frame;
|
|
class Page;
|
|
class SecurityOrigin;
|
|
diff --git a/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp b/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp
|
|
index 31382c765d05a28ca7e787e20730c303f67b8776..f062a480d834479a0d993923073b35d5088d2531 100644
|
|
--- a/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp
|
|
+++ b/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp
|
|
@@ -56,6 +56,7 @@
|
|
#include "MIMETypeRegistry.h"
|
|
#include "MemoryCache.h"
|
|
#include "NetworkResourcesData.h"
|
|
+#include "NetworkStateNotifier.h"
|
|
#include "Page.h"
|
|
#include "PlatformStrategies.h"
|
|
#include "ProgressTracker.h"
|
|
@@ -99,6 +100,23 @@ using namespace Inspector;
|
|
|
|
namespace {
|
|
|
|
+String inspectorInitiatorPrefix()
|
|
+{
|
|
+ return "InspectorPageAgent.navigate referrer:"_s;
|
|
+}
|
|
+
|
|
+Ref<Inspector::Protocol::Network::WebSocketFrame> buildWebSocketMessage(const WebSocketFrame& frame)
|
|
+{
|
|
+ return Inspector::Protocol::Network::WebSocketFrame::create()
|
|
+ .setOpcode(frame.opCode)
|
|
+ .setMask(frame.masked)
|
|
+ .setPayloadData(frame.opCode == 1
|
|
+ ? String::fromUTF8WithLatin1Fallback(frame.payload, frame.payloadLength)
|
|
+ : base64Encode(frame.payload, frame.payloadLength))
|
|
+ .setPayloadLength(frame.payloadLength)
|
|
+ .release();
|
|
+}
|
|
+
|
|
class InspectorThreadableLoaderClient final : public ThreadableLoaderClient {
|
|
WTF_MAKE_NONCOPYABLE(InspectorThreadableLoaderClient);
|
|
public:
|
|
@@ -438,6 +456,13 @@ void InspectorNetworkAgent::willSendRequest(unsigned long identifier, DocumentLo
|
|
for (auto& entry : m_extraRequestHeaders)
|
|
request.setHTTPHeaderField(entry.key, entry.value);
|
|
|
|
+ if (request.initiatorIdentifier().startsWith(inspectorInitiatorPrefix())) {
|
|
+ String referrer = request.initiatorIdentifier().substring(inspectorInitiatorPrefix().length());
|
|
+ if (!referrer.isEmpty())
|
|
+ request.setHTTPReferrer(referrer);
|
|
+ request.setInitiatorIdentifier(String());
|
|
+ }
|
|
+
|
|
auto protocolResourceType = InspectorPageAgent::resourceTypeJSON(type);
|
|
|
|
Document* document = loader && loader->frame() ? loader->frame()->document() : nullptr;
|
|
@@ -770,24 +795,12 @@ void InspectorNetworkAgent::didCloseWebSocket(unsigned long identifier)
|
|
|
|
void InspectorNetworkAgent::didReceiveWebSocketFrame(unsigned long identifier, const WebSocketFrame& frame)
|
|
{
|
|
- auto frameObject = Inspector::Protocol::Network::WebSocketFrame::create()
|
|
- .setOpcode(frame.opCode)
|
|
- .setMask(frame.masked)
|
|
- .setPayloadData(String::fromUTF8WithLatin1Fallback(frame.payload, frame.payloadLength))
|
|
- .setPayloadLength(frame.payloadLength)
|
|
- .release();
|
|
- m_frontendDispatcher->webSocketFrameReceived(IdentifiersFactory::requestId(identifier), timestamp(), WTFMove(frameObject));
|
|
+ m_frontendDispatcher->webSocketFrameReceived(IdentifiersFactory::requestId(identifier), timestamp(), buildWebSocketMessage(frame));
|
|
}
|
|
|
|
void InspectorNetworkAgent::didSendWebSocketFrame(unsigned long identifier, const WebSocketFrame& frame)
|
|
{
|
|
- auto frameObject = Inspector::Protocol::Network::WebSocketFrame::create()
|
|
- .setOpcode(frame.opCode)
|
|
- .setMask(frame.masked)
|
|
- .setPayloadData(String::fromUTF8WithLatin1Fallback(frame.payload, frame.payloadLength))
|
|
- .setPayloadLength(frame.payloadLength)
|
|
- .release();
|
|
- m_frontendDispatcher->webSocketFrameSent(IdentifiersFactory::requestId(identifier), timestamp(), WTFMove(frameObject));
|
|
+ m_frontendDispatcher->webSocketFrameSent(IdentifiersFactory::requestId(identifier), timestamp(), buildWebSocketMessage(frame));
|
|
}
|
|
|
|
void InspectorNetworkAgent::didReceiveWebSocketFrameError(unsigned long identifier, const String& errorMessage)
|
|
@@ -839,6 +852,7 @@ void InspectorNetworkAgent::disable(ErrorString&)
|
|
m_resourcesData->clear();
|
|
m_extraRequestHeaders.clear();
|
|
|
|
+ continuePendingRequests();
|
|
continuePendingResponses();
|
|
|
|
setResourceCachingDisabled(false);
|
|
@@ -862,6 +876,16 @@ bool InspectorNetworkAgent::shouldIntercept(URL url)
|
|
return false;
|
|
}
|
|
|
|
+void InspectorNetworkAgent::continuePendingRequests()
|
|
+{
|
|
+ for (auto& pendingRequest : m_pendingInterceptRequests.values()) {
|
|
+ ResourceLoader* loader = pendingRequest->m_loader.get();
|
|
+ if (loader->identifier())
|
|
+ pendingRequest->m_callback(false);
|
|
+ }
|
|
+ m_pendingInterceptRequests.clear();
|
|
+}
|
|
+
|
|
void InspectorNetworkAgent::continuePendingResponses()
|
|
{
|
|
for (auto& pendingInterceptResponse : m_pendingInterceptResponses.values())
|
|
@@ -1018,17 +1042,15 @@ void InspectorNetworkAgent::resolveWebSocket(ErrorString& errorString, const Str
|
|
result = injectedScript.wrapObject(webSocketAsScriptValue(state, webSocket), objectGroupName);
|
|
}
|
|
|
|
-void InspectorNetworkAgent::setInterceptionEnabled(ErrorString& errorString, bool enabled)
|
|
+void InspectorNetworkAgent::setInterceptionEnabled(ErrorString&, bool enabled, const bool* interceptRequests)
|
|
{
|
|
- if (m_interceptionEnabled == enabled) {
|
|
- errorString = m_interceptionEnabled ? "Interception already enabled"_s : "Interception already disabled"_s;
|
|
- return;
|
|
- }
|
|
-
|
|
m_interceptionEnabled = enabled;
|
|
+ m_interceptRequests = interceptRequests && *interceptRequests;
|
|
|
|
if (!m_interceptionEnabled)
|
|
continuePendingResponses();
|
|
+ if (!m_interceptionEnabled || !m_interceptRequests)
|
|
+ continuePendingRequests();
|
|
}
|
|
|
|
void InspectorNetworkAgent::addInterception(ErrorString& errorString, const String& url, const bool* optionalCaseSensitive, const bool* optionalIsRegex, const String* networkStageString)
|
|
@@ -1110,19 +1132,117 @@ void InspectorNetworkAgent::interceptResponse(const ResourceResponse& response,
|
|
m_frontendDispatcher->responseIntercepted(requestId, buildObjectForResourceResponse(response, nullptr));
|
|
}
|
|
|
|
-void InspectorNetworkAgent::interceptContinue(ErrorString& errorString, const String& requestId)
|
|
-{
|
|
+bool InspectorNetworkAgent::interceptRequest(ResourceLoader& loader, Function<void(bool handled)>&& handler) {
|
|
+ if (!m_interceptionEnabled || !m_interceptRequests)
|
|
+ return false;
|
|
+ String requestId = IdentifiersFactory::requestId(loader.identifier());
|
|
+ auto pendingRequest = makeUnique<PendingInterceptRequest>();
|
|
+ pendingRequest->m_loader = &loader;
|
|
+ pendingRequest->m_callback = WTFMove(handler);
|
|
+ m_pendingInterceptRequests.set(requestId, WTFMove(pendingRequest));
|
|
+ m_frontendDispatcher->requestIntercepted(requestId, buildObjectForResourceRequest(loader.request()));
|
|
+ return true;
|
|
+}
|
|
+
|
|
+void InspectorNetworkAgent::interceptContinue(ErrorString& errorString, const String& requestId, const JSON::Object* headers)
|
|
+{
|
|
+ auto pendingRequest = m_pendingInterceptRequests.take(requestId);
|
|
+ if (pendingRequest) {
|
|
+ ResourceLoader* loader = pendingRequest->m_loader.get();
|
|
+ if (!loader->identifier()) {
|
|
+ // Do not throw upon continue of canceled requests.
|
|
+ return;
|
|
+ }
|
|
+ if (headers) {
|
|
+ // Safe to const cast at this point, we are only adjusting the headers.
|
|
+ ResourceRequest* request = const_cast<ResourceRequest*>(&loader->request());
|
|
+ HTTPHeaderMap explicitHeaders;
|
|
+ for (auto& header : *headers) {
|
|
+ String headerValue;
|
|
+ if (header.value->asString(headerValue))
|
|
+ explicitHeaders.add(header.key, headerValue);
|
|
+ }
|
|
+ request->setHTTPHeaderFields(WTFMove(explicitHeaders));
|
|
+ }
|
|
+ pendingRequest->m_callback(false);
|
|
+ return;
|
|
+ }
|
|
+
|
|
auto pendingInterceptResponse = m_pendingInterceptResponses.take(requestId);
|
|
- if (!pendingInterceptResponse) {
|
|
- errorString = "Missing pending intercept response for given requestId"_s;
|
|
+ if (pendingInterceptResponse) {
|
|
+ pendingInterceptResponse->respondWithOriginalResponse();
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ errorString = "Missing pending intercept response for given requestId"_s;
|
|
+}
|
|
+
|
|
+void InspectorNetworkAgent::interceptAsError(ErrorString& errorString, const String& requestId, const String& reason)
|
|
+{
|
|
+ auto pendingRequest = m_pendingInterceptRequests.take(requestId);
|
|
+ if (pendingRequest) {
|
|
+ ResourceLoader* loader = pendingRequest->m_loader.get();
|
|
+ if (!loader->identifier()) {
|
|
+ errorString = "Unable to abort request, it has already been processed"_s;
|
|
+ return;
|
|
+ }
|
|
+ ResourceError error(errorDomainWebKitInternal, 0, loader->url(), "Request intercepted"_s, ResourceError::Type::General);
|
|
+ if (reason == "AccessControl")
|
|
+ error = ResourceError(errorDomainWebKitInternal, 0, loader->url(), "Access denied"_s, ResourceError::Type::AccessControl);
|
|
+ else if (reason == "Cancellation")
|
|
+ error = ResourceError(errorDomainWebKitInternal, 0, loader->url(), "Request canceled"_s, ResourceError::Type::Cancellation);
|
|
+ else if (reason == "Timeout")
|
|
+ error = ResourceError(errorDomainWebKitInternal, 0, loader->url(), "Request timed out"_s, ResourceError::Type::Timeout);
|
|
+ loader->didFail(error);
|
|
+ pendingRequest->m_callback(true);
|
|
return;
|
|
}
|
|
|
|
- pendingInterceptResponse->respondWithOriginalResponse();
|
|
+ errorString = "Missing pending intercept response for given requestId"_s;
|
|
}
|
|
|
|
-void InspectorNetworkAgent::interceptWithResponse(ErrorString& errorString, const String& requestId, const String& content, bool base64Encoded, const String* mimeType, const int* status, const String* statusText, const JSON::Object* headers)
|
|
+void InspectorNetworkAgent::interceptWithResponse(ErrorString& errorString, const String& requestId, const String* content, const bool* base64Encoded, const String* mimeType, const int* status, const String* statusText, const JSON::Object* headers)
|
|
{
|
|
+ auto pendingRequest = m_pendingInterceptRequests.take(requestId);
|
|
+ if (pendingRequest && status && statusText && mimeType && headers) {
|
|
+ RefPtr<ResourceLoader> loader = pendingRequest->m_loader.get();
|
|
+ if (!loader->identifier()) {
|
|
+ errorString = "Unable to fulfill request, it has already been processed"_s;
|
|
+ return;
|
|
+ }
|
|
+ RefPtr<SharedBuffer> data;
|
|
+ if (base64Encoded && *base64Encoded && content) {
|
|
+ Vector<uint8_t> buffer;
|
|
+ if (!base64Decode(*content, buffer)) {
|
|
+ errorString = "Unable to decode given content"_s;
|
|
+ return;
|
|
+ }
|
|
+ data = SharedBuffer::create(WTFMove(buffer));
|
|
+ } else if (content) {
|
|
+ data = SharedBuffer::create(content->utf8().data(), content->utf8().length());
|
|
+ }
|
|
+
|
|
+ ResourceResponse response(pendingRequest->m_loader->url(), *mimeType, data->size(), String());
|
|
+ response.setSource(ResourceResponse::Source::InspectorOverride);
|
|
+ response.setHTTPStatusCode(*status);
|
|
+ response.setHTTPStatusText(*statusText);
|
|
+ HTTPHeaderMap explicitHeaders;
|
|
+ for (auto& header : *headers) {
|
|
+ String headerValue;
|
|
+ if (header.value->asString(headerValue))
|
|
+ explicitHeaders.add(header.key, headerValue);
|
|
+ }
|
|
+ response.setHTTPHeaderFields(WTFMove(explicitHeaders));
|
|
+ response.setHTTPHeaderField(HTTPHeaderName::ContentType, response.mimeType());
|
|
+ loader->didReceiveResponse(response, [loader, data = data.releaseNonNull()]() mutable {
|
|
+ if (data->size())
|
|
+ loader->didReceiveBuffer(WTFMove(data), data->size(), DataPayloadWholeResource);
|
|
+ loader->didFinishLoading(NetworkLoadMetrics());
|
|
+ });
|
|
+ pendingRequest->m_callback(true);
|
|
+ return;
|
|
+ }
|
|
+
|
|
auto pendingInterceptResponse = m_pendingInterceptResponses.take(requestId);
|
|
if (!pendingInterceptResponse) {
|
|
errorString = "Missing pending intercept response for given requestId"_s;
|
|
@@ -1150,20 +1270,26 @@ void InspectorNetworkAgent::interceptWithResponse(ErrorString& errorString, cons
|
|
}
|
|
|
|
RefPtr<SharedBuffer> overrideData;
|
|
- if (base64Encoded) {
|
|
+ if (base64Encoded && *base64Encoded && content) {
|
|
Vector<uint8_t> buffer;
|
|
- if (!base64Decode(content, buffer)) {
|
|
+ if (!base64Decode(*content, buffer)) {
|
|
errorString = "Unable to decode given content"_s;
|
|
pendingInterceptResponse->respondWithOriginalResponse();
|
|
return;
|
|
}
|
|
overrideData = SharedBuffer::create(WTFMove(buffer));
|
|
- } else
|
|
- overrideData = SharedBuffer::create(content.utf8().data(), content.utf8().length());
|
|
+ } else if (content) {
|
|
+ overrideData = SharedBuffer::create(content->utf8().data(), content->utf8().length());
|
|
+ }
|
|
|
|
pendingInterceptResponse->respond(overrideResponse, overrideData);
|
|
}
|
|
|
|
+void InspectorNetworkAgent::setEmulateOfflineState(ErrorString&, bool offline)
|
|
+{
|
|
+ platformStrategies()->loaderStrategy()->setEmulateOfflineState(offline);
|
|
+}
|
|
+
|
|
bool InspectorNetworkAgent::shouldTreatAsText(const String& mimeType)
|
|
{
|
|
return startsWithLettersIgnoringASCIICase(mimeType, "text/")
|
|
@@ -1293,6 +1419,11 @@ void InspectorNetworkAgent::searchInRequest(ErrorString& errorString, const Stri
|
|
results = ContentSearchUtilities::searchInTextByLines(resourceData->content(), query, caseSensitive, isRegex);
|
|
}
|
|
|
|
+String InspectorNetworkAgent::createInitiatorIdentifierForInspectorNavigation(const String& referrer)
|
|
+{
|
|
+ return inspectorInitiatorPrefix() + referrer;
|
|
+}
|
|
+
|
|
void InspectorNetworkAgent::mainFrameNavigated(DocumentLoader& loader)
|
|
{
|
|
m_resourcesData->clear(loaderIdentifier(&loader));
|
|
diff --git a/Source/WebCore/inspector/agents/InspectorNetworkAgent.h b/Source/WebCore/inspector/agents/InspectorNetworkAgent.h
|
|
index a68f84520736977c8b9216616c5a178fbf5275d6..b839460cf769887f49d1944d780a526fcb681b90 100644
|
|
--- a/Source/WebCore/inspector/agents/InspectorNetworkAgent.h
|
|
+++ b/Source/WebCore/inspector/agents/InspectorNetworkAgent.h
|
|
@@ -87,11 +87,13 @@ public:
|
|
void loadResource(const String& frameId, const String& url, Ref<LoadResourceCallback>&&) final;
|
|
void getSerializedCertificate(ErrorString&, const String& requestId, String* serializedCertificate) final;
|
|
void resolveWebSocket(ErrorString&, const String& requestId, const String* objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>&) final;
|
|
- void setInterceptionEnabled(ErrorString&, bool enabled) final;
|
|
+ void setInterceptionEnabled(ErrorString&, bool enabled, const bool* interceptRequests) final;
|
|
void addInterception(ErrorString&, const String& url, const bool* caseSensitive, const bool* isRegex, const String* networkStageString) final;
|
|
void removeInterception(ErrorString&, const String& url, const bool* caseSensitive, const bool* isRegex, const String* networkStageString) final;
|
|
- void interceptContinue(ErrorString&, const String& requestId) final;
|
|
- void interceptWithResponse(ErrorString&, const String& requestId, const String& content, bool base64Encoded, const String* mimeType, const int* status, const String* statusText, const JSON::Object* headers) final;
|
|
+ void interceptContinue(ErrorString&, const String& requestId, const JSON::Object* headers) final;
|
|
+ void interceptAsError(ErrorString&, const String& requestId, const String& reason) final;
|
|
+ void interceptWithResponse(ErrorString&, const String& requestId, const String* content, const bool* base64Encoded, const String* mimeType, const int* status, const String* statusText, const JSON::Object* headers) final;
|
|
+ void setEmulateOfflineState(ErrorString&, bool offline) final;
|
|
|
|
// InspectorInstrumentation
|
|
void willRecalculateStyle();
|
|
@@ -121,10 +123,13 @@ public:
|
|
bool willInterceptRequest(const ResourceRequest&);
|
|
bool shouldInterceptResponse(const ResourceResponse&);
|
|
void interceptResponse(const ResourceResponse&, unsigned long identifier, CompletionHandler<void(const ResourceResponse&, RefPtr<SharedBuffer>)>&&);
|
|
+ bool interceptRequest(ResourceLoader& loader, Function<void(bool handled)>&&);
|
|
|
|
void searchOtherRequests(const JSC::Yarr::RegularExpression&, RefPtr<JSON::ArrayOf<Inspector::Protocol::Page::SearchResult>>&);
|
|
void searchInRequest(ErrorString&, const String& requestId, const String& query, bool caseSensitive, bool isRegex, RefPtr<JSON::ArrayOf<Inspector::Protocol::GenericTypes::SearchMatch>>&);
|
|
|
|
+ static String createInitiatorIdentifierForInspectorNavigation(const String& referrer);
|
|
+
|
|
protected:
|
|
InspectorNetworkAgent(WebAgentContext&);
|
|
|
|
@@ -141,6 +146,7 @@ private:
|
|
void willSendRequest(unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse, InspectorPageAgent::ResourceType);
|
|
|
|
bool shouldIntercept(URL);
|
|
+ void continuePendingRequests();
|
|
void continuePendingResponses();
|
|
|
|
WebSocket* webSocketForRequestId(const String& requestId);
|
|
@@ -191,6 +197,15 @@ private:
|
|
bool m_responded { false };
|
|
};
|
|
|
|
+ class PendingInterceptRequest {
|
|
+ WTF_MAKE_NONCOPYABLE(PendingInterceptRequest);
|
|
+ WTF_MAKE_FAST_ALLOCATED;
|
|
+ public:
|
|
+ PendingInterceptRequest() = default;
|
|
+ RefPtr<ResourceLoader> m_loader;
|
|
+ CompletionHandler<void(bool handled)> m_callback;
|
|
+ };
|
|
+
|
|
std::unique_ptr<Inspector::NetworkFrontendDispatcher> m_frontendDispatcher;
|
|
RefPtr<Inspector::NetworkBackendDispatcher> m_backendDispatcher;
|
|
Inspector::InjectedScriptManager& m_injectedScriptManager;
|
|
@@ -214,6 +229,7 @@ private:
|
|
};
|
|
Vector<Intercept> m_intercepts;
|
|
HashMap<String, std::unique_ptr<PendingInterceptResponse>> m_pendingInterceptResponses;
|
|
+ HashMap<String, std::unique_ptr<PendingInterceptRequest>> m_pendingInterceptRequests;
|
|
|
|
// FIXME: InspectorNetworkAgent should not be aware of style recalculation.
|
|
RefPtr<Inspector::Protocol::Network::Initiator> m_styleRecalculationInitiator;
|
|
@@ -222,6 +238,7 @@ private:
|
|
bool m_enabled { false };
|
|
bool m_loadingXHRSynchronously { false };
|
|
bool m_interceptionEnabled { false };
|
|
+ bool m_interceptRequests { false };
|
|
};
|
|
|
|
} // namespace WebCore
|
|
diff --git a/Source/WebCore/inspector/agents/InspectorPageAgent.cpp b/Source/WebCore/inspector/agents/InspectorPageAgent.cpp
|
|
index d4e6b5d1f2151a1f4c16081b2695dd66da416ba2..7ddcea8b824043a6a17cfe2d209d861b701029f1 100644
|
|
--- a/Source/WebCore/inspector/agents/InspectorPageAgent.cpp
|
|
+++ b/Source/WebCore/inspector/agents/InspectorPageAgent.cpp
|
|
@@ -32,6 +32,8 @@
|
|
#include "config.h"
|
|
#include "InspectorPageAgent.h"
|
|
|
|
+#include "AXObjectCache.h"
|
|
+#include "BackForwardController.h"
|
|
#include "CachedResource.h"
|
|
#include "CachedResourceLoader.h"
|
|
#include "Cookie.h"
|
|
@@ -39,12 +41,15 @@
|
|
#include "CustomHeaderFields.h"
|
|
#include "Document.h"
|
|
#include "DocumentLoader.h"
|
|
+#include "FocusController.h"
|
|
#include "Frame.h"
|
|
#include "FrameLoadRequest.h"
|
|
#include "FrameLoader.h"
|
|
+#include "FrameLoaderClient.h"
|
|
#include "FrameSnapshotting.h"
|
|
#include "FrameView.h"
|
|
#include "HTMLFrameOwnerElement.h"
|
|
+#include "HTMLInputElement.h"
|
|
#include "HTMLNames.h"
|
|
#include "ImageBuffer.h"
|
|
#include "InspectorClient.h"
|
|
@@ -55,18 +60,24 @@
|
|
#include "MIMETypeRegistry.h"
|
|
#include "MemoryCache.h"
|
|
#include "Page.h"
|
|
+#include "PageRuntimeAgent.h"
|
|
#include "RenderObject.h"
|
|
#include "RenderTheme.h"
|
|
+#include "RuntimeEnabledFeatures.h"
|
|
#include "ScriptController.h"
|
|
#include "ScriptSourceCode.h"
|
|
+#include "ScriptState.h"
|
|
#include "SecurityOrigin.h"
|
|
#include "Settings.h"
|
|
#include "StyleScope.h"
|
|
#include "TextEncoding.h"
|
|
+#include "TypingCommand.h"
|
|
#include "UserGestureIndicator.h"
|
|
#include <JavaScriptCore/ContentSearchUtilities.h>
|
|
#include <JavaScriptCore/IdentifiersFactory.h>
|
|
+#include <JavaScriptCore/InjectedScriptManager.h>
|
|
#include <JavaScriptCore/RegularExpression.h>
|
|
+#include <platform/ProcessIdentifier.h>
|
|
#include <wtf/ListHashSet.h>
|
|
#include <wtf/Stopwatch.h>
|
|
#include <wtf/text/Base64.h>
|
|
@@ -339,6 +350,7 @@ InspectorPageAgent::InspectorPageAgent(PageAgentContext& context, InspectorClien
|
|
, m_frontendDispatcher(makeUnique<Inspector::PageFrontendDispatcher>(context.frontendRouter))
|
|
, m_backendDispatcher(Inspector::PageBackendDispatcher::create(context.backendDispatcher, this))
|
|
, m_inspectedPage(context.inspectedPage)
|
|
+ , m_injectedScriptManager(context.injectedScriptManager)
|
|
, m_client(client)
|
|
, m_overlay(overlay)
|
|
{
|
|
@@ -377,6 +389,8 @@ void InspectorPageAgent::enable(ErrorString& errorString)
|
|
void InspectorPageAgent::disable(ErrorString&)
|
|
{
|
|
m_instrumentingAgents.setInspectorPageAgent(nullptr);
|
|
+ m_interceptFileChooserDialog = false;
|
|
+ m_bypassCSP = false;
|
|
|
|
ErrorString unused;
|
|
setShowPaintRects(unused, false);
|
|
@@ -384,6 +398,7 @@ void InspectorPageAgent::disable(ErrorString&)
|
|
overrideUserAgent(unused, nullptr);
|
|
setEmulatedMedia(unused, emptyString());
|
|
setForcedAppearance(unused, emptyString());
|
|
+ m_isolatedWorldScripts.clear();
|
|
|
|
#define DISABLE_INSPECTOR_OVERRIDE_SETTING(name) \
|
|
m_inspectedPage.settings().set##name##InspectorOverride(WTF::nullopt);
|
|
@@ -414,14 +429,36 @@ void InspectorPageAgent::reload(ErrorString&, const bool* optionalReloadFromOrig
|
|
m_inspectedPage.mainFrame().loader().reload(reloadOptions);
|
|
}
|
|
|
|
-void InspectorPageAgent::navigate(ErrorString&, const String& url)
|
|
+void InspectorPageAgent::goBack(ErrorString& errorString)
|
|
+{
|
|
+ if (!m_inspectedPage.backForward().goBack())
|
|
+ errorString = "Failed to go back"_s;
|
|
+}
|
|
+
|
|
+void InspectorPageAgent::goForward(ErrorString& errorString)
|
|
+{
|
|
+ if (!m_inspectedPage.backForward().goForward())
|
|
+ errorString = "Failed to go forward"_s;
|
|
+}
|
|
+
|
|
+void InspectorPageAgent::navigate(ErrorString& errorString, const String& url, const String* frameId, const String* referrer)
|
|
{
|
|
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) };
|
|
+
|
|
+ if (!resourceRequest.url().isValid()) {
|
|
+ errorString = "Cannot navigate to invalid URL"_s;
|
|
+ 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));
|
|
+ if (referrer)
|
|
+ resourceRequest.setInitiatorIdentifier(InspectorNetworkAgent::createInitiatorIdentifierForInspectorNavigation(*referrer));
|
|
+ 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)
|
|
@@ -682,15 +719,16 @@ void InspectorPageAgent::setShowPaintRects(ErrorString&, bool show)
|
|
m_overlay->setShowPaintRects(show);
|
|
}
|
|
|
|
-void InspectorPageAgent::domContentEventFired()
|
|
+void InspectorPageAgent::domContentEventFired(Frame& frame)
|
|
{
|
|
- m_isFirstLayoutAfterOnLoad = true;
|
|
- m_frontendDispatcher->domContentEventFired(timestamp());
|
|
+ if (frame.isMainFrame())
|
|
+ m_isFirstLayoutAfterOnLoad = true;
|
|
+ m_frontendDispatcher->domContentEventFired(timestamp(), frameId(&frame));
|
|
}
|
|
|
|
-void InspectorPageAgent::loadEventFired()
|
|
+void InspectorPageAgent::loadEventFired(Frame& frame)
|
|
{
|
|
- m_frontendDispatcher->loadEventFired(timestamp());
|
|
+ m_frontendDispatcher->loadEventFired(timestamp(), frameId(&frame));
|
|
}
|
|
|
|
void InspectorPageAgent::frameNavigated(Frame& frame)
|
|
@@ -698,13 +736,18 @@ void InspectorPageAgent::frameNavigated(Frame& frame)
|
|
m_frontendDispatcher->frameNavigated(buildObjectForFrame(&frame));
|
|
}
|
|
|
|
+static String globalIDForFrame(Frame& frame)
|
|
+{
|
|
+ return makeString(Process::identifier().toUInt64(), ".", frame.loader().client().frameID()->toUInt64());
|
|
+}
|
|
+
|
|
void InspectorPageAgent::frameDetached(Frame& frame)
|
|
{
|
|
- auto identifier = m_frameToIdentifier.take(&frame);
|
|
- if (identifier.isNull())
|
|
+ String identifier = globalIDForFrame(frame);
|
|
+ if (!m_identifierToFrame.take(identifier))
|
|
return;
|
|
+
|
|
m_frontendDispatcher->frameDetached(identifier);
|
|
- m_identifierToFrame.remove(identifier);
|
|
}
|
|
|
|
Frame* InspectorPageAgent::frameForId(const String& frameId)
|
|
@@ -716,20 +759,18 @@ String InspectorPageAgent::frameId(Frame* frame)
|
|
{
|
|
if (!frame)
|
|
return emptyString();
|
|
- return m_frameToIdentifier.ensure(frame, [this, frame] {
|
|
- auto identifier = IdentifiersFactory::createIdentifier();
|
|
- m_identifierToFrame.set(identifier, frame);
|
|
- return identifier;
|
|
- }).iterator->value;
|
|
+
|
|
+ String identifier = globalIDForFrame(*frame);
|
|
+ m_identifierToFrame.set(identifier, frame);
|
|
+ return identifier;
|
|
}
|
|
|
|
String InspectorPageAgent::loaderId(DocumentLoader* loader)
|
|
{
|
|
if (!loader)
|
|
return emptyString();
|
|
- return m_loaderToIdentifier.ensure(loader, [] {
|
|
- return IdentifiersFactory::createIdentifier();
|
|
- }).iterator->value;
|
|
+
|
|
+ return String::number(loader->loaderIDForInspector());
|
|
}
|
|
|
|
Frame* InspectorPageAgent::assertFrame(ErrorString& errorString, const String& frameId)
|
|
@@ -740,11 +781,6 @@ Frame* InspectorPageAgent::assertFrame(ErrorString& errorString, const String& f
|
|
return frame;
|
|
}
|
|
|
|
-void InspectorPageAgent::loaderDetachedFromFrame(DocumentLoader& loader)
|
|
-{
|
|
- m_loaderToIdentifier.remove(&loader);
|
|
-}
|
|
-
|
|
void InspectorPageAgent::frameStartedLoading(Frame& frame)
|
|
{
|
|
m_frontendDispatcher->frameStartedLoading(frameId(&frame));
|
|
@@ -765,17 +801,15 @@ void InspectorPageAgent::frameClearedScheduledNavigation(Frame& frame)
|
|
m_frontendDispatcher->frameClearedScheduledNavigation(frameId(&frame));
|
|
}
|
|
|
|
-void InspectorPageAgent::defaultAppearanceDidChange(bool useDarkAppearance)
|
|
+void InspectorPageAgent::didNavigateWithinPage(Frame& frame)
|
|
{
|
|
- m_frontendDispatcher->defaultAppearanceDidChange(useDarkAppearance ? Inspector::Protocol::Page::Appearance::Dark : Inspector::Protocol::Page::Appearance::Light);
|
|
+ String url = frame.document()->url().string();
|
|
+ m_frontendDispatcher->navigatedWithinDocument(frameId(&frame), url);
|
|
}
|
|
|
|
-void InspectorPageAgent::didClearWindowObjectInWorld(Frame& frame)
|
|
+void InspectorPageAgent::defaultAppearanceDidChange(bool useDarkAppearance)
|
|
{
|
|
- if (m_bootstrapScript.isEmpty())
|
|
- return;
|
|
-
|
|
- frame.script().evaluateIgnoringException(ScriptSourceCode(m_bootstrapScript, URL { URL(), "web-inspector://bootstrap.js"_s }));
|
|
+ m_frontendDispatcher->defaultAppearanceDidChange(useDarkAppearance ? Inspector::Protocol::Page::Appearance::Dark : Inspector::Protocol::Page::Appearance::Light);
|
|
}
|
|
|
|
void InspectorPageAgent::didPaint(RenderObject& renderer, const LayoutRect& rect)
|
|
@@ -819,6 +853,38 @@ void InspectorPageAgent::didRecalculateStyle()
|
|
m_overlay->update();
|
|
}
|
|
|
|
+void InspectorPageAgent::runOpenPanel(HTMLInputElement* element, bool* intercept)
|
|
+{
|
|
+ if (m_interceptFileChooserDialog) {
|
|
+ *intercept = true;
|
|
+ } else {
|
|
+ return;
|
|
+ }
|
|
+ Document& document = element->document();
|
|
+ auto* frame = document.frame();
|
|
+ if (!frame)
|
|
+ return;
|
|
+
|
|
+ auto& state = *mainWorldExecState(frame);
|
|
+ auto injectedScript = m_injectedScriptManager.injectedScriptFor(&state);
|
|
+ if (injectedScript.hasNoValue())
|
|
+ return;
|
|
+
|
|
+ m_frontendDispatcher->fileChooserOpened(frameId(frame), injectedScript.wrapObject(InspectorDOMAgent::nodeAsScriptValue(state, element), WTF::String()));
|
|
+}
|
|
+
|
|
+void InspectorPageAgent::frameAttached(Frame& frame)
|
|
+{
|
|
+ Frame* parent = frame.tree().parent();
|
|
+ String parentFrameId = frameId(parent);
|
|
+ m_frontendDispatcher->frameAttached(frameId(&frame), parent ? &parentFrameId : nullptr);
|
|
+}
|
|
+
|
|
+bool InspectorPageAgent::shouldBypassCSP()
|
|
+{
|
|
+ return m_bypassCSP;
|
|
+}
|
|
+
|
|
Ref<Inspector::Protocol::Page::Frame> InspectorPageAgent::buildObjectForFrame(Frame* frame)
|
|
{
|
|
ASSERT_ARG(frame, frame);
|
|
@@ -962,6 +1028,17 @@ void InspectorPageAgent::snapshotRect(ErrorString& errorString, int x, int y, in
|
|
*outDataURL = snapshot->toDataURL("image/png"_s, WTF::nullopt, PreserveResolution::Yes);
|
|
}
|
|
|
|
+void InspectorPageAgent::setTouchEmulationEnabled(ErrorString& errorString, bool enabled) {
|
|
+#if ENABLE(TOUCH_EVENTS)
|
|
+ RuntimeEnabledFeatures::sharedFeatures().setTouchEventsEnabled(enabled);
|
|
+ UNUSED_PARAM(errorString);
|
|
+#else
|
|
+ UNUSED_PARAM(enabled);
|
|
+ errorString = "Not supported"_s;
|
|
+#endif
|
|
+}
|
|
+
|
|
+
|
|
void InspectorPageAgent::archive(ErrorString& errorString, String* data)
|
|
{
|
|
#if ENABLE(WEB_ARCHIVE) && USE(CF)
|
|
@@ -979,4 +1056,511 @@ void InspectorPageAgent::archive(ErrorString& errorString, String* data)
|
|
#endif
|
|
}
|
|
|
|
+void InspectorPageAgent::insertText(ErrorString&, const String& text) {
|
|
+ UserGestureIndicator indicator { ProcessingUserGesture };
|
|
+ Document* focusedDocument = m_inspectedPage.focusController().focusedOrMainFrame().document();
|
|
+ TypingCommand::insertText(*focusedDocument, text, 0);
|
|
+}
|
|
+
|
|
+static String roleFromObject(RefPtr<AXCoreObject> axObject) {
|
|
+ String computedRoleString = axObject->computedRoleString();
|
|
+ if (!computedRoleString.isEmpty())
|
|
+ return computedRoleString;
|
|
+ AccessibilityRole role = axObject->roleValue();
|
|
+ switch(role) {
|
|
+ case AccessibilityRole::Annotation:
|
|
+ return "Annotation";
|
|
+ case AccessibilityRole::Application:
|
|
+ return "Application";
|
|
+ case AccessibilityRole::ApplicationAlert:
|
|
+ return "ApplicationAlert";
|
|
+ case AccessibilityRole::ApplicationAlertDialog:
|
|
+ return "ApplicationAlertDialog";
|
|
+ case AccessibilityRole::ApplicationDialog:
|
|
+ return "ApplicationDialog";
|
|
+ case AccessibilityRole::ApplicationGroup:
|
|
+ return "ApplicationGroup";
|
|
+ case AccessibilityRole::ApplicationLog:
|
|
+ return "ApplicationLog";
|
|
+ case AccessibilityRole::ApplicationMarquee:
|
|
+ return "ApplicationMarquee";
|
|
+ case AccessibilityRole::ApplicationStatus:
|
|
+ return "ApplicationStatus";
|
|
+ case AccessibilityRole::ApplicationTextGroup:
|
|
+ return "ApplicationTextGroup";
|
|
+ case AccessibilityRole::ApplicationTimer:
|
|
+ return "ApplicationTimer";
|
|
+ case AccessibilityRole::Audio:
|
|
+ return "Audio";
|
|
+ case AccessibilityRole::Blockquote:
|
|
+ return "Blockquote";
|
|
+ case AccessibilityRole::Browser:
|
|
+ return "Browser";
|
|
+ case AccessibilityRole::BusyIndicator:
|
|
+ return "BusyIndicator";
|
|
+ case AccessibilityRole::Button:
|
|
+ return "Button";
|
|
+ case AccessibilityRole::Canvas:
|
|
+ return "Canvas";
|
|
+ case AccessibilityRole::Caption:
|
|
+ return "Caption";
|
|
+ case AccessibilityRole::Cell:
|
|
+ return "Cell";
|
|
+ case AccessibilityRole::CheckBox:
|
|
+ return "CheckBox";
|
|
+ case AccessibilityRole::ColorWell:
|
|
+ return "ColorWell";
|
|
+ case AccessibilityRole::Column:
|
|
+ return "Column";
|
|
+ case AccessibilityRole::ColumnHeader:
|
|
+ return "ColumnHeader";
|
|
+ case AccessibilityRole::ComboBox:
|
|
+ return "ComboBox";
|
|
+ case AccessibilityRole::Definition:
|
|
+ return "Definition";
|
|
+ case AccessibilityRole::Deletion:
|
|
+ return "Deletion";
|
|
+ case AccessibilityRole::DescriptionList:
|
|
+ return "DescriptionList";
|
|
+ case AccessibilityRole::DescriptionListTerm:
|
|
+ return "DescriptionListTerm";
|
|
+ case AccessibilityRole::DescriptionListDetail:
|
|
+ return "DescriptionListDetail";
|
|
+ case AccessibilityRole::Details:
|
|
+ return "Details";
|
|
+ case AccessibilityRole::Directory:
|
|
+ return "Directory";
|
|
+ case AccessibilityRole::DisclosureTriangle:
|
|
+ return "DisclosureTriangle";
|
|
+ case AccessibilityRole::Div:
|
|
+ return "Div";
|
|
+ case AccessibilityRole::Document:
|
|
+ return "Document";
|
|
+ case AccessibilityRole::DocumentArticle:
|
|
+ return "DocumentArticle";
|
|
+ case AccessibilityRole::DocumentMath:
|
|
+ return "DocumentMath";
|
|
+ case AccessibilityRole::DocumentNote:
|
|
+ return "DocumentNote";
|
|
+ case AccessibilityRole::Drawer:
|
|
+ return "Drawer";
|
|
+ case AccessibilityRole::EditableText:
|
|
+ return "EditableText";
|
|
+ case AccessibilityRole::Feed:
|
|
+ return "Feed";
|
|
+ case AccessibilityRole::Figure:
|
|
+ return "Figure";
|
|
+ case AccessibilityRole::Footer:
|
|
+ return "Footer";
|
|
+ case AccessibilityRole::Footnote:
|
|
+ return "Footnote";
|
|
+ case AccessibilityRole::Form:
|
|
+ return "Form";
|
|
+ case AccessibilityRole::GraphicsDocument:
|
|
+ return "GraphicsDocument";
|
|
+ case AccessibilityRole::GraphicsObject:
|
|
+ return "GraphicsObject";
|
|
+ case AccessibilityRole::GraphicsSymbol:
|
|
+ return "GraphicsSymbol";
|
|
+ case AccessibilityRole::Grid:
|
|
+ return "Grid";
|
|
+ case AccessibilityRole::GridCell:
|
|
+ return "GridCell";
|
|
+ case AccessibilityRole::Group:
|
|
+ return "Group";
|
|
+ case AccessibilityRole::GrowArea:
|
|
+ return "GrowArea";
|
|
+ case AccessibilityRole::Heading:
|
|
+ return "Heading";
|
|
+ case AccessibilityRole::HelpTag:
|
|
+ return "HelpTag";
|
|
+ case AccessibilityRole::HorizontalRule:
|
|
+ return "HorizontalRule";
|
|
+ case AccessibilityRole::Ignored:
|
|
+ return "Ignored";
|
|
+ case AccessibilityRole::Inline:
|
|
+ return "Inline";
|
|
+ case AccessibilityRole::Image:
|
|
+ return "Image";
|
|
+ case AccessibilityRole::ImageMap:
|
|
+ return "ImageMap";
|
|
+ case AccessibilityRole::ImageMapLink:
|
|
+ return "ImageMapLink";
|
|
+ case AccessibilityRole::Incrementor:
|
|
+ return "Incrementor";
|
|
+ case AccessibilityRole::Insertion:
|
|
+ return "Insertion";
|
|
+ case AccessibilityRole::Label:
|
|
+ return "Label";
|
|
+ case AccessibilityRole::LandmarkBanner:
|
|
+ return "LandmarkBanner";
|
|
+ case AccessibilityRole::LandmarkComplementary:
|
|
+ return "LandmarkComplementary";
|
|
+ case AccessibilityRole::LandmarkContentInfo:
|
|
+ return "LandmarkContentInfo";
|
|
+ case AccessibilityRole::LandmarkDocRegion:
|
|
+ return "LandmarkDocRegion";
|
|
+ case AccessibilityRole::LandmarkMain:
|
|
+ return "LandmarkMain";
|
|
+ case AccessibilityRole::LandmarkNavigation:
|
|
+ return "LandmarkNavigation";
|
|
+ case AccessibilityRole::LandmarkRegion:
|
|
+ return "LandmarkRegion";
|
|
+ case AccessibilityRole::LandmarkSearch:
|
|
+ return "LandmarkSearch";
|
|
+ case AccessibilityRole::Legend:
|
|
+ return "Legend";
|
|
+ case AccessibilityRole::Link:
|
|
+ return "Link";
|
|
+ case AccessibilityRole::List:
|
|
+ return "List";
|
|
+ case AccessibilityRole::ListBox:
|
|
+ return "ListBox";
|
|
+ case AccessibilityRole::ListBoxOption:
|
|
+ return "ListBoxOption";
|
|
+ case AccessibilityRole::ListItem:
|
|
+ return "ListItem";
|
|
+ case AccessibilityRole::ListMarker:
|
|
+ return "ListMarker";
|
|
+ case AccessibilityRole::Mark:
|
|
+ return "Mark";
|
|
+ case AccessibilityRole::MathElement:
|
|
+ return "MathElement";
|
|
+ case AccessibilityRole::Matte:
|
|
+ return "Matte";
|
|
+ case AccessibilityRole::Menu:
|
|
+ return "Menu";
|
|
+ case AccessibilityRole::MenuBar:
|
|
+ return "MenuBar";
|
|
+ case AccessibilityRole::MenuButton:
|
|
+ return "MenuButton";
|
|
+ case AccessibilityRole::MenuItem:
|
|
+ return "MenuItem";
|
|
+ case AccessibilityRole::MenuItemCheckbox:
|
|
+ return "MenuItemCheckbox";
|
|
+ case AccessibilityRole::MenuItemRadio:
|
|
+ return "MenuItemRadio";
|
|
+ case AccessibilityRole::MenuListPopup:
|
|
+ return "MenuListPopup";
|
|
+ case AccessibilityRole::MenuListOption:
|
|
+ return "MenuListOption";
|
|
+ case AccessibilityRole::Meter:
|
|
+ return "Meter";
|
|
+ case AccessibilityRole::Outline:
|
|
+ return "Outline";
|
|
+ case AccessibilityRole::Paragraph:
|
|
+ return "Paragraph";
|
|
+ case AccessibilityRole::PopUpButton:
|
|
+ return "PopUpButton";
|
|
+ case AccessibilityRole::Pre:
|
|
+ return "Pre";
|
|
+ case AccessibilityRole::Presentational:
|
|
+ return "Presentational";
|
|
+ case AccessibilityRole::ProgressIndicator:
|
|
+ return "ProgressIndicator";
|
|
+ case AccessibilityRole::RadioButton:
|
|
+ return "RadioButton";
|
|
+ case AccessibilityRole::RadioGroup:
|
|
+ return "RadioGroup";
|
|
+ case AccessibilityRole::RowHeader:
|
|
+ return "RowHeader";
|
|
+ case AccessibilityRole::Row:
|
|
+ return "Row";
|
|
+ case AccessibilityRole::RowGroup:
|
|
+ return "RowGroup";
|
|
+ case AccessibilityRole::RubyBase:
|
|
+ return "RubyBase";
|
|
+ case AccessibilityRole::RubyBlock:
|
|
+ return "RubyBlock";
|
|
+ case AccessibilityRole::RubyInline:
|
|
+ return "RubyInline";
|
|
+ case AccessibilityRole::RubyRun:
|
|
+ return "RubyRun";
|
|
+ case AccessibilityRole::RubyText:
|
|
+ return "RubyText";
|
|
+ case AccessibilityRole::Ruler:
|
|
+ return "Ruler";
|
|
+ case AccessibilityRole::RulerMarker:
|
|
+ return "RulerMarker";
|
|
+ case AccessibilityRole::ScrollArea:
|
|
+ return "ScrollArea";
|
|
+ case AccessibilityRole::ScrollBar:
|
|
+ return "ScrollBar";
|
|
+ case AccessibilityRole::SearchField:
|
|
+ return "SearchField";
|
|
+ case AccessibilityRole::Sheet:
|
|
+ return "Sheet";
|
|
+ case AccessibilityRole::Slider:
|
|
+ return "Slider";
|
|
+ case AccessibilityRole::SliderThumb:
|
|
+ return "SliderThumb";
|
|
+ case AccessibilityRole::SpinButton:
|
|
+ return "SpinButton";
|
|
+ case AccessibilityRole::SpinButtonPart:
|
|
+ return "SpinButtonPart";
|
|
+ case AccessibilityRole::SplitGroup:
|
|
+ return "SplitGroup";
|
|
+ case AccessibilityRole::Splitter:
|
|
+ return "Splitter";
|
|
+ case AccessibilityRole::StaticText:
|
|
+ return "StaticText";
|
|
+ case AccessibilityRole::Subscript:
|
|
+ return "Subscript";
|
|
+ case AccessibilityRole::Summary:
|
|
+ return "Summary";
|
|
+ case AccessibilityRole::Superscript:
|
|
+ return "Superscript";
|
|
+ case AccessibilityRole::Switch:
|
|
+ return "Switch";
|
|
+ case AccessibilityRole::SystemWide:
|
|
+ return "SystemWide";
|
|
+ case AccessibilityRole::SVGRoot:
|
|
+ return "SVGRoot";
|
|
+ case AccessibilityRole::SVGText:
|
|
+ return "SVGText";
|
|
+ case AccessibilityRole::SVGTSpan:
|
|
+ return "SVGTSpan";
|
|
+ case AccessibilityRole::SVGTextPath:
|
|
+ return "SVGTextPath";
|
|
+ case AccessibilityRole::TabGroup:
|
|
+ return "TabGroup";
|
|
+ case AccessibilityRole::TabList:
|
|
+ return "TabList";
|
|
+ case AccessibilityRole::TabPanel:
|
|
+ return "TabPanel";
|
|
+ case AccessibilityRole::Tab:
|
|
+ return "Tab";
|
|
+ case AccessibilityRole::Table:
|
|
+ return "Table";
|
|
+ case AccessibilityRole::TableHeaderContainer:
|
|
+ return "TableHeaderContainer";
|
|
+ case AccessibilityRole::TextArea:
|
|
+ return "TextArea";
|
|
+ case AccessibilityRole::TextGroup:
|
|
+ return "TextGroup";
|
|
+ case AccessibilityRole::Term:
|
|
+ return "Term";
|
|
+ case AccessibilityRole::Time:
|
|
+ return "Time";
|
|
+ case AccessibilityRole::Tree:
|
|
+ return "Tree";
|
|
+ case AccessibilityRole::TreeGrid:
|
|
+ return "TreeGrid";
|
|
+ case AccessibilityRole::TreeItem:
|
|
+ return "TreeItem";
|
|
+ case AccessibilityRole::TextField:
|
|
+ return "TextField";
|
|
+ case AccessibilityRole::ToggleButton:
|
|
+ return "ToggleButton";
|
|
+ case AccessibilityRole::Toolbar:
|
|
+ return "Toolbar";
|
|
+ case AccessibilityRole::Unknown:
|
|
+ return "Unknown";
|
|
+ case AccessibilityRole::UserInterfaceTooltip:
|
|
+ return "UserInterfaceTooltip";
|
|
+ case AccessibilityRole::ValueIndicator:
|
|
+ return "ValueIndicator";
|
|
+ case AccessibilityRole::Video:
|
|
+ return "Video";
|
|
+ case AccessibilityRole::WebApplication:
|
|
+ return "WebApplication";
|
|
+ case AccessibilityRole::WebArea:
|
|
+ return "WebArea";
|
|
+ case AccessibilityRole::WebCoreLink:
|
|
+ return "WebCoreLink";
|
|
+ case AccessibilityRole::Window:
|
|
+ return "Window";
|
|
+ };
|
|
+ return "Unknown";
|
|
+}
|
|
+
|
|
+static RefPtr<Inspector::Protocol::Page::AXNode> snapshotForAXObject(RefPtr<AXCoreObject> axObject, Node* nodeToFind) {
|
|
+ auto axNode = Inspector::Protocol::Page::AXNode::create()
|
|
+ .setRole(roleFromObject(axObject))
|
|
+ .release();
|
|
+
|
|
+ if (!axObject->computedLabel().isEmpty())
|
|
+ axNode->setName(axObject->computedLabel());
|
|
+ if (!axObject->stringValue().isEmpty())
|
|
+ axNode->setValue(JSON::Value::create(axObject->stringValue()));
|
|
+ if (!axObject->accessibilityDescription().isEmpty())
|
|
+ axNode->setDescription(axObject->accessibilityDescription());
|
|
+ if (!axObject->keyShortcutsValue().isEmpty())
|
|
+ axNode->setKeyshortcuts(axObject->keyShortcutsValue());
|
|
+ if (!axObject->valueDescription().isEmpty())
|
|
+ axNode->setValuetext(axObject->valueDescription());
|
|
+ if (!axObject->roleDescription().isEmpty())
|
|
+ axNode->setRoledescription(axObject->roleDescription());
|
|
+ if (!axObject->isEnabled())
|
|
+ axNode->setDisabled(!axObject->isEnabled());
|
|
+ if (axObject->supportsExpanded())
|
|
+ axNode->setExpanded(axObject->isExpanded());
|
|
+ if (axObject->isFocused())
|
|
+ axNode->setFocused(axObject->isFocused());
|
|
+ if (axObject->isModalNode())
|
|
+ axNode->setModal(axObject->isModalNode());
|
|
+ bool multiline = axObject->ariaIsMultiline() || axObject->roleValue() == AccessibilityRole::TextArea;
|
|
+ if (multiline)
|
|
+ axNode->setMultiline(multiline);
|
|
+ if (axObject->isMultiSelectable())
|
|
+ axNode->setMultiselectable(axObject->isMultiSelectable());
|
|
+ if (axObject->supportsReadOnly() && !axObject->canSetValueAttribute() && axObject->isEnabled())
|
|
+ axNode->setReadonly(true);
|
|
+ if (axObject->supportsRequiredAttribute())
|
|
+ axNode->setRequired(axObject->isRequired());
|
|
+ if (axObject->isSelected())
|
|
+ axNode->setSelected(axObject->isSelected());
|
|
+ if (axObject->supportsChecked()) {
|
|
+ AccessibilityButtonState checkedState = axObject->checkboxOrRadioValue();
|
|
+ switch (checkedState) {
|
|
+ case AccessibilityButtonState::On:
|
|
+ axNode->setChecked(Inspector::Protocol::Page::AXNode::Checked::True);
|
|
+ break;
|
|
+ case AccessibilityButtonState::Off:
|
|
+ axNode->setChecked(Inspector::Protocol::Page::AXNode::Checked::False);
|
|
+ break;
|
|
+ case AccessibilityButtonState::Mixed:
|
|
+ axNode->setChecked(Inspector::Protocol::Page::AXNode::Checked::Mixed);
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ if (axObject->supportsPressed()) {
|
|
+ AccessibilityButtonState checkedState = axObject->checkboxOrRadioValue();
|
|
+ switch (checkedState) {
|
|
+ case AccessibilityButtonState::On:
|
|
+ axNode->setPressed(Inspector::Protocol::Page::AXNode::Pressed::True);
|
|
+ break;
|
|
+ case AccessibilityButtonState::Off:
|
|
+ axNode->setPressed(Inspector::Protocol::Page::AXNode::Pressed::False);
|
|
+ break;
|
|
+ case AccessibilityButtonState::Mixed:
|
|
+ axNode->setPressed(Inspector::Protocol::Page::AXNode::Pressed::Mixed);
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ unsigned level = axObject->hierarchicalLevel() ? axObject->hierarchicalLevel() : axObject->headingLevel();
|
|
+ if (level)
|
|
+ axNode->setLevel(level);
|
|
+ if (axObject->minValueForRange() != 0)
|
|
+ axNode->setValuemin(axObject->minValueForRange());
|
|
+ if (axObject->maxValueForRange() != 0)
|
|
+ axNode->setValuemax(axObject->maxValueForRange());
|
|
+ if (axObject->supportsAutoComplete())
|
|
+ axNode->setAutocomplete(axObject->autoCompleteValue());
|
|
+ if (axObject->hasPopup())
|
|
+ axNode->setHaspopup(axObject->popupValue());
|
|
+
|
|
+ String invalidValue = axObject->invalidStatus();
|
|
+ if (invalidValue != "false") {
|
|
+ if (invalidValue == "grammar")
|
|
+ axNode->setInvalid(Inspector::Protocol::Page::AXNode::Invalid::Grammar);
|
|
+ else if (invalidValue == "spelling")
|
|
+ axNode->setInvalid(Inspector::Protocol::Page::AXNode::Invalid::Spelling);
|
|
+ else // Future versions of ARIA may allow additional truthy values. Ex. format, order, or size.
|
|
+ axNode->setInvalid(Inspector::Protocol::Page::AXNode::Invalid::True);
|
|
+ }
|
|
+ switch (axObject->orientation()) {
|
|
+ case AccessibilityOrientation::Undefined:
|
|
+ break;
|
|
+ case AccessibilityOrientation::Vertical:
|
|
+ axNode->setOrientation("vertical"_s);
|
|
+ break;
|
|
+ case AccessibilityOrientation::Horizontal:
|
|
+ axNode->setOrientation("horizontal"_s);
|
|
+ break;
|
|
+ }
|
|
+
|
|
+ if (axObject->isKeyboardFocusable())
|
|
+ axNode->setFocusable(axObject->isKeyboardFocusable());
|
|
+
|
|
+ if (nodeToFind && axObject->node() == nodeToFind)
|
|
+ axNode->setFound(true);
|
|
+
|
|
+ if (axObject->hasChildren()) {
|
|
+ RefPtr<JSON::ArrayOf<Inspector::Protocol::Page::AXNode>> children = JSON::ArrayOf<Inspector::Protocol::Page::AXNode>::create();
|
|
+ for (auto& childObject : axObject->children())
|
|
+ children->addItem(snapshotForAXObject(childObject, nodeToFind));
|
|
+ axNode->setChildren(children);
|
|
+ }
|
|
+ return axNode;
|
|
+}
|
|
+
|
|
+
|
|
+void InspectorPageAgent::accessibilitySnapshot(ErrorString& errorString, const String* objectId, RefPtr<Inspector::Protocol::Page::AXNode>& out_axNode) {
|
|
+ if (!WebCore::AXObjectCache::accessibilityEnabled())
|
|
+ WebCore::AXObjectCache::enableAccessibility();
|
|
+ auto document = makeRefPtr(m_inspectedPage.mainFrame().document());
|
|
+ if (!document) {
|
|
+ errorString = "No document for main frame"_s;
|
|
+ return;
|
|
+ }
|
|
+ AXObjectCache* axObjectCache = document->axObjectCache();
|
|
+ if (!axObjectCache) {
|
|
+ errorString = "No AXObjectCache for main document"_s;
|
|
+ return;
|
|
+ }
|
|
+ AXCoreObject* axObject = axObjectCache->rootObject();
|
|
+ if (!axObject) {
|
|
+ errorString = "No AXObject for main document"_s;
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ Node* node = nullptr;
|
|
+ if (objectId) {
|
|
+ InspectorDOMAgent* domAgent = m_instrumentingAgents.inspectorDOMAgent();
|
|
+ ASSERT(domAgent);
|
|
+ node = domAgent->nodeForObjectId(*objectId);
|
|
+ if (!node) {
|
|
+ errorString = "No Node for objectId"_s;
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ out_axNode = snapshotForAXObject(makeRefPtr(axObject), node);
|
|
+}
|
|
+
|
|
+void InspectorPageAgent::setInterceptFileChooserDialog(ErrorString&, bool enabled) {
|
|
+ m_interceptFileChooserDialog = enabled;
|
|
+}
|
|
+
|
|
+void InspectorPageAgent::setDefaultBackgroundColorOverride(ErrorString& errorString, const JSON::Object* color)
|
|
+{
|
|
+ FrameView* view = m_inspectedPage.mainFrame().view();
|
|
+ if (!view) {
|
|
+ errorString = "Internal error: No frame view to set color two"_s;
|
|
+ return;
|
|
+ }
|
|
+ if (!color) {
|
|
+ view->updateBackgroundRecursively(Optional<Color>());
|
|
+ return;
|
|
+ }
|
|
+ view->updateBackgroundRecursively(InspectorDOMAgent::parseColor(color));
|
|
+}
|
|
+
|
|
+void InspectorPageAgent::createIsolatedWorld(ErrorString& errorString, const String& name, const String* optionalSource) {
|
|
+ if (m_isolatedWorldScripts.find(name) != m_isolatedWorldScripts.end()) {
|
|
+ errorString = "World with the given name already exists"_s;
|
|
+ return;
|
|
+ }
|
|
+ auto* pageRuntimeAgent = m_instrumentingAgents.pageRuntimeAgent();
|
|
+ if (!pageRuntimeAgent) {
|
|
+ errorString = "Runtime agent must be enabled"_s;
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ String source = optionalSource ? *optionalSource : String();
|
|
+ m_isolatedWorldScripts.set(name, source);
|
|
+
|
|
+ for (Frame* frame = &m_inspectedPage.mainFrame(); frame; frame = frame->tree().traverseNext())
|
|
+ pageRuntimeAgent->createIsolatedWorld(*frame, name, source);
|
|
+}
|
|
+
|
|
+void InspectorPageAgent::setBypassCSP(ErrorString&, bool enabled) {
|
|
+ m_bypassCSP = enabled;
|
|
+}
|
|
+
|
|
+void InspectorPageAgent::crash(ErrorString&) {
|
|
+ CRASH();
|
|
+}
|
|
+
|
|
} // namespace WebCore
|
|
diff --git a/Source/WebCore/inspector/agents/InspectorPageAgent.h b/Source/WebCore/inspector/agents/InspectorPageAgent.h
|
|
index 3f3bbb8fce82044c1c230b0ae7186612cc5d45cf..a25053411467e0c87eaacd1b57d74db623c854c7 100644
|
|
--- a/Source/WebCore/inspector/agents/InspectorPageAgent.h
|
|
+++ b/Source/WebCore/inspector/agents/InspectorPageAgent.h
|
|
@@ -40,10 +40,15 @@
|
|
#include <wtf/Seconds.h>
|
|
#include <wtf/text/WTFString.h>
|
|
|
|
+namespace Inspector {
|
|
+class InjectedScriptManager;
|
|
+}
|
|
+
|
|
namespace WebCore {
|
|
|
|
class DocumentLoader;
|
|
class Frame;
|
|
+class HTMLInputElement;
|
|
class InspectorClient;
|
|
class InspectorOverlay;
|
|
class Page;
|
|
@@ -96,7 +101,9 @@ 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 goBack(ErrorString&) override;
|
|
+ void goForward(ErrorString&) override;
|
|
+ void navigate(ErrorString&, const String& url, const String* frameId, const String* referrer) 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;
|
|
@@ -110,33 +117,45 @@ public:
|
|
void setShowPaintRects(ErrorString&, bool show) override;
|
|
void setEmulatedMedia(ErrorString&, const String&) override;
|
|
void setForcedAppearance(ErrorString&, const String&) override;
|
|
+ void setTouchEmulationEnabled(ErrorString&, bool) override;
|
|
void snapshotNode(ErrorString&, int nodeId, String* outDataURL) override;
|
|
- void snapshotRect(ErrorString&, int x, int y, int width, int height, const String& coordinateSystem, String* outDataURL) override;
|
|
+ void snapshotRect(ErrorString&, int x, int y, int width, int height, const String& coordinateSystem, String* outDataURL) override;
|
|
void archive(ErrorString&, String* data) override;
|
|
+ void insertText(ErrorString&, const String& text) override;
|
|
+ void accessibilitySnapshot(ErrorString&, const String* objectId, RefPtr<Inspector::Protocol::Page::AXNode>& out_axNode) override;
|
|
+ void setInterceptFileChooserDialog(ErrorString&, bool enabled) override;
|
|
+ void setDefaultBackgroundColorOverride(ErrorString&, const JSON::Object*) override;
|
|
+ void createIsolatedWorld(ErrorString&, const String&, const String*) override;
|
|
+ void setBypassCSP(ErrorString&, bool) override;
|
|
+ void crash(ErrorString&) override;
|
|
|
|
// InspectorInstrumentation
|
|
- void domContentEventFired();
|
|
- void loadEventFired();
|
|
+ void domContentEventFired(Frame&);
|
|
+ void loadEventFired(Frame&);
|
|
void frameNavigated(Frame&);
|
|
void frameDetached(Frame&);
|
|
- void loaderDetachedFromFrame(DocumentLoader&);
|
|
void frameStartedLoading(Frame&);
|
|
void frameStoppedLoading(Frame&);
|
|
void frameScheduledNavigation(Frame&, Seconds delay);
|
|
void frameClearedScheduledNavigation(Frame&);
|
|
+ void didNavigateWithinPage(Frame&);
|
|
void defaultAppearanceDidChange(bool useDarkAppearance);
|
|
void applyUserAgentOverride(String&);
|
|
void applyEmulatedMedia(String&);
|
|
- void didClearWindowObjectInWorld(Frame&);
|
|
void didPaint(RenderObject&, const LayoutRect&);
|
|
void didLayout();
|
|
void didScroll();
|
|
void didRecalculateStyle();
|
|
+ void runOpenPanel(HTMLInputElement* element, bool* intercept);
|
|
+ void frameAttached(Frame&);
|
|
+ bool shouldBypassCSP();
|
|
|
|
Frame* frameForId(const String& frameId);
|
|
WEBCORE_EXPORT String frameId(Frame*);
|
|
String loaderId(DocumentLoader*);
|
|
Frame* assertFrame(ErrorString&, const String& frameId);
|
|
+ HashMap<String, String> isolatedWorldScripts() { return m_isolatedWorldScripts; };
|
|
+ String bootstrapScript() { return m_bootstrapScript; }
|
|
|
|
private:
|
|
double timestamp();
|
|
@@ -151,18 +170,20 @@ private:
|
|
RefPtr<Inspector::PageBackendDispatcher> m_backendDispatcher;
|
|
|
|
Page& m_inspectedPage;
|
|
+ Inspector::InjectedScriptManager& m_injectedScriptManager;
|
|
InspectorClient* m_client { nullptr };
|
|
InspectorOverlay* m_overlay { nullptr };
|
|
|
|
- HashMap<Frame*, String> m_frameToIdentifier;
|
|
HashMap<String, Frame*> m_identifierToFrame;
|
|
- HashMap<DocumentLoader*, String> m_loaderToIdentifier;
|
|
String m_userAgentOverride;
|
|
String m_emulatedMedia;
|
|
String m_forcedAppearance;
|
|
String m_bootstrapScript;
|
|
+ HashMap<String, String> m_isolatedWorldScripts;
|
|
bool m_isFirstLayoutAfterOnLoad { false };
|
|
bool m_showPaintRects { false };
|
|
+ bool m_interceptFileChooserDialog { false };
|
|
+ bool m_bypassCSP { false };
|
|
};
|
|
|
|
} // namespace WebCore
|
|
diff --git a/Source/WebCore/inspector/agents/page/PageRuntimeAgent.cpp b/Source/WebCore/inspector/agents/page/PageRuntimeAgent.cpp
|
|
index 864ce3cfe13994642495f2d7dfbdcc9a4cad9f24..50a4c389709d92a251214b24ba6068d96c2ea17b 100644
|
|
--- a/Source/WebCore/inspector/agents/page/PageRuntimeAgent.cpp
|
|
+++ b/Source/WebCore/inspector/agents/page/PageRuntimeAgent.cpp
|
|
@@ -34,12 +34,14 @@
|
|
|
|
#include "Document.h"
|
|
#include "Frame.h"
|
|
+#include "FrameLoader.h"
|
|
#include "InspectorPageAgent.h"
|
|
#include "InstrumentingAgents.h"
|
|
#include "JSDOMWindowBase.h"
|
|
#include "Page.h"
|
|
#include "PageConsoleClient.h"
|
|
#include "ScriptController.h"
|
|
+#include "ScriptSourceCode.h"
|
|
#include "ScriptState.h"
|
|
#include "SecurityOrigin.h"
|
|
#include "UserGestureEmulationScope.h"
|
|
@@ -103,9 +105,25 @@ void PageRuntimeAgent::didClearWindowObjectInWorld(Frame& frame)
|
|
if (!pageAgent)
|
|
return;
|
|
|
|
- auto frameId = pageAgent->frameId(&frame);
|
|
+ // Force main world creation.
|
|
auto* scriptState = mainWorldExecState(&frame);
|
|
- notifyContextCreated(frameId, scriptState, nullptr, true);
|
|
+ Document* document = frame.document();
|
|
+ String worldName = document ? document->securityOrigin().toRawString() : String();
|
|
+ notifyContextCreated(frame, scriptState, worldName, true);
|
|
+ frame.script().evaluateIgnoringException(ScriptSourceCode(pageAgent->bootstrapScript(), URL { URL(), "web-inspector://bootstrap.js"_s }));
|
|
+
|
|
+ // Create user worlds.
|
|
+ for (auto pair : pageAgent->isolatedWorldScripts())
|
|
+ createIsolatedWorld(frame, pair.key, pair.value);
|
|
+}
|
|
+
|
|
+void PageRuntimeAgent::didReceiveMainResourceError(Frame& frame)
|
|
+{
|
|
+ if (frame.loader().stateMachine().isDisplayingInitialEmptyDocument()) {
|
|
+ // Ensure execution context is created for the empty docment to make
|
|
+ // it usable in case loading failed.
|
|
+ mainWorldExecState(&frame);
|
|
+ }
|
|
}
|
|
|
|
InjectedScript PageRuntimeAgent::injectedScriptForEval(ErrorString& errorString, const int* executionContextId)
|
|
@@ -142,38 +160,38 @@ void PageRuntimeAgent::reportExecutionContextCreation()
|
|
|
|
Vector<std::pair<JSC::JSGlobalObject*, SecurityOrigin*>> isolatedContexts;
|
|
for (Frame* frame = &m_inspectedPage.mainFrame(); frame; frame = frame->tree().traverseNext()) {
|
|
- if (!frame->script().canExecuteScripts(NotAboutToExecuteScript))
|
|
- continue;
|
|
-
|
|
- String frameId = pageAgent->frameId(frame);
|
|
-
|
|
JSC::JSGlobalObject* scriptState = mainWorldExecState(frame);
|
|
- notifyContextCreated(frameId, scriptState, nullptr, true);
|
|
+ Document* document = frame->document();
|
|
+ String worldName = document ? document->securityOrigin().toRawString() : String();
|
|
+ notifyContextCreated(*frame, scriptState, worldName, true);
|
|
frame->script().collectIsolatedContexts(isolatedContexts);
|
|
if (isolatedContexts.isEmpty())
|
|
continue;
|
|
for (auto& [globalObject, securityOrigin] : isolatedContexts) {
|
|
- if (globalObject != scriptState)
|
|
- notifyContextCreated(frameId, globalObject, securityOrigin, false);
|
|
+ if (globalObject == scriptState)
|
|
+ continue;
|
|
+ String name = securityOrigin ? securityOrigin->toRawString() : String();
|
|
+ notifyContextCreated(*frame, globalObject, name, false);
|
|
}
|
|
isolatedContexts.clear();
|
|
}
|
|
}
|
|
|
|
-void PageRuntimeAgent::notifyContextCreated(const String& frameId, JSC::JSGlobalObject* scriptState, SecurityOrigin* securityOrigin, bool isPageContext)
|
|
+void PageRuntimeAgent::notifyContextCreated(Frame& frame, JSC::JSGlobalObject* scriptState, const String& contextName, bool isPageContext)
|
|
{
|
|
- ASSERT(securityOrigin || isPageContext);
|
|
-
|
|
+ auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
|
|
+ if (!pageAgent)
|
|
+ return;
|
|
+ String frameId = pageAgent->frameId(&frame);
|
|
InjectedScript result = injectedScriptManager().injectedScriptFor(scriptState);
|
|
if (result.hasNoValue())
|
|
return;
|
|
|
|
int executionContextId = injectedScriptManager().injectedScriptIdFor(scriptState);
|
|
- String name = securityOrigin ? securityOrigin->toRawString() : String();
|
|
m_frontendDispatcher->executionContextCreated(ExecutionContextDescription::create()
|
|
.setId(executionContextId)
|
|
.setIsPageContext(isPageContext)
|
|
- .setName(name)
|
|
+ .setName(contextName)
|
|
.setFrameId(frameId)
|
|
.release());
|
|
}
|
|
@@ -190,4 +208,18 @@ void PageRuntimeAgent::callFunctionOn(ErrorString& errorString, const String& ob
|
|
InspectorRuntimeAgent::callFunctionOn(errorString, objectId, expression, optionalArguments, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, emulateUserGesture, result, wasThrown);
|
|
}
|
|
|
|
+void PageRuntimeAgent::createIsolatedWorld(Frame& frame, const String& name, const String& source) {
|
|
+ auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
|
|
+ if (!pageAgent)
|
|
+ return;
|
|
+
|
|
+ Ref<DOMWrapperWorld> world = ScriptController::createWorld();
|
|
+ frame.windowProxy().jsWindowProxy(world)->window();
|
|
+ if (!source.isEmpty())
|
|
+ frame.script().evaluateInWorldIgnoringException(ScriptSourceCode(source, URL { URL(), "web-inspector://isolate_world.js"_s }), world);
|
|
+ auto* scriptState = frame.windowProxy().jsWindowProxy(world)->window();
|
|
+ notifyContextCreated(frame, scriptState, name, false);
|
|
+ frame.script().evaluateInWorldIgnoringException(ScriptSourceCode(pageAgent->bootstrapScript(), URL { URL(), "web-inspector://bootstrap.js"_s }), world);
|
|
+}
|
|
+
|
|
} // namespace WebCore
|
|
diff --git a/Source/WebCore/inspector/agents/page/PageRuntimeAgent.h b/Source/WebCore/inspector/agents/page/PageRuntimeAgent.h
|
|
index 54a00e05828fbe10d7c69facf69bf0c302687786..df0aa6dbd784813514f59bf8c37d83700876399a 100644
|
|
--- a/Source/WebCore/inspector/agents/page/PageRuntimeAgent.h
|
|
+++ b/Source/WebCore/inspector/agents/page/PageRuntimeAgent.h
|
|
@@ -62,17 +62,19 @@ public:
|
|
// InspectorInstrumentation
|
|
void frameNavigated(Frame&);
|
|
void didClearWindowObjectInWorld(Frame&);
|
|
+ void didReceiveMainResourceError(Frame&);
|
|
+
|
|
+ void createIsolatedWorld(Frame& frame, const String& name, const String& source);
|
|
|
|
private:
|
|
Inspector::InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) override;
|
|
void muteConsole() override;
|
|
void unmuteConsole() override;
|
|
void reportExecutionContextCreation();
|
|
- void notifyContextCreated(const String& frameId, JSC::JSGlobalObject*, SecurityOrigin*, bool isPageContext);
|
|
+ void notifyContextCreated(Frame&, JSC::JSGlobalObject*, const String&, bool isPageContext);
|
|
|
|
std::unique_ptr<Inspector::RuntimeFrontendDispatcher> m_frontendDispatcher;
|
|
RefPtr<Inspector::RuntimeBackendDispatcher> m_backendDispatcher;
|
|
-
|
|
InstrumentingAgents& m_instrumentingAgents;
|
|
|
|
Page& m_inspectedPage;
|
|
diff --git a/Source/WebCore/loader/DocumentLoader.cpp b/Source/WebCore/loader/DocumentLoader.cpp
|
|
index efd2735a329935407f9d89b99fa4a28d00eaa11c..842819adcd9203df6479073bd99557c60ef2149e 100644
|
|
--- a/Source/WebCore/loader/DocumentLoader.cpp
|
|
+++ b/Source/WebCore/loader/DocumentLoader.cpp
|
|
@@ -1265,8 +1265,6 @@ void DocumentLoader::detachFromFrame()
|
|
if (!m_frame)
|
|
return;
|
|
|
|
- InspectorInstrumentation::loaderDetachedFromFrame(*m_frame, *this);
|
|
-
|
|
observeFrame(nullptr);
|
|
}
|
|
|
|
diff --git a/Source/WebCore/loader/DocumentLoader.h b/Source/WebCore/loader/DocumentLoader.h
|
|
index 5bc523a07233d6efab4ee18d19a6b8f105274664..d640783477744da05c5baed94dc0c1689b9db98f 100644
|
|
--- a/Source/WebCore/loader/DocumentLoader.h
|
|
+++ b/Source/WebCore/loader/DocumentLoader.h
|
|
@@ -163,9 +163,13 @@ public:
|
|
|
|
WEBCORE_EXPORT virtual void detachFromFrame();
|
|
|
|
+ virtual void replacedByFragmentNavigation(Frame&) { }
|
|
+
|
|
WEBCORE_EXPORT FrameLoader* frameLoader() const;
|
|
WEBCORE_EXPORT SubresourceLoader* mainResourceLoader() const;
|
|
WEBCORE_EXPORT RefPtr<SharedBuffer> mainResourceData() const;
|
|
+
|
|
+ virtual uint64_t loaderIDForInspector() { return 0; }
|
|
|
|
DocumentWriter& writer() const { return m_writer; }
|
|
|
|
diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp
|
|
index a1285851f259d82a63a86de58c53de3e3b02d914..5d3ea7a182db378927e5124660c2e9b03c879228 100644
|
|
--- a/Source/WebCore/loader/FrameLoader.cpp
|
|
+++ b/Source/WebCore/loader/FrameLoader.cpp
|
|
@@ -1180,6 +1180,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();
|
|
@@ -1365,6 +1366,8 @@ void FrameLoader::loadURL(FrameLoadRequest&& frameLoadRequest, const String& ref
|
|
|
|
ASSERT(newLoadType != FrameLoadType::Same);
|
|
|
|
+ request.setInitiatorIdentifier(frameLoadRequest.resourceRequest().initiatorIdentifier());
|
|
+
|
|
// The search for a target frame is done earlier in the case of form submission.
|
|
Frame* targetFrame = isFormSubmission ? nullptr : findFrameForNavigation(effectiveFrameName);
|
|
if (targetFrame && targetFrame != &m_frame) {
|
|
@@ -1598,6 +1601,8 @@ void FrameLoader::loadWithDocumentLoader(DocumentLoader* loader, FrameLoadType t
|
|
const String& httpMethod = loader->request().httpMethod();
|
|
|
|
if (shouldPerformFragmentNavigation(isFormSubmission, httpMethod, policyChecker().loadType(), newURL)) {
|
|
+ loader->replacedByFragmentNavigation(m_frame);
|
|
+
|
|
RefPtr<DocumentLoader> oldDocumentLoader = m_documentLoader;
|
|
NavigationAction action { *m_frame.document(), loader->request(), InitiatedByMainFrame::Unknown, policyChecker().loadType(), isFormSubmission };
|
|
|
|
@@ -3184,6 +3189,8 @@ void FrameLoader::receivedMainResourceError(const ResourceError& error)
|
|
checkCompleted();
|
|
if (m_frame.page())
|
|
checkLoadComplete();
|
|
+
|
|
+ InspectorInstrumentation::didReceiveMainResourceError(m_frame, error);
|
|
}
|
|
|
|
void FrameLoader::continueFragmentScrollAfterNavigationPolicy(const ResourceRequest& request, bool shouldContinue)
|
|
@@ -3946,9 +3953,6 @@ String FrameLoader::referrer() const
|
|
|
|
void FrameLoader::dispatchDidClearWindowObjectsInAllWorlds()
|
|
{
|
|
- if (!m_frame.script().canExecuteScripts(NotAboutToExecuteScript))
|
|
- return;
|
|
-
|
|
Vector<Ref<DOMWrapperWorld>> worlds;
|
|
ScriptController::getAllWorlds(worlds);
|
|
for (auto& world : worlds)
|
|
@@ -3957,13 +3961,12 @@ void FrameLoader::dispatchDidClearWindowObjectsInAllWorlds()
|
|
|
|
void FrameLoader::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld& world)
|
|
{
|
|
- if (!m_frame.script().canExecuteScripts(NotAboutToExecuteScript) || !m_frame.windowProxy().existingJSWindowProxy(world))
|
|
- return;
|
|
+ if (m_frame.script().canExecuteScripts(NotAboutToExecuteScript) && m_frame.windowProxy().existingJSWindowProxy(world)) {
|
|
+ m_client.dispatchDidClearWindowObjectInWorld(world);
|
|
|
|
- m_client.dispatchDidClearWindowObjectInWorld(world);
|
|
-
|
|
- if (Page* page = m_frame.page())
|
|
- page->inspectorController().didClearWindowObjectInWorld(m_frame, world);
|
|
+ if (Page* page = m_frame.page())
|
|
+ page->inspectorController().didClearWindowObjectInWorld(m_frame, world);
|
|
+ }
|
|
|
|
InspectorInstrumentation::didClearWindowObjectInWorld(m_frame, world);
|
|
}
|
|
diff --git a/Source/WebCore/loader/LoaderStrategy.h b/Source/WebCore/loader/LoaderStrategy.h
|
|
index 0644fec509e60f7a4cf59a352f32335c2d164d99..acf628996ea020a8f0a2239ef72f5c241d108840 100644
|
|
--- a/Source/WebCore/loader/LoaderStrategy.h
|
|
+++ b/Source/WebCore/loader/LoaderStrategy.h
|
|
@@ -79,6 +79,7 @@ public:
|
|
|
|
virtual bool isOnLine() const = 0;
|
|
virtual void addOnlineStateChangeListener(WTF::Function<void(bool)>&&) = 0;
|
|
+ virtual void setEmulateOfflineState(bool) {};
|
|
|
|
virtual bool shouldPerformSecurityChecks() const { return false; }
|
|
virtual bool havePerformedSecurityChecks(const ResourceResponse&) const { return false; }
|
|
diff --git a/Source/WebCore/loader/ProgressTracker.cpp b/Source/WebCore/loader/ProgressTracker.cpp
|
|
index e24fded2225f1c1918f454017566717e20484eab..30e4b7a986418c4b4f6c799b858b608206e22bb5 100644
|
|
--- a/Source/WebCore/loader/ProgressTracker.cpp
|
|
+++ b/Source/WebCore/loader/ProgressTracker.cpp
|
|
@@ -154,6 +154,8 @@ void ProgressTracker::progressCompleted(Frame& frame)
|
|
if (!m_numProgressTrackedFrames || m_originatingProgressFrame == &frame)
|
|
finalProgressComplete();
|
|
|
|
+ InspectorInstrumentation::frameStoppedLoading(frame);
|
|
+
|
|
m_client->didChangeEstimatedProgress();
|
|
}
|
|
|
|
@@ -179,8 +181,6 @@ void ProgressTracker::finalProgressComplete()
|
|
frame->loader().client().setMainFrameDocumentReady(true);
|
|
m_client->progressFinished(*frame);
|
|
frame->loader().loadProgressingStatusChanged();
|
|
-
|
|
- InspectorInstrumentation::frameStoppedLoading(*frame);
|
|
}
|
|
|
|
void ProgressTracker::incrementProgress(unsigned long identifier, const ResourceResponse& response)
|
|
diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp
|
|
index 529ecb07cdc880d37b966ea5cfa7c6b2b8dd4ef0..b1d373d90b7a3c3c5b421d025ac5e6f536cb4ada 100644
|
|
--- a/Source/WebCore/page/EventHandler.cpp
|
|
+++ b/Source/WebCore/page/EventHandler.cpp
|
|
@@ -801,9 +801,7 @@ bool EventHandler::handleMousePressEvent(const MouseEventWithHitTestResults& eve
|
|
m_mousePressNode = event.targetNode();
|
|
m_frame.document()->setFocusNavigationStartingNode(event.targetNode());
|
|
|
|
-#if ENABLE(DRAG_SUPPORT)
|
|
m_dragStartPosition = event.event().position();
|
|
-#endif
|
|
|
|
m_mousePressed = true;
|
|
m_selectionInitiationState = HaveNotStartedSelection;
|
|
@@ -842,8 +840,6 @@ VisiblePosition EventHandler::selectionExtentRespectingEditingBoundary(const Vis
|
|
return targetNode->renderer()->positionForPoint(LayoutPoint(selectionEndPoint), nullptr);
|
|
}
|
|
|
|
-#if ENABLE(DRAG_SUPPORT)
|
|
-
|
|
#if !PLATFORM(IOS_FAMILY)
|
|
|
|
bool EventHandler::supportsSelectionUpdatesOnMouseDrag() const
|
|
@@ -865,8 +861,10 @@ bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& e
|
|
|
|
Ref<Frame> protectedFrame(m_frame);
|
|
|
|
+#if ENABLE(DRAG_SUPPORT)
|
|
if (handleDrag(event, checkDragHysteresis))
|
|
return true;
|
|
+#endif
|
|
|
|
Node* targetNode = event.targetNode();
|
|
if (event.event().button() != LeftButton || !targetNode)
|
|
@@ -887,7 +885,9 @@ bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& e
|
|
ASSERT(m_mouseDownMayStartSelect || m_mouseDownMayStartAutoscroll);
|
|
#endif
|
|
|
|
+#if ENABLE(DRAG_SUPPORT)
|
|
m_mouseDownMayStartDrag = false;
|
|
+#endif
|
|
|
|
if (m_mouseDownMayStartAutoscroll && !panScrollInProgress()) {
|
|
m_autoscrollController->startAutoscrollForSelection(renderer);
|
|
@@ -904,6 +904,8 @@ bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& e
|
|
return true;
|
|
}
|
|
|
|
+#if ENABLE(DRAG_SUPPORT)
|
|
+
|
|
bool EventHandler::eventMayStartDrag(const PlatformMouseEvent& event) const
|
|
{
|
|
// This is a pre-flight check of whether the event might lead to a drag being started. Be careful
|
|
@@ -935,6 +937,8 @@ bool EventHandler::eventMayStartDrag(const PlatformMouseEvent& event) const
|
|
return targetElement && page->dragController().draggableElement(&m_frame, targetElement, result.roundedPointInInnerNodeFrame(), state);
|
|
}
|
|
|
|
+#endif // ENABLE(DRAG_SUPPORT)
|
|
+
|
|
void EventHandler::updateSelectionForMouseDrag()
|
|
{
|
|
if (!supportsSelectionUpdatesOnMouseDrag())
|
|
@@ -1026,7 +1030,6 @@ void EventHandler::updateSelectionForMouseDrag(const HitTestResult& hitTestResul
|
|
m_frame.selection().setSelectionByMouseIfDifferent(newSelection, m_frame.selection().granularity(),
|
|
FrameSelection::AdjustEndpointsAtBidiBoundary);
|
|
}
|
|
-#endif // ENABLE(DRAG_SUPPORT)
|
|
|
|
void EventHandler::lostMouseCapture()
|
|
{
|
|
@@ -1074,9 +1077,7 @@ bool EventHandler::handleMouseReleaseEvent(const MouseEventWithHitTestResults& e
|
|
// on the selection, the selection goes away. However, if we are
|
|
// editing, place the caret.
|
|
if (m_mouseDownWasSingleClickInSelection && m_selectionInitiationState != ExtendedSelection
|
|
-#if ENABLE(DRAG_SUPPORT)
|
|
&& m_dragStartPosition == event.event().position()
|
|
-#endif
|
|
&& m_frame.selection().isRange()
|
|
&& event.event().button() != RightButton) {
|
|
VisibleSelection newSelection;
|
|
@@ -2029,10 +2030,8 @@ bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& platformMouseE
|
|
return true;
|
|
|
|
swallowEvent = !dispatchMouseEvent(eventNames().mousemoveEvent, mouseEvent.targetNode(), false, 0, platformMouseEvent, true);
|
|
-#if ENABLE(DRAG_SUPPORT)
|
|
if (!swallowEvent)
|
|
swallowEvent = handleMouseDraggedEvent(mouseEvent);
|
|
-#endif
|
|
|
|
return swallowEvent;
|
|
}
|
|
diff --git a/Source/WebCore/page/EventHandler.h b/Source/WebCore/page/EventHandler.h
|
|
index d33ad47d4aa0a776b0b27ab682d577fd4717556d..491159be12564fd98259c4dd52a99c5ac686c16f 100644
|
|
--- a/Source/WebCore/page/EventHandler.h
|
|
+++ b/Source/WebCore/page/EventHandler.h
|
|
@@ -132,9 +132,7 @@ public:
|
|
|
|
WEBCORE_EXPORT VisiblePosition selectionExtentRespectingEditingBoundary(const VisibleSelection&, const LayoutPoint&, Node*);
|
|
|
|
-#if ENABLE(DRAG_SUPPORT)
|
|
void updateSelectionForMouseDrag();
|
|
-#endif
|
|
|
|
#if ENABLE(PAN_SCROLLING)
|
|
void didPanScrollStart();
|
|
@@ -366,10 +364,8 @@ private:
|
|
bool handleMousePressEventDoubleClick(const MouseEventWithHitTestResults&);
|
|
bool handleMousePressEventTripleClick(const MouseEventWithHitTestResults&);
|
|
|
|
-#if ENABLE(DRAG_SUPPORT)
|
|
bool handleMouseDraggedEvent(const MouseEventWithHitTestResults&, CheckDragHysteresis = ShouldCheckDragHysteresis);
|
|
bool shouldAllowMouseDownToStartDrag() const;
|
|
-#endif
|
|
|
|
WEBCORE_EXPORT bool handleMouseReleaseEvent(const MouseEventWithHitTestResults&);
|
|
|
|
@@ -455,10 +451,8 @@ private:
|
|
void defaultTabEventHandler(KeyboardEvent&);
|
|
void defaultArrowEventHandler(FocusDirection, KeyboardEvent&);
|
|
|
|
-#if ENABLE(DRAG_SUPPORT)
|
|
DragSourceAction updateDragSourceActionsAllowed() const;
|
|
bool supportsSelectionUpdatesOnMouseDrag() const;
|
|
-#endif
|
|
|
|
// The following are called at the beginning of handleMouseUp and handleDrag.
|
|
// If they return true it indicates that they have consumed the event.
|
|
@@ -466,9 +460,10 @@ private:
|
|
|
|
#if ENABLE(DRAG_SUPPORT)
|
|
bool eventLoopHandleMouseDragged(const MouseEventWithHitTestResults&);
|
|
- void updateSelectionForMouseDrag(const HitTestResult&);
|
|
#endif
|
|
|
|
+ void updateSelectionForMouseDrag(const HitTestResult&);
|
|
+
|
|
enum class SetOrClearLastScrollbar { Clear, Set };
|
|
void updateLastScrollbarUnderMouse(Scrollbar*, SetOrClearLastScrollbar);
|
|
|
|
@@ -516,10 +511,7 @@ private:
|
|
enum SelectionInitiationState { HaveNotStartedSelection, PlacedCaret, ExtendedSelection };
|
|
SelectionInitiationState m_selectionInitiationState { HaveNotStartedSelection };
|
|
|
|
-#if ENABLE(DRAG_SUPPORT)
|
|
LayoutPoint m_dragStartPosition;
|
|
-#endif
|
|
-
|
|
Timer m_hoverTimer;
|
|
Timer m_cursorUpdateTimer;
|
|
|
|
diff --git a/Source/WebCore/page/Frame.cpp b/Source/WebCore/page/Frame.cpp
|
|
index 6f434d95832e2527aa2059e5907154bdf64bef63..563d961443ad3f28e32766302eeee144635154d0 100644
|
|
--- a/Source/WebCore/page/Frame.cpp
|
|
+++ b/Source/WebCore/page/Frame.cpp
|
|
@@ -180,6 +180,7 @@ Frame::Frame(Page& page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient&
|
|
void Frame::init()
|
|
{
|
|
m_loader->init();
|
|
+ InspectorInstrumentation::frameAttached(this);
|
|
}
|
|
|
|
Ref<Frame> Frame::create(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* client)
|
|
diff --git a/Source/WebCore/page/History.cpp b/Source/WebCore/page/History.cpp
|
|
index 9c58b06f4c471130ce4815f11d14cb78f81b49a0..3d624733c36f09518b12095d91e67a2ae67879e2 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/page/csp/ContentSecurityPolicy.cpp b/Source/WebCore/page/csp/ContentSecurityPolicy.cpp
|
|
index ad6f5209c52e0842d93be267f8f5e99551dfe07c..0fcf4fe9877ba8a89a8dfb321e120f7954c6f69b 100644
|
|
--- a/Source/WebCore/page/csp/ContentSecurityPolicy.cpp
|
|
+++ b/Source/WebCore/page/csp/ContentSecurityPolicy.cpp
|
|
@@ -298,6 +298,8 @@ bool ContentSecurityPolicy::protocolMatchesSelf(const URL& url) const
|
|
template<typename Predicate, typename... Args>
|
|
typename std::enable_if<!std::is_convertible<Predicate, ContentSecurityPolicy::ViolatedDirectiveCallback>::value, bool>::type ContentSecurityPolicy::allPoliciesWithDispositionAllow(Disposition disposition, Predicate&& predicate, Args&&... args) const
|
|
{
|
|
+ if (InspectorInstrumentation::shouldBypassCSP(m_scriptExecutionContext))
|
|
+ return true;
|
|
bool isReportOnly = disposition == ContentSecurityPolicy::Disposition::ReportOnly;
|
|
for (auto& policy : m_policies) {
|
|
if (policy->isReportOnly() != isReportOnly)
|
|
@@ -311,6 +313,8 @@ typename std::enable_if<!std::is_convertible<Predicate, ContentSecurityPolicy::V
|
|
template<typename Predicate, typename... Args>
|
|
bool ContentSecurityPolicy::allPoliciesWithDispositionAllow(Disposition disposition, ViolatedDirectiveCallback&& callback, Predicate&& predicate, Args&&... args) const
|
|
{
|
|
+ if (InspectorInstrumentation::shouldBypassCSP(m_scriptExecutionContext))
|
|
+ return true;
|
|
bool isReportOnly = disposition == ContentSecurityPolicy::Disposition::ReportOnly;
|
|
bool isAllowed = true;
|
|
for (auto& policy : m_policies) {
|
|
@@ -327,6 +331,8 @@ bool ContentSecurityPolicy::allPoliciesWithDispositionAllow(Disposition disposit
|
|
template<typename Predicate, typename... Args>
|
|
bool ContentSecurityPolicy::allPoliciesAllow(ViolatedDirectiveCallback&& callback, Predicate&& predicate, Args&&... args) const
|
|
{
|
|
+ if (InspectorInstrumentation::shouldBypassCSP(m_scriptExecutionContext))
|
|
+ return true;
|
|
bool isAllowed = true;
|
|
for (auto& policy : m_policies) {
|
|
if (const ContentSecurityPolicyDirective* violatedDirective = (policy.get()->*predicate)(std::forward<Args>(args)...)) {
|
|
diff --git a/Source/WebCore/platform/PlatformKeyboardEvent.h b/Source/WebCore/platform/PlatformKeyboardEvent.h
|
|
index f423a4a1d5399326fc48fe4d4a8a8fb9d4df861e..b4b60162d8b0d34113df052b04a1695d481d266e 100644
|
|
--- a/Source/WebCore/platform/PlatformKeyboardEvent.h
|
|
+++ b/Source/WebCore/platform/PlatformKeyboardEvent.h
|
|
@@ -138,6 +138,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
|
|
@@ -147,6 +148,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/ScrollableArea.h b/Source/WebCore/platform/ScrollableArea.h
|
|
index a854734a3edf0fed49397da0419916c9b25442ac..42eddb845729e5fc9eceb5306907112016cdaa48 100644
|
|
--- a/Source/WebCore/platform/ScrollableArea.h
|
|
+++ b/Source/WebCore/platform/ScrollableArea.h
|
|
@@ -99,7 +99,7 @@ public:
|
|
void updateScrollSnapState();
|
|
|
|
#if ENABLE(TOUCH_EVENTS)
|
|
- virtual bool handleTouchEvent(const PlatformTouchEvent&);
|
|
+ WEBCORE_EXPORT virtual bool handleTouchEvent(const PlatformTouchEvent&);
|
|
#endif
|
|
|
|
#if PLATFORM(IOS_FAMILY)
|
|
diff --git a/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp b/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp
|
|
index 3cc3dc9012e8ff409141dd43808b71264c8cd337..e44eca80b5a7f0ac8360d39d78ec7097d5296dc3 100644
|
|
--- a/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp
|
|
+++ b/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp
|
|
@@ -27,7 +27,7 @@
|
|
#include "config.h"
|
|
#include "GraphicsContextGLOpenGL.h"
|
|
|
|
-#if ENABLE(GRAPHICS_CONTEXT_GL) && (USE(OPENGL) || (PLATFORM(COCOA) && USE(OPENGL_ES)))
|
|
+#if !PLATFORM(WIN) && ENABLE(GRAPHICS_CONTEXT_GL) && (USE(OPENGL) || (PLATFORM(COCOA) && USE(OPENGL_ES)))
|
|
|
|
#if PLATFORM(IOS_FAMILY)
|
|
#include "GraphicsContextGLOpenGLESIOS.h"
|
|
diff --git a/Source/WebCore/platform/gtk/PlatformKeyboardEventGtk.cpp b/Source/WebCore/platform/gtk/PlatformKeyboardEventGtk.cpp
|
|
index 269008b9053c8d8b6787cf22f13b44b46dace333..d3ba16947bc8964a7cfe746cabbf99d32a673cef 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 a34dc220bbb9a92b40dfb463e8724e81ac745b2c..8ecedd5dae88469366a619b96960598c1232a32d 100644
|
|
--- a/Source/WebCore/platform/libwpe/PlatformKeyboardEventLibWPE.cpp
|
|
+++ b/Source/WebCore/platform/libwpe/PlatformKeyboardEventLibWPE.cpp
|
|
@@ -30,8 +30,10 @@
|
|
|
|
#include "WindowsKeyboardCodes.h"
|
|
#include <wpe/wpe.h>
|
|
+#include <wtf/HashMap.h>
|
|
#include <wtf/HexNumber.h>
|
|
#include <wtf/text/StringBuilder.h>
|
|
+#include <mutex>
|
|
|
|
namespace WebCore {
|
|
|
|
@@ -1291,6 +1293,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/WebCore/platform/network/NetworkStateNotifier.h b/Source/WebCore/platform/network/NetworkStateNotifier.h
|
|
index 87930048f4fd18d6098af7de4da25be532df5931..2bb2afcf9473b0d5d97efbe18dd7b8145bc5f932 100644
|
|
--- a/Source/WebCore/platform/network/NetworkStateNotifier.h
|
|
+++ b/Source/WebCore/platform/network/NetworkStateNotifier.h
|
|
@@ -72,6 +72,7 @@ private:
|
|
#endif
|
|
|
|
Optional<bool> m_isOnLine;
|
|
+ Optional<bool> m_emulatedIsOnLine;
|
|
Vector<WTF::Function<void(bool)>> m_listeners;
|
|
Timer m_updateStateTimer;
|
|
|
|
diff --git a/Source/WebCore/platform/network/curl/CookieJarCurl.cpp b/Source/WebCore/platform/network/curl/CookieJarCurl.cpp
|
|
index 5ecba66ef94984ebff5e3ff034375abb68ca72fa..e834685842aabf572b488394d961566aa8160be7 100644
|
|
--- a/Source/WebCore/platform/network/curl/CookieJarCurl.cpp
|
|
+++ b/Source/WebCore/platform/network/curl/CookieJarCurl.cpp
|
|
@@ -152,6 +152,25 @@ void CookieJarCurl::deleteAllCookiesModifiedSince(const NetworkStorageSession&,
|
|
// FIXME: Not yet implemented
|
|
}
|
|
|
|
+Vector<Cookie> CookieJarCurl::getAllCookies(const NetworkStorageSession& session) const
|
|
+{
|
|
+ CookieJarDB& cookieJarDB = session.cookieDatabase();
|
|
+ return cookieJarDB.getAllCookies();
|
|
+}
|
|
+
|
|
+void CookieJarCurl::setCookie(const NetworkStorageSession& session, const Cookie& cookie) const
|
|
+{
|
|
+ CookieJarDB& cookieJarDB = session.cookieDatabase();
|
|
+ cookieJarDB.setCookie(cookie);
|
|
+}
|
|
+
|
|
+void CookieJarCurl::deleteCookie(const NetworkStorageSession& session, const Cookie& cookie) const
|
|
+{
|
|
+ String url = (cookie.secure ? "https" : "http") + ("://" + cookie.domain + cookie.path);
|
|
+ CookieJarDB& cookieJarDB = session.cookieDatabase();
|
|
+ cookieJarDB.deleteCookie(url, cookie.name);
|
|
+}
|
|
+
|
|
} // namespace WebCore
|
|
|
|
#endif // USE(CURL)
|
|
diff --git a/Source/WebCore/platform/network/curl/CookieJarCurl.h b/Source/WebCore/platform/network/curl/CookieJarCurl.h
|
|
index 5e974f5fbdb8c04975a5511b0dc4a142d101a308..ab2af278059bc47c61dfd3254d0e0cca5aad302b 100644
|
|
--- a/Source/WebCore/platform/network/curl/CookieJarCurl.h
|
|
+++ b/Source/WebCore/platform/network/curl/CookieJarCurl.h
|
|
@@ -58,6 +58,9 @@ public:
|
|
void deleteCookiesForHostnames(const NetworkStorageSession&, const Vector<String>& cookieHostNames) const;
|
|
void deleteAllCookies(const NetworkStorageSession&) const;
|
|
void deleteAllCookiesModifiedSince(const NetworkStorageSession&, WallTime) const;
|
|
+ Vector<Cookie> getAllCookies(const NetworkStorageSession& session) const;
|
|
+ void setCookie(const NetworkStorageSession& session, const Cookie& cookie) const;
|
|
+ void deleteCookie(const NetworkStorageSession& session, const Cookie& cookie) const;
|
|
};
|
|
|
|
} // namespace WebCore
|
|
diff --git a/Source/WebCore/platform/network/curl/CookieJarDB.cpp b/Source/WebCore/platform/network/curl/CookieJarDB.cpp
|
|
index 101624f2900a94cc7d1a89989676d6b45ab7fa3d..6f446b2d57801d8971a3692b7039fec2210fd218 100644
|
|
--- a/Source/WebCore/platform/network/curl/CookieJarDB.cpp
|
|
+++ b/Source/WebCore/platform/network/curl/CookieJarDB.cpp
|
|
@@ -445,6 +445,36 @@ Optional<Vector<Cookie>> CookieJarDB::searchCookies(const URL& firstParty, const
|
|
return results;
|
|
}
|
|
|
|
+Vector<Cookie> CookieJarDB::getAllCookies()
|
|
+{
|
|
+ Vector<Cookie> result;
|
|
+ if (!isEnabled() || !m_database.isOpen())
|
|
+ return result;
|
|
+
|
|
+ const String sql = "SELECT name, value, domain, path, expires, httponly, secure, session FROM Cookie";
|
|
+
|
|
+ auto pstmt = makeUnique<SQLiteStatement>(m_database, sql);
|
|
+ if (!pstmt)
|
|
+ return result;
|
|
+ pstmt->prepare();
|
|
+
|
|
+ while (pstmt->step() == SQLITE_ROW) {
|
|
+ Cookie cookie;
|
|
+ cookie.name = pstmt->getColumnText(0);
|
|
+ cookie.value = pstmt->getColumnText(1);
|
|
+ cookie.domain = pstmt->getColumnText(2).convertToASCIILowercase();
|
|
+ cookie.path = pstmt->getColumnText(3);
|
|
+ cookie.expires = (double)pstmt->getColumnInt64(4) * 1000;
|
|
+ cookie.httpOnly = (pstmt->getColumnInt(5) == 1);
|
|
+ cookie.secure = (pstmt->getColumnInt(6) == 1);
|
|
+ cookie.session = (pstmt->getColumnInt(7) == 1);
|
|
+ result.append(WTFMove(cookie));
|
|
+ }
|
|
+ pstmt->finalize();
|
|
+
|
|
+ return result;
|
|
+}
|
|
+
|
|
bool CookieJarDB::hasHttpOnlyCookie(const String& name, const String& domain, const String& path)
|
|
{
|
|
auto& statement = preparedStatement(CHECK_EXISTS_HTTPONLY_COOKIE_SQL);
|
|
diff --git a/Source/WebCore/platform/network/curl/CookieJarDB.h b/Source/WebCore/platform/network/curl/CookieJarDB.h
|
|
index 2687ae74fb9d9942972bedcac6ab9b1159a7e50f..b62e2a2b032f938065ea4e4d8e093153b4f17cf5 100644
|
|
--- a/Source/WebCore/platform/network/curl/CookieJarDB.h
|
|
+++ b/Source/WebCore/platform/network/curl/CookieJarDB.h
|
|
@@ -64,6 +64,7 @@ public:
|
|
bool deleteCookies(const String& url);
|
|
bool deleteAllCookies();
|
|
|
|
+ Vector<Cookie> getAllCookies();
|
|
WEBCORE_EXPORT CookieJarDB(const String& databasePath);
|
|
WEBCORE_EXPORT ~CookieJarDB();
|
|
|
|
diff --git a/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp b/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp
|
|
index 5cf1e1ea2a712a7033e8390da781283c620b1caa..d02ca0e5e1dc14ca99a2676c1304ee43e58ae522 100644
|
|
--- a/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp
|
|
+++ b/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp
|
|
@@ -62,7 +62,7 @@ static String defaultCookieJarPath()
|
|
NetworkStorageSession::NetworkStorageSession(PAL::SessionID sessionID)
|
|
: m_sessionID(sessionID)
|
|
, m_cookieStorage(makeUniqueRef<CookieJarCurl>())
|
|
- , m_cookieDatabase(makeUniqueRef<CookieJarDB>(defaultCookieJarPath()))
|
|
+ , m_cookieDatabase(makeUniqueRef<CookieJarDB>(sessionID.isEphemeral() ? ":memory:" : defaultCookieJarPath()))
|
|
{
|
|
}
|
|
|
|
@@ -113,14 +113,14 @@ void NetworkStorageSession::setCookies(const Vector<Cookie>&, const URL&, const
|
|
// FIXME: Implement for WebKit to use.
|
|
}
|
|
|
|
-void NetworkStorageSession::setCookie(const Cookie&)
|
|
+void NetworkStorageSession::setCookie(const Cookie& cookie)
|
|
{
|
|
- // FIXME: Implement for WebKit to use.
|
|
+ cookieStorage().setCookie(*this, cookie);
|
|
}
|
|
|
|
-void NetworkStorageSession::deleteCookie(const Cookie&)
|
|
+void NetworkStorageSession::deleteCookie(const Cookie& cookie)
|
|
{
|
|
- // FIXME: Implement for WebKit to use.
|
|
+ cookieStorage().deleteCookie(*this, cookie);
|
|
}
|
|
|
|
void NetworkStorageSession::deleteCookie(const URL& url, const String& cookie) const
|
|
@@ -152,8 +152,7 @@ void NetworkStorageSession::deleteCookiesForHostnames(const Vector<String>& cook
|
|
|
|
Vector<Cookie> NetworkStorageSession::getAllCookies()
|
|
{
|
|
- // FIXME: Implement for WebKit to use.
|
|
- return { };
|
|
+ return cookieStorage().getAllCookies(*this);
|
|
}
|
|
|
|
void NetworkStorageSession::getHostnamesWithCookies(HashSet<String>& hostnames)
|
|
diff --git a/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp b/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp
|
|
index 947e23e5a22162e716b5a3203f4bb2956d9774c0..12606e71350a409586357f463a9b3b4c8be4b2fa 100644
|
|
--- a/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp
|
|
+++ b/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp
|
|
@@ -413,8 +413,13 @@ void NetworkStorageSession::getHostnamesWithCookies(HashSet<String>& hostnames)
|
|
|
|
Vector<Cookie> NetworkStorageSession::getAllCookies()
|
|
{
|
|
- // FIXME: Implement for WK2 to use.
|
|
- return { };
|
|
+ Vector<Cookie> cookies;
|
|
+ GUniquePtr<GSList> cookiesList(soup_cookie_jar_all_cookies(cookieStorage()));
|
|
+ for (GSList* item = cookiesList.get(); item; item = g_slist_next(item)) {
|
|
+ GUniquePtr<SoupCookie> soupCookie(static_cast<SoupCookie*>(item->data));
|
|
+ cookies.append(WebCore::Cookie(soupCookie.get()));
|
|
+ }
|
|
+ return cookies;
|
|
}
|
|
|
|
Vector<Cookie> NetworkStorageSession::getCookies(const URL& url)
|
|
diff --git a/Source/WebCore/platform/win/KeyEventWin.cpp b/Source/WebCore/platform/win/KeyEventWin.cpp
|
|
index 44737686187a06a92c408ea60b63a48ac8481334..c754a763688b52e7ddd47493296ef9b0c6adc527 100644
|
|
--- a/Source/WebCore/platform/win/KeyEventWin.cpp
|
|
+++ b/Source/WebCore/platform/win/KeyEventWin.cpp
|
|
@@ -239,10 +239,16 @@ PlatformKeyboardEvent::PlatformKeyboardEvent(HWND, WPARAM code, LPARAM keyData,
|
|
{
|
|
}
|
|
|
|
-void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type, bool)
|
|
+void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool backwardsCompatibility)
|
|
{
|
|
- // No KeyDown events on Windows to disambiguate.
|
|
- ASSERT_NOT_REACHED();
|
|
+ m_type = type;
|
|
+ if (type == PlatformEvent::RawKeyDown) {
|
|
+ m_text = String();
|
|
+ m_unmodifiedText = String();
|
|
+ } else {
|
|
+ m_keyIdentifier = String();
|
|
+ m_windowsVirtualKeyCode = 0;
|
|
+ }
|
|
}
|
|
|
|
bool PlatformKeyboardEvent::currentCapsLockState()
|
|
diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.cpp b/Source/WebKit/NetworkProcess/NetworkProcess.cpp
|
|
index c4ef81788ade1b28df808564ca694ef15d1dc05d..4550b3fb21cf6c71b237cfd73b319459bd3896f2 100644
|
|
--- a/Source/WebKit/NetworkProcess/NetworkProcess.cpp
|
|
+++ b/Source/WebKit/NetworkProcess/NetworkProcess.cpp
|
|
@@ -26,7 +26,6 @@
|
|
|
|
#include "config.h"
|
|
#include "NetworkProcess.h"
|
|
-
|
|
#include "ArgumentCoders.h"
|
|
#include "Attachment.h"
|
|
#include "AuthenticationManager.h"
|
|
@@ -585,6 +584,35 @@ void NetworkProcess::destroySession(PAL::SessionID sessionID)
|
|
m_storageManagerSet->remove(sessionID);
|
|
}
|
|
|
|
+void NetworkProcess::getAllCookies(PAL::SessionID sessionID, CompletionHandler<void(Vector<WebCore::Cookie>&&)>&& completionHandler)
|
|
+{
|
|
+ if (auto* networkStorageSession = storageSession(sessionID)) {
|
|
+ completionHandler(networkStorageSession->getAllCookies());
|
|
+ return;
|
|
+ }
|
|
+ completionHandler({ });
|
|
+}
|
|
+
|
|
+void NetworkProcess::setCookies(PAL::SessionID sessionID, Vector<WebCore::Cookie> cookies, CompletionHandler<void(bool)>&& completionHandler) {
|
|
+ if (auto* networkStorageSession = storageSession(sessionID)) {
|
|
+ for (auto cookie : cookies)
|
|
+ networkStorageSession->setCookie(cookie);
|
|
+ completionHandler(true);
|
|
+ return;
|
|
+ }
|
|
+ completionHandler(false);
|
|
+}
|
|
+
|
|
+void NetworkProcess::deleteAllCookies(PAL::SessionID sessionID, CompletionHandler<void(bool)>&& completionHandler)
|
|
+{
|
|
+ if (auto* networkStorageSession = storageSession(sessionID)) {
|
|
+ networkStorageSession->deleteAllCookies();
|
|
+ completionHandler(true);
|
|
+ return;
|
|
+ }
|
|
+ completionHandler(false);
|
|
+}
|
|
+
|
|
#if ENABLE(RESOURCE_LOAD_STATISTICS)
|
|
void NetworkProcess::dumpResourceLoadStatistics(PAL::SessionID sessionID, CompletionHandler<void(String)>&& completionHandler)
|
|
{
|
|
diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.h b/Source/WebKit/NetworkProcess/NetworkProcess.h
|
|
index f321df290e94e866baba6ee7d36bb1fd2236cbfe..f94ce432e74a9df1d36abd67904bb841375b1bd8 100644
|
|
--- a/Source/WebKit/NetworkProcess/NetworkProcess.h
|
|
+++ b/Source/WebKit/NetworkProcess/NetworkProcess.h
|
|
@@ -74,6 +74,7 @@ class SessionID;
|
|
|
|
namespace WebCore {
|
|
class CertificateInfo;
|
|
+struct Cookie;
|
|
class CurlProxySettings;
|
|
class DownloadID;
|
|
class ProtectionSpace;
|
|
@@ -201,6 +202,10 @@ public:
|
|
|
|
void addWebsiteDataStore(WebsiteDataStoreParameters&&);
|
|
|
|
+ void getAllCookies(PAL::SessionID, CompletionHandler<void(Vector<WebCore::Cookie>&&)>&&);
|
|
+ void setCookies(PAL::SessionID, Vector<WebCore::Cookie>, CompletionHandler<void(bool)>&&);
|
|
+ void deleteAllCookies(PAL::SessionID, CompletionHandler<void(bool)>&&);
|
|
+
|
|
#if ENABLE(RESOURCE_LOAD_STATISTICS)
|
|
void clearPrevalentResource(PAL::SessionID, const RegistrableDomain&, CompletionHandler<void()>&&);
|
|
void clearUserInteraction(PAL::SessionID, const RegistrableDomain&, CompletionHandler<void()>&&);
|
|
@@ -309,6 +314,7 @@ public:
|
|
|
|
#if PLATFORM(COCOA)
|
|
NetworkHTTPSUpgradeChecker& networkHTTPSUpgradeChecker();
|
|
+ bool ignoreTLSErrors() const { return m_ignoreTLSErrors; }
|
|
#endif
|
|
|
|
const String& uiProcessBundleIdentifier() const { return m_uiProcessBundleIdentifier; }
|
|
@@ -420,8 +426,10 @@ private:
|
|
void syncAllCookies();
|
|
void didSyncAllCookies();
|
|
|
|
-#if USE(SOUP)
|
|
+#if PLATFORM(COCOA) || USE(CURL) || USE(SOUP)
|
|
void setIgnoreTLSErrors(bool);
|
|
+#endif
|
|
+#if USE(SOUP)
|
|
void userPreferredLanguagesChanged(const Vector<String>&);
|
|
void setNetworkProxySettings(const WebCore::SoupNetworkProxySettings&);
|
|
#endif
|
|
@@ -569,6 +577,7 @@ private:
|
|
|
|
#if PLATFORM(COCOA)
|
|
std::unique_ptr<NetworkHTTPSUpgradeChecker> m_networkHTTPSUpgradeChecker;
|
|
+ bool m_ignoreTLSErrors { false };
|
|
#endif
|
|
|
|
#if ENABLE(RESOURCE_LOAD_STATISTICS)
|
|
diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.messages.in b/Source/WebKit/NetworkProcess/NetworkProcess.messages.in
|
|
index 433447ba14e4302e978507fb512e993096ced4c2..cd80803a7c6c48c81bd6d7469d7669af1a898070 100644
|
|
--- a/Source/WebKit/NetworkProcess/NetworkProcess.messages.in
|
|
+++ b/Source/WebKit/NetworkProcess/NetworkProcess.messages.in
|
|
@@ -27,8 +27,10 @@ messages -> NetworkProcess LegacyReceiver {
|
|
# Creates a connection for communication with a WebProcess
|
|
CreateNetworkConnectionToWebProcess(WebCore::ProcessIdentifier processIdentifier, PAL::SessionID sessionID) -> (Optional<IPC::Attachment> connectionIdentifier, enum:uint8_t WebCore::HTTPCookieAcceptPolicy cookieAcceptPolicy) Async
|
|
|
|
-#if USE(SOUP)
|
|
+#if USE(SOUP) || PLATFORM(COCOA) || USE(CURL)
|
|
SetIgnoreTLSErrors(bool ignoreTLSErrors)
|
|
+#endif
|
|
+#if USE(SOUP)
|
|
UserPreferredLanguagesChanged(Vector<String> languages)
|
|
SetNetworkProxySettings(struct WebCore::SoupNetworkProxySettings settings)
|
|
PrefetchDNS(String hostname)
|
|
@@ -80,6 +82,10 @@ messages -> NetworkProcess LegacyReceiver {
|
|
PrepareToSuspend(bool isSuspensionImminent) -> () Async
|
|
ProcessDidResume()
|
|
|
|
+ GetAllCookies(PAL::SessionID sessionID) -> (Vector<WebCore::Cookie> cookies) Async
|
|
+ SetCookies(PAL::SessionID sessionID, Vector<WebCore::Cookie> cookies) -> (bool success) Async
|
|
+ DeleteAllCookies(PAL::SessionID sessionID) -> (bool success) Async
|
|
+
|
|
#if ENABLE(RESOURCE_LOAD_STATISTICS)
|
|
ClearPrevalentResource(PAL::SessionID sessionID, WebCore::RegistrableDomain resourceDomain) -> () Async
|
|
ClearUserInteraction(PAL::SessionID sessionID, WebCore::RegistrableDomain resourceDomain) -> () Async
|
|
diff --git a/Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h b/Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h
|
|
index cb6c3109f8ea413333961c87c2ef6d6981778ef2..66d94afebfa90ab657723d427f819b8225233abb 100644
|
|
--- a/Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h
|
|
+++ b/Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h
|
|
@@ -75,9 +75,9 @@ struct NetworkProcessCreationParameters {
|
|
|
|
WebsiteDataStoreParameters defaultDataStoreParameters;
|
|
|
|
+ bool ignoreTLSErrors { false };
|
|
#if USE(SOUP)
|
|
WebCore::HTTPCookieAcceptPolicy cookieAcceptPolicy { WebCore::HTTPCookieAcceptPolicy::AlwaysAccept };
|
|
- bool ignoreTLSErrors { false };
|
|
Vector<String> languages;
|
|
WebCore::SoupNetworkProxySettings proxySettings;
|
|
#endif
|
|
diff --git a/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm b/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm
|
|
index 488cc33d9918bc2650c315b6dc5b308c1d30a2ab..f3ba740d1ac48c7668370a2420b36f9842860cb7 100644
|
|
--- a/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm
|
|
+++ b/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm
|
|
@@ -91,6 +91,8 @@ void NetworkProcess::platformInitializeNetworkProcessCocoa(const NetworkProcessC
|
|
#endif
|
|
#endif
|
|
|
|
+ setIgnoreTLSErrors(parameters.ignoreTLSErrors);
|
|
+
|
|
_CFNetworkSetATSContext(parameters.networkATSContext.get());
|
|
|
|
m_uiProcessBundleIdentifier = parameters.uiProcessBundleIdentifier;
|
|
@@ -212,6 +214,7 @@ void NetworkProcess::syncAllCookies()
|
|
});
|
|
}
|
|
|
|
+
|
|
#if HAVE(FOUNDATION_WITH_SAVE_COOKIES_WITH_COMPLETION_HANDLER)
|
|
static void saveCookies(NSHTTPCookieStorage *cookieStorage, CompletionHandler<void()>&& completionHandler)
|
|
{
|
|
@@ -242,6 +245,11 @@ void NetworkProcess::platformSyncAllCookies(CompletionHandler<void()>&& completi
|
|
ALLOW_DEPRECATED_DECLARATIONS_END
|
|
}
|
|
|
|
+void NetworkProcess::setIgnoreTLSErrors(bool ignoreTLSErrors)
|
|
+{
|
|
+ m_ignoreTLSErrors = ignoreTLSErrors;
|
|
+}
|
|
+
|
|
void NetworkProcess::platformPrepareToSuspend(CompletionHandler<void()>&& completionHandler)
|
|
{
|
|
completionHandler();
|
|
diff --git a/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h b/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h
|
|
index d71b6e4082e34576329be6b5935d20d51a84b3ba..881c8dccbab1017b8bd8f658b00044a4353df3cf 100644
|
|
--- a/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h
|
|
+++ b/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h
|
|
@@ -76,7 +76,7 @@ public:
|
|
const String& dataConnectionServiceType() const;
|
|
#endif
|
|
|
|
- static bool allowsSpecificHTTPSCertificateForHost(const WebCore::AuthenticationChallenge&);
|
|
+ bool allowsSpecificHTTPSCertificateForHost(const WebCore::AuthenticationChallenge&);
|
|
|
|
void continueDidReceiveChallenge(SessionWrapper&, const WebCore::AuthenticationChallenge&, NetworkDataTaskCocoa::TaskIdentifier, NetworkDataTaskCocoa*, CompletionHandler<void(WebKit::AuthenticationChallengeDisposition, const WebCore::Credential&)>&&);
|
|
|
|
diff --git a/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm b/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm
|
|
index 747ecc552b97958faa3a5fea6d2db4494b0faabd..90a0d943ae9de0fb45525a8fcc4fb9c26746fbde 100644
|
|
--- a/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm
|
|
+++ b/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm
|
|
@@ -629,7 +629,7 @@ static inline void processServerTrustEvaluation(NetworkSessionCocoa *session, Se
|
|
}
|
|
|
|
if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
|
|
- if (NetworkSessionCocoa::allowsSpecificHTTPSCertificateForHost(challenge))
|
|
+ if (sessionCocoa->allowsSpecificHTTPSCertificateForHost(challenge))
|
|
return completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]);
|
|
|
|
// Handle server trust evaluation at platform-level if requested, for performance reasons and to use ATS defaults.
|
|
@@ -1281,6 +1281,9 @@ static bool certificatesMatch(SecTrustRef trust1, SecTrustRef trust2)
|
|
|
|
bool NetworkSessionCocoa::allowsSpecificHTTPSCertificateForHost(const WebCore::AuthenticationChallenge& challenge)
|
|
{
|
|
+ if (networkProcess().ignoreTLSErrors())
|
|
+ return true;
|
|
+
|
|
const String& host = challenge.protectionSpace().host();
|
|
NSArray *certificates = [NSURLRequest allowsSpecificHTTPSCertificateForHost:host];
|
|
if (!certificates)
|
|
diff --git a/Source/WebKit/NetworkProcess/curl/NetworkProcessCurl.cpp b/Source/WebKit/NetworkProcess/curl/NetworkProcessCurl.cpp
|
|
index 5be170266f45b8bf72ef56b10087cb59bb56dba9..24f8885a0054c1a64cb7deebb00bb4421c56a858 100644
|
|
--- a/Source/WebKit/NetworkProcess/curl/NetworkProcessCurl.cpp
|
|
+++ b/Source/WebKit/NetworkProcess/curl/NetworkProcessCurl.cpp
|
|
@@ -94,4 +94,9 @@ void NetworkProcess::setNetworkProxySettings(PAL::SessionID sessionID, WebCore::
|
|
ASSERT_NOT_REACHED();
|
|
}
|
|
|
|
+void NetworkProcess::setIgnoreTLSErrors(bool ignoreTLSErrors)
|
|
+{
|
|
+ CurlContext::singleton().sslHandle().setIgnoreSSLErrors(ignoreTLSErrors);
|
|
+}
|
|
+
|
|
} // namespace WebKit
|
|
diff --git a/Source/WebKit/PlatformWPE.cmake b/Source/WebKit/PlatformWPE.cmake
|
|
index 50e399a49549fdc951717059607d720177540c96..a42ead187b7e1c8b2f5030576e741c5a81c85e47 100644
|
|
--- a/Source/WebKit/PlatformWPE.cmake
|
|
+++ b/Source/WebKit/PlatformWPE.cmake
|
|
@@ -249,6 +249,7 @@ list(APPEND WebKit_INCLUDE_DIRECTORIES
|
|
"${WEBKIT_DIR}/UIProcess/API/wpe"
|
|
"${WEBKIT_DIR}/UIProcess/CoordinatedGraphics"
|
|
"${WEBKIT_DIR}/UIProcess/geoclue"
|
|
+ "${WEBKIT_DIR}/UIProcess/glib"
|
|
"${WEBKIT_DIR}/UIProcess/gstreamer"
|
|
"${WEBKIT_DIR}/UIProcess/linux"
|
|
"${WEBKIT_DIR}/UIProcess/soup"
|
|
diff --git a/Source/WebKit/PlatformWin.cmake b/Source/WebKit/PlatformWin.cmake
|
|
index 2713713d9b0bc91c6312dbe319e1e33a480e58d5..299dde6b6e18b5e2023c14c13940e536a5e8dfd5 100644
|
|
--- a/Source/WebKit/PlatformWin.cmake
|
|
+++ b/Source/WebKit/PlatformWin.cmake
|
|
@@ -54,9 +54,13 @@ list(APPEND WebKit_SOURCES
|
|
|
|
UIProcess/WebsiteData/win/WebsiteDataStoreWin.cpp
|
|
|
|
+ UIProcess/win/InspectorTargetProxyWin.cpp
|
|
+ UIProcess/win/InspectorBrowserAgentClientWin.cpp
|
|
UIProcess/win/PageClientImpl.cpp
|
|
UIProcess/win/WebContextMenuProxyWin.cpp
|
|
UIProcess/win/WebInspectorProxyWin.cpp
|
|
+ UIProcess/win/WebPageInspectorEmulationAgentWin.cpp
|
|
+ UIProcess/win/WebPageInspectorInputAgentWin.cpp
|
|
UIProcess/win/WebPageProxyWin.cpp
|
|
UIProcess/win/WebPopupMenuProxyWin.cpp
|
|
UIProcess/win/WebProcessPoolWin.cpp
|
|
diff --git a/Source/WebKit/Shared/API/c/wpe/WebKit.h b/Source/WebKit/Shared/API/c/wpe/WebKit.h
|
|
index 898e30b370db8176e886fbbde0cd960e38a64818..74945e06fac0eb14936578de6a599a123364a63a 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 f08c19fb95ec8c8cca8f4ca2aa4049885637febf..c09e35e1b4fbf95b31f8d890bf09231055e4373a 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 CompositionUnderline;
|
|
@@ -67,18 +68,34 @@ public:
|
|
#if USE(APPKIT)
|
|
// FIXME: Share iOS's HandledByInputMethod enum here instead of passing a boolean.
|
|
NativeWebKeyboardEvent(NSEvent *, bool handledByInputMethod, bool replacesSoftSpace, const Vector<WebCore::KeypressCommand>&);
|
|
+ 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<WebCore::KeypressCommand>&& commands)
|
|
+ : WebKeyboardEvent(type, text, unmodifiedText, key, code, keyIdentifier, windowsVirtualKeyCode, nativeVirtualKeyCode, isAutoRepeat, isKeypad, isSystemKey, modifiers, timestamp, WTFMove(commands))
|
|
+ {
|
|
+ }
|
|
#elif PLATFORM(GTK)
|
|
NativeWebKeyboardEvent(const NativeWebKeyboardEvent&);
|
|
enum class HandledByInputMethod : bool { No, Yes };
|
|
NativeWebKeyboardEvent(GdkEvent*, const String&, HandledByInputMethod, Optional<Vector<WebCore::CompositionUnderline>>&&, Optional<EditingRange>&&, 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);
|
|
#elif USE(LIBWPE)
|
|
enum class HandledByInputMethod : bool { No, Yes };
|
|
NativeWebKeyboardEvent(struct wpe_input_keyboard_event*, const String&, HandledByInputMethod, Optional<Vector<WebCore::CompositionUnderline>>&&, Optional<EditingRange>&&);
|
|
+ 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)
|
|
+ : WebKeyboardEvent(type, text, unmodifiedText, key, code, keyIdentifier, windowsVirtualKeyCode, nativeVirtualKeyCode, isAutoRepeat, isKeypad, isSystemKey, modifiers, timestamp)
|
|
+ {
|
|
+ }
|
|
#elif PLATFORM(WIN)
|
|
NativeWebKeyboardEvent(HWND, UINT message, WPARAM, LPARAM, Vector<MSG>&& pendingCharEvents);
|
|
+ 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)
|
|
+ : WebKeyboardEvent(type, text, unmodifiedText, key, code, keyIdentifier, windowsVirtualKeyCode, nativeVirtualKeyCode, isAutoRepeat, isKeypad, isSystemKey, modifiers, timestamp)
|
|
+ {
|
|
+ }
|
|
#endif
|
|
|
|
#if USE(APPKIT)
|
|
diff --git a/Source/WebKit/Shared/NativeWebMouseEvent.h b/Source/WebKit/Shared/NativeWebMouseEvent.h
|
|
index 0fa557e9faa34ba81a7a4f7da5e32f30cbfad5d2..4f06afeb895fb1231d87e4304a4b588cd326944c 100644
|
|
--- a/Source/WebKit/Shared/NativeWebMouseEvent.h
|
|
+++ b/Source/WebKit/Shared/NativeWebMouseEvent.h
|
|
@@ -70,6 +70,11 @@ public:
|
|
NativeWebMouseEvent(HWND, UINT message, WPARAM, LPARAM, bool);
|
|
#endif
|
|
|
|
+#if PLATFORM(GTK) || USE(LIBWPE) || PLATFORM(WIN)
|
|
+ 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) { }
|
|
+#endif
|
|
+
|
|
#if USE(APPKIT)
|
|
NSEvent* nativeEvent() const { return m_nativeEvent.get(); }
|
|
#elif PLATFORM(GTK)
|
|
diff --git a/Source/WebKit/Shared/WebEvent.h b/Source/WebKit/Shared/WebEvent.h
|
|
index 224ef51567fdf5eb7321a3411faccd283b5b2813..7c102952d5821486f0c6a0af0b8d3286ace96b93 100644
|
|
--- a/Source/WebKit/Shared/WebEvent.h
|
|
+++ b/Source/WebKit/Shared/WebEvent.h
|
|
@@ -37,6 +37,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>
|
|
|
|
@@ -252,14 +253,18 @@ public:
|
|
|
|
#if USE(APPKIT)
|
|
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);
|
|
+ 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<WebCore::KeypressCommand>&& commands);
|
|
#elif PLATFORM(GTK)
|
|
WebKeyboardEvent(Type, const String& text, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool handledByInputMethod, Optional<Vector<WebCore::CompositionUnderline>>&&, Optional<EditingRange>&&, 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)
|
|
WebKeyboardEvent(Type, const String& text, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool handledByInputMethod, Optional<Vector<WebCore::CompositionUnderline>>&&, Optional<EditingRange>&&, 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);
|
|
#else
|
|
WebKeyboardEvent(Type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, 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);
|
|
#endif
|
|
|
|
const String& text() const { return m_text; }
|
|
@@ -301,7 +306,7 @@ private:
|
|
int32_t m_nativeVirtualKeyCode;
|
|
int32_t m_macCharCode;
|
|
#if USE(APPKIT) || USE(UIKIT_KEYBOARD_ADDITIONS) || PLATFORM(GTK) || USE(LIBWPE)
|
|
- bool m_handledByInputMethod;
|
|
+ bool m_handledByInputMethod = false;
|
|
#endif
|
|
#if PLATFORM(GTK) || USE(LIBWPE)
|
|
Optional<Vector<WebCore::CompositionUnderline>> m_preeditUnderlines;
|
|
diff --git a/Source/WebKit/Shared/WebKeyboardEvent.cpp b/Source/WebKit/Shared/WebKeyboardEvent.cpp
|
|
index cccb560418f32fad40587ac083b95f398eb1399d..f6b0aee44e5f12055dd14ad0636d780d2d4ece5d 100644
|
|
--- a/Source/WebKit/Shared/WebKeyboardEvent.cpp
|
|
+++ b/Source/WebKit/Shared/WebKeyboardEvent.cpp
|
|
@@ -35,6 +35,7 @@ WebKeyboardEvent::WebKeyboardEvent()
|
|
{
|
|
}
|
|
|
|
+
|
|
#if USE(APPKIT)
|
|
|
|
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, const Vector<WebCore::KeypressCommand>& commands, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet<Modifier> modifiers, WallTime timestamp)
|
|
@@ -56,6 +57,24 @@ 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<WebCore::KeypressCommand>&& commands)
|
|
+ : WebEvent(type, modifiers, timestamp)
|
|
+ , m_text(text)
|
|
+ , m_unmodifiedText(text)
|
|
+ , m_key(key)
|
|
+ , m_code(code)
|
|
+ , 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(GTK)
|
|
|
|
WebKeyboardEvent::WebKeyboardEvent(Type type, const String& text, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool handledByInputMethod, Optional<Vector<WebCore::CompositionUnderline>>&& preeditUnderlines, Optional<EditingRange>&& preeditSelectionRange, Vector<String>&& commands, bool isKeypad, OptionSet<Modifier> modifiers, WallTime timestamp)
|
|
@@ -79,6 +98,24 @@ 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)
|
|
+ , m_key(key)
|
|
+ , m_code(code)
|
|
+ , 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)
|
|
@@ -144,6 +181,27 @@ WebKeyboardEvent::WebKeyboardEvent(Type type, const String& text, const String&
|
|
|
|
#endif
|
|
|
|
+#if PLATFORM(WIN) || USE(LIBWPE)
|
|
+
|
|
+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)
|
|
+ : WebEvent(type, modifiers, timestamp)
|
|
+ , m_text(text)
|
|
+ , m_unmodifiedText(text)
|
|
+ , m_key(key)
|
|
+ , m_code(code)
|
|
+ , m_keyIdentifier(keyIdentifier)
|
|
+ , m_windowsVirtualKeyCode(windowsVirtualKeyCode)
|
|
+ , m_nativeVirtualKeyCode(nativeVirtualKeyCode)
|
|
+ , m_macCharCode(0)
|
|
+ , m_isAutoRepeat(isAutoRepeat)
|
|
+ , m_isKeypad(isKeypad)
|
|
+ , m_isSystemKey(isSystemKey)
|
|
+{
|
|
+ ASSERT(isKeyboardEventType(type));
|
|
+}
|
|
+
|
|
+#endif
|
|
+
|
|
WebKeyboardEvent::~WebKeyboardEvent()
|
|
{
|
|
}
|
|
diff --git a/Source/WebKit/Shared/gtk/NativeWebKeyboardEventGtk.cpp b/Source/WebKit/Shared/gtk/NativeWebKeyboardEventGtk.cpp
|
|
index 2357f3d58415fae78e48b0f8a25bddad85c786bf..f3941a74922f5a0a3bf59a11cd4c42fbfd33d0af 100644
|
|
--- a/Source/WebKit/Shared/gtk/NativeWebKeyboardEventGtk.cpp
|
|
+++ b/Source/WebKit/Shared/gtk/NativeWebKeyboardEventGtk.cpp
|
|
@@ -40,7 +40,7 @@ NativeWebKeyboardEvent::NativeWebKeyboardEvent(GdkEvent* event, const String& te
|
|
}
|
|
|
|
NativeWebKeyboardEvent::NativeWebKeyboardEvent(const NativeWebKeyboardEvent& event)
|
|
- : WebKeyboardEvent(WebEventFactory::createWebKeyboardEvent(event.nativeEvent(), event.text(), event.handledByInputMethod(), Optional<Vector<WebCore::CompositionUnderline>>(event.preeditUnderlines()), Optional<EditingRange>(event.preeditSelectionRange()), Vector<String>(event.commands())))
|
|
+ : WebKeyboardEvent(event)
|
|
, m_nativeEvent(gdk_event_copy(event.nativeEvent()))
|
|
{
|
|
}
|
|
diff --git a/Source/WebKit/Shared/gtk/NativeWebMouseEventGtk.cpp b/Source/WebKit/Shared/gtk/NativeWebMouseEventGtk.cpp
|
|
index 58e37fe3827cdb08d36ef0c85b8d4a968dee001a..429d245ea99fdee1b598a5caf51de8ce4b47fb02 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, O
|
|
}
|
|
|
|
NativeWebMouseEvent::NativeWebMouseEvent(const NativeWebMouseEvent& event)
|
|
- : WebMouseEvent(WebEventFactory::createWebMouseEvent(event.nativeEvent(), event.clickCount(), WebCore::IntPoint(event.deltaX(), event.deltaY())))
|
|
- , m_nativeEvent(gdk_event_copy(event.nativeEvent()))
|
|
+ : WebMouseEvent(event)
|
|
+ , m_nativeEvent(event.nativeEvent() ? gdk_event_copy(event.nativeEvent()) : nullptr)
|
|
{
|
|
}
|
|
|
|
diff --git a/Source/WebKit/Shared/ios/WebPlatformTouchPointIOS.cpp b/Source/WebKit/Shared/ios/WebPlatformTouchPointIOS.cpp
|
|
index 7b5eb372880d8662544334cd4697276d543de45b..ba06ecbb2cf5088a4c8c0824b50cb7797605dc57 100644
|
|
--- a/Source/WebKit/Shared/ios/WebPlatformTouchPointIOS.cpp
|
|
+++ b/Source/WebKit/Shared/ios/WebPlatformTouchPointIOS.cpp
|
|
@@ -26,7 +26,7 @@
|
|
#include "config.h"
|
|
#include "WebEvent.h"
|
|
|
|
-#if ENABLE(TOUCH_EVENTS)
|
|
+#if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS_FAMILY)
|
|
|
|
#include "WebCoreArgumentCoders.h"
|
|
|
|
@@ -79,4 +79,4 @@ Optional<WebPlatformTouchPoint> WebPlatformTouchPoint::decode(IPC::Decoder& deco
|
|
|
|
} // namespace WebKit
|
|
|
|
-#endif // ENABLE(TOUCH_EVENTS)
|
|
+#endif // ENABLE(TOUCH_EVENTS) && PLATFORM(IOS_FAMILY)
|
|
diff --git a/Source/WebKit/Shared/ios/WebTouchEventIOS.cpp b/Source/WebKit/Shared/ios/WebTouchEventIOS.cpp
|
|
index 45a56eb3b0fda13c3b78d57594a0092e4e1866f6..5e29e15813be6abe82790e6a98d3947e7a6fae44 100644
|
|
--- a/Source/WebKit/Shared/ios/WebTouchEventIOS.cpp
|
|
+++ b/Source/WebKit/Shared/ios/WebTouchEventIOS.cpp
|
|
@@ -26,7 +26,7 @@
|
|
#include "config.h"
|
|
#include "WebEvent.h"
|
|
|
|
-#if ENABLE(TOUCH_EVENTS)
|
|
+#if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS_FAMILY)
|
|
|
|
#include "ArgumentCoders.h"
|
|
#include "WebCoreArgumentCoders.h"
|
|
@@ -71,4 +71,4 @@ bool WebTouchEvent::decode(IPC::Decoder& decoder, WebTouchEvent& result)
|
|
|
|
} // namespace WebKit
|
|
|
|
-#endif // ENABLE(TOUCH_EVENTS)
|
|
+#endif // ENABLE(TOUCH_EVENTS) && PLATFORM(IOS_FAMILY)
|
|
diff --git a/Source/WebKit/Shared/win/WebEventFactory.cpp b/Source/WebKit/Shared/win/WebEventFactory.cpp
|
|
index 88d53d236cd6d62735f03678a04ca9c198dddacb..b8f8efc57ab00dc5725660c5a8ad56a3e6384de5 100644
|
|
--- a/Source/WebKit/Shared/win/WebEventFactory.cpp
|
|
+++ b/Source/WebKit/Shared/win/WebEventFactory.cpp
|
|
@@ -473,7 +473,7 @@ WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(HWND hwnd, UINT message
|
|
}
|
|
|
|
#if ENABLE(TOUCH_EVENTS)
|
|
-WebTouchEvent WebEventFactory::createWebTouchEvent(const GdkEvent* event, Vector<WebPlatformTouchPoint>&& touchPoints)
|
|
+WebTouchEvent WebEventFactory::createWebTouchEvent()
|
|
{
|
|
return WebTouchEvent();
|
|
}
|
|
diff --git a/Source/WebKit/Sources.txt b/Source/WebKit/Sources.txt
|
|
index 3da2800c9c5f7eae9fae2f36dad0131237f89e29..0e57deddddd3c852da536a4f44943a8346ff8f3d 100644
|
|
--- a/Source/WebKit/Sources.txt
|
|
+++ b/Source/WebKit/Sources.txt
|
|
@@ -262,17 +262,22 @@ Shared/WebsiteData/WebsiteData.cpp
|
|
|
|
UIProcess/AuxiliaryProcessProxy.cpp
|
|
UIProcess/BackgroundProcessResponsivenessTimer.cpp
|
|
+UIProcess/BrowserInspectorController.cpp
|
|
+UIProcess/BrowserInspectorPipe.cpp
|
|
UIProcess/DeviceIdHashSaltStorage.cpp
|
|
UIProcess/DrawingAreaProxy.cpp
|
|
UIProcess/FrameLoadState.cpp
|
|
UIProcess/GeolocationPermissionRequestManagerProxy.cpp
|
|
UIProcess/GeolocationPermissionRequestProxy.cpp
|
|
+UIProcess/InspectorBrowserAgent.cpp
|
|
+UIProcess/InspectorDialogAgent.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
|
|
@@ -315,6 +320,8 @@ UIProcess/WebPageDiagnosticLoggingClient.cpp
|
|
UIProcess/WebPageGroup.cpp
|
|
UIProcess/WebPageInjectedBundleClient.cpp
|
|
UIProcess/WebPageInspectorController.cpp
|
|
+UIProcess/WebPageInspectorEmulationAgent.cpp
|
|
+UIProcess/WebPageInspectorInputAgent.cpp
|
|
UIProcess/WebPageProxy.cpp
|
|
UIProcess/WebPasteboardProxy.cpp
|
|
UIProcess/WebPreferences.cpp
|
|
diff --git a/Source/WebKit/SourcesCocoa.txt b/Source/WebKit/SourcesCocoa.txt
|
|
index 6a8e2e6905c35bc1bc48c469a6ec6c85d5f824b8..846de5fa1e5a3d664f3835d56e44565266758f8c 100644
|
|
--- a/Source/WebKit/SourcesCocoa.txt
|
|
+++ b/Source/WebKit/SourcesCocoa.txt
|
|
@@ -249,6 +249,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 1ef73bc214c6e095fe836f018fa81b63e56cfdb8..0cfeb639e2cb28deecbee22a5d6a8f1cbdf5ae4f 100644
|
|
--- a/Source/WebKit/SourcesGTK.txt
|
|
+++ b/Source/WebKit/SourcesGTK.txt
|
|
@@ -130,6 +130,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
|
|
@@ -230,6 +231,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
|
|
@@ -244,6 +246,7 @@ UIProcess/gtk/AcceleratedBackingStoreX11.cpp @no-unify
|
|
UIProcess/gtk/DragAndDropHandler.cpp
|
|
UIProcess/gtk/GestureController.cpp
|
|
UIProcess/gtk/HardwareAccelerationManager.cpp
|
|
+UIProcess/gtk/InspectorTargetProxyGtk.cpp
|
|
UIProcess/gtk/KeyBindingTranslator.cpp
|
|
UIProcess/gtk/PointerLockManager.cpp @no-unify
|
|
UIProcess/gtk/PointerLockManagerWayland.cpp @no-unify
|
|
@@ -257,6 +260,8 @@ 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/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 1b98c8c09e287de2bc75174a03177d26042e3ad5..c3658c9debe9733898eb57567b3c708da0a1032b 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
|
|
@@ -193,7 +194,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
|
|
@@ -219,6 +220,10 @@ UIProcess/soup/WebProcessPoolSoup.cpp
|
|
|
|
UIProcess/wpe/WebPageProxyWPE.cpp
|
|
|
|
+UIProcess/wpe/InspectorTargetProxyWPE.cpp
|
|
+UIProcess/wpe/WebPageInspectorEmulationAgentWPE.cpp
|
|
+UIProcess/wpe/WebPageInspectorInputAgentWPE.cpp
|
|
+
|
|
WebProcess/InjectedBundle/API/glib/DOM/DOMObjectCache.cpp @no-unify
|
|
WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMDocument.cpp @no-unify
|
|
WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMElement.cpp @no-unify
|
|
diff --git a/Source/WebKit/UIProcess/API/APIUIClient.h b/Source/WebKit/UIProcess/API/APIUIClient.h
|
|
index 54513035b261bfd5e187ec945796198ed09d88b1..2d3200e4f6e90a16f248b255f75d2a7e17d895a5 100644
|
|
--- a/Source/WebKit/UIProcess/API/APIUIClient.h
|
|
+++ b/Source/WebKit/UIProcess/API/APIUIClient.h
|
|
@@ -97,6 +97,7 @@ public:
|
|
virtual void runJavaScriptAlert(WebKit::WebPageProxy&, const WTF::String&, WebKit::WebFrameProxy*, WebCore::SecurityOriginData&&, Function<void()>&& completionHandler) { completionHandler(); }
|
|
virtual void runJavaScriptConfirm(WebKit::WebPageProxy&, const WTF::String&, WebKit::WebFrameProxy*, WebCore::SecurityOriginData&&, Function<void(bool)>&& completionHandler) { completionHandler(false); }
|
|
virtual void runJavaScriptPrompt(WebKit::WebPageProxy&, const WTF::String&, const WTF::String&, WebKit::WebFrameProxy*, WebCore::SecurityOriginData&&, Function<void(const WTF::String&)>&& completionHandler) { completionHandler(WTF::String()); }
|
|
+ virtual void handleJavaScriptDialog(WebKit::WebPageProxy&, bool, const WTF::String&) { }
|
|
|
|
virtual void setStatusText(WebKit::WebPageProxy*, const WTF::String&) { }
|
|
virtual void mouseDidMoveOverElement(WebKit::WebPageProxy&, const WebKit::WebHitTestResultData&, OptionSet<WebKit::WebEvent::Modifier>, Object*) { }
|
|
diff --git a/Source/WebKit/UIProcess/API/C/WKInspector.cpp b/Source/WebKit/UIProcess/API/C/WKInspector.cpp
|
|
index 39327c5c9230591e4f52e4574c416e36687788f0..c84fe4e5249cfec5d65805868769c99200eb27da 100644
|
|
--- a/Source/WebKit/UIProcess/API/C/WKInspector.cpp
|
|
+++ b/Source/WebKit/UIProcess/API/C/WKInspector.cpp
|
|
@@ -28,6 +28,11 @@
|
|
|
|
#if !PLATFORM(IOS_FAMILY)
|
|
|
|
+#if PLATFORM(WIN)
|
|
+#include "BrowserInspectorPipe.h"
|
|
+#include "InspectorBrowserAgentClientWin.h"
|
|
+#endif
|
|
+
|
|
#include "WKAPICast.h"
|
|
#include "WebInspectorProxy.h"
|
|
#include "WebPageProxy.h"
|
|
@@ -130,4 +135,11 @@ void WKInspectorToggleElementSelection(WKInspectorRef inspectorRef)
|
|
toImpl(inspectorRef)->toggleElementSelection();
|
|
}
|
|
|
|
+void WKInspectorInitializeRemoteInspectorPipe(CreatePageCallback createPage, QuitCallback quit)
|
|
+{
|
|
+#if PLATFORM(WIN)
|
|
+ initializeBrowserInspectorPipe(makeUnique<InspectorBrowserAgentClientWin>(createPage, quit));
|
|
+#endif
|
|
+}
|
|
+
|
|
#endif // !PLATFORM(IOS_FAMILY)
|
|
diff --git a/Source/WebKit/UIProcess/API/C/WKInspector.h b/Source/WebKit/UIProcess/API/C/WKInspector.h
|
|
index 026121d114c5fcad84c1396be8d692625beaa3bd..1f707641766b51e3bddcdde0c49ee8cfcd83db0b 100644
|
|
--- a/Source/WebKit/UIProcess/API/C/WKInspector.h
|
|
+++ b/Source/WebKit/UIProcess/API/C/WKInspector.h
|
|
@@ -66,6 +66,9 @@ WK_EXPORT void WKInspectorTogglePageProfiling(WKInspectorRef inspector);
|
|
WK_EXPORT bool WKInspectorIsElementSelectionActive(WKInspectorRef inspector);
|
|
WK_EXPORT void WKInspectorToggleElementSelection(WKInspectorRef inspector);
|
|
|
|
+typedef WKPageRef (*CreatePageCallback)(WKPageConfigurationRef configuration);
|
|
+typedef void (*QuitCallback)();
|
|
+WK_EXPORT void WKInspectorInitializeRemoteInspectorPipe(CreatePageCallback, QuitCallback);
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
diff --git a/Source/WebKit/UIProcess/API/C/WKPage.cpp b/Source/WebKit/UIProcess/API/C/WKPage.cpp
|
|
index eccf4ae35661968057a7cfeeb2d95431e92444da..210d705e8a108df6c4d09f9827a1ab67d8aeba2e 100644
|
|
--- a/Source/WebKit/UIProcess/API/C/WKPage.cpp
|
|
+++ b/Source/WebKit/UIProcess/API/C/WKPage.cpp
|
|
@@ -1675,6 +1675,13 @@ void WKPageSetPageUIClient(WKPageRef pageRef, const WKPageUIClientBase* wkClient
|
|
completionHandler(String());
|
|
}
|
|
|
|
+ void handleJavaScriptDialog(WebPageProxy& page, bool accept, const String& value) final {
|
|
+ if (m_client.handleJavaScriptDialog) {
|
|
+ m_client.handleJavaScriptDialog(toAPI(&page), accept, toAPI(value.impl()), m_client.base.clientInfo);
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
+
|
|
void setStatusText(WebPageProxy* page, const String& text) final
|
|
{
|
|
if (!m_client.setStatusText)
|
|
@@ -1735,6 +1742,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/C/WKPageUIClient.h b/Source/WebKit/UIProcess/API/C/WKPageUIClient.h
|
|
index 1d2febfba8833912f72216aa53c8c20090ee2d8b..1b2c3d84b15b12f1a187c0b7622db43cbbcd5996 100644
|
|
--- a/Source/WebKit/UIProcess/API/C/WKPageUIClient.h
|
|
+++ b/Source/WebKit/UIProcess/API/C/WKPageUIClient.h
|
|
@@ -90,6 +90,7 @@ typedef void (*WKPageRunBeforeUnloadConfirmPanelCallback)(WKPageRef page, WKStri
|
|
typedef void (*WKPageRunJavaScriptAlertCallback)(WKPageRef page, WKStringRef alertText, WKFrameRef frame, WKSecurityOriginRef securityOrigin, WKPageRunJavaScriptAlertResultListenerRef listener, const void *clientInfo);
|
|
typedef void (*WKPageRunJavaScriptConfirmCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, WKSecurityOriginRef securityOrigin, WKPageRunJavaScriptConfirmResultListenerRef listener, const void *clientInfo);
|
|
typedef void (*WKPageRunJavaScriptPromptCallback)(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, WKSecurityOriginRef securityOrigin, WKPageRunJavaScriptPromptResultListenerRef listener, const void *clientInfo);
|
|
+typedef void (*WKPageHandleJavaScriptDialogCallback)(WKPageRef page, bool accept, WKStringRef value, const void *clientInfo);
|
|
typedef void (*WKPageRequestStorageAccessConfirmCallback)(WKPageRef page, WKFrameRef frame, WKStringRef requestingDomain, WKStringRef currentDomain, WKPageRequestStorageAccessConfirmResultListenerRef listener, const void *clientInfo);
|
|
typedef void (*WKPageTakeFocusCallback)(WKPageRef page, WKFocusDirection direction, const void *clientInfo);
|
|
typedef void (*WKPageFocusCallback)(WKPageRef page, const void *clientInfo);
|
|
@@ -1352,6 +1353,7 @@ typedef struct WKPageUIClientV14 {
|
|
|
|
// Version 14.
|
|
WKPageRunWebAuthenticationPanelCallback runWebAuthenticationPanel;
|
|
+ WKPageHandleJavaScriptDialogCallback handleJavaScriptDialog;
|
|
} WKPageUIClientV14;
|
|
|
|
#ifdef __cplusplus
|
|
diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm b/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm
|
|
index cdc847dcb6a29603ac1d5b6613667be4cd274707..7648f2ec84491911f01167375f1941daccef7cdd 100644
|
|
--- a/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm
|
|
+++ b/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm
|
|
@@ -47,6 +47,7 @@
|
|
#import "_WKDownloadDelegate.h"
|
|
#import "_WKDownloadInternal.h"
|
|
#import "_WKProcessPoolConfigurationInternal.h"
|
|
+#import "_WKWebsiteDataStoreInternal.h"
|
|
#import <WebCore/CertificateInfo.h>
|
|
#import <WebCore/HTTPCookieAcceptPolicyCocoa.h>
|
|
#import <WebCore/PluginData.h>
|
|
@@ -85,6 +86,18 @@ static WKProcessPool *sharedProcessPool;
|
|
return self;
|
|
}
|
|
|
|
+- (instancetype)_initWithConfiguration:(_WKProcessPoolConfiguration *)configuration AndDataStore:(WKWebsiteDataStore*)dataStore
|
|
+{
|
|
+ if (!(self = [super init]))
|
|
+ return nil;
|
|
+
|
|
+ API::Object::constructInWrapper<WebKit::WebProcessPool>(self, *configuration->_processPoolConfiguration);
|
|
+ _processPool->setPrimaryDataStore(*dataStore->_websiteDataStore);
|
|
+
|
|
+ return self;
|
|
+}
|
|
+
|
|
+
|
|
- (instancetype)init
|
|
{
|
|
return [self _initWithConfiguration:adoptNS([[_WKProcessPoolConfiguration alloc] init]).get()];
|
|
diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h b/Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h
|
|
index 7cfd05697f25ca66a530b2d497706adbf284b068..c24081d210e4baeb5f7f7868eddd5afc111f687b 100644
|
|
--- a/Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h
|
|
+++ b/Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h
|
|
@@ -37,6 +37,7 @@
|
|
|
|
@interface WKProcessPool ()
|
|
- (instancetype)_initWithConfiguration:(_WKProcessPoolConfiguration *)configuration __attribute__((objc_method_family(init))) NS_DESIGNATED_INITIALIZER;
|
|
+- (instancetype)_initWithConfiguration:(_WKProcessPoolConfiguration *)configuration AndDataStore:(WKWebsiteDataStore *)dataStore __attribute__((objc_method_family(init))) NS_DESIGNATED_INITIALIZER;
|
|
@end
|
|
|
|
@interface WKProcessPool (WKPrivate)
|
|
diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegate.h b/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegate.h
|
|
index cad87f3ef2ab93d93a74cec0c34b47c695de6bc6..66145a384638b97ee08516e56e1e86a83713c634 100644
|
|
--- a/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegate.h
|
|
+++ b/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegate.h
|
|
@@ -123,6 +123,13 @@ NS_ASSUME_NONNULL_BEGIN
|
|
*/
|
|
- (void)webView:(WKWebView *)webView runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(nullable NSString *)defaultText initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(NSString * _Nullable result))completionHandler;
|
|
|
|
+/*! @abstract Handle a JavaScript dialog.
|
|
+ @param webView The web view invoking the delegate method.
|
|
+ @param accept Whether to accept the dialog.
|
|
+ @param value Value to use for prompt dialog.
|
|
+ */
|
|
+- (void)webView:(WKWebView *)webView handleJavaScriptDialog:(BOOL)accept value:(nullable NSString *)value;
|
|
+
|
|
#if TARGET_OS_IPHONE
|
|
|
|
/*! @abstract Allows your app to determine whether or not the given element should show a preview.
|
|
diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.h b/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.h
|
|
index 726c4972aa0b32e0dc602e0ab2d71f6ae8ef93ae..c67f408797724cb6d68ed441c0ef1cccd33ca1e0 100644
|
|
--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.h
|
|
+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.h
|
|
@@ -24,7 +24,6 @@
|
|
*/
|
|
|
|
#import <WebKit/WKFoundation.h>
|
|
-
|
|
#import <WebKit/WKWebsiteDataRecord.h>
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
@@ -78,6 +77,8 @@ WK_CLASS_AVAILABLE(macos(10.11), ios(9.0))
|
|
/*! @abstract Returns the cookie store representing HTTP cookies in this website data store. */
|
|
@property (nonatomic, readonly) WKHTTPCookieStore *httpCookieStore WK_API_AVAILABLE(macos(10.13), ios(11.0));
|
|
|
|
+- (uint64_t)sessionID;
|
|
+
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|
|
diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm b/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm
|
|
index 866754212ddd7fb8288b6f721929fd2966d38a86..988f8c630e33cb0c995ff460c9d10a3dcf9fc815 100644
|
|
--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm
|
|
+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm
|
|
@@ -44,6 +44,7 @@
|
|
#import "_WKWebsiteDataStoreDelegate.h"
|
|
#import <WebCore/Credential.h>
|
|
#import <WebCore/RegistrationDatabase.h>
|
|
+#import <pal/SessionID.h>
|
|
#import <wtf/BlockPtr.h>
|
|
#import <wtf/URL.h>
|
|
#import <wtf/WeakObjCPtr.h>
|
|
@@ -184,6 +185,11 @@ static WallTime toSystemClockTime(NSDate *date)
|
|
});
|
|
}
|
|
|
|
+- (uint64_t) sessionID
|
|
+{
|
|
+ return _websiteDataStore->sessionID().toUInt64();
|
|
+}
|
|
+
|
|
static Vector<WebKit::WebsiteDataRecord> toWebsiteDataRecords(NSArray *dataRecords)
|
|
{
|
|
Vector<WebKit::WebsiteDataRecord> result;
|
|
diff --git a/Source/WebKit/UIProcess/API/Cocoa/_WKBrowserInspector.h b/Source/WebKit/UIProcess/API/Cocoa/_WKBrowserInspector.h
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..b64d1a6d54ec15a99164294706543cee626d1050
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/API/Cocoa/_WKBrowserInspector.h
|
|
@@ -0,0 +1,55 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 <WebKit/WKProcessPool.h>
|
|
+#import <WebKit/WKWebsiteDataStore.h>
|
|
+#import <Foundation/Foundation.h>
|
|
+
|
|
+NS_ASSUME_NONNULL_BEGIN
|
|
+
|
|
+@class WKWebView;
|
|
+
|
|
+WK_CLASS_AVAILABLE(macos(10.14.0))
|
|
+@interface _WKBrowserContext : NSObject
|
|
+@property (nonatomic, strong) WKWebsiteDataStore *dataStore;
|
|
+@property (nonatomic, strong) WKProcessPool *processPool;
|
|
+@end
|
|
+
|
|
+@protocol _WKBrowserInspectorDelegate <NSObject>
|
|
+- (WKWebView *)createNewPage:(uint64_t)sessionID;
|
|
+- (_WKBrowserContext *)createBrowserContext;
|
|
+- (void)deleteBrowserContext:(uint64_t)sessionID;
|
|
+- (void)quit;
|
|
+@end
|
|
+
|
|
+WK_CLASS_AVAILABLE(macos(10.14.0))
|
|
+@interface _WKBrowserInspector : NSObject
|
|
++ (void)initializeRemoteInspectorPipe:(id<_WKBrowserInspectorDelegate>)delegate headless:(BOOL)headless;
|
|
+@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 0000000000000000000000000000000000000000..2db4356a7b26d91e50a8bb73b5b0d9d2b231c1cb
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/API/Cocoa/_WKBrowserInspector.mm
|
|
@@ -0,0 +1,52 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 "PageClientImplMac.h"
|
|
+#include "WebsiteDataStore.h"
|
|
+
|
|
+#import "WKWebView.h"
|
|
+
|
|
+using namespace WebKit;
|
|
+
|
|
+@implementation _WKBrowserInspector
|
|
+
|
|
++ (void)initializeRemoteInspectorPipe:(id<_WKBrowserInspectorDelegate>)delegate headless:(BOOL)headless
|
|
+{
|
|
+#if ENABLE(REMOTE_INSPECTOR)
|
|
+ WebsiteDataStore::defaultDataStore();
|
|
+ PageClientImpl::setHeadless(headless);
|
|
+ initializeBrowserInspectorPipe(makeUnique<InspectorBrowserAgentClientMac>(delegate));
|
|
+#endif
|
|
+}
|
|
+
|
|
+@end
|
|
+
|
|
+@implementation _WKBrowserContext
|
|
+@end
|
|
diff --git a/Source/WebKit/UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm b/Source/WebKit/UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm
|
|
index 2bdb8b9e7256f22096ebaa5d51959aa52389ca0a..2141d9d17497861a6c711f99306de10992a93ce8 100644
|
|
--- a/Source/WebKit/UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm
|
|
+++ b/Source/WebKit/UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm
|
|
@@ -25,6 +25,7 @@
|
|
|
|
#import "config.h"
|
|
#import "_WKRemoteWebInspectorViewController.h"
|
|
+#import "WKWebViewPrivate.h"
|
|
|
|
#if PLATFORM(MAC)
|
|
|
|
diff --git a/Source/WebKit/UIProcess/API/glib/WebKitBrowserInspector.cpp b/Source/WebKit/UIProcess/API/glib/WebKitBrowserInspector.cpp
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..70081db72e035ca99c0279ab02da5cfed9256c57
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/API/glib/WebKitBrowserInspector.cpp
|
|
@@ -0,0 +1,136 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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(GMainLoop* mainLoop)
|
|
+{
|
|
+#if ENABLE(REMOTE_INSPECTOR)
|
|
+ WebKit::initializeBrowserInspectorPipe(makeUnique<WebKit::InspectorBrowserAgentClientGlib>(mainLoop));
|
|
+#endif
|
|
+}
|
|
diff --git a/Source/WebKit/UIProcess/API/glib/WebKitBrowserInspectorPrivate.h b/Source/WebKit/UIProcess/API/glib/WebKitBrowserInspectorPrivate.h
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..1bff4e694f19264d1be418198b7921780e4f8309
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/API/glib/WebKitBrowserInspectorPrivate.h
|
|
@@ -0,0 +1,31 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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/WebKitUIClient.cpp b/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp
|
|
index f769407fdc660c6f6fef77af90a43bd5dca9d544..ba010ed593bdedc0d70e4f4d3139e73d3c395463 100644
|
|
--- a/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp
|
|
+++ b/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp
|
|
@@ -91,6 +91,10 @@ private:
|
|
{
|
|
webkitWebViewRunJavaScriptPrompt(m_webView, message.utf8(), defaultValue.utf8(), WTFMove(completionHandler));
|
|
}
|
|
+ void handleJavaScriptDialog(WebPageProxy&, bool accept, const String& value) final
|
|
+ {
|
|
+ webkitWebViewHandleJavaScriptDialog(m_webView, accept, value);
|
|
+ }
|
|
|
|
bool canRunBeforeUnloadConfirmPanel() const final { return true; }
|
|
|
|
diff --git a/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp b/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp
|
|
index 33a9b7d5ad060f275dcf7156a8cff3f37644e736..128a5c75807848de10aed628618fc7d149a42792 100644
|
|
--- a/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp
|
|
+++ b/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp
|
|
@@ -119,9 +119,7 @@ enum {
|
|
PROP_LOCAL_STORAGE_DIRECTORY,
|
|
#endif
|
|
PROP_WEBSITE_DATA_MANAGER,
|
|
-#if PLATFORM(GTK)
|
|
PROP_PSON_ENABLED
|
|
-#endif
|
|
};
|
|
|
|
enum {
|
|
@@ -202,9 +200,7 @@ struct _WebKitWebContextPrivate {
|
|
|
|
RefPtr<WebProcessPool> processPool;
|
|
bool clientsDetached;
|
|
-#if PLATFORM(GTK)
|
|
bool psonEnabled;
|
|
-#endif
|
|
|
|
GRefPtr<WebKitFaviconDatabase> faviconDatabase;
|
|
GRefPtr<WebKitSecurityManager> securityManager;
|
|
@@ -329,11 +325,9 @@ static void webkitWebContextGetProperty(GObject* object, guint propID, GValue* v
|
|
case PROP_WEBSITE_DATA_MANAGER:
|
|
g_value_set_object(value, webkit_web_context_get_website_data_manager(context));
|
|
break;
|
|
-#if PLATFORM(GTK)
|
|
case PROP_PSON_ENABLED:
|
|
g_value_set_boolean(value, context->priv->psonEnabled);
|
|
break;
|
|
-#endif
|
|
default:
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, paramSpec);
|
|
}
|
|
@@ -354,11 +348,9 @@ static void webkitWebContextSetProperty(GObject* object, guint propID, const GVa
|
|
context->priv->websiteDataManager = manager ? WEBKIT_WEBSITE_DATA_MANAGER(manager) : nullptr;
|
|
break;
|
|
}
|
|
-#if PLATFORM(GTK)
|
|
case PROP_PSON_ENABLED:
|
|
context->priv->psonEnabled = g_value_get_boolean(value);
|
|
break;
|
|
-#endif
|
|
default:
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, paramSpec);
|
|
}
|
|
@@ -375,9 +367,7 @@ static void webkitWebContextConstructed(GObject* object)
|
|
|
|
API::ProcessPoolConfiguration configuration;
|
|
configuration.setInjectedBundlePath(FileSystem::stringFromFileSystemRepresentation(bundleFilename.get()));
|
|
-#if PLATFORM(GTK)
|
|
configuration.setProcessSwapsOnNavigation(priv->psonEnabled);
|
|
-#endif
|
|
|
|
if (!priv->websiteDataManager)
|
|
priv->websiteDataManager = adoptGRef(webkit_website_data_manager_new("local-storage-directory", priv->localStorageDirectory.data(), nullptr));
|
|
@@ -385,6 +375,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) {
|
|
@@ -496,7 +491,6 @@ static void webkit_web_context_class_init(WebKitWebContextClass* webContextClass
|
|
WEBKIT_TYPE_WEBSITE_DATA_MANAGER,
|
|
static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
|
|
|
|
-#if PLATFORM(GTK)
|
|
/**
|
|
* WebKitWebContext:process-swap-on-cross-site-navigation-enabled:
|
|
*
|
|
@@ -519,7 +513,6 @@ static void webkit_web_context_class_init(WebKitWebContextClass* webContextClass
|
|
_("Whether swap Web processes on cross-site navigations is enabled"),
|
|
FALSE,
|
|
static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
|
|
-#endif
|
|
|
|
/**
|
|
* WebKitWebContext::download-started:
|
|
diff --git a/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp b/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp
|
|
index 9633269039aed85e1993b234473509b4ecb39b79..34604cb5723f6ea0157923d2263612f1976f0b55 100644
|
|
--- a/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp
|
|
+++ b/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp
|
|
@@ -131,6 +131,7 @@ enum {
|
|
CLOSE,
|
|
|
|
SCRIPT_DIALOG,
|
|
+ SCRIPT_DIALOG_HANDLED,
|
|
|
|
DECIDE_POLICY,
|
|
PERMISSION_REQUEST,
|
|
@@ -1536,6 +1537,15 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
|
|
G_TYPE_BOOLEAN, 1,
|
|
WEBKIT_TYPE_SCRIPT_DIALOG);
|
|
|
|
+ signals[SCRIPT_DIALOG_HANDLED] = g_signal_new(
|
|
+ "script-dialog-handled",
|
|
+ G_TYPE_FROM_CLASS(webViewClass),
|
|
+ G_SIGNAL_RUN_LAST,
|
|
+ G_STRUCT_OFFSET(WebKitWebViewClass, script_dialog),
|
|
+ g_signal_accumulator_true_handled, nullptr,
|
|
+ g_cclosure_marshal_generic,
|
|
+ G_TYPE_BOOLEAN, 1);
|
|
+
|
|
/**
|
|
* WebKitWebView::decide-policy:
|
|
* @web_view: the #WebKitWebView on which the signal is emitted
|
|
@@ -2417,6 +2427,20 @@ void webkitWebViewRunJavaScriptBeforeUnloadConfirm(WebKitWebView* webView, const
|
|
webkit_script_dialog_unref(webView->priv->currentScriptDialog);
|
|
}
|
|
|
|
+void webkitWebViewHandleJavaScriptDialog(WebKitWebView* webView, bool accept, const String& value) {
|
|
+ auto* dialog = webView->priv->currentScriptDialog;
|
|
+ webkit_script_dialog_ref(dialog);
|
|
+ if (!value.isNull())
|
|
+ webkitWebViewSetCurrentScriptDialogUserInput(webView, value);
|
|
+ if (accept)
|
|
+ webkitWebViewAcceptCurrentScriptDialog(webView);
|
|
+ else
|
|
+ webkitWebViewDismissCurrentScriptDialog(webView);
|
|
+ gboolean returnValue;
|
|
+ g_signal_emit(webView, signals[SCRIPT_DIALOG_HANDLED], 0, dialog, &returnValue);
|
|
+ webkit_script_dialog_unref(dialog);
|
|
+}
|
|
+
|
|
bool webkitWebViewIsShowingScriptDialog(WebKitWebView* webView)
|
|
{
|
|
if (!webView->priv->currentScriptDialog)
|
|
diff --git a/Source/WebKit/UIProcess/API/glib/WebKitWebViewPrivate.h b/Source/WebKit/UIProcess/API/glib/WebKitWebViewPrivate.h
|
|
index 5ab7574c9378f52db87ce75157627c04e9b2e962..5322d725238f5989c04b045615a2de8163329fdf 100644
|
|
--- a/Source/WebKit/UIProcess/API/glib/WebKitWebViewPrivate.h
|
|
+++ b/Source/WebKit/UIProcess/API/glib/WebKitWebViewPrivate.h
|
|
@@ -60,6 +60,7 @@ void webkitWebViewRunJavaScriptAlert(WebKitWebView*, const CString& message, Fun
|
|
void webkitWebViewRunJavaScriptConfirm(WebKitWebView*, const CString& message, Function<void(bool)>&& completionHandler);
|
|
void webkitWebViewRunJavaScriptPrompt(WebKitWebView*, const CString& message, const CString& defaultText, Function<void(const String&)>&& completionHandler);
|
|
void webkitWebViewRunJavaScriptBeforeUnloadConfirm(WebKitWebView*, const CString& message, Function<void(bool)>&& completionHandler);
|
|
+void webkitWebViewHandleJavaScriptDialog(WebKitWebView*, bool accept, const String& value);
|
|
bool webkitWebViewIsShowingScriptDialog(WebKitWebView*);
|
|
bool webkitWebViewIsScriptDialogRunning(WebKitWebView*, WebKitScriptDialog*);
|
|
String webkitWebViewGetCurrentScriptDialogMessage(WebKitWebView*);
|
|
diff --git a/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp b/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp
|
|
index b1252daf7423bb66a177b5d028563e389b73802a..3edc383f6d7bbc1b43a7b4937eee03c473e65686 100644
|
|
--- a/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp
|
|
+++ b/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp
|
|
@@ -224,6 +224,8 @@ void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent& event, bool
|
|
{
|
|
if (wasEventHandled)
|
|
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 0000000000000000000000000000000000000000..a51cfebc270ca5a91cd94645eeeb005ba9a67caf
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/API/gtk/WebKitBrowserInspector.h
|
|
@@ -0,0 +1,79 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 (GMainLoop*);
|
|
+
|
|
+G_END_DECLS
|
|
+
|
|
+#endif
|
|
diff --git a/Source/WebKit/UIProcess/API/gtk/webkit2.h b/Source/WebKit/UIProcess/API/gtk/webkit2.h
|
|
index 930b17b6629e04d0dfa2222bbc3217877c6e1812..395462e5f01c195231e9296d1204167cded99ad3 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 0000000000000000000000000000000000000000..6dffa4fa10a9a64f778a0a77c760c2e76b2f9968
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/API/wpe/WebKitBrowserInspector.h
|
|
@@ -0,0 +1,79 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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);
|
|
+
|
|
+WEBKIT_API void
|
|
+webkit_browser_inspector_initialize_pipe (GMainLoop*);
|
|
+
|
|
+G_END_DECLS
|
|
+
|
|
+#endif
|
|
diff --git a/Source/WebKit/UIProcess/API/wpe/WebKitScriptDialogWPE.cpp b/Source/WebKit/UIProcess/API/wpe/WebKitScriptDialogWPE.cpp
|
|
index 3ad6e613657557045ec07ce4bcdb3eea0d1e7dae..a53a4aa01bd692ba34bacb9f663c335cfd3821a7 100644
|
|
--- a/Source/WebKit/UIProcess/API/wpe/WebKitScriptDialogWPE.cpp
|
|
+++ b/Source/WebKit/UIProcess/API/wpe/WebKitScriptDialogWPE.cpp
|
|
@@ -22,14 +22,26 @@
|
|
|
|
#include "WebKitScriptDialogPrivate.h"
|
|
|
|
-void webkitScriptDialogAccept(WebKitScriptDialog*)
|
|
+void webkitScriptDialogAccept(WebKitScriptDialog* dialog)
|
|
{
|
|
+ if (!dialog->completionHandler)
|
|
+ return;
|
|
+ auto completionHandler = std::exchange(dialog->completionHandler, nullptr);
|
|
+ completionHandler(true, String());
|
|
}
|
|
|
|
-void webkitScriptDialogDismiss(WebKitScriptDialog*)
|
|
+void webkitScriptDialogDismiss(WebKitScriptDialog* dialog)
|
|
{
|
|
+ if (!dialog->completionHandler)
|
|
+ return;
|
|
+ auto completionHandler = std::exchange(dialog->completionHandler, nullptr);
|
|
+ completionHandler(false, String());
|
|
}
|
|
|
|
-void webkitScriptDialogSetUserInput(WebKitScriptDialog*, const String&)
|
|
+void webkitScriptDialogSetUserInput(WebKitScriptDialog* dialog, const String& value)
|
|
{
|
|
+ if (!dialog->completionHandler)
|
|
+ return;
|
|
+ auto completionHandler = std::exchange(dialog->completionHandler, nullptr);
|
|
+ completionHandler(true, value);
|
|
}
|
|
diff --git a/Source/WebKit/UIProcess/API/wpe/webkit.h b/Source/WebKit/UIProcess/API/wpe/webkit.h
|
|
index 02e258253e47fbf6594c20f743d0faeac8a4eefe..e051fdf396dc65717def6b36168b5538e3cb2f4d 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 0000000000000000000000000000000000000000..3be737758e3718c3f55f569a212e878030157830
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/BrowserInspectorController.cpp
|
|
@@ -0,0 +1,236 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 "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;
|
|
+}
|
|
+
|
|
+class BrowserInspectorController::PageProxyChannel : public FrontendChannel {
|
|
+ WTF_MAKE_FAST_ALLOCATED;
|
|
+public:
|
|
+ PageProxyChannel(FrontendChannel& frontendChannel, String pageProxyID, WebPageProxy& page)
|
|
+ : m_pageProxyID(pageProxyID)
|
|
+ , m_frontendChannel(frontendChannel)
|
|
+ , m_page(page)
|
|
+ {
|
|
+ }
|
|
+
|
|
+ ~PageProxyChannel() override = default;
|
|
+
|
|
+ void dispatchMessageFromFrontend(const String& message)
|
|
+ {
|
|
+ m_page.inspectorController().dispatchMessageFromFrontend(message);
|
|
+ }
|
|
+
|
|
+ WebPageProxy& page() { return m_page; }
|
|
+
|
|
+ void disconnect()
|
|
+ {
|
|
+ m_page.inspectorController().disconnectFrontend(*this);
|
|
+ }
|
|
+
|
|
+private:
|
|
+ ConnectionType connectionType() const override { return m_frontendChannel.connectionType(); }
|
|
+ void sendMessageToFrontend(const String& message) override
|
|
+ {
|
|
+ m_frontendChannel.sendMessageToFrontend(addTabIdToMessage(message));
|
|
+ }
|
|
+
|
|
+ String addTabIdToMessage(const String& message) {
|
|
+ RefPtr<JSON::Value> parsedMessage;
|
|
+ if (!JSON::Value::parseJSON(message, parsedMessage))
|
|
+ return message;
|
|
+
|
|
+ RefPtr<JSON::Object> messageObject;
|
|
+ if (!parsedMessage->asObject(messageObject))
|
|
+ return message;
|
|
+
|
|
+ messageObject->setString("pageProxyId"_s, m_pageProxyID);
|
|
+ return messageObject->toJSONString();
|
|
+ }
|
|
+
|
|
+ String m_pageProxyID;
|
|
+ FrontendChannel& m_frontendChannel;
|
|
+ WebPageProxy& m_page;
|
|
+};
|
|
+
|
|
+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))
|
|
+{
|
|
+ PageProxyIDMap* map = this;
|
|
+ auto browserAgent = makeUnique<InspectorBrowserAgent>(m_frontendRouter, m_backendDispatcher, m_browserAgentClient.get(), *map);
|
|
+ m_browserAgent = browserAgent.get();
|
|
+ m_agents.append(WTFMove(browserAgent));
|
|
+}
|
|
+
|
|
+BrowserInspectorController::~BrowserInspectorController()
|
|
+{
|
|
+ if (m_frontendChannel)
|
|
+ disconnectFrontend();
|
|
+}
|
|
+
|
|
+void BrowserInspectorController::connectFrontend(FrontendChannel& frontendChannel)
|
|
+{
|
|
+ ASSERT(!m_frontendChannel);
|
|
+ m_frontendChannel = &frontendChannel;
|
|
+ WebPageInspectorController::setObserver(this);
|
|
+
|
|
+ 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::setObserver(nullptr);
|
|
+ m_frontendChannel = nullptr;
|
|
+}
|
|
+
|
|
+void BrowserInspectorController::dispatchMessageFromFrontend(const String& message)
|
|
+{
|
|
+ m_backendDispatcher->dispatch(message, BackendDispatcher::Mode::FailIfDomainIsMissing, [&](const RefPtr<JSON::Object>& messageObject) {
|
|
+ RefPtr<JSON::Value> pageProxyIDValue;
|
|
+ if (!messageObject->getValue("pageProxyId"_s, pageProxyIDValue))
|
|
+ return BackendDispatcher::DispatchResult::Continue;
|
|
+
|
|
+ String pageProxyID;
|
|
+ if (!pageProxyIDValue->asString(pageProxyID)) {
|
|
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidRequest, "The type of 'pageProxyId' must be string"_s);
|
|
+ m_backendDispatcher->sendPendingErrors();
|
|
+ return BackendDispatcher::DispatchResult::Finished;
|
|
+ }
|
|
+
|
|
+
|
|
+ if (auto pageProxyChannel = m_pageProxyChannels.get(pageProxyID)) {
|
|
+ pageProxyChannel->dispatchMessageFromFrontend(message);
|
|
+ return BackendDispatcher::DispatchResult::Finished;
|
|
+ }
|
|
+
|
|
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidRequest, "Cannot find page proxy with provided 'pageProxyId'"_s);
|
|
+ m_backendDispatcher->sendPendingErrors();
|
|
+ return BackendDispatcher::DispatchResult::Finished;
|
|
+ });
|
|
+}
|
|
+
|
|
+void BrowserInspectorController::connectToAllPages()
|
|
+{
|
|
+ for (auto* page : allPages())
|
|
+ connectToPage(*page);
|
|
+}
|
|
+
|
|
+void BrowserInspectorController::disconnectFromAllPages()
|
|
+{
|
|
+ for (auto it = m_pageProxyChannels.begin(); it != m_pageProxyChannels.end(); ++it)
|
|
+ it->value->disconnect();
|
|
+ m_pageProxyChannels.clear();
|
|
+}
|
|
+
|
|
+void BrowserInspectorController::connectToPage(WebPageProxy& page)
|
|
+{
|
|
+ String pageProxyID = InspectorBrowserAgent::toPageProxyIDProtocolString(page);
|
|
+ auto pageProxyChannel = makeUnique<PageProxyChannel>(*m_frontendChannel, pageProxyID, page);
|
|
+ page.inspectorController().connectFrontend(*pageProxyChannel);
|
|
+ m_pageProxyChannels.set(pageProxyID, WTFMove(pageProxyChannel));
|
|
+}
|
|
+
|
|
+void BrowserInspectorController::didCreateInspectorController(WebPageProxy& page)
|
|
+{
|
|
+ ASSERT(m_frontendChannel);
|
|
+ // Auto-connect to all new pages.
|
|
+ connectToPage(page);
|
|
+ m_browserAgent->didCreateWebPageProxy(page);
|
|
+}
|
|
+
|
|
+void BrowserInspectorController::willDestroyInspectorController(WebPageProxy& page)
|
|
+{
|
|
+ m_browserAgent->willDestroyWebPageProxy(page);
|
|
+
|
|
+ String pageProxyID = InspectorBrowserAgent::toPageProxyIDProtocolString(page);
|
|
+ auto it = m_pageProxyChannels.find(pageProxyID);
|
|
+ ASSERT(it != m_pageProxyChannels.end());
|
|
+ it->value->disconnect();
|
|
+ m_pageProxyChannels.remove(it);
|
|
+}
|
|
+
|
|
+void BrowserInspectorController::didFailProvisionalLoad(WebPageProxy& page, uint64_t navigationID, const String& error)
|
|
+{
|
|
+ m_browserAgent->didFailProvisionalLoad(page, navigationID, error);
|
|
+}
|
|
+
|
|
+WebPageProxy* BrowserInspectorController::findPageProxy(const String& pageProxyID)
|
|
+{
|
|
+ if (auto* pageProxyChannel = m_pageProxyChannels.get(pageProxyID))
|
|
+ return &pageProxyChannel->page();
|
|
+
|
|
+ return nullptr;
|
|
+}
|
|
+
|
|
+} // 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 0000000000000000000000000000000000000000..a6ee1aaaaee4a42ec7afb409c74d3cc3d8eefcd0
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/BrowserInspectorController.h
|
|
@@ -0,0 +1,85 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 "InspectorBrowserAgent.h"
|
|
+#include "WebPageInspectorController.h"
|
|
+#include <JavaScriptCore/InspectorAgentRegistry.h>
|
|
+#include <wtf/Forward.h>
|
|
+#include <wtf/Noncopyable.h>
|
|
+
|
|
+namespace Inspector {
|
|
+class BackendDispatcher;
|
|
+class FrontendChannel;
|
|
+class FrontendRouter;
|
|
+}
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+class InspectorBrowserAgent;
|
|
+class InspectorBrowserAgentClient;
|
|
+
|
|
+class BrowserInspectorController : private WebPageInspectorControllerObserver, private PageProxyIDMap {
|
|
+ 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;
|
|
+ class PageProxyChannel;
|
|
+
|
|
+ // WebPageInspectorControllerObserver
|
|
+ void didCreateInspectorController(WebPageProxy&) override;
|
|
+ void willDestroyInspectorController(WebPageProxy&) override;
|
|
+ void didFailProvisionalLoad(WebPageProxy&, uint64_t navigationID, const String& error) override;
|
|
+
|
|
+ // PageProxyIDMap
|
|
+ WebPageProxy* findPageProxy(const String& pageProxyID) override;
|
|
+
|
|
+ void connectToAllPages();
|
|
+ void disconnectFromAllPages();
|
|
+ void connectToPage(WebPageProxy&);
|
|
+
|
|
+ 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;
|
|
+ InspectorBrowserAgent* m_browserAgent { nullptr };
|
|
+ HashMap<String, std::unique_ptr<PageProxyChannel>> m_pageProxyChannels;
|
|
+};
|
|
+
|
|
+} // 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 0000000000000000000000000000000000000000..ff2aa2f85ece80f9bf029ca7b54cc42835a253c7
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/BrowserInspectorPipe.cpp
|
|
@@ -0,0 +1,57 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 0000000000000000000000000000000000000000..7dd8ee18d2310935db1a9cb6cbc48b7fb4e24f47
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/BrowserInspectorPipe.h
|
|
@@ -0,0 +1,38 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.h b/Source/WebKit/UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.h
|
|
index 454c61ffdefecc476d1560c7c43f5b5d345f281d..6de7509037b7683ddd403ee247bdf2845ce4e87a 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"
|
|
#include <wtf/CompletionHandler.h>
|
|
|
|
@@ -39,6 +41,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 0f18038de989e69a8432c85b71b6c04e931302b3..82a966779403346aed174dcfcd01a79691956d7b 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/Cocoa/UIDelegate.h b/Source/WebKit/UIProcess/Cocoa/UIDelegate.h
|
|
index a3593adf44b8d34a7c461c6b29332ba96f67992b..74661155eaa1dd6a9aa6bd177564dbeee7415019 100644
|
|
--- a/Source/WebKit/UIProcess/Cocoa/UIDelegate.h
|
|
+++ b/Source/WebKit/UIProcess/Cocoa/UIDelegate.h
|
|
@@ -91,6 +91,7 @@ private:
|
|
void runJavaScriptAlert(WebPageProxy&, const WTF::String&, WebFrameProxy*, WebCore::SecurityOriginData&&, Function<void()>&& completionHandler) final;
|
|
void runJavaScriptConfirm(WebPageProxy&, const WTF::String&, WebFrameProxy*, WebCore::SecurityOriginData&&, Function<void(bool)>&& completionHandler) final;
|
|
void runJavaScriptPrompt(WebPageProxy&, const WTF::String&, const WTF::String&, WebFrameProxy*, WebCore::SecurityOriginData&&, Function<void(const WTF::String&)>&&) final;
|
|
+ void handleJavaScriptDialog(WebKit::WebPageProxy&, bool accept, const WTF::String&) final;
|
|
void presentStorageAccessConfirmDialog(const WTF::String& requestingDomain, const WTF::String& currentDomain, CompletionHandler<void(bool)>&&);
|
|
void requestStorageAccessConfirm(WebPageProxy&, WebFrameProxy*, const WebCore::RegistrableDomain& requestingDomain, const WebCore::RegistrableDomain& currentDomain, CompletionHandler<void(bool)>&&) final;
|
|
void decidePolicyForGeolocationPermissionRequest(WebPageProxy&, WebFrameProxy&, API::SecurityOrigin&, Function<void(bool)>&) final;
|
|
@@ -171,6 +172,7 @@ private:
|
|
bool webViewRunJavaScriptAlertPanelWithMessageInitiatedByFrameCompletionHandler : 1;
|
|
bool webViewRunJavaScriptConfirmPanelWithMessageInitiatedByFrameCompletionHandler : 1;
|
|
bool webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler : 1;
|
|
+ bool webViewHandleJavaScriptDialogValue : 1;
|
|
bool webViewRequestStorageAccessPanelUnderFirstPartyCompletionHandler : 1;
|
|
bool webViewRunBeforeUnloadConfirmPanelWithMessageInitiatedByFrameCompletionHandler : 1;
|
|
bool webViewRequestGeolocationPermissionForFrameDecisionHandler : 1;
|
|
diff --git a/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm b/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm
|
|
index a3d0ded6df0566cb74493f98ec28bce0e8d893b3..a4d9a214407eb2c55c07a10b700abbb268768909 100644
|
|
--- a/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm
|
|
+++ b/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm
|
|
@@ -104,6 +104,7 @@ void UIDelegate::setDelegate(id <WKUIDelegate> delegate)
|
|
m_delegateMethods.webViewRunJavaScriptAlertPanelWithMessageInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:)];
|
|
m_delegateMethods.webViewRunJavaScriptConfirmPanelWithMessageInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:completionHandler:)];
|
|
m_delegateMethods.webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:completionHandler:)];
|
|
+ m_delegateMethods.webViewHandleJavaScriptDialogValue = [delegate respondsToSelector:@selector(webView:handleJavaScriptDialog:value:)];
|
|
m_delegateMethods.webViewRequestStorageAccessPanelUnderFirstPartyCompletionHandler = [delegate respondsToSelector:@selector(_webView:requestStorageAccessPanelForDomain:underCurrentDomain:completionHandler:)];
|
|
m_delegateMethods.webViewRunBeforeUnloadConfirmPanelWithMessageInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(_webView:runBeforeUnloadConfirmPanelWithMessage:initiatedByFrame:completionHandler:)];
|
|
m_delegateMethods.webViewRequestGeolocationPermissionForFrameDecisionHandler = [delegate respondsToSelector:@selector(_webView:requestGeolocationPermissionForFrame:decisionHandler:)];
|
|
@@ -341,6 +342,15 @@ void UIDelegate::UIClient::runJavaScriptPrompt(WebPageProxy&, const WTF::String&
|
|
}).get()];
|
|
}
|
|
|
|
+void UIDelegate::UIClient::handleJavaScriptDialog(WebKit::WebPageProxy&, bool accept, const WTF::String& value) {
|
|
+ if (!m_uiDelegate.m_delegateMethods.webViewHandleJavaScriptDialogValue)
|
|
+ return;
|
|
+ auto delegate = m_uiDelegate.m_delegate.get();
|
|
+ if (!delegate)
|
|
+ return;
|
|
+ [delegate webView:m_uiDelegate.m_webView handleJavaScriptDialog:accept value:value];
|
|
+}
|
|
+
|
|
void UIDelegate::UIClient::requestStorageAccessConfirm(WebPageProxy&, WebFrameProxy*, const WebCore::RegistrableDomain& requestingDomain, const WebCore::RegistrableDomain& currentDomain, CompletionHandler<void(bool)>&& completionHandler)
|
|
{
|
|
auto delegate = m_uiDelegate.m_delegate.get();
|
|
diff --git a/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm b/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
|
|
index 60852bc793d2915ffd138d75d005c3b63e5ce0bc..ce4689ff8b9de4243fddc9c99a6fb2399de465ff 100644
|
|
--- a/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
|
|
+++ b/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
|
|
@@ -129,6 +129,13 @@ static void registerUserDefaultsIfNeeded()
|
|
[[NSUserDefaults standardUserDefaults] registerDefaults:registrationDictionary];
|
|
}
|
|
|
|
+void WebProcessPool::setIgnoreTLSErrors(bool ignoreTLSErrors)
|
|
+{
|
|
+ m_ignoreTLSErrors = ignoreTLSErrors;
|
|
+ if (m_networkProcess)
|
|
+ m_networkProcess->send(Messages::NetworkProcess::SetIgnoreTLSErrors(m_ignoreTLSErrors), 0);
|
|
+}
|
|
+
|
|
void WebProcessPool::updateProcessSuppressionState()
|
|
{
|
|
if (m_networkProcess)
|
|
@@ -383,6 +390,7 @@ void WebProcessPool::platformInitializeNetworkProcess(NetworkProcessCreationPara
|
|
}
|
|
}
|
|
|
|
+ parameters.ignoreTLSErrors = m_ignoreTLSErrors;
|
|
parameters.enableLegacyTLS = false;
|
|
if (id value = [defaults objectForKey:@"WebKitEnableLegacyTLS"])
|
|
parameters.enableLegacyTLS = [value boolValue];
|
|
diff --git a/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp b/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp
|
|
index 71c89a98ed2cefb9fe76ea16856b8bf8f9f44687..e0a4a68416a4169553187ad03ecba846b192028f 100644
|
|
--- a/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp
|
|
+++ b/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp
|
|
@@ -37,6 +37,7 @@
|
|
#include "WebProcessProxy.h"
|
|
#include <WebCore/PlatformDisplay.h>
|
|
#include <WebCore/Region.h>
|
|
+#include <wtf/Vector.h>
|
|
|
|
#if PLATFORM(GTK)
|
|
#include <gtk/gtk.h>
|
|
@@ -119,6 +120,10 @@ void DrawingAreaProxyCoordinatedGraphics::paint(BackingStore::PlatformGraphicsCo
|
|
|
|
void DrawingAreaProxyCoordinatedGraphics::sizeDidChange()
|
|
{
|
|
+ for (auto& value : m_callbacks)
|
|
+ value();
|
|
+ m_callbacks.clear();
|
|
+
|
|
#if USE(DIRECT2D)
|
|
m_backingStore = nullptr;
|
|
#endif
|
|
@@ -133,6 +138,11 @@ void DrawingAreaProxyCoordinatedGraphics::deviceScaleFactorDidChange()
|
|
backingStoreStateDidChange(RespondImmediately);
|
|
}
|
|
|
|
+void DrawingAreaProxyCoordinatedGraphics::waitForSizeUpdate(Function<void ()>&& callback)
|
|
+{
|
|
+ m_callbacks.append(WTFMove(callback));
|
|
+}
|
|
+
|
|
void DrawingAreaProxyCoordinatedGraphics::waitForBackingStoreUpdateOnNextPaint()
|
|
{
|
|
m_hasReceivedFirstUpdate = true;
|
|
diff --git a/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h b/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h
|
|
index d7695088e7cfc4f638f157338754f9f157489749..ba114d47ac079661702e44f19853398f5c1d6b55 100644
|
|
--- a/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h
|
|
+++ b/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h
|
|
@@ -30,6 +30,7 @@
|
|
#include "BackingStore.h"
|
|
#include "DrawingAreaProxy.h"
|
|
#include "LayerTreeContext.h"
|
|
+#include <wtf/HashMap.h>
|
|
#include <wtf/RunLoop.h>
|
|
|
|
namespace WebCore {
|
|
@@ -49,6 +50,7 @@ public:
|
|
|
|
bool isInAcceleratedCompositingMode() const { return !m_layerTreeContext.isEmpty(); }
|
|
const LayerTreeContext& layerTreeContext() const { return m_layerTreeContext; }
|
|
+ void waitForSizeUpdate(Function<void ()>&&);
|
|
|
|
private:
|
|
// DrawingAreaProxy
|
|
@@ -126,6 +128,8 @@ private:
|
|
// For a new Drawing Area don't draw anything until the WebProcess has sent over the first content.
|
|
bool m_hasReceivedFirstUpdate { false };
|
|
|
|
+ Vector<Function<void ()>> m_callbacks;
|
|
+
|
|
#if !PLATFORM(WPE)
|
|
bool m_isBackingStoreDiscardable { true };
|
|
std::unique_ptr<BackingStore> m_backingStore;
|
|
diff --git a/Source/WebKit/UIProcess/DrawingAreaProxy.h b/Source/WebKit/UIProcess/DrawingAreaProxy.h
|
|
index 4896c404bc8b25d69360de7d1c509383282b2317..14bdebf732e929ea367c961f9d0bec85202bbae3 100644
|
|
--- a/Source/WebKit/UIProcess/DrawingAreaProxy.h
|
|
+++ b/Source/WebKit/UIProcess/DrawingAreaProxy.h
|
|
@@ -70,6 +70,7 @@ public:
|
|
|
|
const WebCore::IntSize& size() const { return m_size; }
|
|
bool setSize(const WebCore::IntSize&, const WebCore::IntSize& scrollOffset = { });
|
|
+ void waitForSizeUpdate(Function<void ()>&&);
|
|
|
|
// The timeout we use when waiting for a DidUpdateGeometry message.
|
|
static constexpr Seconds didUpdateBackingStoreStateTimeout() { return Seconds::fromMilliseconds(500); }
|
|
diff --git a/Source/WebKit/UIProcess/InspectorBrowserAgent.cpp b/Source/WebKit/UIProcess/InspectorBrowserAgent.cpp
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..e3fdebc6d86036f93361c3f0b9d7fbd0e7ac67bf
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/InspectorBrowserAgent.cpp
|
|
@@ -0,0 +1,482 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 "APIPageConfiguration.h"
|
|
+#include "InspectorBrowserAgentClient.h"
|
|
+#include "InspectorTargetProxy.h"
|
|
+#include "NetworkProcessMessages.h"
|
|
+#include "NetworkProcessProxy.h"
|
|
+#include "WebGeolocationManagerProxy.h"
|
|
+#include "WebGeolocationPosition.h"
|
|
+#include "WebPageInspectorController.h"
|
|
+#include "WebPageInspectorTarget.h"
|
|
+#include "WebPageProxy.h"
|
|
+#include "WebProcessPool.h"
|
|
+#include "WebProcessProxy.h"
|
|
+#include <WebCore/FrameIdentifier.h>
|
|
+#include <WebCore/GeolocationPositionData.h>
|
|
+#include <WebCore/ProcessIdentifier.h>
|
|
+#include <WebCore/ResourceRequest.h>
|
|
+#include <JavaScriptCore/InspectorFrontendRouter.h>
|
|
+#include <pal/SessionID.h>
|
|
+#include <stdlib.h>
|
|
+#include <wtf/HashMap.h>
|
|
+#include <wtf/HexNumber.h>
|
|
+
|
|
+
|
|
+using namespace Inspector;
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+namespace {
|
|
+
|
|
+Inspector::Protocol::Browser::CookieSameSitePolicy cookieSameSitePolicy(WebCore::Cookie::SameSitePolicy policy)
|
|
+{
|
|
+ switch (policy) {
|
|
+ case WebCore::Cookie::SameSitePolicy::None:
|
|
+ return Inspector::Protocol::Browser::CookieSameSitePolicy::None;
|
|
+ case WebCore::Cookie::SameSitePolicy::Lax:
|
|
+ return Inspector::Protocol::Browser::CookieSameSitePolicy::Lax;
|
|
+ case WebCore::Cookie::SameSitePolicy::Strict:
|
|
+ return Inspector::Protocol::Browser::CookieSameSitePolicy::Strict;
|
|
+ }
|
|
+ ASSERT_NOT_REACHED();
|
|
+ return Inspector::Protocol::Browser::CookieSameSitePolicy::None;
|
|
+}
|
|
+
|
|
+Ref<Inspector::Protocol::Browser::Cookie> buildObjectForCookie(const WebCore::Cookie& cookie)
|
|
+{
|
|
+ return Inspector::Protocol::Browser::Cookie::create()
|
|
+ .setName(cookie.name)
|
|
+ .setValue(cookie.value)
|
|
+ .setDomain(cookie.domain)
|
|
+ .setPath(cookie.path)
|
|
+ .setExpires(cookie.expires)
|
|
+ .setHttpOnly(cookie.httpOnly)
|
|
+ .setSecure(cookie.secure)
|
|
+ .setSession(cookie.session)
|
|
+ .setSameSite(cookieSameSitePolicy(cookie.sameSite))
|
|
+ .release();
|
|
+}
|
|
+
|
|
+Ref<Inspector::Protocol::Browser::PageProxyInfo> buildPageProxyInfo(const WebPageProxy& page) {
|
|
+ auto result = Inspector::Protocol::Browser::PageProxyInfo::create()
|
|
+ .setPageProxyId(InspectorBrowserAgent::toPageProxyIDProtocolString(page))
|
|
+ .setBrowserContextId(InspectorBrowserAgent::toBrowserContextIDProtocolString(page.sessionID()))
|
|
+ .release();
|
|
+ auto* opener = page.configuration().relatedPage();
|
|
+ if (opener)
|
|
+ result->setOpenerId(InspectorBrowserAgent::toPageProxyIDProtocolString(*opener));
|
|
+ return result;
|
|
+}
|
|
+
|
|
+} // namespace
|
|
+
|
|
+InspectorBrowserAgent::InspectorBrowserAgent(Inspector::FrontendRouter& frontendRouter, Inspector::BackendDispatcher& backendDispatcher, InspectorBrowserAgentClient* client, PageProxyIDMap& pageProxyIDMap)
|
|
+ : InspectorAgentBase("Browser"_s)
|
|
+ , m_frontendDispatcher(makeUnique<BrowserFrontendDispatcher>(frontendRouter))
|
|
+ , m_backendDispatcher(BrowserBackendDispatcher::create(backendDispatcher, this))
|
|
+ , m_client(client)
|
|
+ , m_pageProxyIDMap(pageProxyIDMap)
|
|
+{
|
|
+}
|
|
+
|
|
+InspectorBrowserAgent::~InspectorBrowserAgent() = default;
|
|
+
|
|
+void InspectorBrowserAgent::didCreateWebPageProxy(const WebPageProxy& page)
|
|
+{
|
|
+ if (m_isConnected)
|
|
+ m_frontendDispatcher->pageProxyCreated(buildPageProxyInfo(page));
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgent::willDestroyWebPageProxy(const WebPageProxy& page)
|
|
+{
|
|
+ if (m_isConnected)
|
|
+ m_frontendDispatcher->pageProxyDestroyed(toPageProxyIDProtocolString(page));
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgent::didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*)
|
|
+{
|
|
+ m_isConnected = true;
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgent::didFailProvisionalLoad(WebPageProxy& page, uint64_t navigationID, const String& error)
|
|
+{
|
|
+ if (!m_isConnected)
|
|
+ return;
|
|
+
|
|
+ m_frontendDispatcher->provisionalLoadFailed(toPageProxyIDProtocolString(page), String::number(navigationID), error);
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgent::willDestroyFrontendAndBackend(DisconnectReason)
|
|
+{
|
|
+ m_isConnected = false;
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgent::close(ErrorString& errorString)
|
|
+{
|
|
+ if (m_client == nullptr) {
|
|
+ errorString = "no platform delegate to close browser";
|
|
+ } else {
|
|
+ m_client->closeBrowser();
|
|
+ }
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgent::createContext(ErrorString& errorString, String* browserContextID)
|
|
+{
|
|
+ BrowserContext browserContext = m_client->createBrowserContext(errorString);
|
|
+ if (!errorString.isEmpty())
|
|
+ return;
|
|
+ browserContext.processPool->setPrimaryDataStore(*browserContext.dataStore);
|
|
+ browserContext.processPool->ensureNetworkProcess(browserContext.dataStore.get());
|
|
+ PAL::SessionID sessionID = browserContext.dataStore->sessionID();
|
|
+ *browserContextID = toBrowserContextIDProtocolString(sessionID);
|
|
+ m_browserContexts.set(*browserContextID, browserContext);
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgent::deleteContext(ErrorString& errorString, const String& browserContextID)
|
|
+{
|
|
+ BrowserContext browserContext = lookupBrowserContext(errorString, &browserContextID);
|
|
+ if (!errorString.isEmpty())
|
|
+ return;
|
|
+
|
|
+ Vector<WebPageProxy*> pages;
|
|
+ for (auto& process : browserContext.processPool->processes()) {
|
|
+ for (auto* page : process->pages())
|
|
+ pages.append(page);
|
|
+ }
|
|
+
|
|
+ for (auto* page : pages)
|
|
+ page->closePage();
|
|
+
|
|
+ PAL::SessionID sessionID = browserContext.dataStore->sessionID();
|
|
+ m_client->deleteBrowserContext(errorString, sessionID);
|
|
+ m_browserContexts.remove(browserContextID);
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgent::createPage(ErrorString& errorString, const String* browserContextID, String* pageProxyID)
|
|
+{
|
|
+ BrowserContext browserContext = lookupBrowserContext(errorString, browserContextID);
|
|
+ if (!errorString.isEmpty())
|
|
+ return;
|
|
+ RefPtr<WebPageProxy> page = m_client->createPage(errorString, browserContext);
|
|
+ if (!page)
|
|
+ return;
|
|
+ page->setPermissionsForAutomation(m_permissions.get(browserContextID ? *browserContextID : ""));
|
|
+ *pageProxyID = toPageProxyIDProtocolString(*page);
|
|
+}
|
|
+
|
|
+WebFrameProxy* InspectorBrowserAgent::frameForID(const String& frameID, String& error)
|
|
+{
|
|
+ size_t dotPos = frameID.find(".");
|
|
+ if (dotPos == notFound) {
|
|
+ error = "Invalid frame id"_s;
|
|
+ return nullptr;
|
|
+ }
|
|
+
|
|
+ if (!frameID.isAllASCII()) {
|
|
+ error = "Invalid frame id"_s;
|
|
+ return nullptr;
|
|
+ }
|
|
+
|
|
+ String processIDString = frameID.left(dotPos);
|
|
+ uint64_t pid = strtoull(processIDString.ascii().data(), 0, 10);
|
|
+ auto processID = makeObjectIdentifier<WebCore::ProcessIdentifierType>(pid);
|
|
+ WebProcessProxy* process = WebProcessProxy::processForIdentifier(processID);
|
|
+ if (!process) {
|
|
+ error = "Cannot find web process for the frame id"_s;
|
|
+ return nullptr;
|
|
+ }
|
|
+
|
|
+ String frameIDString = frameID.substring(dotPos + 1);
|
|
+ uint64_t frameIDNumber = strtoull(frameIDString.ascii().data(), 0, 10);
|
|
+ auto frameIdentifier = makeObjectIdentifier<WebCore::FrameIdentifierType>(frameIDNumber);
|
|
+ WebFrameProxy* frame = process->webFrame(frameIdentifier);
|
|
+ if (!frame) {
|
|
+ error = "Cannot find web frame for the frame id"_s;
|
|
+ return nullptr;
|
|
+ }
|
|
+
|
|
+ return frame;
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgent::navigate(const String& url, const String& pageProxyID, const String* frameID, const String* referrer, Ref<NavigateCallback>&& callback)
|
|
+{
|
|
+ WebPageProxy* page = m_pageProxyIDMap.findPageProxy(pageProxyID);
|
|
+ if (!page) {
|
|
+ callback->sendFailure("Cannot find page proxy with provided 'pageProxyId'"_s);
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ WebCore::ResourceRequest resourceRequest { url };
|
|
+
|
|
+ if (referrer)
|
|
+ resourceRequest.setHTTPReferrer(*referrer);
|
|
+
|
|
+ if (!resourceRequest.url().isValid()) {
|
|
+ callback->sendFailure("Cannot navigate to invalid URL"_s);
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ WebFrameProxy* frame = nullptr;
|
|
+ if (frameID) {
|
|
+ String error;
|
|
+ frame = frameForID(*frameID, error);
|
|
+ if (!frame) {
|
|
+ callback->sendFailure(error);
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ if (frame->page() != page) {
|
|
+ callback->sendFailure("Frame with specified is not from the specified page"_s);
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ page->inspectorController().navigate(WTFMove(resourceRequest), frame, [callback = WTFMove(callback)](const String& error, uint64_t navigationID) {
|
|
+ if (!error.isEmpty()) {
|
|
+ callback->sendFailure(error);
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ Optional<String> navigationIDString;
|
|
+ if (navigationID)
|
|
+ navigationIDString = String::number(navigationID);
|
|
+ callback->sendSuccess(navigationIDString);
|
|
+ });
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgent::setIgnoreCertificateErrors(Inspector::ErrorString& errorString, const String* browserContextID, bool ignore)
|
|
+{
|
|
+ BrowserContext browserContext = lookupBrowserContext(errorString, browserContextID);
|
|
+ if (!errorString.isEmpty())
|
|
+ return;
|
|
+ browserContext.processPool->setIgnoreTLSErrors(ignore);
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgent::getAllCookies(const String* browserContextID, Ref<GetAllCookiesCallback>&& callback) {
|
|
+ String errorString;
|
|
+ BrowserContext browserContext = lookupBrowserContext(errorString, browserContextID);
|
|
+ if (!errorString.isEmpty()) {
|
|
+ callback->sendFailure(errorString);
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ PAL::SessionID sessionID = browserContext.dataStore->sessionID();
|
|
+ NetworkProcessProxy* networkProcess = browserContext.processPool->networkProcess();
|
|
+ networkProcess->sendWithAsyncReply(Messages::NetworkProcess::GetAllCookies(sessionID),
|
|
+ [callback = WTFMove(callback)](Vector<WebCore::Cookie> allCookies) {
|
|
+ if (!callback->isActive())
|
|
+ return;
|
|
+ auto cookies = JSON::ArrayOf<Inspector::Protocol::Browser::Cookie>::create();
|
|
+ for (const auto& cookie : allCookies)
|
|
+ cookies->addItem(buildObjectForCookie(cookie));
|
|
+ callback->sendSuccess(WTFMove(cookies));
|
|
+ }, 0);
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgent::setCookies(const String* browserContextID, const JSON::Array& in_cookies, Ref<SetCookiesCallback>&& callback) {
|
|
+ String errorString;
|
|
+ BrowserContext browserContext = lookupBrowserContext(errorString, browserContextID);
|
|
+ if (!errorString.isEmpty()) {
|
|
+ callback->sendFailure(errorString);
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ NetworkProcessProxy* networkProcess = browserContext.processPool->networkProcess();
|
|
+ PAL::SessionID sessionID = browserContext.dataStore->sessionID();
|
|
+
|
|
+ Vector<WebCore::Cookie> cookies;
|
|
+ for (unsigned i = 0; i < in_cookies.length(); ++i) {
|
|
+ RefPtr<JSON::Value> item = in_cookies.get(i);
|
|
+ RefPtr<JSON::Object> obj;
|
|
+ if (!item->asObject(obj)) {
|
|
+ errorString = "Invalid cookie payload format"_s;
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ WebCore::Cookie cookie;
|
|
+ if (!obj->getString("name", cookie.name) ||
|
|
+ !obj->getString("value", cookie.value) ||
|
|
+ !obj->getString("domain", cookie.domain) ||
|
|
+ !obj->getString("path", cookie.path)) {
|
|
+ errorString = "Invalid file payload format"_s;
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ obj->getDouble("expires", cookie.expires);
|
|
+ obj->getBoolean("httpOnly", cookie.httpOnly);
|
|
+ obj->getBoolean("secure", cookie.secure);
|
|
+ obj->getBoolean("session", cookie.session);
|
|
+ String sameSite;
|
|
+ if (obj->getString("sameSite", sameSite)) {
|
|
+ if (sameSite == "None")
|
|
+ cookie.sameSite = WebCore::Cookie::SameSitePolicy::None;
|
|
+ if (sameSite == "Lax")
|
|
+ cookie.sameSite = WebCore::Cookie::SameSitePolicy::Lax;
|
|
+ if (sameSite == "Strict")
|
|
+ cookie.sameSite = WebCore::Cookie::SameSitePolicy::Strict;
|
|
+ }
|
|
+ cookies.append(WTFMove(cookie));
|
|
+ }
|
|
+
|
|
+ networkProcess->sendWithAsyncReply(Messages::NetworkProcess::SetCookies(sessionID, WTFMove(cookies)),
|
|
+ [callback = WTFMove(callback)](bool success) {
|
|
+ if (!callback->isActive())
|
|
+ return;
|
|
+
|
|
+ if (success)
|
|
+ callback->sendSuccess();
|
|
+ else
|
|
+ callback->sendFailure("Internal error: no network storage"_s);
|
|
+ callback->sendSuccess();
|
|
+ }, 0);
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgent::deleteAllCookies(const String* browserContextID, Ref<DeleteAllCookiesCallback>&& callback) {
|
|
+ String errorString;
|
|
+ BrowserContext browserContext = lookupBrowserContext(errorString, browserContextID);
|
|
+ if (!errorString.isEmpty()) {
|
|
+ callback->sendFailure(errorString);
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ NetworkProcessProxy* networkProcess = browserContext.processPool->networkProcess();
|
|
+ PAL::SessionID sessionID = browserContext.dataStore->sessionID();
|
|
+ networkProcess->sendWithAsyncReply(Messages::NetworkProcess::DeleteAllCookies(sessionID),
|
|
+ [callback = WTFMove(callback)](bool success) {
|
|
+ if (!callback->isActive())
|
|
+ return;
|
|
+ if (success)
|
|
+ callback->sendSuccess();
|
|
+ else
|
|
+ callback->sendFailure("Internal error: no network storage"_s);
|
|
+ }, 0);
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgent::grantPermissions(Inspector::ErrorString& errorString, const String* browserContextID, const String& origin, const JSON::Array& values)
|
|
+{
|
|
+ BrowserContext browserContext = lookupBrowserContext(errorString, browserContextID);
|
|
+ if (!errorString.isEmpty())
|
|
+ return;
|
|
+ HashSet<String> set;
|
|
+ for (const auto& value : values) {
|
|
+ String name;
|
|
+ if (!value->asString(name)) {
|
|
+ errorString = "Permission must be a string"_s;
|
|
+ return;
|
|
+ }
|
|
+ set.add(name);
|
|
+ }
|
|
+ String key = browserContextID ? *browserContextID : "";
|
|
+ auto it = m_permissions.add(key, Permissions()).iterator;
|
|
+ it->value.set(origin, WTFMove(set));
|
|
+ Vector<WebPageProxy*> pages;
|
|
+ for (auto& process : browserContext.processPool->processes()) {
|
|
+ for (auto* page : process->pages())
|
|
+ page->setPermissionsForAutomation(it->value);
|
|
+ }
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgent::resetPermissions(Inspector::ErrorString& errorString, const String* browserContextID)
|
|
+{
|
|
+ BrowserContext browserContext = lookupBrowserContext(errorString, browserContextID);
|
|
+ if (!errorString.isEmpty())
|
|
+ return;
|
|
+ m_permissions.clear();
|
|
+ for (auto& process : browserContext.processPool->processes()) {
|
|
+ for (auto* page : process->pages())
|
|
+ page->setPermissionsForAutomation(HashMap<String, HashSet<String>>());
|
|
+ }
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgent::setGeolocationOverride(Inspector::ErrorString& errorString, const String* browserContextID, const JSON::Object* geolocation)
|
|
+{
|
|
+ BrowserContext browserContext = lookupBrowserContext(errorString, browserContextID);
|
|
+ if (!errorString.isEmpty())
|
|
+ return;
|
|
+ auto* geoManager = browserContext.processPool->supplement<WebGeolocationManagerProxy>();
|
|
+ if (!geoManager) {
|
|
+ errorString = "Internal error: geolocation manager is not available.";
|
|
+ return;
|
|
+ }
|
|
+ if (geolocation) {
|
|
+ double timestamp = 0;
|
|
+ double latitude = 0;
|
|
+ double longitude = 0;
|
|
+ double accuracy = 0;
|
|
+ if (!geolocation->getDouble("timestamp", timestamp) ||
|
|
+ !geolocation->getDouble("latitude", latitude) ||
|
|
+ !geolocation->getDouble("longitude", longitude) ||
|
|
+ !geolocation->getDouble("accuracy", accuracy)) {
|
|
+ errorString = "Invalid geolocation format"_s;
|
|
+ return;
|
|
+ }
|
|
+ auto position = WebGeolocationPosition::create(WebCore::GeolocationPositionData(timestamp, latitude, longitude, accuracy));
|
|
+ geoManager->providerDidChangePosition(&position.get());
|
|
+ } else {
|
|
+ geoManager->providerDidFailToDeterminePosition("Position unavailable"_s);
|
|
+ }
|
|
+}
|
|
+
|
|
+String InspectorBrowserAgent::toBrowserContextIDProtocolString(const PAL::SessionID& sessionID)
|
|
+{
|
|
+ StringBuilder builder;
|
|
+ builder.append(hex(sessionID.toUInt64(), 16));
|
|
+ return builder.toString();
|
|
+}
|
|
+
|
|
+String InspectorBrowserAgent::toPageProxyIDProtocolString(const WebPageProxy& page)
|
|
+{
|
|
+ return makeString(page.identifier().toUInt64());
|
|
+}
|
|
+
|
|
+BrowserContext InspectorBrowserAgent::lookupBrowserContext(ErrorString& errorString, const String* browserContextID)
|
|
+{
|
|
+ if (!browserContextID) {
|
|
+ for (auto& pool : WebProcessPool::allProcessPools()) {
|
|
+ BrowserContext context;
|
|
+ context.processPool = pool;
|
|
+ context.dataStore = pool->websiteDataStore();
|
|
+ return context;
|
|
+ }
|
|
+ errorString = "No default context"_s;
|
|
+ return BrowserContext();
|
|
+ }
|
|
+
|
|
+ BrowserContext browserContext = m_browserContexts.get(*browserContextID);
|
|
+ if (!browserContext.processPool)
|
|
+ errorString = "Could not find browser context for given id"_s;
|
|
+ return browserContext;
|
|
+}
|
|
+
|
|
+} // 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 0000000000000000000000000000000000000000..71a26862762e695015ca27aac2e4645d69234bc1
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/InspectorBrowserAgent.h
|
|
@@ -0,0 +1,113 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 <JavaScriptCore/InspectorAgentBase.h>
|
|
+#include <JavaScriptCore/InspectorBackendDispatchers.h>
|
|
+#include <wtf/HashMap.h>
|
|
+#include <pal/SessionID.h>
|
|
+#include <wtf/Forward.h>
|
|
+#include <wtf/Noncopyable.h>
|
|
+
|
|
+namespace Inspector {
|
|
+class BackendDispatcher;
|
|
+class BrowserFrontendDispatcher;
|
|
+class FrontendChannel;
|
|
+class FrontendRouter;
|
|
+}
|
|
+
|
|
+namespace PAL {
|
|
+class SessionID;
|
|
+}
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+class NetworkProcess;
|
|
+class WebFrameProxy;
|
|
+class WebProcessPool;
|
|
+
|
|
+class PageProxyIDMap {
|
|
+public:
|
|
+ virtual WebPageProxy* findPageProxy(const String& pageProxyID) = 0;
|
|
+
|
|
+protected:
|
|
+ virtual ~PageProxyIDMap() = default;
|
|
+};
|
|
+
|
|
+class InspectorBrowserAgent final : public Inspector::InspectorAgentBase, public Inspector::BrowserBackendDispatcherHandler {
|
|
+ WTF_MAKE_NONCOPYABLE(InspectorBrowserAgent);
|
|
+ WTF_MAKE_FAST_ALLOCATED;
|
|
+public:
|
|
+ InspectorBrowserAgent(Inspector::FrontendRouter&, Inspector::BackendDispatcher&, InspectorBrowserAgentClient*, PageProxyIDMap&);
|
|
+ ~InspectorBrowserAgent() override;
|
|
+
|
|
+ void didCreateWebPageProxy(const WebPageProxy&);
|
|
+ void willDestroyWebPageProxy(const WebPageProxy&);
|
|
+ void didFailProvisionalLoad(WebPageProxy&, uint64_t navigationID, const String& error);
|
|
+
|
|
+ // 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* pageProxyID) override;
|
|
+ void navigate(const String& url, const String& pageProxyID, const String* frameId, const String* referrer, Ref<NavigateCallback>&&) override;
|
|
+ void setIgnoreCertificateErrors(Inspector::ErrorString&, const String* browserContextID, bool ignore) override;
|
|
+
|
|
+ void getAllCookies(const String* browserContextID, Ref<GetAllCookiesCallback>&&) override;
|
|
+ void setCookies(const String* browserContextID, const JSON::Array& in_cookies, Ref<SetCookiesCallback>&&) override;
|
|
+ void deleteAllCookies(const String* browserContextID, Ref<DeleteAllCookiesCallback>&&) override;
|
|
+
|
|
+ void grantPermissions(Inspector::ErrorString&, const String* browserContextID, const String& origin, const JSON::Array& permissions) override;
|
|
+ void resetPermissions(Inspector::ErrorString&, const String* browserContextID) override;
|
|
+ void setGeolocationOverride(Inspector::ErrorString&, const String* browserContextID, const JSON::Object* geolocation) override;
|
|
+
|
|
+ static String toBrowserContextIDProtocolString(const PAL::SessionID&);
|
|
+ static String toPageProxyIDProtocolString(const WebPageProxy&);
|
|
+
|
|
+private:
|
|
+ BrowserContext lookupBrowserContext(Inspector::ErrorString&, const String* browserContextID);
|
|
+ WebFrameProxy* frameForID(const String& frameID, String& error);
|
|
+
|
|
+ std::unique_ptr<Inspector::BrowserFrontendDispatcher> m_frontendDispatcher;
|
|
+ Ref<Inspector::BrowserBackendDispatcher> m_backendDispatcher;
|
|
+ InspectorBrowserAgentClient* m_client;
|
|
+ PageProxyIDMap& m_pageProxyIDMap;
|
|
+ using Permissions = HashMap<String, HashSet<String>>;
|
|
+ HashMap<String, Permissions> m_permissions;
|
|
+ HashMap<String, BrowserContext> m_browserContexts;
|
|
+ bool m_isConnected { false };
|
|
+};
|
|
+
|
|
+} // 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 0000000000000000000000000000000000000000..21f8cc9bffd8f2d4a88764a4eafa13f367aa1e7c
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/InspectorBrowserAgentClient.h
|
|
@@ -0,0 +1,55 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 <pal/SessionID.h>
|
|
+#include <wtf/Forward.h>
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+class WebsiteDataStore;
|
|
+class WebPageProxy;
|
|
+class WebProcessPool;
|
|
+
|
|
+struct BrowserContext {
|
|
+ RefPtr<WebsiteDataStore> dataStore;
|
|
+ RefPtr<WebProcessPool> processPool;
|
|
+};
|
|
+
|
|
+class InspectorBrowserAgentClient {
|
|
+public:
|
|
+ virtual ~InspectorBrowserAgentClient() = default;
|
|
+ virtual RefPtr<WebKit::WebPageProxy> createPage(WTF::String& error, const BrowserContext& context) = 0;
|
|
+ virtual void closeBrowser() = 0;
|
|
+ virtual BrowserContext createBrowserContext(WTF::String& error) = 0;
|
|
+ virtual void deleteBrowserContext(WTF::String& error, PAL::SessionID) = 0;
|
|
+};
|
|
+
|
|
+} // namespace WebKit
|
|
+
|
|
+#endif // ENABLE(REMOTE_INSPECTOR)
|
|
diff --git a/Source/WebKit/UIProcess/InspectorDialogAgent.cpp b/Source/WebKit/UIProcess/InspectorDialogAgent.cpp
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..ca5965f9d682c0821a40f0d1d43e5cbeda1353a5
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/InspectorDialogAgent.cpp
|
|
@@ -0,0 +1,86 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 "InspectorDialogAgent.h"
|
|
+
|
|
+#include "APINavigation.h"
|
|
+#include "APIUIClient.h"
|
|
+#include "WebPageProxy.h"
|
|
+#include <JavaScriptCore/InspectorFrontendRouter.h>
|
|
+
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+using namespace Inspector;
|
|
+
|
|
+InspectorDialogAgent::InspectorDialogAgent(Inspector::BackendDispatcher& backendDispatcher, Inspector::FrontendRouter& frontendRouter, WebPageProxy& page)
|
|
+ : InspectorAgentBase("Dialog"_s)
|
|
+ , m_frontendDispatcher(makeUnique<DialogFrontendDispatcher>(frontendRouter))
|
|
+ , m_backendDispatcher(DialogBackendDispatcher::create(backendDispatcher, this))
|
|
+ , m_page(page)
|
|
+{
|
|
+}
|
|
+
|
|
+InspectorDialogAgent::~InspectorDialogAgent()
|
|
+{
|
|
+ Inspector::ErrorString err;
|
|
+ disable(err);
|
|
+}
|
|
+
|
|
+void InspectorDialogAgent::didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*)
|
|
+{
|
|
+}
|
|
+
|
|
+void InspectorDialogAgent::willDestroyFrontendAndBackend(Inspector::DisconnectReason)
|
|
+{
|
|
+}
|
|
+
|
|
+void InspectorDialogAgent::enable(Inspector::ErrorString& errorString)
|
|
+{
|
|
+ if (m_page.inspectorDialogAgent()) {
|
|
+ errorString = "Dialog domain is already enabled."_s;
|
|
+ return;
|
|
+ }
|
|
+ m_page.setInspectorDialogAgent(this);
|
|
+}
|
|
+
|
|
+void InspectorDialogAgent::disable(Inspector::ErrorString&)
|
|
+{
|
|
+ if (m_page.inspectorDialogAgent() != this)
|
|
+ return;
|
|
+ m_page.setInspectorDialogAgent(nullptr);
|
|
+}
|
|
+
|
|
+void InspectorDialogAgent::handleJavaScriptDialog(Inspector::ErrorString& errorString, bool accept, const String* value)
|
|
+{
|
|
+ m_page.uiClient().handleJavaScriptDialog(m_page, accept, value ? *value : String());
|
|
+}
|
|
+
|
|
+void InspectorDialogAgent::javascriptDialogOpening(const String& type, const String& message, const String* defaultValue) {
|
|
+ m_frontendDispatcher->javascriptDialogOpening(type, message, defaultValue);
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/InspectorDialogAgent.h b/Source/WebKit/UIProcess/InspectorDialogAgent.h
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..f356c613945fd263889bc74166bef2b279ab4ca1
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/InspectorDialogAgent.h
|
|
@@ -0,0 +1,70 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 "WebEvent.h"
|
|
+
|
|
+#include <JavaScriptCore/InspectorAgentBase.h>
|
|
+#include <JavaScriptCore/InspectorBackendDispatchers.h>
|
|
+#include <JavaScriptCore/InspectorFrontendDispatchers.h>
|
|
+
|
|
+#include <wtf/Forward.h>
|
|
+#include <wtf/Noncopyable.h>
|
|
+
|
|
+namespace Inspector {
|
|
+class FrontendChannel;
|
|
+class FrontendRouter;
|
|
+}
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+class NativeWebKeyboardEvent;
|
|
+class WebPageProxy;
|
|
+
|
|
+class InspectorDialogAgent : public Inspector::InspectorAgentBase, public Inspector::DialogBackendDispatcherHandler {
|
|
+ WTF_MAKE_NONCOPYABLE(InspectorDialogAgent);
|
|
+ WTF_MAKE_FAST_ALLOCATED;
|
|
+public:
|
|
+ InspectorDialogAgent(Inspector::BackendDispatcher& backendDispatcher, Inspector::FrontendRouter& frontendRouter, WebPageProxy& page);
|
|
+ ~InspectorDialogAgent() override;
|
|
+
|
|
+ void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) override;
|
|
+ void willDestroyFrontendAndBackend(Inspector::DisconnectReason) override;
|
|
+
|
|
+ void enable(Inspector::ErrorString&) override;
|
|
+ void disable(Inspector::ErrorString&) override;
|
|
+ void handleJavaScriptDialog(Inspector::ErrorString& errorString, bool accept, const String* promptText) override;
|
|
+
|
|
+ void javascriptDialogOpening(const String& type, const String& message, const String* defaultValue = nullptr);
|
|
+
|
|
+private:
|
|
+ void platformHandleJavaScriptDialog(bool accept, const String* promptText);
|
|
+ std::unique_ptr<Inspector::DialogFrontendDispatcher> m_frontendDispatcher;
|
|
+ Ref<Inspector::DialogBackendDispatcher> m_backendDispatcher;
|
|
+ WebPageProxy& m_page;
|
|
+};
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/InspectorTargetProxy.cpp b/Source/WebKit/UIProcess/InspectorTargetProxy.cpp
|
|
index 6928ca2fbfb6939062e3cd14bb7ba6f2fdc87f5f..a54a1c99c1e255fd34a0c2fad13be32e7889cc8f 100644
|
|
--- a/Source/WebKit/UIProcess/InspectorTargetProxy.cpp
|
|
+++ b/Source/WebKit/UIProcess/InspectorTargetProxy.cpp
|
|
@@ -28,10 +28,13 @@
|
|
|
|
#include "ProvisionalPageProxy.h"
|
|
#include "WebFrameProxy.h"
|
|
+#include "WebPageInspectorController.h"
|
|
#include "WebPageInspectorTarget.h"
|
|
#include "WebPageMessages.h"
|
|
#include "WebPageProxy.h"
|
|
#include "WebProcessProxy.h"
|
|
+#include "ProvisionalPageProxy.h"
|
|
+
|
|
|
|
namespace WebKit {
|
|
|
|
@@ -39,23 +42,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)
|
|
+std::unique_ptr<InspectorTargetProxy> InspectorTargetProxy::create(ProvisionalPageProxy& provisionalPage, const String& targetId)
|
|
{
|
|
- auto target = InspectorTargetProxy::create(provisionalPage.page(), targetId, type);
|
|
- target->m_provisionalPage = makeWeakPtr(provisionalPage);
|
|
- return target;
|
|
+ return makeUnique<InspectorTargetProxy>(provisionalPage.page(), &provisionalPage, targetId, Inspector::InspectorTargetType::Page);
|
|
}
|
|
|
|
-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) {
|
|
@@ -83,6 +92,9 @@ void InspectorTargetProxy::disconnect()
|
|
|
|
void InspectorTargetProxy::sendMessageToTargetBackend(const String& message)
|
|
{
|
|
+ if (m_page.inspectorController().dispatchMessageToTargetBackend(message))
|
|
+ return;
|
|
+
|
|
if (m_provisionalPage) {
|
|
m_provisionalPage->send(Messages::WebPage::SendMessageToTargetBackend(identifier(), message));
|
|
return;
|
|
@@ -97,9 +109,35 @@ void InspectorTargetProxy::didCommitProvisionalTarget()
|
|
m_provisionalPage = nullptr;
|
|
}
|
|
|
|
+void InspectorTargetProxy::activate(String& error)
|
|
+{
|
|
+ if (m_type != Inspector::InspectorTargetType::Page)
|
|
+ return InspectorTarget::activate(error);
|
|
+
|
|
+ platformActivate(error);
|
|
+}
|
|
+
|
|
+void InspectorTargetProxy::close(String& error, bool runBeforeUnload)
|
|
+{
|
|
+ if (m_type != Inspector::InspectorTargetType::Page)
|
|
+ return InspectorTarget::close(error, runBeforeUnload);
|
|
+
|
|
+ if (runBeforeUnload)
|
|
+ m_page.tryClose();
|
|
+ else
|
|
+ m_page.closePage();
|
|
+}
|
|
+
|
|
bool InspectorTargetProxy::isProvisional() const
|
|
{
|
|
return !!m_provisionalPage;
|
|
}
|
|
|
|
+String InspectorTargetProxy::oldTargetID() const
|
|
+{
|
|
+ if (!m_provisionalPage)
|
|
+ return String();
|
|
+ return WebPageInspectorTarget::toTargetID(m_page.webPageID());
|
|
+}
|
|
+
|
|
} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/InspectorTargetProxy.h b/Source/WebKit/UIProcess/InspectorTargetProxy.h
|
|
index a2239cec8e18850f35f7f88a9c4ebadc62bf4023..8c9960d59c7712b4f56d2c2f9bd862f0af7cf982 100644
|
|
--- a/Source/WebKit/UIProcess/InspectorTargetProxy.h
|
|
+++ b/Source/WebKit/UIProcess/InspectorTargetProxy.h
|
|
@@ -37,30 +37,36 @@ 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);
|
|
+ static std::unique_ptr<InspectorTargetProxy> create(ProvisionalPageProxy&, const String& targetId);
|
|
+ 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;
|
|
+ String oldTargetID() const override;
|
|
|
|
void connect(Inspector::FrontendChannel::ConnectionType) override;
|
|
void disconnect() override;
|
|
void sendMessageToTargetBackend(const String&) override;
|
|
+ void activate(String& error) override;
|
|
+ void close(String& error, bool runBeforeUnload) override;
|
|
|
|
private:
|
|
+ void platformActivate(String& error) const;
|
|
+
|
|
WebPageProxy& m_page;
|
|
+ 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 0000000000000000000000000000000000000000..0b4ec2de5671723f4045e98b3e398fc11180b3b8
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/RemoteInspectorPipe.cpp
|
|
@@ -0,0 +1,219 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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
|
|
+
|
|
+#if PLATFORM(WIN)
|
|
+#include <io.h>
|
|
+#endif
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+namespace {
|
|
+
|
|
+const int readFD = 3;
|
|
+const int writeFD = 4;
|
|
+
|
|
+const size_t kWritePacketSize = 1 << 16;
|
|
+
|
|
+#if PLATFORM(WIN)
|
|
+HANDLE readHandle;
|
|
+HANDLE writeHandle;
|
|
+#endif
|
|
+
|
|
+size_t ReadBytes(void* buffer, size_t size, bool exact_size)
|
|
+{
|
|
+ size_t bytesRead = 0;
|
|
+ while (bytesRead < size) {
|
|
+#if PLATFORM(WIN)
|
|
+ DWORD sizeRead = 0;
|
|
+ bool hadError = !ReadFile(readHandle, static_cast<char*>(buffer) + bytesRead,
|
|
+ size - bytesRead, &sizeRead, nullptr);
|
|
+#else
|
|
+ int sizeRead = read(readFD, static_cast<char*>(buffer) + bytesRead,
|
|
+ size - bytesRead);
|
|
+ if (sizeRead < 0 && errno == EINTR)
|
|
+ continue;
|
|
+ bool hadError = sizeRead <= 0;
|
|
+#endif
|
|
+ if (hadError) {
|
|
+ return 0;
|
|
+ }
|
|
+ bytesRead += sizeRead;
|
|
+ if (!exact_size)
|
|
+ break;
|
|
+ }
|
|
+ return bytesRead;
|
|
+}
|
|
+
|
|
+void WriteBytes(const char* bytes, size_t size)
|
|
+{
|
|
+ size_t totalWritten = 0;
|
|
+ while (totalWritten < size) {
|
|
+ size_t length = size - totalWritten;
|
|
+ if (length > kWritePacketSize)
|
|
+ length = kWritePacketSize;
|
|
+#if PLATFORM(WIN)
|
|
+ DWORD bytesWritten = 0;
|
|
+ bool hadError = !WriteFile(writeHandle, bytes + totalWritten, static_cast<DWORD>(length), &bytesWritten, nullptr);
|
|
+#else
|
|
+ int bytesWritten = write(writeFD, bytes + totalWritten, length);
|
|
+ if (bytesWritten < 0 && errno == EINTR)
|
|
+ continue;
|
|
+ bool hadError = bytesWritten <= 0;
|
|
+#endif
|
|
+ if (hadError)
|
|
+ return;
|
|
+ totalWritten += bytesWritten;
|
|
+ }
|
|
+}
|
|
+
|
|
+} // namespace
|
|
+
|
|
+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()]() {
|
|
+ WriteBytes(message.ascii().data(), message.length());
|
|
+ WriteBytes("\0", 1);
|
|
+ });
|
|
+ }
|
|
+
|
|
+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;
|
|
+
|
|
+#if PLATFORM(WIN)
|
|
+ readHandle = reinterpret_cast<HANDLE>(_get_osfhandle(readFD));
|
|
+ writeHandle = reinterpret_cast<HANDLE>(_get_osfhandle(writeFD));
|
|
+#endif
|
|
+
|
|
+ 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) {
|
|
+ size_t size = ReadBytes(buffer.get(), bufSize, false);
|
|
+ if (!size)
|
|
+ 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 0000000000000000000000000000000000000000..b1307da8b9ee02d63ef98d276473d65a1d8c3556
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/RemoteInspectorPipe.h
|
|
@@ -0,0 +1,65 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 3db63ef6bd5ea32b296ac046aa43a0d1497c5e74..4f04cf936b5521fd9528942fd5027b611421884d 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/WebGeolocationManagerProxy.cpp b/Source/WebKit/UIProcess/WebGeolocationManagerProxy.cpp
|
|
index 846a5aa27dfab3d274cffa4873861f2587d17fd8..cf0dc99f5601636c48abff09cd47ace49d127a08 100644
|
|
--- a/Source/WebKit/UIProcess/WebGeolocationManagerProxy.cpp
|
|
+++ b/Source/WebKit/UIProcess/WebGeolocationManagerProxy.cpp
|
|
@@ -118,7 +118,8 @@ void WebGeolocationManagerProxy::startUpdating(IPC::Connection& connection)
|
|
if (!wasUpdating) {
|
|
m_provider->setEnableHighAccuracy(*this, isHighAccuracyEnabled());
|
|
m_provider->startUpdating(*this);
|
|
- } else if (m_lastPosition)
|
|
+ }
|
|
+ if (m_lastPosition)
|
|
connection.send(Messages::WebGeolocationManager::DidChangePosition(m_lastPosition.value()), 0);
|
|
}
|
|
|
|
diff --git a/Source/WebKit/UIProcess/WebPageInspectorController.cpp b/Source/WebKit/UIProcess/WebPageInspectorController.cpp
|
|
index 1ee28bf716374371433215148aa20a51927a8a33..17a7f735dd0024bf6f701571b74d5ffbbe8256ba 100644
|
|
--- a/Source/WebKit/UIProcess/WebPageInspectorController.cpp
|
|
+++ b/Source/WebKit/UIProcess/WebPageInspectorController.cpp
|
|
@@ -26,10 +26,16 @@
|
|
#include "config.h"
|
|
#include "WebPageInspectorController.h"
|
|
|
|
+#include "APINavigation.h"
|
|
+#include "InspectorDialogAgent.h"
|
|
#include "ProvisionalPageProxy.h"
|
|
#include "WebFrameProxy.h"
|
|
+#include "WebPageInspectorEmulationAgent.h"
|
|
+#include "WebPageInspectorInputAgent.h"
|
|
#include "WebPageInspectorTarget.h"
|
|
#include "WebPageProxy.h"
|
|
+#include "WebPreferences.h"
|
|
+#include <WebCore/ResourceError.h>
|
|
#include <JavaScriptCore/InspectorAgentBase.h>
|
|
#include <JavaScriptCore/InspectorBackendDispatcher.h>
|
|
#include <JavaScriptCore/InspectorBackendDispatchers.h>
|
|
@@ -46,29 +52,90 @@ static String getTargetID(const ProvisionalPageProxy& provisionalPage)
|
|
return WebPageInspectorTarget::toTargetID(provisionalPage.webPageID());
|
|
}
|
|
|
|
+WebPageInspectorControllerObserver* WebPageInspectorController::s_observer = nullptr;
|
|
+
|
|
+void WebPageInspectorController::setObserver(WebPageInspectorControllerObserver* observer)
|
|
+{
|
|
+ s_observer = observer;
|
|
+}
|
|
+
|
|
WebPageInspectorController::WebPageInspectorController(WebPageProxy& page)
|
|
: m_page(page)
|
|
, m_frontendRouter(FrontendRouter::create())
|
|
, m_backendDispatcher(BackendDispatcher::create(m_frontendRouter.copyRef()))
|
|
+{
|
|
+}
|
|
+
|
|
+void WebPageInspectorController::init()
|
|
{
|
|
auto targetAgent = makeUnique<InspectorTargetAgent>(m_frontendRouter.get(), m_backendDispatcher.get());
|
|
|
|
m_targetAgent = targetAgent.get();
|
|
|
|
m_agents.append(WTFMove(targetAgent));
|
|
-}
|
|
+ m_agents.append(makeUnique<WebPageInspectorEmulationAgent>(m_backendDispatcher.get(), m_page));
|
|
+ auto inputAgent = makeUnique<WebPageInspectorInputAgent>(m_backendDispatcher.get(), m_page);
|
|
+ m_inputAgent = inputAgent.get();
|
|
+ m_agents.append(WTFMove(inputAgent));
|
|
+ m_agents.append(makeUnique<InspectorDialogAgent>(m_backendDispatcher.get(), m_frontendRouter.get(), m_page));
|
|
|
|
-void WebPageInspectorController::init()
|
|
-{
|
|
+ if (s_observer)
|
|
+ s_observer->didCreateInspectorController(m_page);
|
|
+
|
|
+ // 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();
|
|
+
|
|
+ if (s_observer)
|
|
+ s_observer->willDestroyInspectorController(m_page);
|
|
+}
|
|
+
|
|
+bool WebPageInspectorController::pageCrashed(ProcessTerminationReason reason)
|
|
+{
|
|
+ if (reason != ProcessTerminationReason::Crash)
|
|
+ return false;
|
|
+ String targetId = WebPageInspectorTarget::toTargetID(m_page.webPageID());
|
|
+ auto it = m_targets.find(targetId);
|
|
+ if (it == m_targets.end())
|
|
+ return false;
|
|
+ m_targetAgent->targetCrashed(*it->value);
|
|
+ m_targets.remove(it);
|
|
+
|
|
+ return m_targetAgent->isConnected();
|
|
+}
|
|
+
|
|
+void WebPageInspectorController::didProcessAllPendingKeyboardEvents()
|
|
+{
|
|
+ if (m_frontendRouter->hasFrontends())
|
|
+ m_inputAgent->didProcessAllPendingKeyboardEvents();
|
|
+}
|
|
+
|
|
+void WebPageInspectorController::didProcessAllPendingMouseEvents()
|
|
+{
|
|
+ if (m_frontendRouter->hasFrontends())
|
|
+ m_inputAgent->didProcessAllPendingMouseEvents();
|
|
}
|
|
|
|
bool WebPageInspectorController::hasLocalFrontend() const
|
|
@@ -80,6 +147,17 @@ void WebPageInspectorController::connectFrontend(Inspector::FrontendChannel& fro
|
|
{
|
|
bool connectingFirstFrontend = !m_frontendRouter->hasFrontends();
|
|
|
|
+ // HACK: forcefully disconnect remote connections to show local inspector starting with initial
|
|
+ // agents' state.
|
|
+ if (frontendChannel.connectionType() == Inspector::FrontendChannel::ConnectionType::Local &&
|
|
+ !connectingFirstFrontend && !m_frontendRouter->hasLocalFrontend()) {
|
|
+ disconnectAllFrontends();
|
|
+ connectingFirstFrontend = true;
|
|
+ }
|
|
+
|
|
+ if (connectingFirstFrontend)
|
|
+ adjustPageSettings();
|
|
+
|
|
m_frontendRouter->connectFrontend(frontendChannel);
|
|
|
|
if (connectingFirstFrontend)
|
|
@@ -98,8 +176,10 @@ void WebPageInspectorController::disconnectFrontend(FrontendChannel& frontendCha
|
|
m_frontendRouter->disconnectFrontend(frontendChannel);
|
|
|
|
bool disconnectingLastFrontend = !m_frontendRouter->hasFrontends();
|
|
- if (disconnectingLastFrontend)
|
|
+ if (disconnectingLastFrontend) {
|
|
m_agents.willDestroyFrontendAndBackend(DisconnectReason::InspectorDestroyed);
|
|
+ m_pendingNavigations.clear();
|
|
+ }
|
|
|
|
m_page.didChangeInspectorFrontendCount(m_frontendRouter->frontendCount());
|
|
|
|
@@ -122,6 +202,8 @@ void WebPageInspectorController::disconnectAllFrontends()
|
|
// Disconnect any remaining remote frontends.
|
|
m_frontendRouter->disconnectAllFrontends();
|
|
|
|
+ m_pendingNavigations.clear();
|
|
+
|
|
m_page.didChangeInspectorFrontendCount(m_frontendRouter->frontendCount());
|
|
|
|
#if ENABLE(REMOTE_INSPECTOR)
|
|
@@ -134,6 +216,11 @@ 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;
|
|
+}
|
|
+
|
|
#if ENABLE(REMOTE_INSPECTOR)
|
|
void WebPageInspectorController::setIndicating(bool indicating)
|
|
{
|
|
@@ -148,6 +235,55 @@ void WebPageInspectorController::setIndicating(bool indicating)
|
|
}
|
|
#endif
|
|
|
|
+void WebPageInspectorController::navigate(WebCore::ResourceRequest&& request, WebFrameProxy* frame, NavigationHandler&& completionHandler)
|
|
+{
|
|
+ auto navigation = m_page.loadRequestForInspector(WTFMove(request), frame);
|
|
+ if (!navigation) {
|
|
+ completionHandler("Failed to navigate"_s, 0);
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ m_pendingNavigations.set(navigation->navigationID(), WTFMove(completionHandler));
|
|
+}
|
|
+
|
|
+void WebPageInspectorController::didReceivePolicyDecision(WebCore::PolicyAction action, uint64_t navigationID)
|
|
+{
|
|
+ if (!m_frontendRouter->hasFrontends())
|
|
+ return;
|
|
+
|
|
+ if (!navigationID)
|
|
+ return;
|
|
+
|
|
+ auto completionHandler = m_pendingNavigations.take(navigationID);
|
|
+ if (!completionHandler)
|
|
+ return;
|
|
+
|
|
+ if (action == WebCore::PolicyAction::Ignore)
|
|
+ completionHandler("Navigation cancelled"_s, 0);
|
|
+ else
|
|
+ completionHandler(String(), navigationID);
|
|
+}
|
|
+
|
|
+void WebPageInspectorController::didDestroyNavigation(uint64_t navigationID)
|
|
+{
|
|
+ if (!m_frontendRouter->hasFrontends())
|
|
+ return;
|
|
+
|
|
+ auto completionHandler = m_pendingNavigations.take(navigationID);
|
|
+ if (!completionHandler)
|
|
+ return;
|
|
+
|
|
+ // Inspector initiated navigation is destroyed before policy check only when it
|
|
+ // becomes a fragment navigation (which always reuses current navigation).
|
|
+ completionHandler(String(), 0);
|
|
+}
|
|
+
|
|
+void WebPageInspectorController::didFailProvisionalLoadForFrame(uint64_t navigationID, const WebCore::ResourceError& error)
|
|
+{
|
|
+ if (s_observer)
|
|
+ s_observer->didFailProvisionalLoad(m_page, navigationID, error.localizedDescription());
|
|
+}
|
|
+
|
|
void WebPageInspectorController::createInspectorTarget(const String& targetId, Inspector::InspectorTargetType type)
|
|
{
|
|
addTarget(InspectorTargetProxy::create(m_page, targetId, type));
|
|
@@ -186,7 +322,7 @@ void WebPageInspectorController::setContinueLoadingCallback(const ProvisionalPag
|
|
|
|
void WebPageInspectorController::didCreateProvisionalPage(ProvisionalPageProxy& provisionalPage)
|
|
{
|
|
- addTarget(InspectorTargetProxy::create(provisionalPage, getTargetID(provisionalPage), Inspector::InspectorTargetType::Page));
|
|
+ addTarget(InspectorTargetProxy::create(provisionalPage, getTargetID(provisionalPage)));
|
|
}
|
|
|
|
void WebPageInspectorController::willDestroyProvisionalPage(const ProvisionalPageProxy& provisionalPage)
|
|
@@ -218,4 +354,16 @@ void WebPageInspectorController::addTarget(std::unique_ptr<InspectorTargetProxy>
|
|
m_targets.set(target->identifier(), WTFMove(target));
|
|
}
|
|
|
|
+void WebPageInspectorController::adjustPageSettings()
|
|
+{
|
|
+ // Set this to true as otherwise updating any preferences will override its
|
|
+ // value in the Web Process to false (and InspectorController sets it locally
|
|
+ // to true when frontend is connected).
|
|
+ m_page.preferences().setDeveloperExtrasEnabled(true);
|
|
+
|
|
+ // Navigation to cached pages doesn't fire some of the events (e.g. execution context created)
|
|
+ // that inspector depends on. So we disable the cache when front-end connects.
|
|
+ m_page.preferences().setUsesBackForwardCache(false);
|
|
+}
|
|
+
|
|
} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/WebPageInspectorController.h b/Source/WebKit/UIProcess/WebPageInspectorController.h
|
|
index 78caedf0c0ce83675569502d150fcc44e5f9868c..c5c375b9aef58d1df2dad223462bce2da4b1aef2 100644
|
|
--- a/Source/WebKit/UIProcess/WebPageInspectorController.h
|
|
+++ b/Source/WebKit/UIProcess/WebPageInspectorController.h
|
|
@@ -26,6 +26,7 @@
|
|
#pragma once
|
|
|
|
#include "InspectorTargetProxy.h"
|
|
+#include "ProcessTerminationReason.h"
|
|
#include <JavaScriptCore/InspectorAgentRegistry.h>
|
|
#include <JavaScriptCore/InspectorTargetAgent.h>
|
|
#include <WebCore/PageIdentifier.h>
|
|
@@ -37,10 +38,30 @@ namespace Inspector {
|
|
class BackendDispatcher;
|
|
class FrontendChannel;
|
|
class FrontendRouter;
|
|
+class InspectorTarget;
|
|
+}
|
|
+
|
|
+namespace WebCore {
|
|
+class ResourceError;
|
|
+class ResourceRequest;
|
|
+enum class PolicyAction : uint8_t;
|
|
}
|
|
|
|
namespace WebKit {
|
|
|
|
+class WebFrameProxy;
|
|
+class WebPageInspectorInputAgent;
|
|
+
|
|
+class WebPageInspectorControllerObserver {
|
|
+public:
|
|
+ virtual void didCreateInspectorController(WebPageProxy&) = 0;
|
|
+ virtual void willDestroyInspectorController(WebPageProxy&) = 0;
|
|
+ virtual void didFailProvisionalLoad(WebPageProxy&, uint64_t navigationID, const String& error) = 0;
|
|
+
|
|
+protected:
|
|
+ virtual ~WebPageInspectorControllerObserver() = default;
|
|
+};
|
|
+
|
|
class WebPageInspectorController {
|
|
WTF_MAKE_NONCOPYABLE(WebPageInspectorController);
|
|
WTF_MAKE_FAST_ALLOCATED;
|
|
@@ -48,7 +69,15 @@ public:
|
|
WebPageInspectorController(WebPageProxy&);
|
|
|
|
void init();
|
|
+ void didFinishAttachingToWebProcess();
|
|
+
|
|
+ static void setObserver(WebPageInspectorControllerObserver*);
|
|
+
|
|
void pageClosed();
|
|
+ bool pageCrashed(ProcessTerminationReason);
|
|
+
|
|
+ void didProcessAllPendingKeyboardEvents();
|
|
+ void didProcessAllPendingMouseEvents();
|
|
|
|
bool hasLocalFrontend() const;
|
|
|
|
@@ -57,11 +86,19 @@ public:
|
|
void disconnectAllFrontends();
|
|
|
|
void dispatchMessageFromFrontend(const String& message);
|
|
+ bool dispatchMessageToTargetBackend(const String&);
|
|
|
|
#if ENABLE(REMOTE_INSPECTOR)
|
|
void setIndicating(bool);
|
|
#endif
|
|
|
|
+ using NavigationHandler = Function<void(const String&, uint64_t)>;
|
|
+ void navigate(WebCore::ResourceRequest&&, WebFrameProxy*, NavigationHandler&&);
|
|
+ void didReceivePolicyDecision(WebCore::PolicyAction action, uint64_t navigationID);
|
|
+ void didDestroyNavigation(uint64_t navigationID);
|
|
+
|
|
+ void didFailProvisionalLoadForFrame(uint64_t navigationID, const WebCore::ResourceError& error);
|
|
+
|
|
void createInspectorTarget(const String& targetId, Inspector::InspectorTargetType);
|
|
void destroyInspectorTarget(const String& targetId);
|
|
void sendMessageToInspectorFrontend(const String& targetId, const String& message);
|
|
@@ -75,13 +112,18 @@ public:
|
|
|
|
private:
|
|
void addTarget(std::unique_ptr<InspectorTargetProxy>&&);
|
|
+ void adjustPageSettings();
|
|
|
|
WebPageProxy& m_page;
|
|
Ref<Inspector::FrontendRouter> m_frontendRouter;
|
|
Ref<Inspector::BackendDispatcher> m_backendDispatcher;
|
|
Inspector::AgentRegistry m_agents;
|
|
- Inspector::InspectorTargetAgent* m_targetAgent;
|
|
+ Inspector::InspectorTargetAgent* m_targetAgent { nullptr };
|
|
+ WebPageInspectorInputAgent* m_inputAgent { nullptr };
|
|
HashMap<String, std::unique_ptr<InspectorTargetProxy>> m_targets;
|
|
+ HashMap<uint64_t, NavigationHandler> m_pendingNavigations;
|
|
+
|
|
+ static WebPageInspectorControllerObserver* s_observer;
|
|
};
|
|
|
|
} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/WebPageInspectorEmulationAgent.cpp b/Source/WebKit/UIProcess/WebPageInspectorEmulationAgent.cpp
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..78815bc17978a23ca811ff99039b4fe86e6fb4a0
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/WebPageInspectorEmulationAgent.cpp
|
|
@@ -0,0 +1,95 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 "WebPageInspectorEmulationAgent.h"
|
|
+
|
|
+#include "WebPageProxy.h"
|
|
+#include "WebPreferences.h"
|
|
+#include <JavaScriptCore/InspectorFrontendRouter.h>
|
|
+#include <WebCore/Credential.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(int width, int height, double deviceScaleFactor, bool fixedlayout, Ref<SetDeviceMetricsOverrideCallback>&& callback)
|
|
+{
|
|
+#if PLATFORM(GTK)
|
|
+ // On gtk, fixed layout doesn't work with compositing enabled
|
|
+ // FIXME: This turns off compositing forever, even if fixedLayout is disabled.
|
|
+ if (fixedlayout) {
|
|
+ auto copy = m_page.preferences().copy();
|
|
+ copy->setAcceleratedCompositingEnabled(false);
|
|
+ m_page.setPreferences(copy);
|
|
+ }
|
|
+#endif
|
|
+
|
|
+ m_page.setCustomDeviceScaleFactor(deviceScaleFactor);
|
|
+ m_page.setUseFixedLayout(fixedlayout);
|
|
+ platformSetSize(width, height, [callback = WTFMove(callback)](const String& error) {
|
|
+ if (error.isEmpty())
|
|
+ callback->sendSuccess();
|
|
+ else
|
|
+ callback->sendFailure(error);
|
|
+ });
|
|
+}
|
|
+
|
|
+void WebPageInspectorEmulationAgent::setJavaScriptEnabled(ErrorString&, bool enabled)
|
|
+{
|
|
+ auto copy = m_page.preferences().copy();
|
|
+ copy->setJavaScriptEnabled(enabled);
|
|
+ m_page.setPreferences(copy);
|
|
+}
|
|
+
|
|
+void WebPageInspectorEmulationAgent::setAuthCredentials(Inspector::ErrorString&, const String* username, const String* password)
|
|
+{
|
|
+ if (username && password)
|
|
+ m_page.setAuthCredentialsForAutomation(WebCore::Credential(*username, *password, CredentialPersistencePermanent));
|
|
+ else
|
|
+ m_page.setAuthCredentialsForAutomation(Optional<WebCore::Credential>());
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/WebPageInspectorEmulationAgent.h b/Source/WebKit/UIProcess/WebPageInspectorEmulationAgent.h
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..77dff2c191fee081773bc5705d80168c3898f496
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/WebPageInspectorEmulationAgent.h
|
|
@@ -0,0 +1,66 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 <JavaScriptCore/InspectorAgentBase.h>
|
|
+#include <JavaScriptCore/InspectorBackendDispatchers.h>
|
|
+
|
|
+#include <wtf/Forward.h>
|
|
+#include <wtf/Function.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(int width, int height, double deviceScaleFactor, bool fixedlayout, Ref<SetDeviceMetricsOverrideCallback>&&) override;
|
|
+ void setJavaScriptEnabled(Inspector::ErrorString&, bool enabled) override;
|
|
+ void setAuthCredentials(Inspector::ErrorString&, const String*, const String*) override;
|
|
+
|
|
+private:
|
|
+ void platformSetSize(int width, int height, Function<void (const String& error)>&&);
|
|
+
|
|
+ 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 0000000000000000000000000000000000000000..7b1125da9a39107a73e9f282480e81d3fd3d7d6a
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/WebPageInspectorInputAgent.cpp
|
|
@@ -0,0 +1,244 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 "WebPageInspectorInputAgent.h"
|
|
+
|
|
+#include "NativeWebKeyboardEvent.h"
|
|
+#include "NativeWebMouseEvent.h"
|
|
+#include "WebPageProxy.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::KeyboardCallbacks : public CallbackList<Inspector::InputBackendDispatcherHandler::DispatchKeyEventCallback> {
|
|
+};
|
|
+
|
|
+class WebPageInspectorInputAgent::MouseCallbacks : public CallbackList<Inspector::InputBackendDispatcherHandler::DispatchMouseEventCallback> {
|
|
+};
|
|
+
|
|
+WebPageInspectorInputAgent::WebPageInspectorInputAgent(Inspector::BackendDispatcher& backendDispatcher, WebPageProxy& page)
|
|
+ : InspectorAgentBase("Input"_s)
|
|
+ , m_backendDispatcher(InputBackendDispatcher::create(backendDispatcher, this))
|
|
+ , m_page(page)
|
|
+{
|
|
+}
|
|
+
|
|
+WebPageInspectorInputAgent::~WebPageInspectorInputAgent() = default;
|
|
+
|
|
+void WebPageInspectorInputAgent::didProcessAllPendingKeyboardEvents()
|
|
+{
|
|
+ m_keyboardCallbacks->sendSuccess();
|
|
+}
|
|
+
|
|
+void WebPageInspectorInputAgent::didProcessAllPendingMouseEvents()
|
|
+{
|
|
+ m_mouseCallbacks->sendSuccess();
|
|
+}
|
|
+
|
|
+void WebPageInspectorInputAgent::didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*)
|
|
+{
|
|
+ m_keyboardCallbacks = makeUnique<KeyboardCallbacks>();
|
|
+ m_mouseCallbacks = makeUnique<MouseCallbacks>();
|
|
+}
|
|
+
|
|
+void WebPageInspectorInputAgent::willDestroyFrontendAndBackend(Inspector::DisconnectReason)
|
|
+{
|
|
+ m_keyboardCallbacks = nullptr;
|
|
+ m_mouseCallbacks = nullptr;
|
|
+}
|
|
+
|
|
+void WebPageInspectorInputAgent::dispatchKeyEvent(const String& type, const int* modifiers, const String* text, const String* unmodifiedText, const String* code, const String* key, const int* windowsVirtualKeyCode, const int* nativeVirtualKeyCode, const bool* autoRepeat, const bool* isKeypad, const bool* isSystemKey, const JSON::Array* commands, Ref<Inspector::InputBackendDispatcherHandler::DispatchKeyEventCallback>&& callback)
|
|
+{
|
|
+ WebKit::WebEvent::Type eventType;
|
|
+ if (type == "keyDown") {
|
|
+ eventType = WebKit::WebEvent::KeyDown;
|
|
+ } else if (type == "keyUp") {
|
|
+ eventType = WebKit::WebEvent::KeyUp;
|
|
+ } else {
|
|
+ callback->sendFailure("Unsupported event type.");
|
|
+ return;
|
|
+ }
|
|
+ OptionSet<WebEvent::Modifier> eventModifiers;
|
|
+ if (modifiers)
|
|
+ eventModifiers = eventModifiers.fromRaw(*modifiers);
|
|
+ String eventText;
|
|
+ if (text)
|
|
+ eventText = *text;
|
|
+ String eventUnmodifiedText;
|
|
+ if (unmodifiedText)
|
|
+ eventUnmodifiedText = *unmodifiedText;
|
|
+ String eventCode;
|
|
+ if (code)
|
|
+ eventCode = *code;
|
|
+ String eventKey;
|
|
+ if (key)
|
|
+ eventKey = *key;
|
|
+ int eventWindowsVirtualKeyCode = 0;
|
|
+ if (windowsVirtualKeyCode)
|
|
+ eventWindowsVirtualKeyCode = *windowsVirtualKeyCode;
|
|
+ int eventNativeVirtualKeyCode = 0;
|
|
+ if (nativeVirtualKeyCode)
|
|
+ eventNativeVirtualKeyCode = *nativeVirtualKeyCode;
|
|
+ Vector<String> eventCommands;
|
|
+ if (commands) {
|
|
+ for (const auto& value : *commands) {
|
|
+ String command;
|
|
+ if (!value->asString(command)) {
|
|
+ callback->sendFailure("Command must be string");
|
|
+ return;
|
|
+ }
|
|
+ eventCommands.append(command);
|
|
+ }
|
|
+ }
|
|
+
|
|
+ bool eventIsAutoRepeat = false;
|
|
+ if (autoRepeat)
|
|
+ eventIsAutoRepeat = *autoRepeat;
|
|
+ bool eventIsKeypad = false;
|
|
+ if (isKeypad)
|
|
+ eventIsKeypad = *isKeypad;
|
|
+ bool eventIsSystemKey = false;
|
|
+ if (isSystemKey)
|
|
+ eventIsSystemKey = *isSystemKey;
|
|
+ WallTime timestamp = WallTime::now();
|
|
+
|
|
+ m_keyboardCallbacks->append(WTFMove(callback));
|
|
+ platformDispatchKeyEvent(
|
|
+ eventType,
|
|
+ eventText,
|
|
+ eventUnmodifiedText,
|
|
+ eventKey,
|
|
+ eventCode,
|
|
+ eventWindowsVirtualKeyCode,
|
|
+ eventNativeVirtualKeyCode,
|
|
+ eventIsAutoRepeat,
|
|
+ eventIsKeypad,
|
|
+ eventIsSystemKey,
|
|
+ eventModifiers,
|
|
+ eventCommands,
|
|
+ timestamp);
|
|
+}
|
|
+
|
|
+void WebPageInspectorInputAgent::dispatchMouseEvent(const String& type, int x, int y, const int* modifiers, const String* button, const int* buttons, const int* clickCount, const int* deltaX, const int* deltaY, Ref<DispatchMouseEventCallback>&& callback)
|
|
+{
|
|
+ WebEvent::Type eventType = WebEvent::NoType;
|
|
+ if (type == "down")
|
|
+ eventType = WebEvent::MouseDown;
|
|
+ else if (type == "up")
|
|
+ eventType = WebEvent::MouseUp;
|
|
+ else if (type == "move")
|
|
+ eventType = WebEvent::MouseMove;
|
|
+ else {
|
|
+ callback->sendFailure("Unsupported event type");
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ OptionSet<WebEvent::Modifier> eventModifiers;
|
|
+ if (modifiers)
|
|
+ eventModifiers = eventModifiers.fromRaw(*modifiers);
|
|
+
|
|
+ WebMouseEvent::Button eventButton = WebMouseEvent::NoButton;
|
|
+ if (button) {
|
|
+ if (*button == "left")
|
|
+ eventButton = WebMouseEvent::LeftButton;
|
|
+ else if (*button == "middle")
|
|
+ eventButton = WebMouseEvent::MiddleButton;
|
|
+ else if (*button == "right")
|
|
+ eventButton = WebMouseEvent::RightButton;
|
|
+ else if (*button == "none")
|
|
+ eventButton = WebMouseEvent::NoButton;
|
|
+ else {
|
|
+ callback->sendFailure("Unsupported eventButton");
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ unsigned short eventButtons = 0;
|
|
+ if (buttons)
|
|
+ eventButtons = *buttons;
|
|
+
|
|
+ int eventClickCount = 0;
|
|
+ if (clickCount)
|
|
+ eventClickCount = *clickCount;
|
|
+ int eventDeltaX = 0;
|
|
+ if (deltaX)
|
|
+ eventDeltaX = *deltaX;
|
|
+ int eventDeltaY = 0;
|
|
+ if (deltaY)
|
|
+ eventDeltaY = *deltaY;
|
|
+ m_mouseCallbacks->append(WTFMove(callback));
|
|
+#if PLATFORM(MAC)
|
|
+ platformDispatchMouseEvent(type, x, y, modifiers, button, clickCount);
|
|
+#elif PLATFORM(GTK) || PLATFORM(WPE) || PLATFORM(WIN)
|
|
+ WallTime timestamp = WallTime::now();
|
|
+ NativeWebMouseEvent event(
|
|
+ eventType,
|
|
+ eventButton,
|
|
+ eventButtons,
|
|
+ {x, y},
|
|
+ WebCore::IntPoint(),
|
|
+ eventDeltaX,
|
|
+ eventDeltaY,
|
|
+ 0,
|
|
+ eventClickCount,
|
|
+ eventModifiers,
|
|
+ timestamp);
|
|
+ m_page.handleMouseEvent(event);
|
|
+#endif
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/WebPageInspectorInputAgent.h b/Source/WebKit/UIProcess/WebPageInspectorInputAgent.h
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..76290475097e756e3d932d22be4d8c797be4aa0c
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/WebPageInspectorInputAgent.h
|
|
@@ -0,0 +1,84 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 "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 didProcessAllPendingKeyboardEvents();
|
|
+ void didProcessAllPendingMouseEvents();
|
|
+
|
|
+ void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) override;
|
|
+ void willDestroyFrontendAndBackend(Inspector::DisconnectReason) override;
|
|
+
|
|
+ // Protocol handler
|
|
+ void dispatchKeyEvent(const String& type, const int* modifiers, const String* text, const String* unmodifiedText, const String* code, const String* key, const int* windowsVirtualKeyCode, const int* nativeVirtualKeyCode, const bool* autoRepeat, const bool* isKeypad, const bool* isSystemKey, const JSON::Array*, Ref<DispatchKeyEventCallback>&& callback) override;
|
|
+ void dispatchMouseEvent(const String& type, int x, int y, const int* modifiers, const String* button, const int* buttons, const int* clickCount, const int* deltaX, const int* deltaY, Ref<DispatchMouseEventCallback>&& callback) 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, Vector<String>& commands, WallTime timestamp);
|
|
+#if PLATFORM(WPE)
|
|
+ void platformDispatchMouseEvent(WebMouseEvent::Type type, int x, int y, WebMouseEvent::Button button, OptionSet<WebEvent::Modifier> modifiers);
|
|
+#endif
|
|
+#if PLATFORM(MAC)
|
|
+ void platformDispatchMouseEvent(const String& type, int x, int y, const int* modifier, const String* button, const int* clickCount);
|
|
+#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 KeyboardCallbacks;
|
|
+ std::unique_ptr<KeyboardCallbacks> m_keyboardCallbacks;
|
|
+ class MouseCallbacks;
|
|
+ std::unique_ptr<MouseCallbacks> m_mouseCallbacks;
|
|
+};
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp
|
|
index 6f1a3ea0b45d339fc8029046de6895530208db5d..16e73d3494187640f0fdd73df3d8260f939796bc 100644
|
|
--- a/Source/WebKit/UIProcess/WebPageProxy.cpp
|
|
+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp
|
|
@@ -903,6 +903,7 @@ void WebPageProxy::finishAttachingToWebProcess(ProcessLaunchReason reason)
|
|
m_pageLoadState.didSwapWebProcesses();
|
|
if (reason != ProcessLaunchReason::InitialProcess)
|
|
m_drawingArea->waitForBackingStoreUpdateOnNextPaint();
|
|
+ m_inspectorController->didFinishAttachingToWebProcess();
|
|
}
|
|
|
|
void WebPageProxy::didAttachToRunningProcess()
|
|
@@ -1238,6 +1239,21 @@ WebProcessProxy& WebPageProxy::ensureRunningProcess()
|
|
return m_process;
|
|
}
|
|
|
|
+RefPtr<API::Navigation> WebPageProxy::loadRequestForInspector(WebCore::ResourceRequest&& request, WebFrameProxy* frame)
|
|
+{
|
|
+ if (!frame || frame == mainFrame())
|
|
+ return loadRequest(WTFMove(request), WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow);
|
|
+
|
|
+ auto navigation = m_navigationState->createLoadRequestNavigation(ResourceRequest(request), m_backForwardList->currentItem());
|
|
+ LoadParameters loadParameters;
|
|
+ loadParameters.navigationID = navigation->navigationID();
|
|
+ loadParameters.request = WTFMove(request);
|
|
+ loadParameters.shouldOpenExternalURLsPolicy = WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow;
|
|
+ loadParameters.shouldTreatAsContinuingLoad = false;
|
|
+ m_process->send(Messages::WebPage::LoadRequestInFrameForInspector(loadParameters, frame->frameID()), m_webPageID);
|
|
+ return navigation;
|
|
+}
|
|
+
|
|
RefPtr<API::Navigation> WebPageProxy::loadRequest(ResourceRequest&& request, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, API::Object* userData)
|
|
{
|
|
if (m_isClosed)
|
|
@@ -1674,6 +1690,19 @@ void WebPageProxy::setControlledByAutomation(bool controlled)
|
|
m_process->processPool().sendToNetworkingProcess(Messages::NetworkProcess::SetSessionIsControlledByAutomation(m_websiteDataStore->sessionID(), m_controlledByAutomation));
|
|
}
|
|
|
|
+void WebPageProxy::setAuthCredentialsForAutomation(Optional<WebCore::Credential>&& credentials) {
|
|
+ m_credentialsForAutomation = WTFMove(credentials);
|
|
+}
|
|
+
|
|
+void WebPageProxy::setPermissionsForAutomation(const HashMap<String, HashSet<String>>& permissions) {
|
|
+ m_permissionsForAutomation = permissions;
|
|
+}
|
|
+
|
|
+void WebPageProxy::logToStderr(const String& str)
|
|
+{
|
|
+ fprintf(stderr, "RENDERER: %s\n", str.utf8().data());
|
|
+}
|
|
+
|
|
void WebPageProxy::createInspectorTarget(const String& targetId, Inspector::InspectorTargetType type)
|
|
{
|
|
m_inspectorController->createInspectorTarget(targetId, type);
|
|
@@ -2740,7 +2769,7 @@ static TrackingType mergeTrackingTypes(TrackingType a, TrackingType b)
|
|
|
|
void WebPageProxy::updateTouchEventTracking(const WebTouchEvent& touchStartEvent)
|
|
{
|
|
-#if ENABLE(ASYNC_SCROLLING) && PLATFORM(COCOA)
|
|
+#if ENABLE(ASYNC_SCROLLING) && PLATFORM(IOS_FAMILY)
|
|
const EventNames& names = eventNames();
|
|
for (auto& touchPoint : touchStartEvent.touchPoints()) {
|
|
IntPoint location = touchPoint.location();
|
|
@@ -2773,7 +2802,7 @@ void WebPageProxy::updateTouchEventTracking(const WebTouchEvent& touchStartEvent
|
|
m_touchAndPointerEventTracking.touchStartTracking = TrackingType::Synchronous;
|
|
m_touchAndPointerEventTracking.touchMoveTracking = TrackingType::Synchronous;
|
|
m_touchAndPointerEventTracking.touchEndTracking = TrackingType::Synchronous;
|
|
-#endif // ENABLE(ASYNC_SCROLLING)
|
|
+#endif // ENABLE(ASYNC_SCROLLING) && PLATFORM(IOS_FAMILY)
|
|
}
|
|
|
|
TrackingType WebPageProxy::touchEventTrackingType(const WebTouchEvent& touchStartEvent) const
|
|
@@ -3106,6 +3135,7 @@ void WebPageProxy::receivedNavigationPolicyDecision(PolicyAction policyAction, A
|
|
|
|
void WebPageProxy::receivedPolicyDecision(PolicyAction action, API::Navigation* navigation, Optional<WebsitePoliciesData>&& websitePolicies, Ref<PolicyDecisionSender>&& sender, WillContinueLoadInNewProcess willContinueLoadInNewProcess)
|
|
{
|
|
+ m_inspectorController->didReceivePolicyDecision(action, navigation ? navigation->navigationID() : 0);
|
|
if (!hasRunningProcess()) {
|
|
sender->send(PolicyAction::Ignore, 0, DownloadID(), WTF::nullopt);
|
|
return;
|
|
@@ -4199,6 +4229,7 @@ void WebPageProxy::didDestroyNavigation(uint64_t navigationID)
|
|
|
|
// FIXME: Message check the navigationID.
|
|
m_navigationState->didDestroyNavigation(navigationID);
|
|
+ m_inspectorController->didDestroyNavigation(navigationID);
|
|
}
|
|
|
|
void WebPageProxy::didStartProvisionalLoadForFrame(FrameIdentifier frameID, uint64_t navigationID, URL&& url, URL&& unreachableURL, const UserData& userData)
|
|
@@ -4420,6 +4451,8 @@ void WebPageProxy::didFailProvisionalLoadForFrameShared(Ref<WebProcessProxy>&& p
|
|
|
|
m_failingProvisionalLoadURL = { };
|
|
|
|
+ m_inspectorController->didFailProvisionalLoadForFrame(navigationID, error);
|
|
+
|
|
// If the provisional page's load fails then we destroy the provisional page.
|
|
if (m_provisionalPage && m_provisionalPage->mainFrame() == frame && willContinueLoading == WillContinueLoading::No)
|
|
m_provisionalPage = nullptr;
|
|
@@ -5430,6 +5463,8 @@ void WebPageProxy::runJavaScriptAlert(FrameIdentifier frameID, SecurityOriginDat
|
|
if (auto* automationSession = process().processPool().automationSession())
|
|
automationSession->willShowJavaScriptDialog(*this);
|
|
}
|
|
+ if (m_inspectorDialogAgent)
|
|
+ m_inspectorDialogAgent->javascriptDialogOpening("alert"_s, message);
|
|
m_uiClient->runJavaScriptAlert(*this, message, frame, WTFMove(securityOrigin), WTFMove(reply));
|
|
}
|
|
|
|
@@ -5449,6 +5484,8 @@ void WebPageProxy::runJavaScriptConfirm(FrameIdentifier frameID, SecurityOriginD
|
|
if (auto* automationSession = process().processPool().automationSession())
|
|
automationSession->willShowJavaScriptDialog(*this);
|
|
}
|
|
+ if (m_inspectorDialogAgent)
|
|
+ m_inspectorDialogAgent->javascriptDialogOpening("confirm"_s, message);
|
|
|
|
m_uiClient->runJavaScriptConfirm(*this, message, frame, WTFMove(securityOrigin), WTFMove(reply));
|
|
}
|
|
@@ -5468,6 +5505,8 @@ void WebPageProxy::runJavaScriptPrompt(FrameIdentifier frameID, SecurityOriginDa
|
|
if (auto* automationSession = process().processPool().automationSession())
|
|
automationSession->willShowJavaScriptDialog(*this);
|
|
}
|
|
+ if (m_inspectorDialogAgent)
|
|
+ m_inspectorDialogAgent->javascriptDialogOpening("prompt"_s, message, &defaultValue);
|
|
|
|
m_uiClient->runJavaScriptPrompt(*this, message, defaultValue, frame, WTFMove(securityOrigin), WTFMove(reply));
|
|
}
|
|
@@ -5627,6 +5666,8 @@ void WebPageProxy::runBeforeUnloadConfirmPanel(FrameIdentifier frameID, Security
|
|
return;
|
|
}
|
|
}
|
|
+ if (m_inspectorDialogAgent)
|
|
+ m_inspectorDialogAgent->javascriptDialogOpening("beforeunload"_s, message);
|
|
|
|
// Since runBeforeUnloadConfirmPanel() can spin a nested run loop we need to turn off the responsiveness timer and the tryClose timer.
|
|
m_process->responsivenessTimer().stop();
|
|
@@ -6686,6 +6727,7 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
|
|
if (auto* automationSession = process().processPool().automationSession())
|
|
automationSession->mouseEventsFlushedForPage(*this);
|
|
pageClient().didFinishProcessingAllPendingMouseEvents();
|
|
+ m_inspectorController->didProcessAllPendingMouseEvents();
|
|
}
|
|
|
|
break;
|
|
@@ -6712,7 +6754,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();
|
|
|
|
@@ -6732,7 +6773,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);
|
|
@@ -6741,6 +6781,7 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
|
|
if (!canProcessMoreKeyEvents) {
|
|
if (auto* automationSession = process().processPool().automationSession())
|
|
automationSession->keyboardEventsFlushedForPage(*this);
|
|
+ m_inspectorController->didProcessAllPendingKeyboardEvents();
|
|
}
|
|
break;
|
|
}
|
|
@@ -7209,8 +7250,10 @@ static bool shouldReloadAfterProcessTermination(ProcessTerminationReason reason)
|
|
void WebPageProxy::dispatchProcessDidTerminate(ProcessTerminationReason reason)
|
|
{
|
|
RELEASE_LOG_IF_ALLOWED(Loading, "dispatchProcessDidTerminate: reason = %d", reason);
|
|
+ bool handledByClient = m_inspectorController->pageCrashed(reason);
|
|
+ if (handledByClient)
|
|
+ return;
|
|
|
|
- bool handledByClient = false;
|
|
if (m_loaderClient)
|
|
handledByClient = reason != ProcessTerminationReason::RequestedByClient && m_loaderClient->processDidCrash(*this);
|
|
else
|
|
@@ -7668,6 +7711,14 @@ void WebPageProxy::gamepadActivity(const Vector<GamepadData>& gamepadDatas, bool
|
|
|
|
void WebPageProxy::didReceiveAuthenticationChallengeProxy(Ref<AuthenticationChallengeProxy>&& authenticationChallenge)
|
|
{
|
|
+ if (m_credentialsForAutomation.hasValue()) {
|
|
+ if (m_credentialsForAutomation->isEmpty() || authenticationChallenge->core().previousFailureCount()) {
|
|
+ authenticationChallenge->listener().completeChallenge(AuthenticationChallengeDisposition::PerformDefaultHandling);
|
|
+ return;
|
|
+ }
|
|
+ authenticationChallenge->listener().completeChallenge(AuthenticationChallengeDisposition::UseCredential, *m_credentialsForAutomation);
|
|
+ return;
|
|
+ }
|
|
m_navigationClient->didReceiveAuthenticationChallenge(*this, authenticationChallenge.get());
|
|
}
|
|
|
|
@@ -7729,7 +7780,8 @@ void WebPageProxy::requestGeolocationPermissionForFrame(uint64_t geolocationID,
|
|
MESSAGE_CHECK(m_process, frame);
|
|
|
|
// FIXME: Geolocation should probably be using toString() as its string representation instead of databaseIdentifier().
|
|
- auto origin = API::SecurityOrigin::create(SecurityOriginData::fromDatabaseIdentifier(originIdentifier)->securityOrigin());
|
|
+ auto securityOrigin = SecurityOriginData::fromDatabaseIdentifier(originIdentifier)->securityOrigin();
|
|
+ auto origin = API::SecurityOrigin::create(securityOrigin);
|
|
auto request = m_geolocationPermissionRequestManager.createRequest(geolocationID);
|
|
Function<void(bool)> completionHandler = [request = WTFMove(request)](bool allowed) {
|
|
if (allowed)
|
|
@@ -7737,6 +7789,11 @@ void WebPageProxy::requestGeolocationPermissionForFrame(uint64_t geolocationID,
|
|
else
|
|
request->deny();
|
|
};
|
|
+ auto permissions = m_permissionsForAutomation.find(securityOrigin->toString());
|
|
+ if (permissions != m_permissionsForAutomation.end()) {
|
|
+ completionHandler(permissions->value.contains("geolocation"));
|
|
+ return;
|
|
+ }
|
|
|
|
// FIXME: Once iOS migrates to the new WKUIDelegate SPI, clean this up
|
|
// and make it one UIClient call that calls the completionHandler with false
|
|
diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h
|
|
index ac6615a1a96cb0b8dd2cc0811c994ccaa35f573f..a0597f1dafb76bf233505ed5a28b6a59dd1a3a46 100644
|
|
--- a/Source/WebKit/UIProcess/WebPageProxy.h
|
|
+++ b/Source/WebKit/UIProcess/WebPageProxy.h
|
|
@@ -35,6 +35,7 @@
|
|
#include "FocusedElementInformation.h"
|
|
#include "GeolocationPermissionRequestManagerProxy.h"
|
|
#include "HiddenPageThrottlingAutoIncreasesCounter.h"
|
|
+#include "InspectorDialogAgent.h"
|
|
#include "LayerTreeContext.h"
|
|
#include "MessageSender.h"
|
|
#include "NotificationPermissionRequestManagerProxy.h"
|
|
@@ -486,6 +487,8 @@ public:
|
|
void setControlledByAutomation(bool);
|
|
|
|
WebPageInspectorController& inspectorController() { return *m_inspectorController; }
|
|
+ InspectorDialogAgent* inspectorDialogAgent() { return m_inspectorDialogAgent; }
|
|
+ void setInspectorDialogAgent(InspectorDialogAgent * dialogAgent) { m_inspectorDialogAgent = dialogAgent; }
|
|
|
|
#if PLATFORM(IOS_FAMILY)
|
|
void showInspectorIndication();
|
|
@@ -552,6 +555,10 @@ public:
|
|
|
|
void setPageLoadStateObserver(std::unique_ptr<PageLoadState::Observer>&&);
|
|
|
|
+ void setAuthCredentialsForAutomation(Optional<WebCore::Credential>&&);
|
|
+ void setPermissionsForAutomation(const HashMap<String, HashSet<String>>&);
|
|
+ void logToStderr(const String& str);
|
|
+
|
|
void initializeWebPage();
|
|
void setDrawingArea(std::unique_ptr<DrawingAreaProxy>&&);
|
|
|
|
@@ -577,6 +584,7 @@ public:
|
|
void closePage();
|
|
|
|
void addPlatformLoadParameters(LoadParameters&);
|
|
+ RefPtr<API::Navigation> loadRequestForInspector(WebCore::ResourceRequest&&, WebFrameProxy*);
|
|
RefPtr<API::Navigation> loadRequest(WebCore::ResourceRequest&&, WebCore::ShouldOpenExternalURLsPolicy = WebCore::ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes, API::Object* userData = nullptr);
|
|
RefPtr<API::Navigation> loadFile(const String& fileURL, const String& resourceDirectoryURL, API::Object* userData = nullptr);
|
|
RefPtr<API::Navigation> loadData(const IPC::DataReference&, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData = nullptr, WebCore::ShouldOpenExternalURLsPolicy = WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow);
|
|
@@ -2286,6 +2294,7 @@ private:
|
|
bool m_treatsSHA1CertificatesAsInsecure { true };
|
|
|
|
RefPtr<WebInspectorProxy> m_inspector;
|
|
+ InspectorDialogAgent* m_inspectorDialogAgent { nullptr };
|
|
|
|
#if ENABLE(FULLSCREEN_API)
|
|
std::unique_ptr<WebFullScreenManagerProxy> m_fullScreenManager;
|
|
@@ -2698,6 +2707,8 @@ private:
|
|
bool m_isLayerTreeFrozenDueToSwipeAnimation { false };
|
|
|
|
String m_overriddenMediaType;
|
|
+ Optional<WebCore::Credential> m_credentialsForAutomation;
|
|
+ HashMap<String, HashSet<String>> m_permissionsForAutomation;
|
|
|
|
#if PLATFORM(IOS_FAMILY) && ENABLE(DEVICE_ORIENTATION)
|
|
std::unique_ptr<WebDeviceOrientationUpdateProviderProxy> m_webDeviceOrientationUpdateProviderProxy;
|
|
diff --git a/Source/WebKit/UIProcess/WebPageProxy.messages.in b/Source/WebKit/UIProcess/WebPageProxy.messages.in
|
|
index 3a746011ea8da8ee8ccaf7b77f954b007783c342..62918ecc3246b1ab7e70796344421249e110c673 100644
|
|
--- a/Source/WebKit/UIProcess/WebPageProxy.messages.in
|
|
+++ b/Source/WebKit/UIProcess/WebPageProxy.messages.in
|
|
@@ -29,6 +29,7 @@ messages -> WebPageProxy {
|
|
RunJavaScriptConfirm(WebCore::FrameIdentifier frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, String message) -> (bool result) Synchronous
|
|
RunJavaScriptPrompt(WebCore::FrameIdentifier frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, String message, String defaultValue) -> (String result) Synchronous
|
|
MouseDidMoveOverElement(struct WebKit::WebHitTestResultData hitTestResultData, uint32_t modifiers, WebKit::UserData userData)
|
|
+ LogToStderr(String text)
|
|
|
|
#if ENABLE(NETSCAPE_PLUGIN_API)
|
|
UnavailablePluginButtonClicked(uint32_t pluginUnavailabilityReason, String mimeType, String pluginURLString, String pluginspageAttributeURLString, String frameURLString, String pageURLString)
|
|
diff --git a/Source/WebKit/UIProcess/WebProcessPool.h b/Source/WebKit/UIProcess/WebProcessPool.h
|
|
index 64b1dbce4c907536999b1c2a5eb314670f423e1e..e86d634f64fdaa0fd4a9338ffba566bf7209e02d 100644
|
|
--- a/Source/WebKit/UIProcess/WebProcessPool.h
|
|
+++ b/Source/WebKit/UIProcess/WebProcessPool.h
|
|
@@ -416,7 +416,7 @@ public:
|
|
|
|
void windowServerConnectionStateChanged();
|
|
|
|
-#if USE(SOUP)
|
|
+#if USE(SOUP) || PLATFORM(COCOA) || PLATFORM(WIN)
|
|
void setIgnoreTLSErrors(bool);
|
|
bool ignoreTLSErrors() const { return m_ignoreTLSErrors; }
|
|
#endif
|
|
@@ -711,8 +711,8 @@ private:
|
|
HashMap<uint64_t, RefPtr<DictionaryCallback>> m_dictionaryCallbacks;
|
|
HashMap<uint64_t, RefPtr<StatisticsRequest>> m_statisticsRequests;
|
|
|
|
-#if USE(SOUP)
|
|
- bool m_ignoreTLSErrors { true };
|
|
+#if USE(SOUP) || PLATFORM(COCOA) || PLATFORM(WIN)
|
|
+ bool m_ignoreTLSErrors { false };
|
|
#endif
|
|
|
|
bool m_memoryCacheDisabled { false };
|
|
diff --git a/Source/WebKit/UIProcess/geoclue/GeoclueGeolocationProvider.cpp b/Source/WebKit/UIProcess/geoclue/GeoclueGeolocationProvider.cpp
|
|
index dba2a990d15683216a6fa90a48eb30eebd3c526f..6a8afc7c206765670d25152f7b6a1aa7e5563a27 100644
|
|
--- a/Source/WebKit/UIProcess/geoclue/GeoclueGeolocationProvider.cpp
|
|
+++ b/Source/WebKit/UIProcess/geoclue/GeoclueGeolocationProvider.cpp
|
|
@@ -55,10 +55,11 @@ void GeoclueGeolocationProvider::start(UpdateNotifyFunction&& updateNotifyFuncti
|
|
m_destroyManagerLaterTimer.stop();
|
|
m_updateNotifyFunction = WTFMove(updateNotifyFunction);
|
|
m_isRunning = true;
|
|
-
|
|
if (!m_manager) {
|
|
+ g_cancellable_cancel(m_cancellable_start.get());
|
|
+ m_cancellable_start = adoptGRef(g_cancellable_new());
|
|
g_dbus_proxy_new_for_bus(G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, nullptr,
|
|
- "org.freedesktop.GeoClue2", "/org/freedesktop/GeoClue2/Manager", "org.freedesktop.GeoClue2.Manager", nullptr,
|
|
+ "org.freedesktop.GeoClue2", "/org/freedesktop/GeoClue2/Manager", "org.freedesktop.GeoClue2.Manager", m_cancellable_start.get(),
|
|
[](GObject*, GAsyncResult* result, gpointer userData) {
|
|
auto& provider = *static_cast<GeoclueGeolocationProvider*>(userData);
|
|
GUniqueOutPtr<GError> error;
|
|
@@ -84,6 +85,12 @@ void GeoclueGeolocationProvider::stop()
|
|
m_updateNotifyFunction = nullptr;
|
|
g_cancellable_cancel(m_cancellable.get());
|
|
stopClient();
|
|
+ g_cancellable_cancel(m_cancellable_start.get());
|
|
+ m_cancellable_start = nullptr;
|
|
+ g_cancellable_cancel(m_cancellable_setup.get());
|
|
+ m_cancellable_setup = nullptr;
|
|
+ g_cancellable_cancel(m_cancellable_create.get());
|
|
+ m_cancellable_create = nullptr;
|
|
destroyManagerLater();
|
|
}
|
|
|
|
@@ -121,7 +128,9 @@ void GeoclueGeolocationProvider::setupManager(GRefPtr<GDBusProxy>&& proxy)
|
|
return;
|
|
}
|
|
|
|
- g_dbus_proxy_call(m_manager.get(), "CreateClient", nullptr, G_DBUS_CALL_FLAGS_NONE, -1, nullptr,
|
|
+ g_cancellable_cancel(m_cancellable_setup.get());
|
|
+ m_cancellable_setup = adoptGRef(g_cancellable_new());
|
|
+ g_dbus_proxy_call(m_manager.get(), "CreateClient", nullptr, G_DBUS_CALL_FLAGS_NONE, -1, m_cancellable_setup.get(),
|
|
[](GObject* manager, GAsyncResult* result, gpointer userData) {
|
|
auto& provider = *static_cast<GeoclueGeolocationProvider*>(userData);
|
|
GUniqueOutPtr<GError> error;
|
|
@@ -143,8 +152,10 @@ void GeoclueGeolocationProvider::createClient(const char* clientPath)
|
|
return;
|
|
}
|
|
|
|
+ g_cancellable_cancel(m_cancellable_create.get());
|
|
+ m_cancellable_create = adoptGRef(g_cancellable_new());
|
|
g_dbus_proxy_new_for_bus(G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, nullptr,
|
|
- "org.freedesktop.GeoClue2", clientPath, "org.freedesktop.GeoClue2.Client", nullptr,
|
|
+ "org.freedesktop.GeoClue2", clientPath, "org.freedesktop.GeoClue2.Client", m_cancellable_create.get(),
|
|
[](GObject*, GAsyncResult* result, gpointer userData) {
|
|
auto& provider = *static_cast<GeoclueGeolocationProvider*>(userData);
|
|
GUniqueOutPtr<GError> error;
|
|
@@ -190,6 +201,7 @@ void GeoclueGeolocationProvider::startClient()
|
|
|
|
g_signal_connect(m_client.get(), "g-signal", G_CALLBACK(clientLocationUpdatedCallback), this);
|
|
|
|
+ g_cancellable_cancel(m_cancellable.get());
|
|
m_cancellable = adoptGRef(g_cancellable_new());
|
|
g_dbus_proxy_call(m_client.get(), "Start", nullptr, G_DBUS_CALL_FLAGS_NONE, -1, m_cancellable.get(),
|
|
[](GObject* client, GAsyncResult* result, gpointer userData) {
|
|
@@ -282,7 +294,8 @@ void GeoclueGeolocationProvider::locationUpdated(GRefPtr<GDBusProxy>&& proxy)
|
|
|
|
void GeoclueGeolocationProvider::didFail(CString errorMessage)
|
|
{
|
|
- m_updateNotifyFunction({ }, errorMessage);
|
|
+ if (m_updateNotifyFunction)
|
|
+ m_updateNotifyFunction({ }, errorMessage);
|
|
}
|
|
|
|
} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/geoclue/GeoclueGeolocationProvider.h b/Source/WebKit/UIProcess/geoclue/GeoclueGeolocationProvider.h
|
|
index 31d29091985f34a65134a2b0e7cb3ace1dae441d..571ceac8a4b291fa6e91eb8b17065c0aba908ac3 100644
|
|
--- a/Source/WebKit/UIProcess/geoclue/GeoclueGeolocationProvider.h
|
|
+++ b/Source/WebKit/UIProcess/geoclue/GeoclueGeolocationProvider.h
|
|
@@ -71,6 +71,9 @@ private:
|
|
GRefPtr<GDBusProxy> m_manager;
|
|
GRefPtr<GDBusProxy> m_client;
|
|
GRefPtr<GCancellable> m_cancellable;
|
|
+ GRefPtr<GCancellable> m_cancellable_start;
|
|
+ GRefPtr<GCancellable> m_cancellable_setup;
|
|
+ GRefPtr<GCancellable> m_cancellable_create;
|
|
UpdateNotifyFunction m_updateNotifyFunction;
|
|
RunLoop::Timer<GeoclueGeolocationProvider> m_destroyManagerLaterTimer;
|
|
};
|
|
diff --git a/Source/WebKit/UIProcess/glib/InspectorBrowserAgentClientGLib.cpp b/Source/WebKit/UIProcess/glib/InspectorBrowserAgentClientGLib.cpp
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..d3f969edbd888c4f9265c04e07814d0a3e337802
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/glib/InspectorBrowserAgentClientGLib.cpp
|
|
@@ -0,0 +1,132 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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();
|
|
+}
|
|
+
|
|
+InspectorBrowserAgentClientGlib::InspectorBrowserAgentClientGlib(GMainLoop* mainLoop)
|
|
+ : m_mainLoop(mainLoop)
|
|
+{
|
|
+}
|
|
+
|
|
+RefPtr<WebPageProxy> InspectorBrowserAgentClientGlib::createPage(WTF::String& error, const BrowserContext& browserContext)
|
|
+{
|
|
+ auto sessionID = browserContext.dataStore->sessionID();
|
|
+ WebKitWebContext* context;
|
|
+ if (!sessionID || webkitWebContextGetProcessPool(webkit_web_context_get_default()).websiteDataStore()->sessionID() == sessionID)
|
|
+ context = webkit_web_context_get_default();
|
|
+ else
|
|
+ context = m_idToContext.get(sessionID);
|
|
+
|
|
+ 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::closeBrowser()
|
|
+{
|
|
+ closeAllPages(Optional<PAL::SessionID>());
|
|
+ m_idToContext.clear();
|
|
+#if PLATFORM(GTK)
|
|
+ gtk_main_quit();
|
|
+#else
|
|
+ if (m_mainLoop)
|
|
+ g_main_loop_quit(m_mainLoop);
|
|
+#endif
|
|
+}
|
|
+
|
|
+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();
|
|
+}
|
|
+
|
|
+BrowserContext InspectorBrowserAgentClientGlib::createBrowserContext(WTF::String& error)
|
|
+{
|
|
+ BrowserContext browserContext;
|
|
+ GRefPtr<WebKitWebsiteDataManager> data_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", data_manager.get(), "process-swap-on-cross-site-navigation-enabled", true, nullptr)));
|
|
+ if (!context) {
|
|
+ error = "Failed to create GLib ephemeral context";
|
|
+ return browserContext;
|
|
+ }
|
|
+ browserContext.processPool = &webkitWebContextGetProcessPool(context.get());
|
|
+ browserContext.dataStore = &webkitWebsiteDataManagerGetDataStore(data_manager.get());
|
|
+ PAL::SessionID sessionID = sessionIDFromContext(context.get());
|
|
+ m_idToContext.set(sessionID, WTFMove(context));
|
|
+ return browserContext;
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgentClientGlib::deleteBrowserContext(WTF::String& error, PAL::SessionID sessionID)
|
|
+{
|
|
+ m_idToContext.remove(sessionID);
|
|
+}
|
|
+
|
|
+} // 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 0000000000000000000000000000000000000000..9e27fe017ffdef1e8aafce69344fd688c732c3b4
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/glib/InspectorBrowserAgentClientGLib.h
|
|
@@ -0,0 +1,59 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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(GMainLoop* mainLoop);
|
|
+ ~InspectorBrowserAgentClientGlib() override = default;
|
|
+
|
|
+ RefPtr<WebPageProxy> createPage(WTF::String& error, const BrowserContext&) override;
|
|
+ void closeBrowser() override;
|
|
+ BrowserContext createBrowserContext(WTF::String& error) override;
|
|
+ void deleteBrowserContext(WTF::String& error, PAL::SessionID) override;
|
|
+
|
|
+private:
|
|
+ WebKitWebContext* findContext(WTF::String& error, PAL::SessionID);
|
|
+
|
|
+ HashMap<PAL::SessionID, GRefPtr<WebKitWebContext>> m_idToContext;
|
|
+ GMainLoop* m_mainLoop;
|
|
+};
|
|
+
|
|
+} // namespace API
|
|
+
|
|
+#endif // ENABLE(REMOTE_INSPECTOR)
|
|
diff --git a/Source/WebKit/UIProcess/gtk/InspectorTargetProxyGtk.cpp b/Source/WebKit/UIProcess/gtk/InspectorTargetProxyGtk.cpp
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..8a86cc348bc210b71bb463dcb3057f575ad7c1d3
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/gtk/InspectorTargetProxyGtk.cpp
|
|
@@ -0,0 +1,44 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 "InspectorTargetProxy.h"
|
|
+
|
|
+#include "WebPageProxy.h"
|
|
+#include <WebCore/GtkUtilities.h>
|
|
+#include <gtk/gtk.h>
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+void InspectorTargetProxy::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/gtk/WebPageInspectorEmulationAgentGtk.cpp b/Source/WebKit/UIProcess/gtk/WebPageInspectorEmulationAgentGtk.cpp
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..e5e25acebabb76a05a77db02a99f1267bd99a3af
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/gtk/WebPageInspectorEmulationAgentGtk.cpp
|
|
@@ -0,0 +1,69 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 "DrawingAreaProxyCoordinatedGraphics.h"
|
|
+#include "WebPageInspectorEmulationAgent.h"
|
|
+#include "WebPageProxy.h"
|
|
+#include <WebCore/IntSize.h>
|
|
+#include <gtk/gtk.h>
|
|
+
|
|
+namespace WebKit {
|
|
+void WebPageInspectorEmulationAgent::platformSetSize(int width, int height, Function<void (const String& error)>&& callback)
|
|
+{
|
|
+ GtkWidget* viewWidget = m_page.viewWidget();
|
|
+ GtkWidget* window = gtk_widget_get_toplevel(viewWidget);
|
|
+ if (!window) {
|
|
+ callback("Cannot find parent window"_s);
|
|
+ return;
|
|
+ }
|
|
+ if (!GTK_IS_WINDOW(window)) {
|
|
+ callback("Toplevel is not a window"_s);
|
|
+ return;
|
|
+ }
|
|
+ GtkAllocation viewAllocation;
|
|
+ gtk_widget_get_allocation(viewWidget, &viewAllocation);
|
|
+ if (viewAllocation.width == width && viewAllocation.height == height) {
|
|
+ callback(String());
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ GtkAllocation windowAllocation;
|
|
+ gtk_widget_get_allocation(window, &windowAllocation);
|
|
+
|
|
+ width += windowAllocation.width - viewAllocation.width;
|
|
+ height += windowAllocation.height - viewAllocation.height;
|
|
+
|
|
+ if (auto* drawingArea = static_cast<DrawingAreaProxyCoordinatedGraphics*>(m_page.drawingArea())) {
|
|
+ drawingArea->waitForSizeUpdate([callback = WTFMove(callback)]() {
|
|
+ callback(String());
|
|
+ });
|
|
+ } else {
|
|
+ callback("No backing store for window"_s);
|
|
+ }
|
|
+ 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 0000000000000000000000000000000000000000..7ad3fe416c5c747eaad8c6948c3549a3984223ea
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/gtk/WebPageInspectorInputAgentGtk.cpp
|
|
@@ -0,0 +1,107 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 "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, Vector<String>& macCommands, 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/ios/PageClientImplIOS.mm b/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
|
|
index dbfb34900ad983a8f2267a29ccca9adbb89de2d6..bcf76c1f8df1bb307074393a62fa8b2eb72c9b74 100644
|
|
--- a/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
|
|
+++ b/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
|
|
@@ -416,6 +416,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 0000000000000000000000000000000000000000..f9e7e5906301bb7add100bba3f88c0c0aef04fd1
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/mac/InspectorBrowserAgentClientMac.h
|
|
@@ -0,0 +1,51 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 BrowserContext&) override;
|
|
+ void closeBrowser() override;
|
|
+ BrowserContext createBrowserContext(WTF::String& error) override;
|
|
+ void deleteBrowserContext(WTF::String& error, PAL::SessionID) 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 0000000000000000000000000000000000000000..fc40a8a0ee3f88a4f15d5b75f060b00e1126f47b
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/mac/InspectorBrowserAgentClientMac.mm
|
|
@@ -0,0 +1,77 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 "WebsiteDataStore.h"
|
|
+#import "_WKBrowserInspector.h"
|
|
+#import "WKProcessPoolInternal.h"
|
|
+#import "WKWebsiteDataStoreInternal.h"
|
|
+#import "WKWebView.h"
|
|
+#import "WKWebViewInternal.h"
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+InspectorBrowserAgentClientMac::InspectorBrowserAgentClientMac(_WKBrowserInspectorDelegate* delegate)
|
|
+ : delegate_(delegate)
|
|
+{
|
|
+}
|
|
+
|
|
+RefPtr<WebPageProxy> InspectorBrowserAgentClientMac::createPage(WTF::String& error, const BrowserContext& browserContext)
|
|
+{
|
|
+ auto sessionID = browserContext.dataStore->sessionID();
|
|
+ WKWebView *webView = [delegate_ createNewPage:sessionID.toUInt64()];
|
|
+ if (!webView) {
|
|
+ error = "Internal error: can't create page in given context"_s;
|
|
+ return nil;
|
|
+ }
|
|
+ return [webView _page].get();
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgentClientMac::closeBrowser()
|
|
+{
|
|
+ [delegate_ quit];
|
|
+}
|
|
+
|
|
+BrowserContext InspectorBrowserAgentClientMac::createBrowserContext(WTF::String& error)
|
|
+{
|
|
+ _WKBrowserContext* wkBrowserContext = [[delegate_ createBrowserContext] autorelease];
|
|
+ BrowserContext browserContext;
|
|
+ browserContext.processPool = &static_cast<WebProcessPool&>([[wkBrowserContext processPool] _apiObject]);
|
|
+ browserContext.dataStore = &static_cast<WebsiteDataStore&>([[wkBrowserContext dataStore] _apiObject]);
|
|
+ return browserContext;
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgentClientMac::deleteBrowserContext(WTF::String& error, PAL::SessionID sessionID)
|
|
+{
|
|
+ [delegate_ deleteBrowserContext:sessionID.toUInt64()];
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/mac/InspectorTargetProxyMac.mm b/Source/WebKit/UIProcess/mac/InspectorTargetProxyMac.mm
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..721826c8c98fc85b68a4f45deaee69c1219a7254
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/mac/InspectorTargetProxyMac.mm
|
|
@@ -0,0 +1,42 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 "InspectorTargetProxy.h"
|
|
+#import "WebPageProxy.h"
|
|
+
|
|
+#if PLATFORM(MAC)
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+void InspectorTargetProxy::platformActivate(String& error) const
|
|
+{
|
|
+ NSWindow* window = m_page.platformWindow();
|
|
+ [window makeKeyAndOrderFront:nil];
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
+
|
|
+#endif
|
|
diff --git a/Source/WebKit/UIProcess/mac/PageClientImplMac.h b/Source/WebKit/UIProcess/mac/PageClientImplMac.h
|
|
index 8016b56c160acc7b4269600f07f737b3793767bb..651a86c41af3305e215d7baf7f149cc7f401c470 100644
|
|
--- a/Source/WebKit/UIProcess/mac/PageClientImplMac.h
|
|
+++ b/Source/WebKit/UIProcess/mac/PageClientImplMac.h
|
|
@@ -53,6 +53,8 @@ class PageClientImpl final : public PageClientImplCocoa
|
|
#endif
|
|
{
|
|
public:
|
|
+ static void setHeadless(bool headless);
|
|
+
|
|
PageClientImpl(NSView *, WKWebView *);
|
|
virtual ~PageClientImpl();
|
|
|
|
@@ -206,6 +208,10 @@ private:
|
|
void beganExitFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame) override;
|
|
#endif
|
|
|
|
+#if ENABLE(TOUCH_EVENTS)
|
|
+ void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled) override;
|
|
+#endif
|
|
+
|
|
void navigationGestureDidBegin() override;
|
|
void navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem&) override;
|
|
void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&) override;
|
|
diff --git a/Source/WebKit/UIProcess/mac/PageClientImplMac.mm b/Source/WebKit/UIProcess/mac/PageClientImplMac.mm
|
|
index bf7dc132b1ef9e081275cbecb562dd1bfd3a2a0e..63eb41bc3e52c97b933e6bd8288f6824f71ca675 100644
|
|
--- a/Source/WebKit/UIProcess/mac/PageClientImplMac.mm
|
|
+++ b/Source/WebKit/UIProcess/mac/PageClientImplMac.mm
|
|
@@ -78,6 +78,7 @@
|
|
#import <WebCore/TextUndoInsertionMarkupMac.h>
|
|
#import <WebCore/ValidationBubble.h>
|
|
#import <WebCore/WebCoreCALayerExtras.h>
|
|
+#import <WebCore/NotImplemented.h>
|
|
#import <wtf/ProcessPrivilege.h>
|
|
#import <wtf/text/CString.h>
|
|
#import <wtf/text/WTFString.h>
|
|
@@ -105,6 +106,13 @@ static NSString * const kAXLoadCompleteNotification = @"AXLoadComplete";
|
|
namespace WebKit {
|
|
using namespace WebCore;
|
|
|
|
+static bool _headless = false;
|
|
+
|
|
+// static
|
|
+void PageClientImpl::setHeadless(bool headless) {
|
|
+ _headless = true;
|
|
+}
|
|
+
|
|
PageClientImpl::PageClientImpl(NSView* view, WKWebView *webView)
|
|
: PageClientImplCocoa(webView)
|
|
, m_view(view)
|
|
@@ -163,6 +171,9 @@ NSWindow *PageClientImpl::activeWindow() const
|
|
|
|
bool PageClientImpl::isViewWindowActive()
|
|
{
|
|
+ if (_headless)
|
|
+ return true;
|
|
+
|
|
ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
|
|
NSWindow *activeViewWindow = activeWindow();
|
|
return activeViewWindow.isKeyWindow || [NSApp keyWindow] == activeViewWindow;
|
|
@@ -170,6 +181,9 @@ bool PageClientImpl::isViewWindowActive()
|
|
|
|
bool PageClientImpl::isViewFocused()
|
|
{
|
|
+ if (_headless)
|
|
+ return true;
|
|
+
|
|
// FIXME: This is called from the WebPageProxy constructor before we have a WebViewImpl.
|
|
// Once WebViewImpl and PageClient merge, this won't be a problem.
|
|
if (!m_impl)
|
|
@@ -193,6 +207,9 @@ void PageClientImpl::makeFirstResponder()
|
|
|
|
bool PageClientImpl::isViewVisible()
|
|
{
|
|
+ if (_headless)
|
|
+ return true;
|
|
+
|
|
NSView *activeView = this->activeView();
|
|
NSWindow *activeViewWindow = activeWindow();
|
|
|
|
@@ -456,6 +473,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);
|
|
}
|
|
|
|
@@ -760,6 +779,13 @@ void PageClientImpl::beganExitFullScreen(const IntRect& initialFrame, const IntR
|
|
|
|
#endif // ENABLE(FULLSCREEN_API)
|
|
|
|
+#if ENABLE(TOUCH_EVENTS)
|
|
+void PageClientImpl::doneWithTouchEvent(const NativeWebTouchEvent& event, bool wasEventHandled)
|
|
+{
|
|
+ notImplemented();
|
|
+}
|
|
+#endif // ENABLE(TOUCH_EVENTS)
|
|
+
|
|
void PageClientImpl::navigationGestureDidBegin()
|
|
{
|
|
m_impl->dismissContentRelativeChildWindowsWithAnimation(true);
|
|
@@ -931,6 +957,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 0000000000000000000000000000000000000000..6113f4cd60a5d72b8ead61176cb43200803478ed
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/mac/WebPageInspectorEmulationAgentMac.mm
|
|
@@ -0,0 +1,44 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 "WebPageInspectorEmulationAgent.h"
|
|
+
|
|
+#import "WebPageProxy.h"
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+void WebPageInspectorEmulationAgent::platformSetSize(int width, int height, Function<void (const String& error)>&& callback)
|
|
+{
|
|
+ NSWindow* window = m_page.platformWindow();
|
|
+ NSRect windowRect = [window frame];
|
|
+ NSRect viewRect = window.contentLayoutRect;
|
|
+ windowRect.size.width += width - viewRect.size.width;
|
|
+ windowRect.size.height += height - viewRect.size.height;
|
|
+ [window setFrame:windowRect display:YES animate:NO];
|
|
+ callback(String());
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/mac/WebPageInspectorInputAgentMac.mm b/Source/WebKit/UIProcess/mac/WebPageInspectorInputAgentMac.mm
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..30e6ae3bdc8c1695189885afae949071add54c4e
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/mac/WebPageInspectorInputAgentMac.mm
|
|
@@ -0,0 +1,124 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 "NativeWebMouseEvent.h"
|
|
+#import "WebPageInspectorInputAgent.h"
|
|
+#import "WebPageProxy.h"
|
|
+#import <WebCore/IntPoint.h>
|
|
+#import <WebCore/IntSize.h>
|
|
+#import "NativeWebKeyboardEvent.h"
|
|
+#import <wtf/HexNumber.h>
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+using namespace WebCore;
|
|
+
|
|
+void WebPageInspectorInputAgent::platformDispatchMouseEvent(const String& type, int x, int y, const int* optionalModifiers, const String* button, const int* optionalClickCount) {
|
|
+ IntPoint locationInWindow(x, y);
|
|
+
|
|
+ NSEventModifierFlags modifiers = 0;
|
|
+ if (optionalModifiers) {
|
|
+ int inputModifiers = *optionalModifiers;
|
|
+ if (inputModifiers & 1)
|
|
+ modifiers |= NSEventModifierFlagShift;
|
|
+ if (inputModifiers & 2)
|
|
+ modifiers |= NSEventModifierFlagControl;
|
|
+ if (inputModifiers & 4)
|
|
+ modifiers |= NSEventModifierFlagOption;
|
|
+ if (inputModifiers & 8)
|
|
+ modifiers |= NSEventModifierFlagCommand;
|
|
+ }
|
|
+ int clickCount = optionalClickCount ? *optionalClickCount : 0;
|
|
+
|
|
+ NSTimeInterval timestamp = [NSDate timeIntervalSinceReferenceDate];
|
|
+ NSWindow *window = m_page.platformWindow();
|
|
+ NSInteger windowNumber = window.windowNumber;
|
|
+
|
|
+ NSEventType downEventType = (NSEventType)0;
|
|
+ NSEventType dragEventType = (NSEventType)0;
|
|
+ NSEventType upEventType = (NSEventType)0;
|
|
+
|
|
+ if (!button || *button == "none") {
|
|
+ downEventType = NSEventTypeMouseMoved;
|
|
+ dragEventType = NSEventTypeMouseMoved;
|
|
+ upEventType = NSEventTypeMouseMoved;
|
|
+ } else if (*button == "left") {
|
|
+ downEventType = NSEventTypeLeftMouseDown;
|
|
+ dragEventType = NSEventTypeLeftMouseDragged;
|
|
+ upEventType = NSEventTypeLeftMouseUp;
|
|
+ } else if (*button == "middle") {
|
|
+ downEventType = NSEventTypeOtherMouseDown;
|
|
+ dragEventType = NSEventTypeLeftMouseDragged;
|
|
+ upEventType = NSEventTypeOtherMouseUp;
|
|
+ } else if (*button == "right") {
|
|
+ downEventType = NSEventTypeRightMouseDown;
|
|
+ upEventType = NSEventTypeRightMouseUp;
|
|
+ }
|
|
+
|
|
+ NSInteger eventNumber = 0;
|
|
+
|
|
+ NSEvent* event = nil;
|
|
+ if (type == "move") {
|
|
+ event = [NSEvent mouseEventWithType:dragEventType location:locationInWindow modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:eventNumber clickCount:clickCount pressure:0.0f];
|
|
+ } else if (type == "down") {
|
|
+ event = [NSEvent mouseEventWithType:downEventType location:locationInWindow modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:eventNumber clickCount:clickCount pressure:WebCore::ForceAtClick];
|
|
+ } else if (type == "up") {
|
|
+ event = [NSEvent mouseEventWithType:upEventType location:locationInWindow modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:eventNumber clickCount:clickCount pressure:0.0f];
|
|
+ }
|
|
+
|
|
+ if (event) {
|
|
+ NativeWebMouseEvent nativeEvent(event, nil, [window contentView]);
|
|
+ m_page.handleMouseEvent(nativeEvent);
|
|
+ }
|
|
+}
|
|
+
|
|
+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, Vector<String>& commands, WallTime timestamp)
|
|
+{
|
|
+ String keyIdentifier = key.length() == 1 ? makeString("U+", hex(toASCIIUpper(key.characterAt(0)), 4)) : key;
|
|
+ Vector<WebCore::KeypressCommand> macCommands;
|
|
+ for (const String& command : commands)
|
|
+ macCommands.append(WebCore::KeypressCommand(command.utf8().data()));
|
|
+ if (text.length() > 0 && macCommands.size() == 0)
|
|
+ macCommands.append(WebCore::KeypressCommand("insertText:", text));
|
|
+ NativeWebKeyboardEvent event(
|
|
+ type,
|
|
+ text,
|
|
+ unmodifiedText,
|
|
+ key,
|
|
+ code,
|
|
+ keyIdentifier,
|
|
+ windowsVirtualKeyCode,
|
|
+ nativeVirtualKeyCode,
|
|
+ isAutoRepeat,
|
|
+ isKeypad,
|
|
+ isSystemKey,
|
|
+ modifiers,
|
|
+ timestamp,
|
|
+ WTFMove(macCommands));
|
|
+ m_page.handleKeyboardEvent(event);
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/win/InspectorBrowserAgentClientWin.cpp b/Source/WebKit/UIProcess/win/InspectorBrowserAgentClientWin.cpp
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..d33b1bb189d561754e5f44cc1fa87f2760a2f424
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/win/InspectorBrowserAgentClientWin.cpp
|
|
@@ -0,0 +1,83 @@
|
|
+/*
|
|
+ * Copyright (C) 2020 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 "InspectorBrowserAgentClientWin.h"
|
|
+
|
|
+#if ENABLE(REMOTE_INSPECTOR)
|
|
+
|
|
+#include "APIPageConfiguration.h"
|
|
+#include "APIProcessPoolConfiguration.h"
|
|
+#include "InspectorBrowserAgent.h"
|
|
+#include "WebPageProxy.h"
|
|
+#include "WebsiteDataStore.h"
|
|
+#include "WebPreferences.h"
|
|
+#include "WebProcessPool.h"
|
|
+#include "WebView.h"
|
|
+#include "WKAPICast.h"
|
|
+#include <wtf/HashMap.h>
|
|
+#include <wtf/RefPtr.h>
|
|
+#include <wtf/text/StringView.h>
|
|
+#include <wtf/text/WTFString.h>
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+InspectorBrowserAgentClientWin::InspectorBrowserAgentClientWin(CreatePageCallback createPage, QuitCallback quit)
|
|
+ : m_createPage(createPage)
|
|
+ , m_quit(quit)
|
|
+{
|
|
+}
|
|
+
|
|
+RefPtr<WebPageProxy> InspectorBrowserAgentClientWin::createPage(WTF::String& error, const BrowserContext& context)
|
|
+{
|
|
+ auto conf = &API::PageConfiguration::create().leakRef();
|
|
+ auto prefs = &WebPreferences::create(String(), "WebKit2Automation.", "WebKit2Automation.").leakRef();
|
|
+ conf->setProcessPool(context.processPool.get());
|
|
+ conf->setWebsiteDataStore(context.dataStore.get());
|
|
+ return toImpl(m_createPage(toAPI(conf)));
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgentClientWin::closeBrowser()
|
|
+{
|
|
+ m_quit();
|
|
+}
|
|
+
|
|
+BrowserContext InspectorBrowserAgentClientWin::createBrowserContext(WTF::String& error)
|
|
+{
|
|
+ auto config = API::ProcessPoolConfiguration::create();
|
|
+ BrowserContext browserContext;
|
|
+ browserContext.processPool = WebKit::WebProcessPool::create(config);
|
|
+ browserContext.dataStore = WebKit::WebsiteDataStore::createNonPersistent();
|
|
+ PAL::SessionID sessionID = browserContext.dataStore->sessionID();
|
|
+ return browserContext;
|
|
+}
|
|
+
|
|
+void InspectorBrowserAgentClientWin::deleteBrowserContext(WTF::String& error, PAL::SessionID sessionID)
|
|
+{
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
+
|
|
+#endif // ENABLE(REMOTE_INSPECTOR)
|
|
diff --git a/Source/WebKit/UIProcess/win/InspectorBrowserAgentClientWin.h b/Source/WebKit/UIProcess/win/InspectorBrowserAgentClientWin.h
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..2311841478469154473c259a4e0c669daf4644f9
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/win/InspectorBrowserAgentClientWin.h
|
|
@@ -0,0 +1,58 @@
|
|
+/*
|
|
+ * Copyright (C) 2020 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 <WebKit/WKInspector.h>
|
|
+#include <wtf/Forward.h>
|
|
+#include <wtf/text/StringHash.h>
|
|
+
|
|
+typedef WKPageRef (*CreatePageCallback)(WKPageConfigurationRef configuration);
|
|
+typedef void (*QuitCallback)();
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+class InspectorBrowserAgentClientWin : public InspectorBrowserAgentClient {
|
|
+ WTF_MAKE_FAST_ALLOCATED;
|
|
+public:
|
|
+ InspectorBrowserAgentClientWin(CreatePageCallback, QuitCallback);
|
|
+ ~InspectorBrowserAgentClientWin() override = default;
|
|
+
|
|
+ RefPtr<WebPageProxy> createPage(WTF::String& error, const BrowserContext&) override;
|
|
+ void closeBrowser() override;
|
|
+ BrowserContext createBrowserContext(WTF::String& error) override;
|
|
+ void deleteBrowserContext(WTF::String& error, PAL::SessionID) override;
|
|
+
|
|
+private:
|
|
+ CreatePageCallback m_createPage;
|
|
+ QuitCallback m_quit;
|
|
+};
|
|
+
|
|
+} // namespace API
|
|
+
|
|
+#endif // ENABLE(REMOTE_INSPECTOR)
|
|
diff --git a/Source/WebKit/UIProcess/win/InspectorTargetProxyWin.cpp b/Source/WebKit/UIProcess/win/InspectorTargetProxyWin.cpp
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..135a60361fa8fbf907382625e7c8dd4ea64ceb94
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/win/InspectorTargetProxyWin.cpp
|
|
@@ -0,0 +1,36 @@
|
|
+/*
|
|
+ * Copyright (C) 2020 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 "InspectorTargetProxy.h"
|
|
+#include "WebPageProxy.h"
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+void InspectorTargetProxy::platformActivate(String& error) const
|
|
+{
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/win/WebPageInspectorEmulationAgentWin.cpp b/Source/WebKit/UIProcess/win/WebPageInspectorEmulationAgentWin.cpp
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..520d9714bac279a8b778c2c377af4411fba8d5d7
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/win/WebPageInspectorEmulationAgentWin.cpp
|
|
@@ -0,0 +1,58 @@
|
|
+/*
|
|
+ * Copyright (C) 2020 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 "WebPageInspectorEmulationAgent.h"
|
|
+#include "WebPageProxy.h"
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+void WebPageInspectorEmulationAgent::platformSetSize(int width, int height, Function<void (const String& error)>&& callback)
|
|
+{
|
|
+ HWND viewHwnd = m_page.viewWidget();
|
|
+ HWND windowHwnd = GetAncestor(viewHwnd, GA_ROOT);
|
|
+ RECT viewRect;
|
|
+ RECT windowRect;
|
|
+
|
|
+ if (!windowHwnd || !GetWindowRect(windowHwnd, &windowRect)) {
|
|
+ callback("Could not retrieve window size");
|
|
+ return;
|
|
+ }
|
|
+ if (!GetWindowRect(viewHwnd, &viewRect)) {
|
|
+ callback("Could retrieve view size");
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ width += windowRect.right - windowRect.left - viewRect.right + viewRect.left;
|
|
+ height += windowRect.bottom - windowRect.top - viewRect.bottom + viewRect.top;
|
|
+
|
|
+ if (!SetWindowPos(windowHwnd, 0, 0, 0, width, height, SWP_NOMOVE)) {
|
|
+ callback("Could not resize window");
|
|
+ return;
|
|
+ }
|
|
+ callback(String());
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/win/WebPageInspectorInputAgentWin.cpp b/Source/WebKit/UIProcess/win/WebPageInspectorInputAgentWin.cpp
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..a299240b1fea96694cb47fa11fc6a6411ffdaf70
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/win/WebPageInspectorInputAgentWin.cpp
|
|
@@ -0,0 +1,55 @@
|
|
+/*
|
|
+ * Copyright (C) 2020 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 "WebPageInspectorInputAgent.h"
|
|
+
|
|
+#include "NativeWebKeyboardEvent.h"
|
|
+#include "WebPageProxy.h"
|
|
+#include <WebCore/PlatformKeyboardEvent.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, Vector<String>& macCommands, WallTime timestamp)
|
|
+{
|
|
+ NativeWebKeyboardEvent event(
|
|
+ type,
|
|
+ text,
|
|
+ unmodifiedText,
|
|
+ key,
|
|
+ code,
|
|
+ "",
|
|
+ windowsVirtualKeyCode,
|
|
+ nativeVirtualKeyCode,
|
|
+ isAutoRepeat,
|
|
+ isKeypad,
|
|
+ isSystemKey,
|
|
+ modifiers,
|
|
+ timestamp);
|
|
+ m_page.handleKeyboardEvent(event);
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/win/WebProcessPoolWin.cpp b/Source/WebKit/UIProcess/win/WebProcessPoolWin.cpp
|
|
index 18f9e93932793b7c3e44e6346be0f13ed6dbf233..acb0617bcded07029665d4949659c73adf2fd633 100644
|
|
--- a/Source/WebKit/UIProcess/win/WebProcessPoolWin.cpp
|
|
+++ b/Source/WebKit/UIProcess/win/WebProcessPoolWin.cpp
|
|
@@ -26,7 +26,7 @@
|
|
|
|
#include "config.h"
|
|
#include "WebProcessPool.h"
|
|
-
|
|
+#include "NetworkProcessMessages.h"
|
|
#include "WebProcessCreationParameters.h"
|
|
#include <WebCore/NotImplemented.h>
|
|
|
|
@@ -97,4 +97,11 @@ void WebProcessPool::platformResolvePathsForSandboxExtensions()
|
|
{
|
|
}
|
|
|
|
+void WebProcessPool::setIgnoreTLSErrors(bool ignoreTLSErrors)
|
|
+{
|
|
+ m_ignoreTLSErrors = ignoreTLSErrors;
|
|
+ if (networkProcess())
|
|
+ networkProcess()->send(Messages::NetworkProcess::SetIgnoreTLSErrors(m_ignoreTLSErrors), 0);
|
|
+}
|
|
+
|
|
} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/wpe/InspectorTargetProxyWPE.cpp b/Source/WebKit/UIProcess/wpe/InspectorTargetProxyWPE.cpp
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..7453194ca6f032ba86a4c67f5bf12688ab6ec1be
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/wpe/InspectorTargetProxyWPE.cpp
|
|
@@ -0,0 +1,40 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 "InspectorTargetProxy.h"
|
|
+
|
|
+#include "WebPageProxy.h"
|
|
+#include <wpe/wpe.h>
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+void InspectorTargetProxy::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/UIProcess/wpe/WebPageInspectorEmulationAgentWPE.cpp b/Source/WebKit/UIProcess/wpe/WebPageInspectorEmulationAgentWPE.cpp
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..5dc76aa302cb574307059e66a1b73730efe920da
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/wpe/WebPageInspectorEmulationAgentWPE.cpp
|
|
@@ -0,0 +1,41 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 "WebPageInspectorEmulationAgent.h"
|
|
+
|
|
+#include "WebPageProxy.h"
|
|
+#include <wpe/wpe.h>
|
|
+
|
|
+namespace WebKit {
|
|
+
|
|
+void WebPageInspectorEmulationAgent::platformSetSize(int width, int height, Function<void (const String& error)>&& callback)
|
|
+{
|
|
+ struct wpe_view_backend* backend = m_page.viewBackend();
|
|
+ wpe_view_backend_dispatch_set_size(backend, width, height);
|
|
+ callback(String());
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/UIProcess/wpe/WebPageInspectorInputAgentWPE.cpp b/Source/WebKit/UIProcess/wpe/WebPageInspectorInputAgentWPE.cpp
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..585fb151f302e4b376c705ed0d0974d518733605
|
|
--- /dev/null
|
|
+++ b/Source/WebKit/UIProcess/wpe/WebPageInspectorInputAgentWPE.cpp
|
|
@@ -0,0 +1,59 @@
|
|
+/*
|
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
|
+ *
|
|
+ * 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 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 "WebPageInspectorInputAgent.h"
|
|
+
|
|
+#include "NativeWebKeyboardEvent.h"
|
|
+#include "WebPageProxy.h"
|
|
+#include <WebCore/PlatformKeyboardEvent.h>
|
|
+#include <wpe/wpe.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, Vector<String>& macCommands, WallTime timestamp)
|
|
+{
|
|
+ unsigned keyCode = WebCore::PlatformKeyboardEvent::WPEKeyCodeForWindowsKeyCode(windowsVirtualKeyCode);
|
|
+ String keyIdentifier;
|
|
+ if (keyCode)
|
|
+ keyIdentifier = WebCore::PlatformKeyboardEvent::keyIdentifierForWPEKeyCode(keyCode);
|
|
+ NativeWebKeyboardEvent event(
|
|
+ type,
|
|
+ text,
|
|
+ unmodifiedText,
|
|
+ key,
|
|
+ code,
|
|
+ keyIdentifier,
|
|
+ windowsVirtualKeyCode,
|
|
+ nativeVirtualKeyCode,
|
|
+ isAutoRepeat,
|
|
+ isKeypad,
|
|
+ isSystemKey,
|
|
+ modifiers,
|
|
+ timestamp);
|
|
+ m_page.handleKeyboardEvent(event);
|
|
+}
|
|
+
|
|
+} // namespace WebKit
|
|
diff --git a/Source/WebKit/WebKit.xcodeproj/project.pbxproj b/Source/WebKit/WebKit.xcodeproj/project.pbxproj
|
|
index e8787899ef02ff0eb8f45f0e11f2637b3dcf0b7b..3ba252852f9b2fd87aac761c51374937dc0fc15c 100644
|
|
--- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj
|
|
+++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj
|
|
@@ -1728,6 +1728,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 */; };
|
|
+ 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 */; };
|
|
+ D76D6888238DBD81008D314B /* InspectorDialogAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = D76D6887238DBD80008D314B /* InspectorDialogAgent.h */; };
|
|
+ D79902B1236E9404005D6F7E /* WebPageInspectorEmulationAgentMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = D79902AE236E9404005D6F7E /* WebPageInspectorEmulationAgentMac.mm */; };
|
|
+ D79902B2236E9404005D6F7E /* InspectorTargetProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = D79902AF236E9404005D6F7E /* InspectorTargetProxyMac.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 */; };
|
|
@@ -4990,6 +5003,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>"; };
|
|
+ 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>"; };
|
|
+ D76D6887238DBD80008D314B /* InspectorDialogAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorDialogAgent.h; sourceTree = "<group>"; };
|
|
+ D79902AE236E9404005D6F7E /* WebPageInspectorEmulationAgentMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPageInspectorEmulationAgentMac.mm; sourceTree = "<group>"; };
|
|
+ D79902AF236E9404005D6F7E /* InspectorTargetProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InspectorTargetProxyMac.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>"; };
|
|
@@ -6802,6 +6829,7 @@
|
|
37C4C08318149C2A003688B9 /* Cocoa */ = {
|
|
isa = PBXGroup;
|
|
children = (
|
|
+ D71A94492372290B002C4D9E /* _WKBrowserInspector.h */,
|
|
1A43E826188F38E2009E4D30 /* Deprecated */,
|
|
37A5E01218BBF937000A081E /* _WKActivatedElementInfo.h */,
|
|
37A5E01118BBF937000A081E /* _WKActivatedElementInfo.mm */,
|
|
@@ -8363,6 +8391,13 @@
|
|
BC032DC310F438260058C15A /* UIProcess */ = {
|
|
isa = PBXGroup;
|
|
children = (
|
|
+ D76D6887238DBD80008D314B /* InspectorDialogAgent.h */,
|
|
+ D71A944B237239FB002C4D9E /* BrowserInspectorPipe.h */,
|
|
+ D71A943F2371F67E002C4D9E /* WebPageInspectorEmulationAgent.h */,
|
|
+ D71A94402371F67E002C4D9E /* WebPageInspectorInputAgent.h */,
|
|
+ D71A94392370F060002C4D9E /* RemoteInspectorPipe.h */,
|
|
+ D71A94372370F032002C4D9E /* BrowserInspectorController.h */,
|
|
+ D71A94332370E07A002C4D9E /* InspectorBrowserAgentClient.h */,
|
|
BC032DC410F4387C0058C15A /* API */,
|
|
512F588D12A8836F00629530 /* Authentication */,
|
|
9955A6E81C79809000EB6A93 /* Automation */,
|
|
@@ -8653,6 +8688,7 @@
|
|
BC0C376610F807660076D7CB /* C */ = {
|
|
isa = PBXGroup;
|
|
children = (
|
|
+ D71A942C2370DF81002C4D9E /* WKBrowserInspector.h */,
|
|
5123CF18133D25E60056F800 /* cg */,
|
|
6EE849C41368D9040038D481 /* mac */,
|
|
BCB63477116BF10600603215 /* WebKit2_C.h */,
|
|
@@ -9256,6 +9292,11 @@
|
|
BCCF085C113F3B7500C650C5 /* mac */ = {
|
|
isa = PBXGroup;
|
|
children = (
|
|
+ D7EB04E62372A73B00F744CE /* InspectorBrowserAgentClientMac.mm */,
|
|
+ D71A94302370E025002C4D9E /* InspectorBrowserAgentClientMac.h */,
|
|
+ D79902AE236E9404005D6F7E /* WebPageInspectorEmulationAgentMac.mm */,
|
|
+ D79902B0236E9404005D6F7E /* WebPageInspectorInputAgentMac.mm */,
|
|
+ D79902AF236E9404005D6F7E /* InspectorTargetProxyMac.mm */,
|
|
B878B613133428DC006888E9 /* CorrectionPanel.h */,
|
|
B878B614133428DC006888E9 /* CorrectionPanel.mm */,
|
|
C1817362205844A900DFDA65 /* DisplayLink.cpp */,
|
|
@@ -9960,6 +10001,7 @@
|
|
5CAFDE452130846300B1F7E1 /* _WKInspector.h in Headers */,
|
|
991F492F23A812C60054642B /* _WKInspectorDebuggableInfo.h in Headers */,
|
|
99036AE223A949CF0000B06A /* _WKInspectorDebuggableInfoInternal.h in Headers */,
|
|
+ D71A944A2372290B002C4D9E /* _WKBrowserInspector.h in Headers */,
|
|
5CAFDE472130846A00B1F7E1 /* _WKInspectorInternal.h in Headers */,
|
|
9979CA58237F49F10039EC05 /* _WKInspectorPrivate.h in Headers */,
|
|
A5C0F0AB2000658200536536 /* _WKInspectorWindow.h in Headers */,
|
|
@@ -10083,6 +10125,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 */,
|
|
49BCA19223A177660028A836 /* APIResourceLoadStatisticsFirstParty.h in Headers */,
|
|
49BCA19723A1930D0028A836 /* APIResourceLoadStatisticsThirdParty.h in Headers */,
|
|
@@ -10208,6 +10251,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 */,
|
|
@@ -10331,8 +10375,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 */,
|
|
@@ -10414,6 +10460,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 */,
|
|
@@ -10824,6 +10871,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 */,
|
|
@@ -10873,6 +10921,7 @@
|
|
5C795D71229F3757003FF1C4 /* WKContextMenuElementInfoPrivate.h in Headers */,
|
|
51A555F6128C6C47009ABCEC /* WKContextMenuItem.h in Headers */,
|
|
51A55601128C6D92009ABCEC /* WKContextMenuItemTypes.h in Headers */,
|
|
+ D76D6888238DBD81008D314B /* InspectorDialogAgent.h in Headers */,
|
|
A1EA02381DABFF7E0096021F /* WKContextMenuListener.h in Headers */,
|
|
BCC938E11180DE440085E5FE /* WKContextPrivate.h in Headers */,
|
|
9FB5F395169E6A80002C25BF /* WKContextPrivateMac.h in Headers */,
|
|
@@ -11022,6 +11071,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 */,
|
|
@@ -12048,6 +12098,7 @@
|
|
CDA93DB122F8BCF400490A69 /* FullscreenTouchSecheuristicParameters.cpp in Sources */,
|
|
2749F6442146561B008380BF /* InjectedBundleNodeHandle.cpp in Sources */,
|
|
2749F6452146561E008380BF /* InjectedBundleRangeHandle.cpp in Sources */,
|
|
+ D79902B2236E9404005D6F7E /* InspectorTargetProxyMac.mm in Sources */,
|
|
2D913441212CF9F000128AFD /* JSNPMethod.cpp in Sources */,
|
|
2D913442212CF9F000128AFD /* JSNPObject.cpp in Sources */,
|
|
2984F588164BA095004BC0C6 /* LegacyCustomProtocolManagerMessageReceiver.cpp in Sources */,
|
|
@@ -12058,6 +12109,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 */,
|
|
@@ -12082,6 +12134,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 */,
|
|
@@ -12351,6 +12404,7 @@
|
|
2D92A78C212B6AB100F493FD /* WebMouseEvent.cpp in Sources */,
|
|
31BA924D148831260062EDB5 /* WebNotificationManagerMessageReceiver.cpp in Sources */,
|
|
2DF6FE52212E110900469030 /* WebPage.cpp in Sources */,
|
|
+ D79902B3236E9404005D6F7E /* WebPageInspectorInputAgentMac.mm in Sources */,
|
|
C0CE72A01247E71D00BC0EC4 /* WebPageMessageReceiver.cpp in Sources */,
|
|
BCBD3914125BB1A800D2C29F /* WebPageProxyMessageReceiver.cpp in Sources */,
|
|
7CE9CE101FA0767A000177DE /* WebPageUpdatePreferences.cpp in Sources */,
|
|
diff --git a/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp b/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp
|
|
index c47b876533428bcd10c05059f183c7755fddf64d..1dce9b1891e1b211185acc4c6b620845317ed83e 100644
|
|
--- a/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp
|
|
+++ b/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp
|
|
@@ -58,6 +58,7 @@
|
|
#include <WebCore/Frame.h>
|
|
#include <WebCore/FrameLoader.h>
|
|
#include <WebCore/HTMLFrameOwnerElement.h>
|
|
+#include <WebCore/InspectorInstrumentationWebKit.h>
|
|
#include <WebCore/NetscapePlugInStreamLoader.h>
|
|
#include <WebCore/NetworkLoadInformation.h>
|
|
#include <WebCore/PlatformStrategies.h>
|
|
@@ -228,8 +229,22 @@ void WebLoaderStrategy::scheduleLoad(ResourceLoader& resourceLoader, CachedResou
|
|
}
|
|
#endif
|
|
|
|
+ if (m_emulateOfflineState) {
|
|
+ scheduleInternallyFailedLoad(resourceLoader);
|
|
+ return;
|
|
+ }
|
|
+
|
|
if (!tryLoadingUsingURLSchemeHandler(resourceLoader, trackingParameters)) {
|
|
WEBLOADERSTRATEGY_RELEASE_LOG_IF_ALLOWED("scheduleLoad: URL will be scheduled with the NetworkProcess");
|
|
+
|
|
+ RefPtr<ResourceLoader> coreLoader = &resourceLoader;
|
|
+ if (InspectorInstrumentationWebKit::interceptRequest(resourceLoader, [this, coreLoader, trackingParameters, shouldClearReferrerOnHTTPSToHTTPRedirect, resource](bool handled) mutable {
|
|
+ if (!handled)
|
|
+ scheduleLoadFromNetworkProcess(*coreLoader, coreLoader->request(), trackingParameters, shouldClearReferrerOnHTTPSToHTTPRedirect, maximumBufferingTime(resource));
|
|
+ })) {
|
|
+ return;
|
|
+ }
|
|
+
|
|
scheduleLoadFromNetworkProcess(resourceLoader, resourceLoader.request(), trackingParameters, shouldClearReferrerOnHTTPSToHTTPRedirect, maximumBufferingTime(resource));
|
|
return;
|
|
}
|
|
@@ -748,7 +763,7 @@ void WebLoaderStrategy::didFinishPreconnection(uint64_t preconnectionIdentifier,
|
|
|
|
bool WebLoaderStrategy::isOnLine() const
|
|
{
|
|
- return m_isOnLine;
|
|
+ return m_emulateOfflineState ? false : m_isOnLine;
|
|
}
|
|
|
|
void WebLoaderStrategy::addOnlineStateChangeListener(Function<void(bool)>&& listener)
|
|
@@ -759,6 +774,11 @@ void WebLoaderStrategy::addOnlineStateChangeListener(Function<void(bool)>&& list
|
|
|
|
void WebLoaderStrategy::setOnLineState(bool isOnLine)
|
|
{
|
|
+ if (m_emulateOfflineState) {
|
|
+ m_isOnLine = isOnLine;
|
|
+ return;
|
|
+ }
|
|
+
|
|
if (m_isOnLine == isOnLine)
|
|
return;
|
|
|
|
@@ -767,6 +787,12 @@ void WebLoaderStrategy::setOnLineState(bool isOnLine)
|
|
listener(isOnLine);
|
|
}
|
|
|
|
+void WebLoaderStrategy::setEmulateOfflineState(bool offline) {
|
|
+ m_emulateOfflineState = offline;
|
|
+ for (auto& listener : m_onlineStateChangeListeners)
|
|
+ listener(offline ? false : m_isOnLine);
|
|
+}
|
|
+
|
|
void WebLoaderStrategy::setCaptureExtraNetworkLoadMetricsEnabled(bool enabled)
|
|
{
|
|
WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::SetCaptureExtraNetworkLoadMetricsEnabled(enabled), 0);
|
|
diff --git a/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h b/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h
|
|
index 9a78a5fe24da78b34ebefa785a07b5049ba473ba..17f4f626641629cb6c97d36b7361305a1f5d8258 100644
|
|
--- a/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h
|
|
+++ b/Source/WebKit/WebProcess/Network/WebLoaderStrategy.h
|
|
@@ -87,6 +87,7 @@ public:
|
|
bool isOnLine() const final;
|
|
void addOnlineStateChangeListener(Function<void(bool)>&&) final;
|
|
void setOnLineState(bool);
|
|
+ void setEmulateOfflineState(bool) final;
|
|
|
|
private:
|
|
void scheduleLoad(WebCore::ResourceLoader&, WebCore::CachedResource*, bool shouldClearReferrerOnHTTPSToHTTPRedirect);
|
|
@@ -125,6 +126,7 @@ private:
|
|
HashMap<unsigned long, PreconnectCompletionHandler> m_preconnectCompletionHandlers;
|
|
Vector<Function<void(bool)>> m_onlineStateChangeListeners;
|
|
bool m_isOnLine { true };
|
|
+ bool m_emulateOfflineState { false };
|
|
HashSet<WebResourceLoader*> m_loadersWithUploads;
|
|
};
|
|
|
|
diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
|
|
index 8e4c9375d7b8cc10ffa00803d482173be5a3558a..eaf27b62b1e73517bd4561719fc0065891afeb26 100644
|
|
--- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
|
|
+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
|
|
@@ -410,6 +410,8 @@ void WebChromeClient::setResizable(bool resizable)
|
|
|
|
void WebChromeClient::addMessageToConsole(MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, unsigned columnNumber, const String& sourceID)
|
|
{
|
|
+ if (level == MessageLevel::Error)
|
|
+ m_page.send(Messages::WebPageProxy::LogToStderr(message));
|
|
// Notify the bundle client.
|
|
m_page.injectedBundleUIClient().willAddMessageToConsole(&m_page, source, level, message, lineNumber, columnNumber, sourceID);
|
|
}
|
|
diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp
|
|
index fbdf254ec42dc736ca0a00f521de8339f08ffbf2..5bd0472c37cc18d5dd6680e833fab3948acf80ff 100644
|
|
--- a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp
|
|
+++ b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp
|
|
@@ -242,12 +242,20 @@ void DrawingAreaCoordinatedGraphics::updatePreferences(const WebPreferencesStore
|
|
settings.setAcceleratedCompositingEnabled(false);
|
|
}
|
|
#endif
|
|
+
|
|
+#if USE(LIBWPE)
|
|
+ settings.setAcceleratedCompositingEnabled(false);
|
|
+ settings.setForceCompositingMode(false);
|
|
+ settings.setAcceleratedCompositingForFixedPositionEnabled(false);
|
|
+ m_alwaysUseCompositing = false;
|
|
+#else
|
|
settings.setForceCompositingMode(store.getBoolValueForKey(WebPreferencesKey::forceCompositingModeKey()));
|
|
// Fixed position elements need to be composited and create stacking contexts
|
|
// in order to be scrolled by the ScrollingCoordinator.
|
|
settings.setAcceleratedCompositingForFixedPositionEnabled(settings.acceleratedCompositingEnabled());
|
|
|
|
m_alwaysUseCompositing = settings.acceleratedCompositingEnabled() && settings.forceCompositingMode();
|
|
+#endif
|
|
|
|
// If async scrolling is disabled, we have to force-disable async frame and overflow scrolling
|
|
// to keep the non-async scrolling on those elements working.
|
|
diff --git a/Source/WebKit/WebProcess/WebPage/WebDocumentLoader.cpp b/Source/WebKit/WebProcess/WebPage/WebDocumentLoader.cpp
|
|
index b2d54a627b94583bda3518c4e7c3364481b605a4..d407e32b6a7b8b27925c49391e86d42c9b3dfa8b 100644
|
|
--- a/Source/WebKit/WebProcess/WebPage/WebDocumentLoader.cpp
|
|
+++ b/Source/WebKit/WebProcess/WebPage/WebDocumentLoader.cpp
|
|
@@ -47,6 +47,14 @@ void WebDocumentLoader::detachFromFrame()
|
|
DocumentLoader::detachFromFrame();
|
|
}
|
|
|
|
+void WebDocumentLoader::replacedByFragmentNavigation(Frame& frame)
|
|
+{
|
|
+ ASSERT(!this->frame());
|
|
+ // Notify WebPageProxy that the navigation has been converted into same page navigation.
|
|
+ if (m_navigationID)
|
|
+ WebFrame::fromCoreFrame(frame)->documentLoaderDetached(m_navigationID);
|
|
+}
|
|
+
|
|
void WebDocumentLoader::setNavigationID(uint64_t navigationID)
|
|
{
|
|
ASSERT(navigationID);
|
|
diff --git a/Source/WebKit/WebProcess/WebPage/WebDocumentLoader.h b/Source/WebKit/WebProcess/WebPage/WebDocumentLoader.h
|
|
index f127d64d005ab7b93875591b94a5899205e91579..df0de26e4dc449a0fbf93e7037444df4e5365822 100644
|
|
--- a/Source/WebKit/WebProcess/WebPage/WebDocumentLoader.h
|
|
+++ b/Source/WebKit/WebProcess/WebPage/WebDocumentLoader.h
|
|
@@ -43,7 +43,10 @@ public:
|
|
private:
|
|
WebDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
|
|
|
|
+ uint64_t loaderIDForInspector() override { return navigationID(); }
|
|
+
|
|
void detachFromFrame() override;
|
|
+ void replacedByFragmentNavigation(WebCore::Frame&) override;
|
|
|
|
uint64_t m_navigationID;
|
|
};
|
|
diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp
|
|
index 862b13ac7d78e3cba0e7ede53791a8547720d64a..fc1a141e0aed0c5f6ad650cf0883b6ab1386b591 100644
|
|
--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp
|
|
+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp
|
|
@@ -1557,6 +1557,22 @@ void WebPage::platformDidReceiveLoadParameters(const LoadParameters& loadParamet
|
|
}
|
|
#endif
|
|
|
|
+void WebPage::loadRequestInFrameForInspector(LoadParameters&& loadParameters, WebCore::FrameIdentifier frameID)
|
|
+{
|
|
+ WebFrame* frame = WebProcess::singleton().webFrame(frameID);
|
|
+ if (!frame) {
|
|
+ send(Messages::WebPageProxy::DidDestroyNavigation(loadParameters.navigationID));
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ // FIXME: use m_pendingNavigationID instead?
|
|
+ m_pendingFrameNavigationID = loadParameters.navigationID;
|
|
+
|
|
+ FrameLoadRequest frameLoadRequest { *frame->coreFrame(), loadParameters.request, ShouldOpenExternalURLsPolicy::ShouldNotAllow };
|
|
+ frame->coreFrame()->loader().load(WTFMove(frameLoadRequest));
|
|
+ ASSERT(!m_pendingFrameNavigationID);
|
|
+}
|
|
+
|
|
void WebPage::loadRequest(LoadParameters&& loadParameters)
|
|
{
|
|
SendStopResponsivenessTimer stopper;
|
|
@@ -1740,17 +1756,13 @@ void WebPage::setSize(const WebCore::IntSize& viewSize)
|
|
view->resize(viewSize);
|
|
m_drawingArea->setNeedsDisplay();
|
|
|
|
-#if USE(COORDINATED_GRAPHICS)
|
|
if (view->useFixedLayout())
|
|
sendViewportAttributesChanged(m_page->viewportArguments());
|
|
-#endif
|
|
}
|
|
|
|
-#if USE(COORDINATED_GRAPHICS)
|
|
void WebPage::sendViewportAttributesChanged(const ViewportArguments& viewportArguments)
|
|
{
|
|
- FrameView* view = m_page->mainFrame().view();
|
|
- ASSERT(view && view->useFixedLayout());
|
|
+ ASSERT(m_page->mainFrame().view() && m_page->mainFrame().view()->useFixedLayout());
|
|
|
|
// Viewport properties have no impact on zero sized fixed viewports.
|
|
if (m_viewSize.isEmpty())
|
|
@@ -1767,26 +1779,18 @@ void WebPage::sendViewportAttributesChanged(const ViewportArguments& viewportArg
|
|
|
|
ViewportAttributes attr = computeViewportAttributes(viewportArguments, minimumLayoutFallbackWidth, deviceWidth, deviceHeight, 1, m_viewSize);
|
|
|
|
- // If no layout was done yet set contentFixedOrigin to (0,0).
|
|
- IntPoint contentFixedOrigin = view->didFirstLayout() ? view->fixedVisibleContentRect().location() : IntPoint();
|
|
-
|
|
- // Put the width and height to the viewport width and height. In css units however.
|
|
- // Use FloatSize to avoid truncated values during scale.
|
|
- FloatSize contentFixedSize = m_viewSize;
|
|
-
|
|
#if ENABLE(CSS_DEVICE_ADAPTATION)
|
|
+ FrameView* view = m_page->mainFrame().view();
|
|
// CSS viewport descriptors might be applied to already affected viewport size
|
|
// if the page enables/disables stylesheets, so need to keep initial viewport size.
|
|
- view->setInitialViewportSize(roundedIntSize(contentFixedSize));
|
|
+ view->setInitialViewportSize(roundedIntSize(m_viewSize));
|
|
#endif
|
|
|
|
- contentFixedSize.scale(1 / attr.initialScale);
|
|
- view->setFixedVisibleContentRect(IntRect(contentFixedOrigin, roundedIntSize(contentFixedSize)));
|
|
-
|
|
attr.initialScale = m_page->viewportArguments().zoom; // Resets auto (-1) if no value was set by user.
|
|
|
|
// This also takes care of the relayout.
|
|
setFixedLayoutSize(roundedIntSize(attr.layoutSize));
|
|
+ scaleView(deviceWidth / attr.layoutSize.width());
|
|
|
|
#if USE(COORDINATED_GRAPHICS)
|
|
m_drawingArea->didChangeViewportAttributes(WTFMove(attr));
|
|
@@ -1794,7 +1798,6 @@ void WebPage::sendViewportAttributesChanged(const ViewportArguments& viewportArg
|
|
send(Messages::WebPageProxy::DidChangeViewportProperties(attr));
|
|
#endif
|
|
}
|
|
-#endif
|
|
|
|
void WebPage::scrollMainFrameIfNotAtMaxScrollPosition(const IntSize& scrollOffset)
|
|
{
|
|
@@ -2176,17 +2179,13 @@ void WebPage::viewportPropertiesDidChange(const ViewportArguments& viewportArgum
|
|
viewportConfigurationChanged();
|
|
#endif
|
|
|
|
-#if USE(COORDINATED_GRAPHICS)
|
|
FrameView* view = m_page->mainFrame().view();
|
|
if (view && view->useFixedLayout())
|
|
sendViewportAttributesChanged(viewportArguments);
|
|
+#if USE(COORDINATED_GRAPHICS)
|
|
else
|
|
m_drawingArea->didChangeViewportAttributes(ViewportAttributes());
|
|
#endif
|
|
-
|
|
-#if !PLATFORM(IOS_FAMILY) && !USE(COORDINATED_GRAPHICS)
|
|
- UNUSED_PARAM(viewportArguments);
|
|
-#endif
|
|
}
|
|
|
|
void WebPage::listenForLayoutMilestones(OptionSet<WebCore::LayoutMilestone> milestones)
|
|
@@ -6291,6 +6290,9 @@ Ref<DocumentLoader> WebPage::createDocumentLoader(Frame& frame, const ResourceRe
|
|
WebsitePoliciesData::applyToDocumentLoader(WTFMove(*m_pendingWebsitePolicies), documentLoader);
|
|
m_pendingWebsitePolicies = WTF::nullopt;
|
|
}
|
|
+ } else if (m_pendingFrameNavigationID) {
|
|
+ documentLoader->setNavigationID(m_pendingFrameNavigationID);
|
|
+ m_pendingFrameNavigationID = 0;
|
|
}
|
|
|
|
return documentLoader;
|
|
diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h
|
|
index 4a6d4f29717c5566c0fcfdb4253ef971e755fb81..d394dd650fe64a81902eec8b6d48817cc109bf89 100644
|
|
--- a/Source/WebKit/WebProcess/WebPage/WebPage.h
|
|
+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h
|
|
@@ -1370,6 +1370,7 @@ private:
|
|
// Actions
|
|
void tryClose(CompletionHandler<void(bool)>&&);
|
|
void platformDidReceiveLoadParameters(const LoadParameters&);
|
|
+ void loadRequestInFrameForInspector(LoadParameters&&, WebCore::FrameIdentifier);
|
|
void loadRequest(LoadParameters&&);
|
|
NO_RETURN void loadRequestWaitingForProcessLaunch(LoadParameters&&, URL&&, WebPageProxyIdentifier, bool);
|
|
void loadData(LoadParameters&&);
|
|
@@ -1517,9 +1518,7 @@ private:
|
|
void countStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
|
|
void replaceMatches(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly, CallbackID);
|
|
|
|
-#if USE(COORDINATED_GRAPHICS)
|
|
void sendViewportAttributesChanged(const WebCore::ViewportArguments&);
|
|
-#endif
|
|
|
|
void didChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
|
|
void setTextForActivePopupMenu(int32_t index);
|
|
@@ -1979,6 +1978,7 @@ private:
|
|
UserActivity m_userActivity;
|
|
|
|
uint64_t m_pendingNavigationID { 0 };
|
|
+ uint64_t m_pendingFrameNavigationID { 0 };
|
|
Optional<WebsitePoliciesData> m_pendingWebsitePolicies;
|
|
|
|
bool m_mainFrameProgressCompleted { false };
|
|
diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in
|
|
index d6dd3705763d94e2896c54eb8efd17d731b299dc..45546585228f047bb809bf3137b278b4fb1a73ae 100644
|
|
--- a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in
|
|
+++ b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in
|
|
@@ -167,6 +167,7 @@ GenerateSyntheticEditingCommand(enum:uint8_t WebKit::SyntheticEditingCommandType
|
|
LoadURLInFrame(URL url, String referrer, WebCore::FrameIdentifier frameID)
|
|
LoadDataInFrame(IPC::DataReference data, String MIMEType, String encodingName, URL baseURL, WebCore::FrameIdentifier frameID)
|
|
LoadRequest(struct WebKit::LoadParameters loadParameters)
|
|
+ LoadRequestInFrameForInspector(struct WebKit::LoadParameters loadParameters, WebCore::FrameIdentifier frameID)
|
|
LoadRequestWaitingForProcessLaunch(struct WebKit::LoadParameters loadParameters, URL resourceDirectoryURL, WebKit::WebPageProxyIdentifier pageID, bool checkAssumedReadAccessToResourceURL)
|
|
LoadData(struct WebKit::LoadParameters loadParameters)
|
|
LoadAlternateHTML(struct WebKit::LoadParameters loadParameters)
|
|
diff --git a/Source/WebKit/WebProcess/WebPage/WebPageInspectorTarget.cpp b/Source/WebKit/WebProcess/WebPage/WebPageInspectorTarget.cpp
|
|
index a70f6fd52096a5dca901ea70a3755f14d6b4a0fd..f02e5c774a49d3e67860adb3b011531313eaf8d1 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 6cbd7fad5ff91afd858da346adbfeed6424b0b2b..176c46f186bc925fd28492d14d8d9e11bd8def26 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 65c9bc4ca76ac950dd9682e1224dcb8f6e0e48fe..1c0061063af2df56ad154206372a92a2333c3646 100644
|
|
--- a/Source/WebKit/WebProcess/WebProcess.cpp
|
|
+++ b/Source/WebKit/WebProcess/WebProcess.cpp
|
|
@@ -77,6 +77,7 @@
|
|
#include "WebsiteData.h"
|
|
#include "WebsiteDataStoreParameters.h"
|
|
#include "WebsiteDataType.h"
|
|
+#include <JavaScriptCore/IdentifiersFactory.h>
|
|
#include <JavaScriptCore/JSLock.h>
|
|
#include <JavaScriptCore/MemoryStatistics.h>
|
|
#include <JavaScriptCore/WasmFaultSignalHandler.h>
|
|
@@ -253,6 +254,8 @@ void WebProcess::initializeProcess(const AuxiliaryProcessInitializationParameter
|
|
|
|
platformInitializeProcess(parameters);
|
|
updateCPULimit();
|
|
+
|
|
+ Inspector::IdentifiersFactory::initializeWithProcessID(parameters.processIdentifier->toUInt64());
|
|
}
|
|
|
|
void WebProcess::initializeConnection(IPC::Connection* connection)
|
|
diff --git a/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm b/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm
|
|
index b2a1d085938ef3e7d2259fef166ddbcf53897f8d..9a362468b347e053a079f6f5531753d2ebae169c 100644
|
|
--- a/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm
|
|
+++ b/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm
|
|
@@ -4244,7 +4244,7 @@ static BOOL currentScrollIsBlit(NSView *clipView)
|
|
_private->handlingMouseDownEvent = NO;
|
|
}
|
|
|
|
-#if ENABLE(TOUCH_EVENTS)
|
|
+#if ENABLE(IOS_TOUCH_EVENTS)
|
|
|
|
- (void)touch:(WebEvent *)event
|
|
{
|
|
diff --git a/Source/WebKitLegacy/mac/WebView/WebView.mm b/Source/WebKitLegacy/mac/WebView/WebView.mm
|
|
index 5c296b61cc16a71b60632db6083d48b702a9fcd3..ae989cf2f188466ce09ba2ef1872dfd2aef52948 100644
|
|
--- a/Source/WebKitLegacy/mac/WebView/WebView.mm
|
|
+++ b/Source/WebKitLegacy/mac/WebView/WebView.mm
|
|
@@ -4343,7 +4343,7 @@ IGNORE_WARNINGS_END
|
|
}
|
|
#endif // PLATFORM(IOS_FAMILY)
|
|
|
|
-#if ENABLE(TOUCH_EVENTS)
|
|
+#if ENABLE(IOS_TOUCH_EVENTS)
|
|
- (NSArray *)_touchEventRegions
|
|
{
|
|
auto* frame = [self _mainCoreFrame];
|
|
@@ -4389,7 +4389,7 @@ IGNORE_WARNINGS_END
|
|
|
|
return eventRegionArray;
|
|
}
|
|
-#endif // ENABLE(TOUCH_EVENTS)
|
|
+#endif // ENABLE(IOS_TOUCH_EVENTS)
|
|
|
|
// For backwards compatibility with the WebBackForwardList API, we honor both
|
|
// a per-WebView and a per-preferences setting for whether to use the back/forward cache.
|
|
diff --git a/Source/cmake/OptionsGTK.cmake b/Source/cmake/OptionsGTK.cmake
|
|
index 904e379acd88151193fc285b5a1e4c56cd4d2a4d..465f1898a4a846cd9b6eea327ca9d6b71b51ea80 100644
|
|
--- a/Source/cmake/OptionsGTK.cmake
|
|
+++ b/Source/cmake/OptionsGTK.cmake
|
|
@@ -3,6 +3,7 @@ include(VersioningUtils)
|
|
|
|
SET_PROJECT_VERSION(2 27 4)
|
|
set(WEBKITGTK_API_VERSION 4.0)
|
|
+set(ENABLE_WEBKIT_LEGACY OFF)
|
|
|
|
CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE(WEBKIT 80 0 43)
|
|
CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE(JAVASCRIPTCORE 34 0 16)
|
|
diff --git a/Source/cmake/OptionsWPE.cmake b/Source/cmake/OptionsWPE.cmake
|
|
index 149a592c891e8b375f441c17fb421099e3c477dc..10173cd7d06e5014c978aec90027d71b3c0b98d7 100644
|
|
--- a/Source/cmake/OptionsWPE.cmake
|
|
+++ b/Source/cmake/OptionsWPE.cmake
|
|
@@ -3,6 +3,7 @@ include(VersioningUtils)
|
|
|
|
SET_PROJECT_VERSION(2 27 4)
|
|
set(WPE_API_VERSION 1.0)
|
|
+set(ENABLE_WEBKIT_LEGACY OFF)
|
|
|
|
CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE(WEBKIT 12 0 9)
|
|
|
|
@@ -50,6 +51,7 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_XSLT PUBLIC ON)
|
|
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ASYNC_SCROLLING PRIVATE ON)
|
|
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_AUTOCAPITALIZE PRIVATE ON)
|
|
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CONTENT_EXTENSIONS PRIVATE ON)
|
|
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DARK_MODE_CSS PRIVATE ON)
|
|
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_STREAM PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
|
|
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MHTML PRIVATE ON)
|
|
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NETSCAPE_PLUGIN_API PRIVATE OFF)
|
|
diff --git a/Source/cmake/OptionsWin.cmake b/Source/cmake/OptionsWin.cmake
|
|
index 935a7fd136754694c5301100ad4699ccb2210e67..2a04380900326ec5ef03ff5b78c67643132aac93 100644
|
|
--- a/Source/cmake/OptionsWin.cmake
|
|
+++ b/Source/cmake/OptionsWin.cmake
|
|
@@ -7,8 +7,9 @@ add_definitions(-D_WINDOWS -DWINVER=0x601 -D_WIN32_WINNT=0x601)
|
|
add_definitions(-DNOMINMAX)
|
|
add_definitions(-DUNICODE -D_UNICODE)
|
|
|
|
+set(ENABLE_WEBKIT_LEGACY OFF)
|
|
+
|
|
if ((NOT DEFINED ENABLE_WEBKIT_LEGACY) OR ENABLE_WEBKIT_LEGACY)
|
|
- set(ENABLE_WEBKIT_LEGACY ON)
|
|
set(ENABLE_WEBKIT OFF)
|
|
endif ()
|
|
|
|
@@ -78,6 +79,8 @@ if (${WTF_PLATFORM_WIN_CAIRO})
|
|
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_PUBLIC_SUFFIX_LIST PRIVATE ON)
|
|
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_USER_MESSAGE_HANDLERS PRIVATE ON)
|
|
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL PUBLIC ON)
|
|
+ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DARK_MODE_CSS PRIVATE ON)
|
|
+ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TOUCH_EVENTS PRIVATE ON)
|
|
|
|
# Experimental features
|
|
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_APPLICATION_MANIFEST PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
|
|
diff --git a/Tools/MiniBrowser/gtk/BrowserWindow.h b/Tools/MiniBrowser/gtk/BrowserWindow.h
|
|
index 1570d65effb5d601ee3c44a2a7461436f4691c2c..456f96cf589320efa70a76f76e230b6795886b5a 100644
|
|
--- a/Tools/MiniBrowser/gtk/BrowserWindow.h
|
|
+++ b/Tools/MiniBrowser/gtk/BrowserWindow.h
|
|
@@ -37,7 +37,7 @@ G_BEGIN_DECLS
|
|
#define BROWSER_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), BROWSER_TYPE_WINDOW))
|
|
#define BROWSER_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), BROWSER_TYPE_WINDOW))
|
|
#define BROWSER_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), BROWSER_TYPE_WINDOW, BrowserWindowClass))
|
|
-#define BROWSER_DEFAULT_URL "http://www.webkitgtk.org/"
|
|
+#define BROWSER_DEFAULT_URL "about:blank"
|
|
#define BROWSER_ABOUT_SCHEME "minibrowser-about"
|
|
|
|
typedef struct _BrowserWindow BrowserWindow;
|
|
diff --git a/Tools/MiniBrowser/gtk/main.c b/Tools/MiniBrowser/gtk/main.c
|
|
index 4c5147dcd38a53e2feaeaae0fce38f92dc60eba6..17854dbfb1a3223e091ab90c0ca1bfc1e1f13d44 100644
|
|
--- a/Tools/MiniBrowser/gtk/main.c
|
|
+++ b/Tools/MiniBrowser/gtk/main.c
|
|
@@ -53,6 +53,9 @@ static const char *cookiesFile;
|
|
static const char *cookiesPolicy;
|
|
static const char *proxy;
|
|
static gboolean darkMode;
|
|
+static gboolean inspectorPipe;
|
|
+static gboolean headless;
|
|
+static const char *userDataDir;
|
|
static gboolean printVersion;
|
|
|
|
typedef enum {
|
|
@@ -121,6 +124,9 @@ 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 },
|
|
+ { "user-data-dir", 0, 0, G_OPTION_ARG_STRING, &userDataDir, "Default profile persistence folder location", NULL },
|
|
+ { "headless", 0, 0, G_OPTION_ARG_NONE, &headless, "Noop headless operation", NULL },
|
|
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &uriArguments, 0, "[URL…]" },
|
|
{ 0, 0, 0, 0, 0, 0, 0 }
|
|
};
|
|
@@ -498,6 +504,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(NULL);
|
|
+}
|
|
+
|
|
int main(int argc, char *argv[])
|
|
{
|
|
#if ENABLE_DEVELOPER_MODE
|
|
@@ -541,10 +570,22 @@ int main(int argc, char *argv[])
|
|
return 0;
|
|
}
|
|
|
|
- WebKitWebsiteDataManager *manager = (privateMode || automationMode) ? webkit_website_data_manager_new_ephemeral() : webkit_website_data_manager_new(NULL);
|
|
+ WebKitWebsiteDataManager *manager;
|
|
+ if (inspectorPipe) {
|
|
+ manager = webkit_web_context_get_website_data_manager(webkit_web_context_get_default());
|
|
+ g_object_ref(manager);
|
|
+ } else if (privateMode || automationMode) {
|
|
+ manager = webkit_website_data_manager_new_ephemeral();
|
|
+ } else {
|
|
+ manager = webkit_website_data_manager_new(NULL);
|
|
+ }
|
|
+
|
|
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/win/Common.cpp b/Tools/MiniBrowser/win/Common.cpp
|
|
index 87fde928c12a91f13a4f8bc2f2dc24097e42f2d0..145a4ac7546bbfbc46ee09ae801f14c96bde5725 100644
|
|
--- a/Tools/MiniBrowser/win/Common.cpp
|
|
+++ b/Tools/MiniBrowser/win/Common.cpp
|
|
@@ -278,6 +278,10 @@ CommandLineOptions parseCommandLine()
|
|
#if ENABLE(WEBKIT)
|
|
else if (!wcsicmp(argv[i], L"--wk2") || !wcsicmp(argv[i], L"--webkit"))
|
|
options.windowType = BrowserWindowType::WebKit;
|
|
+ else if (!wcsicmp(argv[i], L"--inspector-pipe"))
|
|
+ options.inspectorPipe = true;
|
|
+ else if (!wcsicmp(argv[i], L"--headless"))
|
|
+ options.headless = true;
|
|
#endif
|
|
else if (!options.requestedURL)
|
|
options.requestedURL = argv[i];
|
|
diff --git a/Tools/MiniBrowser/win/Common.h b/Tools/MiniBrowser/win/Common.h
|
|
index d996feb64e02d7399f2ed0b34d3d0dd03133f824..474caddaafa1fd464acd9117e3260fe3889224eb 100644
|
|
--- a/Tools/MiniBrowser/win/Common.h
|
|
+++ b/Tools/MiniBrowser/win/Common.h
|
|
@@ -36,6 +36,8 @@ enum class BrowserWindowType {
|
|
struct CommandLineOptions {
|
|
bool usesLayeredWebView { };
|
|
bool useFullDesktop { };
|
|
+ bool inspectorPipe { };
|
|
+ bool headless { };
|
|
BrowserWindowType windowType;
|
|
_bstr_t requestedURL;
|
|
|
|
diff --git a/Tools/MiniBrowser/win/WebKitBrowserWindow.cpp b/Tools/MiniBrowser/win/WebKitBrowserWindow.cpp
|
|
index 71c43e6691395b787140ca0603550aac1c8513d5..fbcf0036e3778fb7c2eb6edd8ada08bd49d8b643 100644
|
|
--- a/Tools/MiniBrowser/win/WebKitBrowserWindow.cpp
|
|
+++ b/Tools/MiniBrowser/win/WebKitBrowserWindow.cpp
|
|
@@ -39,6 +39,8 @@
|
|
#include <WebKit/WKWebsiteDataStoreRefCurl.h>
|
|
#include <vector>
|
|
|
|
+static bool s_headless = false;
|
|
+
|
|
std::wstring createString(WKStringRef wkString)
|
|
{
|
|
size_t maxSize = WKStringGetLength(wkString);
|
|
@@ -143,11 +145,17 @@ WebKitBrowserWindow::WebKitBrowserWindow(BrowserWindowClient& client, WKPageConf
|
|
navigationClient.didReceiveAuthenticationChallenge = didReceiveAuthenticationChallenge;
|
|
WKPageSetPageNavigationClient(page, &navigationClient.base);
|
|
|
|
- WKPageUIClientV13 uiClient = { };
|
|
- uiClient.base.version = 13;
|
|
+ WKPageUIClientV14 uiClient = { };
|
|
+ uiClient.base.version = 14;
|
|
uiClient.base.clientInfo = this;
|
|
uiClient.createNewPage = createNewPage;
|
|
uiClient.didNotHandleKeyEvent = didNotHandleKeyEvent;
|
|
+ uiClient.close = closeWindow;
|
|
+ uiClient.runJavaScriptAlert = runJavaScriptAlert;
|
|
+ uiClient.runJavaScriptConfirm = runJavaScriptConfirm;
|
|
+ uiClient.runJavaScriptPrompt = runJavaScriptPrompt;
|
|
+ uiClient.runBeforeUnloadConfirmPanel = runBeforeUnloadConfirmPanel;
|
|
+ uiClient.handleJavaScriptDialog = handleJavaScriptDialog;
|
|
WKPageSetPageUIClient(page, &uiClient.base);
|
|
|
|
WKPageStateClientV0 stateClient = { };
|
|
@@ -163,6 +171,29 @@ WebKitBrowserWindow::WebKitBrowserWindow(BrowserWindowClient& client, WKPageConf
|
|
resetZoom();
|
|
}
|
|
|
|
+WebKitBrowserWindow::~WebKitBrowserWindow()
|
|
+{
|
|
+ if (m_alertDialog) {
|
|
+ WKRelease(m_alertDialog);
|
|
+ m_alertDialog = NULL;
|
|
+ }
|
|
+
|
|
+ if (m_confirmDialog) {
|
|
+ WKRelease(m_confirmDialog);
|
|
+ m_confirmDialog = NULL;
|
|
+ }
|
|
+
|
|
+ if (m_promptDialog) {
|
|
+ WKRelease(m_promptDialog);
|
|
+ m_promptDialog = NULL;
|
|
+ }
|
|
+
|
|
+ if (m_beforeUnloadDialog) {
|
|
+ WKRelease(m_beforeUnloadDialog);
|
|
+ m_beforeUnloadDialog = NULL;
|
|
+ }
|
|
+}
|
|
+
|
|
void WebKitBrowserWindow::updateProxySettings()
|
|
{
|
|
auto context = WKPageGetContext(WKViewGetPage(m_view.get()));
|
|
@@ -381,21 +412,97 @@ bool WebKitBrowserWindow::canTrustServerCertificate(WKProtectionSpaceRef protect
|
|
return false;
|
|
}
|
|
|
|
-WKPageRef WebKitBrowserWindow::createNewPage(WKPageRef page, WKPageConfigurationRef configuration, WKNavigationActionRef navigationAction, WKWindowFeaturesRef windowFeatures, const void *clientInfo)
|
|
+// static
|
|
+void WebKitBrowserWindow::setHeadless(bool headless)
|
|
+{
|
|
+ s_headless = headless;
|
|
+}
|
|
+
|
|
+void WebKitBrowserWindow::closeWindow(WKPageRef page, const void* clientInfo)
|
|
+{
|
|
+ auto& thisWindow = toWebKitBrowserWindow(clientInfo);
|
|
+ PostMessage(thisWindow.m_hMainWnd, WM_CLOSE, 0, 0);
|
|
+}
|
|
+
|
|
+void WebKitBrowserWindow::runJavaScriptAlert(WKPageRef page, WKStringRef alertText, WKFrameRef frame, WKSecurityOriginRef securityOrigin, WKPageRunJavaScriptAlertResultListenerRef listener, const void *clientInfo)
|
|
+{
|
|
+ auto& thisWindow = toWebKitBrowserWindow(clientInfo);
|
|
+ WKRetain(listener);
|
|
+ thisWindow.m_alertDialog = listener;
|
|
+}
|
|
+
|
|
+void WebKitBrowserWindow::runJavaScriptConfirm(WKPageRef page, WKStringRef message, WKFrameRef frame, WKSecurityOriginRef securityOrigin, WKPageRunJavaScriptConfirmResultListenerRef listener, const void *clientInfo)
|
|
+{
|
|
+ auto& thisWindow = toWebKitBrowserWindow(clientInfo);
|
|
+ WKRetain(listener);
|
|
+ thisWindow.m_confirmDialog = listener;
|
|
+}
|
|
+
|
|
+void WebKitBrowserWindow::runJavaScriptPrompt(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, WKSecurityOriginRef securityOrigin, WKPageRunJavaScriptPromptResultListenerRef listener, const void *clientInfo)
|
|
+{
|
|
+ auto& thisWindow = toWebKitBrowserWindow(clientInfo);
|
|
+ WKRetain(listener);
|
|
+ thisWindow.m_promptDialog = listener;
|
|
+}
|
|
+
|
|
+void WebKitBrowserWindow::runBeforeUnloadConfirmPanel(WKPageRef page, WKStringRef message, WKFrameRef frame, WKPageRunBeforeUnloadConfirmPanelResultListenerRef listener, const void *clientInfo)
|
|
+{
|
|
+ auto& thisWindow = toWebKitBrowserWindow(clientInfo);
|
|
+ WKRetain(listener);
|
|
+ thisWindow.m_beforeUnloadDialog = listener;
|
|
+}
|
|
+
|
|
+void WebKitBrowserWindow::handleJavaScriptDialog(WKPageRef page, bool accept, WKStringRef value, const void *clientInfo)
|
|
+{
|
|
+ auto& thisWindow = toWebKitBrowserWindow(clientInfo);
|
|
+ if (thisWindow.m_alertDialog) {
|
|
+ WKPageRunJavaScriptAlertResultListenerCall(thisWindow.m_alertDialog);
|
|
+ WKRelease(thisWindow.m_alertDialog);
|
|
+ thisWindow.m_alertDialog = NULL;
|
|
+ }
|
|
+
|
|
+ if (thisWindow.m_confirmDialog) {
|
|
+ WKPageRunJavaScriptConfirmResultListenerCall(thisWindow.m_confirmDialog, accept);
|
|
+ WKRelease(thisWindow.m_confirmDialog);
|
|
+ thisWindow.m_confirmDialog = NULL;
|
|
+ }
|
|
+
|
|
+ if (thisWindow.m_promptDialog) {
|
|
+ WKPageRunJavaScriptPromptResultListenerCall(thisWindow.m_promptDialog, accept ? value : NULL);
|
|
+ WKRelease(thisWindow.m_promptDialog);
|
|
+ thisWindow.m_promptDialog = NULL;
|
|
+ }
|
|
+
|
|
+ if (thisWindow.m_beforeUnloadDialog) {
|
|
+ WKPageRunBeforeUnloadConfirmPanelResultListenerCall(thisWindow.m_beforeUnloadDialog, accept);
|
|
+ WKRelease(thisWindow.m_beforeUnloadDialog);
|
|
+ thisWindow.m_beforeUnloadDialog = NULL;
|
|
+ }
|
|
+}
|
|
+
|
|
+WKPageRef WebKitBrowserWindow::createPageCallback(WKPageConfigurationRef configuration)
|
|
{
|
|
auto& newWindow = MainWindow::create().leakRef();
|
|
auto factory = [configuration](BrowserWindowClient& client, HWND mainWnd, bool) -> auto {
|
|
return adoptRef(*new WebKitBrowserWindow(client, configuration, mainWnd));
|
|
};
|
|
bool ok = newWindow.init(factory, hInst);
|
|
- if (!ok)
|
|
- return nullptr;
|
|
- ShowWindow(newWindow.hwnd(), SW_SHOW);
|
|
+ if (s_headless)
|
|
+ SetMenu(newWindow.hwnd(), NULL);
|
|
+ else
|
|
+ ShowWindow(newWindow.hwnd(), SW_SHOW);
|
|
+ newWindow.browserWindow()->loadURL(_bstr_t("about:blank").GetBSTR());
|
|
+
|
|
auto& newBrowserWindow = *static_cast<WebKitBrowserWindow*>(newWindow.browserWindow());
|
|
WKRetainPtr<WKPageRef> newPage = WKViewGetPage(newBrowserWindow.m_view.get());
|
|
return newPage.leakRef();
|
|
}
|
|
|
|
+WKPageRef WebKitBrowserWindow::createNewPage(WKPageRef, WKPageConfigurationRef configuration, WKNavigationActionRef, WKWindowFeaturesRef, const void*)
|
|
+{
|
|
+ return createPageCallback(configuration);
|
|
+}
|
|
+
|
|
void WebKitBrowserWindow::didNotHandleKeyEvent(WKPageRef, WKNativeEventPtr event, const void* clientInfo)
|
|
{
|
|
auto& thisWindow = toWebKitBrowserWindow(clientInfo);
|
|
diff --git a/Tools/MiniBrowser/win/WebKitBrowserWindow.h b/Tools/MiniBrowser/win/WebKitBrowserWindow.h
|
|
index e8efe3c2838a9bb553a1c59ff6c1fb25d2f96500..adebbe537e72d3e3708c9fb66a408a1e400e9ff5 100644
|
|
--- a/Tools/MiniBrowser/win/WebKitBrowserWindow.h
|
|
+++ b/Tools/MiniBrowser/win/WebKitBrowserWindow.h
|
|
@@ -34,9 +34,12 @@
|
|
class WebKitBrowserWindow : public BrowserWindow {
|
|
public:
|
|
static Ref<BrowserWindow> create(BrowserWindowClient&, HWND mainWnd, bool useLayeredWebView = false);
|
|
+ static void setHeadless(bool headless);
|
|
+ static WKPageRef createPageCallback(WKPageConfigurationRef configuration);
|
|
|
|
private:
|
|
WebKitBrowserWindow(BrowserWindowClient&, WKPageConfigurationRef, HWND mainWnd);
|
|
+ ~WebKitBrowserWindow() override;
|
|
|
|
HRESULT init() override;
|
|
HWND hwnd() override;
|
|
@@ -71,6 +74,12 @@ private:
|
|
static void didChangeActiveURL(const void*);
|
|
static void didReceiveAuthenticationChallenge(WKPageRef, WKAuthenticationChallengeRef, const void*);
|
|
static WKPageRef createNewPage(WKPageRef, WKPageConfigurationRef, WKNavigationActionRef, WKWindowFeaturesRef, const void *);
|
|
+ static void closeWindow(WKPageRef, const void*);
|
|
+ static void runJavaScriptAlert(WKPageRef page, WKStringRef alertText, WKFrameRef frame, WKSecurityOriginRef securityOrigin, WKPageRunJavaScriptAlertResultListenerRef listener, const void *clientInfo);
|
|
+ static void runJavaScriptConfirm(WKPageRef page, WKStringRef message, WKFrameRef frame, WKSecurityOriginRef securityOrigin, WKPageRunJavaScriptConfirmResultListenerRef listener, const void *clientInfo);
|
|
+ static void runJavaScriptPrompt(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, WKSecurityOriginRef securityOrigin, WKPageRunJavaScriptPromptResultListenerRef listener, const void *clientInfo);
|
|
+ static void runBeforeUnloadConfirmPanel(WKPageRef page, WKStringRef message, WKFrameRef frame, WKPageRunBeforeUnloadConfirmPanelResultListenerRef listener, const void *clientInfo);
|
|
+ static void handleJavaScriptDialog(WKPageRef page, bool accept, WKStringRef value, const void *clientInfo);
|
|
static void didNotHandleKeyEvent(WKPageRef, WKNativeEventPtr, const void*);
|
|
|
|
BrowserWindowClient& m_client;
|
|
@@ -78,4 +87,8 @@ private:
|
|
HWND m_hMainWnd { nullptr };
|
|
ProxySettings m_proxy { };
|
|
std::unordered_map<std::wstring, std::wstring> m_acceptedServerTrustCerts;
|
|
+ WKPageRunJavaScriptAlertResultListenerRef m_alertDialog = { };
|
|
+ WKPageRunJavaScriptConfirmResultListenerRef m_confirmDialog = { };
|
|
+ WKPageRunJavaScriptPromptResultListenerRef m_promptDialog = { };
|
|
+ WKPageRunBeforeUnloadConfirmPanelResultListenerRef m_beforeUnloadDialog = { };
|
|
};
|
|
diff --git a/Tools/MiniBrowser/win/WinMain.cpp b/Tools/MiniBrowser/win/WinMain.cpp
|
|
index b1d17e88de61a6f196830f62604e4174564506bd..eb5b63e75be20ffbe390c0b084314c3542b6b5b2 100644
|
|
--- a/Tools/MiniBrowser/win/WinMain.cpp
|
|
+++ b/Tools/MiniBrowser/win/WinMain.cpp
|
|
@@ -47,11 +47,18 @@
|
|
#include <WebKitLegacy/WebKitCOMAPI.h>
|
|
#endif
|
|
|
|
+#include <wtf/MainThread.h>
|
|
+#include <WebKit/WKInspector.h>
|
|
+
|
|
SOFT_LINK_LIBRARY(user32);
|
|
SOFT_LINK_OPTIONAL(user32, SetProcessDpiAwarenessContext, BOOL, STDAPICALLTYPE, (DPI_AWARENESS_CONTEXT));
|
|
|
|
int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpstrCmdLine, _In_ int nCmdShow)
|
|
{
|
|
+#if ENABLE(WEBKIT)
|
|
+ // WebKit2 does not use RunLoop.
|
|
+ WTF::initializeMainThread();
|
|
+#endif
|
|
#ifdef _CRTDBG_MAP_ALLOC
|
|
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
|
|
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
|
|
@@ -67,6 +74,12 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
|
|
InitCommonControlsEx(&InitCtrlEx);
|
|
|
|
auto options = parseCommandLine();
|
|
+ if (options.inspectorPipe) {
|
|
+ WebKitBrowserWindow::setHeadless(options.headless);
|
|
+ WKInspectorInitializeRemoteInspectorPipe(
|
|
+ WebKitBrowserWindow::createPageCallback,
|
|
+ []() { PostQuitMessage(0); });
|
|
+ }
|
|
|
|
if (options.useFullDesktop)
|
|
computeFullDesktopFrame();
|
|
@@ -91,14 +104,17 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
|
|
if (FAILED(hr))
|
|
goto exit;
|
|
|
|
- ShowWindow(mainWindow.hwnd(), nCmdShow);
|
|
+ if (options.headless)
|
|
+ SetMenu(mainWindow.hwnd(), NULL);
|
|
+ else
|
|
+ ShowWindow(mainWindow.hwnd(), nCmdShow);
|
|
|
|
hAccelTable = LoadAccelerators(hInst, MAKEINTRESOURCE(IDC_MINIBROWSER));
|
|
|
|
if (options.requestedURL.length())
|
|
mainWindow.loadURL(options.requestedURL.GetBSTR());
|
|
else
|
|
- mainWindow.browserWindow()->loadURL(_bstr_t(defaultURL).GetBSTR());
|
|
+ mainWindow.loadURL(_bstr_t("about:blank").GetBSTR());
|
|
|
|
#pragma warning(disable:4509)
|
|
|
|
diff --git a/Tools/MiniBrowser/wpe/CMakeLists.txt b/Tools/MiniBrowser/wpe/CMakeLists.txt
|
|
index 245f319abf2595e154d03e1ee8b3250d7f46aafd..9cae87b23deade7c163f34aade2b2aed91d47fc8 100644
|
|
--- a/Tools/MiniBrowser/wpe/CMakeLists.txt
|
|
+++ b/Tools/MiniBrowser/wpe/CMakeLists.txt
|
|
@@ -13,6 +13,7 @@ set(MiniBrowser_INCLUDE_DIRECTORIES
|
|
|
|
set(MiniBrowser_SYSTEM_INCLUDE_DIRECTORIES
|
|
${ATK_INCLUDE_DIRS}
|
|
+ ${GLIB_INCLUDE_DIRS}
|
|
${WPE_INCLUDE_DIRS}
|
|
${WPEBACKEND_FDO_INCLUDE_DIRS}
|
|
)
|
|
diff --git a/Tools/MiniBrowser/wpe/main.cpp b/Tools/MiniBrowser/wpe/main.cpp
|
|
index 2d183d394123bd84545dc51f53eb9be796fb8873..867e7d08fd5f922e32e09550ac19a21d0c8fb7d1 100644
|
|
--- a/Tools/MiniBrowser/wpe/main.cpp
|
|
+++ b/Tools/MiniBrowser/wpe/main.cpp
|
|
@@ -25,7 +25,7 @@
|
|
|
|
#include "cmakeconfig.h"
|
|
|
|
-#include "HeadlessViewBackend.h"
|
|
+#include "NullViewBackend.h"
|
|
#include "WindowViewBackend.h"
|
|
#if ENABLE_WEB_AUDIO || ENABLE_VIDEO
|
|
#include <gst/gst.h>
|
|
@@ -43,6 +43,8 @@ static gboolean headlessMode;
|
|
static gboolean privateMode;
|
|
static gboolean automationMode;
|
|
static gboolean ignoreTLSErrors;
|
|
+static gboolean inspectorPipe;
|
|
+static const char* userDataDir;
|
|
static const char* contentFilter;
|
|
static const char* cookiesFile;
|
|
static const char* cookiesPolicy;
|
|
@@ -63,6 +65,8 @@ static const GOptionEntry commandLineOptions[] =
|
|
{ "content-filter", 0, 0, G_OPTION_ARG_FILENAME, &contentFilter, "JSON with content filtering rules", "FILE" },
|
|
{ "bg-color", 0, 0, G_OPTION_ARG_STRING, &bgColor, "Window background color. Default: white", "COLOR" },
|
|
{ "version", 'v', 0, G_OPTION_ARG_NONE, &printVersion, "Print the WPE version", nullptr },
|
|
+ { "inspector-pipe", 'v', 0, G_OPTION_ARG_NONE, &inspectorPipe, "Expose remote debugging protocol over pipe", nullptr },
|
|
+ { "user-data-dir", 0, 0, G_OPTION_ARG_STRING, &userDataDir, "Default profile persistence folder location", "FILE" },
|
|
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &uriArguments, nullptr, "[URL]" },
|
|
{ nullptr, 0, 0, G_OPTION_ARG_NONE, nullptr, nullptr, nullptr }
|
|
};
|
|
@@ -131,7 +135,7 @@ static gboolean decidePermissionRequest(WebKitWebView *, WebKitPermissionRequest
|
|
static std::unique_ptr<WPEToolingBackends::ViewBackend> createViewBackend(uint32_t width, uint32_t height)
|
|
{
|
|
if (headlessMode)
|
|
- return std::make_unique<WPEToolingBackends::HeadlessViewBackend>(width, height);
|
|
+ return std::make_unique<WPEToolingBackends::NullViewBackend>();
|
|
return std::make_unique<WPEToolingBackends::WindowViewBackend>(width, height);
|
|
}
|
|
|
|
@@ -152,7 +156,23 @@ static void webViewClose(WebKitWebView* webView, gpointer)
|
|
g_object_unref(webView);
|
|
}
|
|
|
|
-static WebKitWebView* createWebView(WebKitWebView* webView, WebKitNavigationAction*, gpointer)
|
|
+static gboolean scriptDialog(WebKitWebView*, WebKitScriptDialog* dialog, gpointer)
|
|
+{
|
|
+ if (inspectorPipe)
|
|
+ webkit_script_dialog_ref(dialog);
|
|
+ return TRUE;
|
|
+}
|
|
+
|
|
+static gboolean scriptDialogHandled(WebKitWebView*, WebKitScriptDialog* dialog, gpointer)
|
|
+{
|
|
+ if (inspectorPipe)
|
|
+ webkit_script_dialog_unref(dialog);
|
|
+ return TRUE;
|
|
+}
|
|
+
|
|
+static WebKitWebView* createWebView(WebKitWebView* webView, WebKitNavigationAction*, gpointer);
|
|
+
|
|
+static WebKitWebView* createWebViewImpl(WebKitWebView* webView, WebKitWebContext *webContext)
|
|
{
|
|
auto backend = createViewBackend(1280, 720);
|
|
struct wpe_view_backend* wpeBackend = backend->backend();
|
|
@@ -164,14 +184,48 @@ static WebKitWebView* createWebView(WebKitWebView* webView, WebKitNavigationActi
|
|
delete static_cast<WPEToolingBackends::ViewBackend*>(data);
|
|
}, backend.release());
|
|
|
|
- auto* newWebView = webkit_web_view_new_with_related_view(viewBackend, webView);
|
|
- webkit_web_view_set_settings(newWebView, webkit_web_view_get_settings(webView));
|
|
+ WebKitWebView* newWebView;
|
|
+ if (webView) {
|
|
+ newWebView = webkit_web_view_new_with_related_view(viewBackend, webView);
|
|
+ } else {
|
|
+ newWebView = WEBKIT_WEB_VIEW(g_object_new(WEBKIT_TYPE_WEB_VIEW,
|
|
+ "backend", viewBackend,
|
|
+ "web-context", webContext,
|
|
+ nullptr));
|
|
+ }
|
|
+ auto* settings = webkit_settings_new_with_settings(
|
|
+ "enable-developer-extras", TRUE,
|
|
+ "enable-webgl", TRUE,
|
|
+ "enable-media-stream", TRUE,
|
|
+ "enable-encrypted-media", TRUE,
|
|
+ nullptr);
|
|
+ webkit_web_view_set_settings(newWebView, settings);
|
|
|
|
g_signal_connect(newWebView, "close", G_CALLBACK(webViewClose), nullptr);
|
|
-
|
|
+ g_signal_connect(newWebView, "script-dialog", G_CALLBACK(scriptDialog), nullptr);
|
|
+ g_signal_connect(newWebView, "script-dialog-handled", G_CALLBACK(scriptDialogHandled), nullptr);
|
|
+ g_signal_connect(newWebView, "create", G_CALLBACK(createWebView), nullptr);
|
|
+ webkit_web_view_load_uri(newWebView, "about:blank");
|
|
return newWebView;
|
|
}
|
|
|
|
+static WebKitWebView* createWebView(WebKitWebView* webView, WebKitNavigationAction*, gpointer)
|
|
+{
|
|
+ return createWebViewImpl(webView, nullptr);
|
|
+}
|
|
+
|
|
+static WebKitWebView* createNewPage(WebKitBrowserInspector*, WebKitWebContext *webContext)
|
|
+{
|
|
+ return createWebViewImpl(nullptr, webContext);
|
|
+}
|
|
+
|
|
+static void configureBrowserInspector(GMainLoop* mainLoop)
|
|
+{
|
|
+ WebKitBrowserInspector* browserInspector = webkit_browser_inspector_get_default();
|
|
+ g_signal_connect(browserInspector, "create-new-page", G_CALLBACK(createNewPage), NULL);
|
|
+ webkit_browser_inspector_initialize_pipe(mainLoop);
|
|
+}
|
|
+
|
|
int main(int argc, char *argv[])
|
|
{
|
|
#if ENABLE_DEVELOPER_MODE
|
|
@@ -280,6 +334,9 @@ int main(int argc, char *argv[])
|
|
delete static_cast<WPEToolingBackends::ViewBackend*>(data);
|
|
}, backend.release());
|
|
|
|
+ if (inspectorPipe)
|
|
+ configureBrowserInspector(loop);
|
|
+
|
|
auto* webView = WEBKIT_WEB_VIEW(g_object_new(WEBKIT_TYPE_WEB_VIEW,
|
|
"backend", viewBackend,
|
|
"web-context", webContext,
|
|
@@ -318,7 +375,7 @@ int main(int argc, char *argv[])
|
|
g_object_unref(file);
|
|
webkit_web_view_load_uri(webView, url);
|
|
g_free(url);
|
|
- } else if (automationMode)
|
|
+ } else if (automationMode || inspectorPipe)
|
|
webkit_web_view_load_uri(webView, "about:blank");
|
|
else
|
|
webkit_web_view_load_uri(webView, "https://wpewebkit.org");
|
|
diff --git a/Tools/Playwright/Configurations/Base.xcconfig b/Tools/Playwright/Configurations/Base.xcconfig
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..fc61d5227c8608488514cbd92a28dc7c1c2efaf4
|
|
--- /dev/null
|
|
+++ b/Tools/Playwright/Configurations/Base.xcconfig
|
|
@@ -0,0 +1,87 @@
|
|
+// Copyright (C) 2010-2017 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? "../../../../Internal/Configurations/HaveInternalSDK.xcconfig"
|
|
+#include "SDKVariant.xcconfig"
|
|
+
|
|
+USE_INTERNAL_SDK = $(USE_INTERNAL_SDK_$(CONFIGURATION));
|
|
+USE_INTERNAL_SDK_Production = YES;
|
|
+USE_INTERNAL_SDK_Debug = $(HAVE_INTERNAL_SDK);
|
|
+USE_INTERNAL_SDK_Release = $(HAVE_INTERNAL_SDK);
|
|
+
|
|
+GCC_PREPROCESSOR_DEFINITIONS = DISABLE_LEGACY_WEBKIT_DEPRECATIONS $(inherited);
|
|
+
|
|
+CLANG_CXX_LANGUAGE_STANDARD = gnu++1z;
|
|
+CLANG_CXX_LIBRARY = libc++;
|
|
+CLANG_ENABLE_OBJC_WEAK = YES;
|
|
+DEBUG_INFORMATION_FORMAT = dwarf-with-dsym;
|
|
+PREBINDING = NO
|
|
+GCC_C_LANGUAGE_STANDARD = gnu99
|
|
+GCC_ENABLE_CPP_EXCEPTIONS = NO;
|
|
+GCC_PRECOMPILE_PREFIX_HEADER = YES
|
|
+ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
+GCC_TREAT_WARNINGS_AS_ERRORS = YES
|
|
+CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
+CLANG_WARN_BOOL_CONVERSION = YES;
|
|
+CLANG_WARN_COMMA = YES;
|
|
+CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
+CLANG_WARN_EMPTY_BODY = YES;
|
|
+CLANG_WARN_ENUM_CONVERSION = YES;
|
|
+CLANG_WARN_INFINITE_RECURSION = YES;
|
|
+CLANG_WARN_INT_CONVERSION = YES;
|
|
+CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
+CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
+CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
+CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
+CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
+CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
|
+CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
+GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
+GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO;
|
|
+GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
|
+GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
|
+GCC_WARN_UNUSED_FUNCTION = YES
|
|
+GCC_WARN_UNUSED_VARIABLE = YES
|
|
+CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
+GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
+CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
|
+CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
|
+GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
|
+WARNING_CFLAGS = -Wall -W -Wno-unused-parameter
|
|
+GCC_NO_COMMON_BLOCKS = YES;
|
|
+
|
|
+SUPPORTED_PLATFORMS = iphoneos iphonesimulator macosx tvos tvsimulator watchos watchsimulator;
|
|
+
|
|
+TARGET_MAC_OS_X_VERSION_MAJOR = $(TARGET_MAC_OS_X_VERSION_MAJOR$(MACOSX_DEPLOYMENT_TARGET:suffix:identifier));
|
|
+TARGET_MAC_OS_X_VERSION_MAJOR_13 = 101300;
|
|
+TARGET_MAC_OS_X_VERSION_MAJOR_14 = 101400;
|
|
+TARGET_MAC_OS_X_VERSION_MAJOR_15 = 101500;
|
|
+TARGET_MAC_OS_X_VERSION_MAJOR_16 = 101600;
|
|
+
|
|
+SDKROOT = macosx.internal;
|
|
+
|
|
+OTHER_CFLAGS = $(ASAN_OTHER_CFLAGS);
|
|
+OTHER_CPLUSPLUSFLAGS = $(ASAN_OTHER_CPLUSPLUSFLAGS);
|
|
+OTHER_LDFLAGS = $(ASAN_OTHER_LDFLAGS);
|
|
+
|
|
+CODE_SIGN_IDENTITY = -;
|
|
diff --git a/Tools/Playwright/Configurations/DebugRelease.xcconfig b/Tools/Playwright/Configurations/DebugRelease.xcconfig
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..44dc1139c298bd119368ef4f45bbf0888dc71cdb
|
|
--- /dev/null
|
|
+++ b/Tools/Playwright/Configurations/DebugRelease.xcconfig
|
|
@@ -0,0 +1,45 @@
|
|
+// Copyright (C) 2010, 2013 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 "Base.xcconfig"
|
|
+
|
|
+ARCHS = $(ARCHS_STANDARD_32_64_BIT);
|
|
+
|
|
+ONLY_ACTIVE_ARCH = YES;
|
|
+
|
|
+TARGET_MAC_OS_X_VERSION_MAJOR = $(MAC_OS_X_VERSION_MAJOR);
|
|
+
|
|
+MACOSX_DEPLOYMENT_TARGET = $(MACOSX_DEPLOYMENT_TARGET_$(TARGET_MAC_OS_X_VERSION_MAJOR))
|
|
+MACOSX_DEPLOYMENT_TARGET_101300 = 10.13;
|
|
+MACOSX_DEPLOYMENT_TARGET_101400 = 10.14;
|
|
+MACOSX_DEPLOYMENT_TARGET_101500 = 10.15;
|
|
+MACOSX_DEPLOYMENT_TARGET_101600 = 10.16;
|
|
+
|
|
+GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES;
|
|
+
|
|
+SDKROOT = $(SDKROOT_$(USE_INTERNAL_SDK));
|
|
+SDKROOT_ = macosx;
|
|
+SDKROOT_YES = macosx.internal;
|
|
+
|
|
+WK_CCACHE_DIR = $(SRCROOT)/../ccache;
|
|
+#include "../../ccache/ccache.xcconfig"
|
|
diff --git a/Tools/Playwright/Configurations/Playwright.xcconfig b/Tools/Playwright/Configurations/Playwright.xcconfig
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..d05c841a5b0f5fce481f16b8c98caf3a5846db77
|
|
--- /dev/null
|
|
+++ b/Tools/Playwright/Configurations/Playwright.xcconfig
|
|
@@ -0,0 +1,30 @@
|
|
+// Copyright (C) 2010 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.
|
|
+
|
|
+PRODUCT_NAME = Playwright
|
|
+PRODUCT_BUNDLE_IDENTIFIER = org.webkit.$(PRODUCT_NAME:rfc1034identifier)
|
|
+GCC_PREFIX_HEADER = mac/Playwright_Prefix.pch
|
|
+INFOPLIST_FILE = mac/Info.plist
|
|
+EXCLUDED_SOURCE_FILE_NAMES[sdk=iphone*] = *
|
|
+OTHER_LDFLAGS[sdk=macosx*] = $(inherited) -framework Cocoa -framework WebKit
|
|
+STRIP_STYLE = debugging;
|
|
diff --git a/Tools/Playwright/Configurations/SDKVariant.xcconfig b/Tools/Playwright/Configurations/SDKVariant.xcconfig
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..fcdf7e65a67c61fb19ef19c428652f336c180e8e
|
|
--- /dev/null
|
|
+++ b/Tools/Playwright/Configurations/SDKVariant.xcconfig
|
|
@@ -0,0 +1,45 @@
|
|
+// Copyright (C) 2019 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.
|
|
+
|
|
+WK_EMPTY_ = YES;
|
|
+WK_NOT_ = YES;
|
|
+WK_NOT_YES = NO;
|
|
+
|
|
+WK_ALTERNATE_FRAMEWORKS_DIR = $(WK_ALTERNATE_FRAMEWORKS_DIR_$(SDK_VARIANT));
|
|
+WK_ALTERNATE_FRAMEWORKS_DIR_iosmac = /System/iOSSupport;
|
|
+WK_USE_ALTERNATE_FRAMEWORKS_DIR = $(WK_NOT_$(WK_EMPTY_$(WK_ALTERNATE_FRAMEWORKS_DIR)));
|
|
+
|
|
+WK_ALTERNATE_PLATFORM_NAME = $(WK_ALTERNATE_PLATFORM_NAME_$(SDK_VARIANT));
|
|
+WK_ALTERNATE_PLATFORM_NAME_iosmac = maccatalyst;
|
|
+WK_USE_ALTERNATE_PLATFORM_NAME = $(WK_NOT_$(WK_EMPTY_$(WK_ALTERNATE_PLATFORM_NAME)));
|
|
+
|
|
+WK_ALTERNATE_WEBKIT_SDK_PATH = $(WK_ALTERNATE_WEBKIT_SDK_PATH_$(WK_USE_ALTERNATE_FRAMEWORKS_DIR));
|
|
+WK_ALTERNATE_WEBKIT_SDK_PATH_YES = $(WK_ALTERNATE_FRAMEWORKS_DIR)/;
|
|
+
|
|
+WK_PLATFORM_NAME = $(WK_PLATFORM_NAME_ALTERNATE_$(WK_USE_ALTERNATE_PLATFORM_NAME));
|
|
+WK_PLATFORM_NAME_ALTERNATE_YES = $(WK_ALTERNATE_PLATFORM_NAME);
|
|
+WK_PLATFORM_NAME_ALTERNATE_NO = $(PLATFORM_NAME);
|
|
+
|
|
+EFFECTIVE_PLATFORM_NAME = $(EFFECTIVE_PLATFORM_NAME_ALTERNATE_$(WK_USE_ALTERNATE_PLATFORM_NAME));
|
|
+EFFECTIVE_PLATFORM_NAME_ALTERNATE_YES = -$(WK_ALTERNATE_PLATFORM_NAME);
|
|
+EFFECTIVE_PLATFORM_NAME_ALTERNATE_NO = $(EFFECTIVE_PLATFORM_NAME);
|
|
diff --git a/Tools/Playwright/MBToolbarItem.h b/Tools/Playwright/MBToolbarItem.h
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..9971d4c1023a9f6e57c6058ae20729e51bb6d503
|
|
--- /dev/null
|
|
+++ b/Tools/Playwright/MBToolbarItem.h
|
|
@@ -0,0 +1,27 @@
|
|
+/*
|
|
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions
|
|
+ * are met:
|
|
+ * 1. Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * 2. Redistributions in binary form must reproduce the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer in the
|
|
+ * documentation and/or other materials provided with the distribution.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
|
|
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
|
|
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
+ * THE POSSIBILITY OF SUCH DAMAGE.
|
|
+ */
|
|
+
|
|
+@interface MBToolbarItem : NSToolbarItem
|
|
+@end
|
|
diff --git a/Tools/Playwright/MBToolbarItem.m b/Tools/Playwright/MBToolbarItem.m
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..56f777891519e820105ae50a86141a534ec4794b
|
|
--- /dev/null
|
|
+++ b/Tools/Playwright/MBToolbarItem.m
|
|
@@ -0,0 +1,35 @@
|
|
+/*
|
|
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions
|
|
+ * are met:
|
|
+ * 1. Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * 2. Redistributions in binary form must reproduce the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer in the
|
|
+ * documentation and/or other materials provided with the distribution.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
|
|
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
|
|
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
+ * THE POSSIBILITY OF SUCH DAMAGE.
|
|
+ */
|
|
+
|
|
+#import "MBToolbarItem.h"
|
|
+
|
|
+@implementation MBToolbarItem
|
|
+
|
|
+- (void)validate
|
|
+{
|
|
+ [self setEnabled:[[self target] validateUserInterfaceItem:self]];
|
|
+}
|
|
+
|
|
+@end
|
|
diff --git a/Tools/Playwright/Makefile b/Tools/Playwright/Makefile
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..58e52428388d927ae7681d999e6dd28e0fb3ec6b
|
|
--- /dev/null
|
|
+++ b/Tools/Playwright/Makefile
|
|
@@ -0,0 +1,21 @@
|
|
+# Build Playwright only on SnowLeopard and later.
|
|
+
|
|
+OSX_VERSION ?= $(shell sw_vers -productVersion | cut -d. -f 2)
|
|
+BUILD_PLAYWRIGHT = $(shell (( $(OSX_VERSION) >= 6 )) && echo "YES" )
|
|
+
|
|
+ifeq "$(BUILD_PLAYWRIGHT)" "YES"
|
|
+
|
|
+SCRIPTS_PATH = ../Scripts
|
|
+include ../../Makefile.shared
|
|
+
|
|
+else
|
|
+
|
|
+all: ;
|
|
+
|
|
+debug d development dev develop: ;
|
|
+
|
|
+release r deployment dep deploy: ;
|
|
+
|
|
+clean: ;
|
|
+
|
|
+endif
|
|
diff --git a/Tools/Playwright/Playwright.xcodeproj/project.pbxproj b/Tools/Playwright/Playwright.xcodeproj/project.pbxproj
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..75a945e72d9fcad94bb89fc6325df18d3259383d
|
|
--- /dev/null
|
|
+++ b/Tools/Playwright/Playwright.xcodeproj/project.pbxproj
|
|
@@ -0,0 +1,264 @@
|
|
+// !$*UTF8*$!
|
|
+{
|
|
+ archiveVersion = 1;
|
|
+ classes = {
|
|
+ };
|
|
+ objectVersion = 46;
|
|
+ objects = {
|
|
+
|
|
+/* Begin PBXBuildFile section */
|
|
+ 256AC3DA0F4B6AC300CF336A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 256AC3D90F4B6AC300CF336A /* AppDelegate.m */; };
|
|
+ 51E244FA11EFCE07008228D2 /* MBToolbarItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 51E244F911EFCE07008228D2 /* MBToolbarItem.m */; };
|
|
+ BC329487116A92E2008635D1 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = BC329486116A92E2008635D1 /* main.m */; };
|
|
+ BC329498116A941B008635D1 /* BrowserWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = BC329497116A941B008635D1 /* BrowserWindowController.m */; };
|
|
+ BC72B89511E57E07001EB4EB /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58150DA1D0A300B3202A /* MainMenu.xib */; };
|
|
+ BC72B89611E57E0F001EB4EB /* BrowserWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = BC3294A2116A9852008635D1 /* BrowserWindow.xib */; };
|
|
+/* End PBXBuildFile section */
|
|
+
|
|
+/* Begin PBXFileReference section */
|
|
+ 1AFFEF761860EE6800DA465F /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
|
|
+ 1AFFEF781860EE6800DA465F /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
|
|
+ 1DDD58150DA1D0A300B3202A /* MainMenu.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = MainMenu.xib; path = mac/MainMenu.xib; sourceTree = "<group>"; };
|
|
+ 256AC3D80F4B6AC300CF336A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = mac/AppDelegate.h; sourceTree = "<group>"; };
|
|
+ 256AC3D90F4B6AC300CF336A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = mac/AppDelegate.m; sourceTree = "<group>"; };
|
|
+ 256AC3F00F4B6AF500CF336A /* Playwright_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Playwright_Prefix.pch; path = mac/Playwright_Prefix.pch; sourceTree = "<group>"; };
|
|
+ 29B97324FDCFA39411CA2CEB /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
|
|
+ 29B97325FDCFA39411CA2CEB /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
|
|
+ 37BAF90620218053000EA87A /* Playwright.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Playwright.entitlements; sourceTree = "<group>"; };
|
|
+ 51E244F811EFCE07008228D2 /* MBToolbarItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MBToolbarItem.h; sourceTree = "<group>"; };
|
|
+ 51E244F911EFCE07008228D2 /* MBToolbarItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MBToolbarItem.m; sourceTree = "<group>"; };
|
|
+ 8D1107320486CEB800E47091 /* Playwright.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Playwright.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
+ A1B89B95221E027A00EB4CEB /* SDKVariant.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = SDKVariant.xcconfig; sourceTree = "<group>"; };
|
|
+ BC329486116A92E2008635D1 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = mac/main.m; sourceTree = "<group>"; };
|
|
+ BC329496116A941B008635D1 /* BrowserWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BrowserWindowController.h; path = mac/BrowserWindowController.h; sourceTree = "<group>"; };
|
|
+ BC329497116A941B008635D1 /* BrowserWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BrowserWindowController.m; path = mac/BrowserWindowController.m; sourceTree = "<group>"; };
|
|
+ BC3294A2116A9852008635D1 /* BrowserWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = BrowserWindow.xib; path = mac/BrowserWindow.xib; sourceTree = "<group>"; };
|
|
+ BC72B89A11E57E8A001EB4EB /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = mac/Info.plist; sourceTree = "<group>"; };
|
|
+ BCA8CBDD11E578A000812FB8 /* Base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = "<group>"; };
|
|
+ BCA8CBDE11E578A000812FB8 /* DebugRelease.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = "<group>"; };
|
|
+ BCA8CBDF11E578A000812FB8 /* Playwright.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Playwright.xcconfig; sourceTree = "<group>"; };
|
|
+/* End PBXFileReference section */
|
|
+
|
|
+/* Begin PBXFrameworksBuildPhase section */
|
|
+ 8D11072E0486CEB800E47091 /* Frameworks */ = {
|
|
+ isa = PBXFrameworksBuildPhase;
|
|
+ buildActionMask = 2147483647;
|
|
+ files = (
|
|
+ );
|
|
+ runOnlyForDeploymentPostprocessing = 0;
|
|
+ };
|
|
+/* End PBXFrameworksBuildPhase section */
|
|
+
|
|
+/* Begin PBXGroup section */
|
|
+ 080E96DDFE201D6D7F000002 /* Playwright */ = {
|
|
+ isa = PBXGroup;
|
|
+ children = (
|
|
+ 256AC3D80F4B6AC300CF336A /* AppDelegate.h */,
|
|
+ 256AC3D90F4B6AC300CF336A /* AppDelegate.m */,
|
|
+ BC72B89A11E57E8A001EB4EB /* Info.plist */,
|
|
+ BC329486116A92E2008635D1 /* main.m */,
|
|
+ 51E244F811EFCE07008228D2 /* MBToolbarItem.h */,
|
|
+ 51E244F911EFCE07008228D2 /* MBToolbarItem.m */,
|
|
+ 37BAF90620218053000EA87A /* Playwright.entitlements */,
|
|
+ BC329496116A941B008635D1 /* BrowserWindowController.h */,
|
|
+ BC329497116A941B008635D1 /* BrowserWindowController.m */,
|
|
+ );
|
|
+ name = Playwright;
|
|
+ sourceTree = "<group>";
|
|
+ };
|
|
+ 1058C7A2FEA54F0111CA2CBC /* Other Frameworks */ = {
|
|
+ isa = PBXGroup;
|
|
+ children = (
|
|
+ 29B97324FDCFA39411CA2CEB /* AppKit.framework */,
|
|
+ 1AFFEF781860EE6800DA465F /* CoreData.framework */,
|
|
+ 29B97325FDCFA39411CA2CEB /* Foundation.framework */,
|
|
+ );
|
|
+ name = "Other Frameworks";
|
|
+ sourceTree = "<group>";
|
|
+ };
|
|
+ 19C28FACFE9D520D11CA2CBC /* Products */ = {
|
|
+ isa = PBXGroup;
|
|
+ children = (
|
|
+ 8D1107320486CEB800E47091 /* Playwright.app */,
|
|
+ );
|
|
+ name = Products;
|
|
+ sourceTree = "<group>";
|
|
+ };
|
|
+ 29B97314FDCFA39411CA2CEB /* Playwright */ = {
|
|
+ isa = PBXGroup;
|
|
+ children = (
|
|
+ 256AC3F00F4B6AF500CF336A /* Playwright_Prefix.pch */,
|
|
+ 080E96DDFE201D6D7F000002 /* Playwright */,
|
|
+ 29B97317FDCFA39411CA2CEB /* Resources */,
|
|
+ BCA8CBDA11E5787800812FB8 /* Configurations */,
|
|
+ 29B97323FDCFA39411CA2CEB /* Frameworks */,
|
|
+ 19C28FACFE9D520D11CA2CBC /* Products */,
|
|
+ );
|
|
+ name = Playwright;
|
|
+ sourceTree = "<group>";
|
|
+ };
|
|
+ 29B97317FDCFA39411CA2CEB /* Resources */ = {
|
|
+ isa = PBXGroup;
|
|
+ children = (
|
|
+ BC3294A2116A9852008635D1 /* BrowserWindow.xib */,
|
|
+ 1DDD58150DA1D0A300B3202A /* MainMenu.xib */,
|
|
+ );
|
|
+ name = Resources;
|
|
+ sourceTree = "<group>";
|
|
+ };
|
|
+ 29B97323FDCFA39411CA2CEB /* Frameworks */ = {
|
|
+ isa = PBXGroup;
|
|
+ children = (
|
|
+ 1058C7A2FEA54F0111CA2CBC /* Other Frameworks */,
|
|
+ 1AFFEF761860EE6800DA465F /* Cocoa.framework */,
|
|
+ );
|
|
+ name = Frameworks;
|
|
+ sourceTree = "<group>";
|
|
+ };
|
|
+ BCA8CBDA11E5787800812FB8 /* Configurations */ = {
|
|
+ isa = PBXGroup;
|
|
+ children = (
|
|
+ BCA8CBDD11E578A000812FB8 /* Base.xcconfig */,
|
|
+ BCA8CBDE11E578A000812FB8 /* DebugRelease.xcconfig */,
|
|
+ BCA8CBDF11E578A000812FB8 /* Playwright.xcconfig */,
|
|
+ A1B89B95221E027A00EB4CEB /* SDKVariant.xcconfig */,
|
|
+ );
|
|
+ path = Configurations;
|
|
+ sourceTree = "<group>";
|
|
+ };
|
|
+/* End PBXGroup section */
|
|
+
|
|
+/* Begin PBXNativeTarget section */
|
|
+ 8D1107260486CEB800E47091 /* Playwright */ = {
|
|
+ isa = PBXNativeTarget;
|
|
+ buildConfigurationList = C01FCF4A08A954540054247C /* Build configuration list for PBXNativeTarget "Playwright" */;
|
|
+ buildPhases = (
|
|
+ 8D1107290486CEB800E47091 /* Resources */,
|
|
+ 8D11072C0486CEB800E47091 /* Sources */,
|
|
+ 8D11072E0486CEB800E47091 /* Frameworks */,
|
|
+ );
|
|
+ buildRules = (
|
|
+ );
|
|
+ dependencies = (
|
|
+ );
|
|
+ name = Playwright;
|
|
+ productInstallPath = "$(HOME)/Applications";
|
|
+ productName = Playwright;
|
|
+ productReference = 8D1107320486CEB800E47091 /* Playwright.app */;
|
|
+ productType = "com.apple.product-type.application";
|
|
+ };
|
|
+/* End PBXNativeTarget section */
|
|
+
|
|
+/* Begin PBXProject section */
|
|
+ 29B97313FDCFA39411CA2CEC /* Project object */ = {
|
|
+ isa = PBXProject;
|
|
+ attributes = {
|
|
+ LastSwiftUpdateCheck = 0700;
|
|
+ LastUpgradeCheck = 1000;
|
|
+ TargetAttributes = {
|
|
+ 8D1107260486CEB800E47091 = {
|
|
+ SystemCapabilities = {
|
|
+ com.apple.Sandbox = {
|
|
+ enabled = 1;
|
|
+ };
|
|
+ };
|
|
+ };
|
|
+ };
|
|
+ };
|
|
+ buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Playwright" */;
|
|
+ compatibilityVersion = "Xcode 3.2";
|
|
+ developmentRegion = en;
|
|
+ hasScannedForEncodings = 1;
|
|
+ knownRegions = (
|
|
+ en,
|
|
+ );
|
|
+ mainGroup = 29B97314FDCFA39411CA2CEB /* Playwright */;
|
|
+ projectDirPath = "";
|
|
+ projectRoot = "";
|
|
+ targets = (
|
|
+ 8D1107260486CEB800E47091 /* Playwright */,
|
|
+ );
|
|
+ };
|
|
+/* End PBXProject section */
|
|
+
|
|
+/* Begin PBXResourcesBuildPhase section */
|
|
+ 8D1107290486CEB800E47091 /* Resources */ = {
|
|
+ isa = PBXResourcesBuildPhase;
|
|
+ buildActionMask = 2147483647;
|
|
+ files = (
|
|
+ BC72B89611E57E0F001EB4EB /* BrowserWindow.xib in Resources */,
|
|
+ BC72B89511E57E07001EB4EB /* MainMenu.xib in Resources */,
|
|
+ );
|
|
+ runOnlyForDeploymentPostprocessing = 0;
|
|
+ };
|
|
+/* End PBXResourcesBuildPhase section */
|
|
+
|
|
+/* Begin PBXSourcesBuildPhase section */
|
|
+ 8D11072C0486CEB800E47091 /* Sources */ = {
|
|
+ isa = PBXSourcesBuildPhase;
|
|
+ buildActionMask = 2147483647;
|
|
+ files = (
|
|
+ 256AC3DA0F4B6AC300CF336A /* AppDelegate.m in Sources */,
|
|
+ BC329487116A92E2008635D1 /* main.m in Sources */,
|
|
+ 51E244FA11EFCE07008228D2 /* MBToolbarItem.m in Sources */,
|
|
+ BC329498116A941B008635D1 /* BrowserWindowController.m in Sources */,
|
|
+ );
|
|
+ runOnlyForDeploymentPostprocessing = 0;
|
|
+ };
|
|
+/* End PBXSourcesBuildPhase section */
|
|
+
|
|
+/* Begin XCBuildConfiguration section */
|
|
+ C01FCF4B08A954540054247C /* Debug */ = {
|
|
+ isa = XCBuildConfiguration;
|
|
+ baseConfigurationReference = BCA8CBDF11E578A000812FB8 /* Playwright.xcconfig */;
|
|
+ buildSettings = {
|
|
+ };
|
|
+ name = Debug;
|
|
+ };
|
|
+ C01FCF4C08A954540054247B /* Release */ = {
|
|
+ isa = XCBuildConfiguration;
|
|
+ baseConfigurationReference = BCA8CBDF11E578A000812FB8 /* Playwright.xcconfig */;
|
|
+ buildSettings = {
|
|
+ };
|
|
+ name = Release;
|
|
+ };
|
|
+ C01FCF4F08A954540054247C /* Debug */ = {
|
|
+ isa = XCBuildConfiguration;
|
|
+ baseConfigurationReference = BCA8CBDE11E578A000812FB8 /* DebugRelease.xcconfig */;
|
|
+ buildSettings = {
|
|
+ GCC_OPTIMIZATION_LEVEL = 0;
|
|
+ };
|
|
+ name = Debug;
|
|
+ };
|
|
+ C01FCF5008A954540054247C /* Release */ = {
|
|
+ isa = XCBuildConfiguration;
|
|
+ baseConfigurationReference = BCA8CBDE11E578A000812FB8 /* DebugRelease.xcconfig */;
|
|
+ buildSettings = {
|
|
+ };
|
|
+ name = Release;
|
|
+ };
|
|
+/* End XCBuildConfiguration section */
|
|
+
|
|
+/* Begin XCConfigurationList section */
|
|
+ C01FCF4A08A954540054247C /* Build configuration list for PBXNativeTarget "Playwright" */ = {
|
|
+ isa = XCConfigurationList;
|
|
+ buildConfigurations = (
|
|
+ C01FCF4B08A954540054247C /* Debug */,
|
|
+ C01FCF4C08A954540054247B /* Release */,
|
|
+ );
|
|
+ defaultConfigurationIsVisible = 0;
|
|
+ defaultConfigurationName = Release;
|
|
+ };
|
|
+ C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Playwright" */ = {
|
|
+ isa = XCConfigurationList;
|
|
+ buildConfigurations = (
|
|
+ C01FCF4F08A954540054247C /* Debug */,
|
|
+ C01FCF5008A954540054247C /* Release */,
|
|
+ );
|
|
+ defaultConfigurationIsVisible = 0;
|
|
+ defaultConfigurationName = Release;
|
|
+ };
|
|
+/* End XCConfigurationList section */
|
|
+ };
|
|
+ rootObject = 29B97313FDCFA39411CA2CEC /* Project object */;
|
|
+}
|
|
diff --git a/Tools/Playwright/Playwright.xcodeproj/xcshareddata/xcschemes/Playwright.xcscheme b/Tools/Playwright/Playwright.xcodeproj/xcshareddata/xcschemes/Playwright.xcscheme
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..00fb6b0006c743091a8bbf8edb18b21192ea7d6c
|
|
--- /dev/null
|
|
+++ b/Tools/Playwright/Playwright.xcodeproj/xcshareddata/xcschemes/Playwright.xcscheme
|
|
@@ -0,0 +1,78 @@
|
|
+<?xml version="1.0" encoding="UTF-8"?>
|
|
+<Scheme
|
|
+ LastUpgradeVersion = "1140"
|
|
+ version = "1.3">
|
|
+ <BuildAction
|
|
+ parallelizeBuildables = "YES"
|
|
+ buildImplicitDependencies = "YES">
|
|
+ <BuildActionEntries>
|
|
+ <BuildActionEntry
|
|
+ buildForTesting = "YES"
|
|
+ buildForRunning = "YES"
|
|
+ buildForProfiling = "YES"
|
|
+ buildForArchiving = "YES"
|
|
+ buildForAnalyzing = "YES">
|
|
+ <BuildableReference
|
|
+ BuildableIdentifier = "primary"
|
|
+ BlueprintIdentifier = "8D1107260486CEB800E47090"
|
|
+ BuildableName = "Playwright.app"
|
|
+ BlueprintName = "Playwright"
|
|
+ ReferencedContainer = "container:Playwright.xcodeproj">
|
|
+ </BuildableReference>
|
|
+ </BuildActionEntry>
|
|
+ </BuildActionEntries>
|
|
+ </BuildAction>
|
|
+ <TestAction
|
|
+ buildConfiguration = "Debug"
|
|
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
+ shouldUseLaunchSchemeArgsEnv = "YES">
|
|
+ <Testables>
|
|
+ </Testables>
|
|
+ </TestAction>
|
|
+ <LaunchAction
|
|
+ buildConfiguration = "Debug"
|
|
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
+ launchStyle = "0"
|
|
+ useCustomWorkingDirectory = "NO"
|
|
+ ignoresPersistentStateOnLaunch = "NO"
|
|
+ debugDocumentVersioning = "YES"
|
|
+ debugServiceExtension = "internal"
|
|
+ allowLocationSimulation = "YES">
|
|
+ <BuildableProductRunnable
|
|
+ runnableDebuggingMode = "0">
|
|
+ <BuildableReference
|
|
+ BuildableIdentifier = "primary"
|
|
+ BlueprintIdentifier = "8D1107260486CEB800E47090"
|
|
+ BuildableName = "Playwright.app"
|
|
+ BlueprintName = "Playwright"
|
|
+ ReferencedContainer = "container:Playwright.xcodeproj">
|
|
+ </BuildableReference>
|
|
+ </BuildableProductRunnable>
|
|
+ </LaunchAction>
|
|
+ <ProfileAction
|
|
+ buildConfiguration = "Release"
|
|
+ shouldUseLaunchSchemeArgsEnv = "YES"
|
|
+ savedToolIdentifier = ""
|
|
+ useCustomWorkingDirectory = "NO"
|
|
+ debugDocumentVersioning = "YES">
|
|
+ <BuildableProductRunnable
|
|
+ runnableDebuggingMode = "0">
|
|
+ <BuildableReference
|
|
+ BuildableIdentifier = "primary"
|
|
+ BlueprintIdentifier = "8D1107260486CEB800E47090"
|
|
+ BuildableName = "Playwright.app"
|
|
+ BlueprintName = "Playwright"
|
|
+ ReferencedContainer = "container:Playwright.xcodeproj">
|
|
+ </BuildableReference>
|
|
+ </BuildableProductRunnable>
|
|
+ </ProfileAction>
|
|
+ <AnalyzeAction
|
|
+ buildConfiguration = "Debug">
|
|
+ </AnalyzeAction>
|
|
+ <ArchiveAction
|
|
+ buildConfiguration = "Release"
|
|
+ revealArchiveInOrganizer = "YES">
|
|
+ </ArchiveAction>
|
|
+</Scheme>
|
|
diff --git a/Tools/Playwright/mac/AppDelegate.h b/Tools/Playwright/mac/AppDelegate.h
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..41b5751cab626971cd12c5066218c6d14c00fba0
|
|
--- /dev/null
|
|
+++ b/Tools/Playwright/mac/AppDelegate.h
|
|
@@ -0,0 +1,55 @@
|
|
+/*
|
|
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions
|
|
+ * are met:
|
|
+ * 1. Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * 2. Redistributions in binary form must reproduce the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer in the
|
|
+ * documentation and/or other materials provided with the distribution.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
|
|
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
|
|
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
+ * THE POSSIBILITY OF SUCH DAMAGE.
|
|
+ */
|
|
+
|
|
+#import <WebKit/_WKBrowserInspector.h>
|
|
+
|
|
+@interface WebViewDialog : NSObject
|
|
+@property (nonatomic, strong) WKWebView *webView;
|
|
+@property (nonatomic, copy) void (^completionHandler)(BOOL accept, NSString* value);
|
|
+@end
|
|
+
|
|
+@interface BrowserAppDelegate : NSObject <NSApplicationDelegate, WKUIDelegate, _WKBrowserInspectorDelegate> {
|
|
+ NSMutableSet *_browserWindowControllers;
|
|
+ NSMutableSet *_headlessWindows;
|
|
+ NSMutableSet *_browserContexts;
|
|
+ bool _headless;
|
|
+ NSMutableSet *_dialogs;
|
|
+ NSString* _initialURL;
|
|
+ NSString* _userDataDir;
|
|
+ IBOutlet NSMenuItem *_newWebKit2WindowItem;
|
|
+}
|
|
+
|
|
+- (void)browserWindowWillClose:(NSWindow *)window;
|
|
+
|
|
+@property (readonly, nonatomic) WKUserContentController *userContentContoller;
|
|
+@property (readonly, nonatomic) WKPreferences *defaultPreferences;
|
|
+
|
|
+@end
|
|
+
|
|
+@interface NSApplication (PlaywrightApplicationExtensions)
|
|
+
|
|
+- (BrowserAppDelegate *)browserAppDelegate;
|
|
+
|
|
+@end
|
|
diff --git a/Tools/Playwright/mac/AppDelegate.m b/Tools/Playwright/mac/AppDelegate.m
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..84e0cd9c2d20111e936e4b16519d20bcd5aa37db
|
|
--- /dev/null
|
|
+++ b/Tools/Playwright/mac/AppDelegate.m
|
|
@@ -0,0 +1,486 @@
|
|
+/*
|
|
+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions
|
|
+ * are met:
|
|
+ * 1. Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * 2. Redistributions in binary form must reproduce the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer in the
|
|
+ * documentation and/or other materials provided with the distribution.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
|
|
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
|
|
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
+ * THE POSSIBILITY OF SUCH DAMAGE.
|
|
+ */
|
|
+
|
|
+#import "AppDelegate.h"
|
|
+
|
|
+#import "BrowserWindowController.h"
|
|
+#import <WebKit/WKPreferencesPrivate.h>
|
|
+#import <WebKit/WKProcessPoolPrivate.h>
|
|
+#import <WebKit/WKUserContentControllerPrivate.h>
|
|
+#import <WebKit/WKWebViewConfigurationPrivate.h>
|
|
+#import <WebKit/WKWebViewPrivate.h>
|
|
+#import <WebKit/WKWebsiteDataStorePrivate.h>
|
|
+#import <WebKit/WebNSURLExtras.h>
|
|
+#import <WebKit/WebKit.h>
|
|
+#import <WebKit/_WKExperimentalFeature.h>
|
|
+#import <WebKit/_WKInternalDebugFeature.h>
|
|
+#import <WebKit/_WKProcessPoolConfiguration.h>
|
|
+#import <WebKit/_WKWebsiteDataStoreConfiguration.h>
|
|
+
|
|
+enum {
|
|
+ WebKit1NewWindowTag = 1,
|
|
+ WebKit2NewWindowTag = 2,
|
|
+ WebKit1NewEditorTag = 3,
|
|
+ WebKit2NewEditorTag = 4
|
|
+};
|
|
+
|
|
+@implementation NSApplication (PlaywrightApplicationExtensions)
|
|
+
|
|
+- (BrowserAppDelegate *)browserAppDelegate
|
|
+{
|
|
+ return (BrowserAppDelegate *)[self delegate];
|
|
+}
|
|
+
|
|
+@end
|
|
+
|
|
+@interface NSApplication (TouchBar)
|
|
+@property (getter=isAutomaticCustomizeTouchBarMenuItemEnabled) BOOL automaticCustomizeTouchBarMenuItemEnabled;
|
|
+
|
|
+@property (readonly, nonatomic) WKWebViewConfiguration *defaultConfiguration;
|
|
+
|
|
+@end
|
|
+
|
|
+@implementation WebViewDialog
|
|
+@end
|
|
+
|
|
+enum {
|
|
+ _NSBackingStoreUnbuffered = 3
|
|
+};
|
|
+
|
|
+NSString* const ActivityReason = @"Batch headless process";
|
|
+const NSActivityOptions ActivityOptions =
|
|
+ (NSActivityUserInitiatedAllowingIdleSystemSleep |
|
|
+ NSActivityLatencyCritical) &
|
|
+ ~(NSActivitySuddenTerminationDisabled |
|
|
+ NSActivityAutomaticTerminationDisabled);
|
|
+
|
|
+@implementation BrowserAppDelegate
|
|
+
|
|
+- (id)init
|
|
+{
|
|
+ self = [super init];
|
|
+ if (!self)
|
|
+ return nil;
|
|
+
|
|
+ _initialURL = nil;
|
|
+ _userDataDir = nil;
|
|
+ NSArray *arguments = [[NSProcessInfo processInfo] arguments];
|
|
+ NSRange subargs = NSMakeRange(1, [arguments count] - 1);
|
|
+ NSArray *subArray = [arguments subarrayWithRange:subargs];
|
|
+
|
|
+ for (NSString *argument in subArray) {
|
|
+ if (![argument hasPrefix:@"--"])
|
|
+ _initialURL = argument;
|
|
+ if ([argument hasPrefix:@"--user-data-dir="]) {
|
|
+ NSRange range = NSMakeRange(16, [argument length] - 16);
|
|
+ _userDataDir = [[argument substringWithRange:range] copy];
|
|
+ }
|
|
+ }
|
|
+
|
|
+ _headless = [arguments containsObject: @"--headless"];
|
|
+ _browserContexts = [[NSMutableSet alloc] init];
|
|
+
|
|
+ if (_headless) {
|
|
+ _headlessWindows = [[NSMutableSet alloc] init];
|
|
+ [NSApp setActivationPolicy:NSApplicationActivationPolicyAccessory];
|
|
+ [[NSProcessInfo processInfo] beginActivityWithOptions:ActivityOptions
|
|
+ reason:ActivityReason];
|
|
+ _dialogs = [[NSMutableSet alloc] init];
|
|
+ } else {
|
|
+ [NSApp activateIgnoringOtherApps:YES];
|
|
+ _browserWindowControllers = [[NSMutableSet alloc] init];
|
|
+ }
|
|
+ if ([arguments containsObject: @"--inspector-pipe"])
|
|
+ [_WKBrowserInspector initializeRemoteInspectorPipe:self headless:_headless];
|
|
+ return self;
|
|
+}
|
|
+
|
|
+- (void)awakeFromNib
|
|
+{
|
|
+ if ([NSApp respondsToSelector:@selector(setAutomaticCustomizeTouchBarMenuItemEnabled:)])
|
|
+ [NSApp setAutomaticCustomizeTouchBarMenuItemEnabled:YES];
|
|
+}
|
|
+
|
|
+- (WKWebsiteDataStore *)persistentDataStore
|
|
+{
|
|
+ static WKWebsiteDataStore *dataStore;
|
|
+
|
|
+ if (!dataStore) {
|
|
+ _WKWebsiteDataStoreConfiguration *configuration = [[[_WKWebsiteDataStoreConfiguration alloc] init] autorelease];
|
|
+ if (_userDataDir) {
|
|
+ NSURL *cookieFile = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/cookie.db", _userDataDir]];
|
|
+ [configuration _setCookieStorageFile:cookieFile];
|
|
+
|
|
+ NSURL *applicationCacheDirectory = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/ApplicationCache", _userDataDir]];
|
|
+ [configuration setApplicationCacheDirectory:applicationCacheDirectory];
|
|
+
|
|
+ NSURL *cacheStorageDirectory = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/CacheStorage", _userDataDir]];
|
|
+ [configuration _setCacheStorageDirectory:cacheStorageDirectory];
|
|
+
|
|
+ NSURL *indexedDBDirectory = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/IndexedDB", _userDataDir]];
|
|
+ [configuration _setIndexedDBDatabaseDirectory:indexedDBDirectory];
|
|
+
|
|
+ NSURL *localStorageDirectory = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/LocalStorage", _userDataDir]];
|
|
+ [configuration _setWebStorageDirectory:localStorageDirectory];
|
|
+
|
|
+ NSURL *mediaCacheDirectory = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/MediaCache", _userDataDir]];
|
|
+ [configuration setMediaCacheDirectory:mediaCacheDirectory];
|
|
+
|
|
+ NSURL *mediaKeysDirectory = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/MediaKeys", _userDataDir]];
|
|
+ [configuration setMediaKeysStorageDirectory:mediaKeysDirectory];
|
|
+
|
|
+ NSURL *networkCacheDirectory = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/NetworkCache", _userDataDir]];
|
|
+ [configuration setNetworkCacheDirectory:networkCacheDirectory];
|
|
+
|
|
+ NSURL *loadStatsDirectory = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/ResourceLoadStatistics", _userDataDir]];
|
|
+ [configuration _setResourceLoadStatisticsDirectory:loadStatsDirectory];
|
|
+
|
|
+ NSURL *serviceWorkersDirectory = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/ServiceWorkers", _userDataDir]];
|
|
+ [configuration _setServiceWorkerRegistrationDirectory:serviceWorkersDirectory];
|
|
+
|
|
+ NSURL *webSqlDirectory = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/WebSQL", _userDataDir]];
|
|
+ [configuration _setWebSQLDatabaseDirectory:webSqlDirectory];
|
|
+ }
|
|
+ dataStore = [[WKWebsiteDataStore alloc] _initWithConfiguration:configuration];
|
|
+ }
|
|
+
|
|
+ return dataStore;
|
|
+}
|
|
+
|
|
+- (WKWebViewConfiguration *)defaultConfiguration
|
|
+{
|
|
+ static WKWebViewConfiguration *configuration;
|
|
+
|
|
+ if (!configuration) {
|
|
+ configuration = [[WKWebViewConfiguration alloc] init];
|
|
+ configuration.websiteDataStore = [self persistentDataStore];
|
|
+ configuration.preferences._fullScreenEnabled = YES;
|
|
+ configuration.preferences._developerExtrasEnabled = YES;
|
|
+ configuration.preferences._mediaDevicesEnabled = YES;
|
|
+ configuration.preferences._mockCaptureDevicesEnabled = YES;
|
|
+ configuration.preferences._hiddenPageDOMTimerThrottlingEnabled = NO;
|
|
+ configuration.preferences._hiddenPageDOMTimerThrottlingAutoIncreases = NO;
|
|
+ configuration.preferences._pageVisibilityBasedProcessSuppressionEnabled = NO;
|
|
+ configuration.preferences._domTimersThrottlingEnabled = NO;
|
|
+ configuration.preferences._requestAnimationFrameEnabled = YES;
|
|
+ _WKProcessPoolConfiguration *processConfiguration = [[[_WKProcessPoolConfiguration alloc] init] autorelease];
|
|
+ configuration.processPool = [[[WKProcessPool alloc] _initWithConfiguration:processConfiguration AndDataStore:configuration.websiteDataStore] autorelease];
|
|
+ }
|
|
+ return configuration;
|
|
+}
|
|
+
|
|
+- (WKPreferences *)defaultPreferences
|
|
+{
|
|
+ return self.defaultConfiguration.preferences;
|
|
+}
|
|
+
|
|
+- (BrowserWindowController *)createBrowserWindowController:(id)sender
|
|
+{
|
|
+ if (_headless)
|
|
+ return nil;
|
|
+
|
|
+ BrowserWindowController *controller = [[[BrowserWindowController alloc] initWithConfiguration:[self defaultConfiguration]] autorelease];
|
|
+ if (!controller)
|
|
+ return nil;
|
|
+ [_browserWindowControllers addObject:controller];
|
|
+ return controller;
|
|
+}
|
|
+
|
|
+- (IBAction)newWindow:(id)sender
|
|
+{
|
|
+ BrowserWindowController *controller = [self createBrowserWindowController:sender];
|
|
+ if (!controller)
|
|
+ return;
|
|
+
|
|
+ [[controller window] makeKeyAndOrderFront:sender];
|
|
+ [controller loadURLString:@"about:blank"];
|
|
+}
|
|
+
|
|
+- (IBAction)newPrivateWindow:(id)sender
|
|
+{
|
|
+ if (_headless)
|
|
+ return;
|
|
+
|
|
+ WKWebViewConfiguration *privateConfiguraton = [self.defaultConfiguration copy];
|
|
+ privateConfiguraton.websiteDataStore = [WKWebsiteDataStore nonPersistentDataStore];
|
|
+
|
|
+ BrowserWindowController *controller = [[BrowserWindowController alloc] initWithConfiguration:privateConfiguraton];
|
|
+ [privateConfiguraton release];
|
|
+
|
|
+ [[controller window] makeKeyAndOrderFront:sender];
|
|
+ [_browserWindowControllers addObject:controller];
|
|
+
|
|
+ [controller loadURLString:@"about:blank"];
|
|
+}
|
|
+
|
|
+- (void)browserWindowWillClose:(NSWindow *)window
|
|
+{
|
|
+ [_browserWindowControllers removeObject:window.windowController];
|
|
+}
|
|
+
|
|
+- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
|
|
+{
|
|
+ if (_headless) {
|
|
+ [self createNewPage:0];
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ WebHistory *webHistory = [[WebHistory alloc] init];
|
|
+ [WebHistory setOptionalSharedHistory:webHistory];
|
|
+ [webHistory release];
|
|
+
|
|
+ [self _updateNewWindowKeyEquivalents];
|
|
+ if (!_initialURL)
|
|
+ [self newWindow:self];
|
|
+ _initialURL = nil;
|
|
+}
|
|
+
|
|
+- (BrowserWindowController *)frontmostBrowserWindowController
|
|
+{
|
|
+ for (NSWindow* window in [NSApp windows]) {
|
|
+ id delegate = [window delegate];
|
|
+
|
|
+ if (![delegate isKindOfClass:[BrowserWindowController class]])
|
|
+ continue;
|
|
+
|
|
+ BrowserWindowController *controller = (BrowserWindowController *)delegate;
|
|
+ assert([_browserWindowControllers containsObject:controller]);
|
|
+ return controller;
|
|
+ }
|
|
+
|
|
+ return nil;
|
|
+}
|
|
+
|
|
+- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
|
|
+{
|
|
+ BrowserWindowController *controller = [self createBrowserWindowController:nil];
|
|
+ if (!controller)
|
|
+ return NO;
|
|
+
|
|
+ [controller.window makeKeyAndOrderFront:self];
|
|
+ [controller loadURLString:_initialURL ? _initialURL : [NSURL fileURLWithPath:filename].absoluteString];
|
|
+ return YES;
|
|
+}
|
|
+
|
|
+- (IBAction)openDocument:(id)sender
|
|
+{
|
|
+ if (_headless)
|
|
+ return;
|
|
+
|
|
+ BrowserWindowController *browserWindowController = [self frontmostBrowserWindowController];
|
|
+
|
|
+ if (browserWindowController) {
|
|
+ NSOpenPanel *openPanel = [[NSOpenPanel openPanel] retain];
|
|
+ [openPanel beginSheetModalForWindow:browserWindowController.window completionHandler:^(NSInteger result) {
|
|
+ if (result != NSModalResponseOK)
|
|
+ return;
|
|
+
|
|
+ NSURL *url = [openPanel.URLs objectAtIndex:0];
|
|
+ [browserWindowController loadURLString:[url absoluteString]];
|
|
+ }];
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ NSOpenPanel *openPanel = [NSOpenPanel openPanel];
|
|
+ [openPanel beginWithCompletionHandler:^(NSInteger result) {
|
|
+ if (result != NSModalResponseOK)
|
|
+ return;
|
|
+
|
|
+ BrowserWindowController *controller = [self createBrowserWindowController:nil];
|
|
+ [controller.window makeKeyAndOrderFront:self];
|
|
+
|
|
+ NSURL *url = [openPanel.URLs objectAtIndex:0];
|
|
+ [controller loadURLString:[url absoluteString]];
|
|
+ }];
|
|
+}
|
|
+
|
|
+- (void)_updateNewWindowKeyEquivalents
|
|
+{
|
|
+ NSString *normalWindowEquivalent = @"n";
|
|
+ _newWebKit2WindowItem.keyEquivalentModifierMask = NSEventModifierFlagCommand;
|
|
+ _newWebKit2WindowItem.keyEquivalent = normalWindowEquivalent;
|
|
+}
|
|
+
|
|
+- (WKUserContentController *)userContentContoller
|
|
+{
|
|
+ return self.defaultConfiguration.userContentController;
|
|
+}
|
|
+
|
|
+#pragma mark WKBrowserInspectorDelegate
|
|
+
|
|
+- (WKWebViewConfiguration *) sessionConfiguration:(uint64_t)sessionID
|
|
+{
|
|
+ for (_WKBrowserContext *browserContext in _browserContexts) {
|
|
+ if ([[browserContext dataStore] sessionID] != sessionID)
|
|
+ continue;
|
|
+ WKWebViewConfiguration *configuration = [[[self defaultConfiguration] copy] autorelease];
|
|
+ configuration.websiteDataStore = [browserContext dataStore];
|
|
+ configuration.processPool = [browserContext processPool];
|
|
+ return configuration;
|
|
+ }
|
|
+ return [self defaultConfiguration];
|
|
+}
|
|
+
|
|
+- (WKWebView *)createNewPage:(uint64_t)sessionID
|
|
+{
|
|
+ if (_headless)
|
|
+ return [self createHeadlessPage:sessionID];
|
|
+
|
|
+ WKWebViewConfiguration *configuration = [self sessionConfiguration:sessionID];
|
|
+ BrowserWindowController *controller = [[[BrowserWindowController alloc] initWithConfiguration:configuration] autorelease];
|
|
+ if (!controller)
|
|
+ return nil;
|
|
+ [[controller window] makeKeyAndOrderFront:nil];
|
|
+ [_browserWindowControllers addObject:controller];
|
|
+ [controller loadURLString:@"about:blank"];
|
|
+ return [controller webView];
|
|
+}
|
|
+
|
|
+- (WKWebView *)createHeadlessWebView:(WKWebViewConfiguration *)configuration
|
|
+{
|
|
+ NSRect rect = NSMakeRect(0, 0, 1024, 768);
|
|
+ NSScreen *firstScreen = [[NSScreen screens] objectAtIndex:0];
|
|
+ NSRect windowRect = NSOffsetRect(rect, -10000, [firstScreen frame].size.height - rect.size.height + 10000);
|
|
+ NSWindow* window = [[NSWindow alloc] initWithContentRect:windowRect styleMask:NSWindowStyleMaskBorderless backing:(NSBackingStoreType)_NSBackingStoreUnbuffered defer:YES];
|
|
+
|
|
+ WKWebView* webView = [[WKWebView alloc] initWithFrame:[window.contentView bounds] configuration:configuration];
|
|
+ webView._windowOcclusionDetectionEnabled = NO;
|
|
+ if (!webView)
|
|
+ return nil;
|
|
+
|
|
+ webView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
|
|
+ [window.contentView addSubview:webView];
|
|
+ NSURL *url = [NSURL _webkit_URLWithUserTypedString:_initialURL ? _initialURL : @"about:blank"];
|
|
+ _initialURL = nil;
|
|
+ [webView loadRequest:[NSURLRequest requestWithURL:url]];
|
|
+ [_headlessWindows addObject:window];
|
|
+ webView.UIDelegate = self;
|
|
+ return [webView autorelease];
|
|
+}
|
|
+
|
|
+- (WKWebView *)createHeadlessPage:(uint64_t)sessionID
|
|
+{
|
|
+ WKWebViewConfiguration *configuration = [self sessionConfiguration:sessionID];
|
|
+ return [self createHeadlessWebView:configuration];
|
|
+}
|
|
+
|
|
+- (_WKBrowserContext *)createBrowserContext
|
|
+{
|
|
+ _WKBrowserContext *browserContext = [[_WKBrowserContext alloc] init];
|
|
+ _WKProcessPoolConfiguration *processConfiguration = [[[_WKProcessPoolConfiguration alloc] init] autorelease];
|
|
+ browserContext.dataStore = [WKWebsiteDataStore nonPersistentDataStore];
|
|
+ browserContext.processPool = [[[WKProcessPool alloc] _initWithConfiguration:processConfiguration] autorelease];
|
|
+ [_browserContexts addObject:browserContext];
|
|
+ return browserContext;
|
|
+}
|
|
+
|
|
+- (void)deleteBrowserContext:(uint64_t)sessionID
|
|
+{
|
|
+ for (_WKBrowserContext *browserContext in _browserContexts) {
|
|
+ if ([[browserContext dataStore] sessionID] != sessionID)
|
|
+ continue;
|
|
+ [_browserContexts removeObject:browserContext];
|
|
+ return;
|
|
+ }
|
|
+}
|
|
+
|
|
+- (void)quit
|
|
+{
|
|
+ [NSApp performSelector:@selector(terminate:) withObject:nil afterDelay:0.0];
|
|
+}
|
|
+
|
|
+#pragma mark WKUIDelegate
|
|
+
|
|
+- (void)webViewDidClose:(WKWebView *)webView {
|
|
+ for (NSWindow *window in _headlessWindows) {
|
|
+ if (webView.window != window)
|
|
+ continue;
|
|
+ [webView removeFromSuperview];
|
|
+ [window close];
|
|
+ [_headlessWindows removeObject:window];
|
|
+ break;
|
|
+ }
|
|
+}
|
|
+
|
|
+- (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(void))completionHandler
|
|
+{
|
|
+ WebViewDialog* dialog = [[WebViewDialog alloc] autorelease];
|
|
+ dialog.webView = webView;
|
|
+ dialog.completionHandler = ^void (BOOL accept, NSString* value) {
|
|
+ completionHandler();
|
|
+ [_dialogs removeObject:dialog];
|
|
+ };
|
|
+ [_dialogs addObject:dialog];
|
|
+}
|
|
+
|
|
+- (void)webView:(WKWebView *)webView runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(BOOL result))completionHandler
|
|
+{
|
|
+ WebViewDialog* dialog = [[WebViewDialog alloc] autorelease];
|
|
+ dialog.webView = webView;
|
|
+ dialog.completionHandler = ^void (BOOL accept, NSString* value) {
|
|
+ completionHandler(accept);
|
|
+ [_dialogs removeObject:dialog];
|
|
+ };
|
|
+ [_dialogs addObject:dialog];
|
|
+}
|
|
+
|
|
+- (void)webView:(WKWebView *)webView runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(NSString *result))completionHandler
|
|
+{
|
|
+ WebViewDialog* dialog = [[WebViewDialog alloc] autorelease];
|
|
+ dialog.webView = webView;
|
|
+ dialog.completionHandler = ^void (BOOL accept, NSString* value) {
|
|
+ completionHandler(accept && value ? value : nil);
|
|
+ [_dialogs removeObject:dialog];
|
|
+ };
|
|
+ [_dialogs addObject:dialog];
|
|
+}
|
|
+
|
|
+- (void)_webView:(WKWebView *)webView runBeforeUnloadConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(BOOL result))completionHandler
|
|
+{
|
|
+ WebViewDialog* dialog = [[WebViewDialog alloc] autorelease];
|
|
+ dialog.webView = webView;
|
|
+ dialog.completionHandler = ^void (BOOL accept, NSString* value) {
|
|
+ completionHandler(accept);
|
|
+ [_dialogs removeObject:dialog];
|
|
+ };
|
|
+ [_dialogs addObject:dialog];
|
|
+}
|
|
+
|
|
+- (void)webView:(WKWebView *)webView handleJavaScriptDialog:(BOOL)accept value:(NSString *)value
|
|
+{
|
|
+ for (WebViewDialog *dialog in _dialogs) {
|
|
+ if (dialog.webView != webView)
|
|
+ continue;
|
|
+ dialog.completionHandler(accept, value);
|
|
+ break;
|
|
+ }
|
|
+}
|
|
+
|
|
+- (nullable WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures
|
|
+{
|
|
+ return [self createHeadlessWebView:configuration];
|
|
+}
|
|
+
|
|
+@end
|
|
diff --git a/Tools/Playwright/mac/BrowserWindow.xib b/Tools/Playwright/mac/BrowserWindow.xib
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..f6f3d8e3a0f163e61b2f3d54819e9d25a0a3eb75
|
|
--- /dev/null
|
|
+++ b/Tools/Playwright/mac/BrowserWindow.xib
|
|
@@ -0,0 +1,153 @@
|
|
+<?xml version="1.0" encoding="UTF-8"?>
|
|
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11191" systemVersion="16D17a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
|
|
+ <dependencies>
|
|
+ <deployment identifier="macosx"/>
|
|
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11191"/>
|
|
+ </dependencies>
|
|
+ <objects>
|
|
+ <customObject id="-2" userLabel="File's Owner" customClass="BrowserWindowController">
|
|
+ <connections>
|
|
+ <outlet property="backButton" destination="40" id="46"/>
|
|
+ <outlet property="containerView" destination="9" id="37"/>
|
|
+ <outlet property="forwardButton" destination="42" id="47"/>
|
|
+ <outlet property="progressIndicator" destination="21" id="33"/>
|
|
+ <outlet property="reloadButton" destination="23" id="34"/>
|
|
+ <outlet property="share" destination="1hB-AH-eUl" id="si4-8e-DsM"/>
|
|
+ <outlet property="toggleUseShrinkToFitButton" destination="82" id="9w7-AB-Ye3"/>
|
|
+ <outlet property="toolbar" destination="48" id="67"/>
|
|
+ <outlet property="urlText" destination="10" id="32"/>
|
|
+ <outlet property="window" destination="1" id="3"/>
|
|
+ </connections>
|
|
+ </customObject>
|
|
+ <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
|
+ <customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
|
+ <window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" frameAutosaveName="Main Window" animationBehavior="default" id="1">
|
|
+ <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" unifiedTitleAndToolbar="YES" fullSizeContentView="YES"/>
|
|
+ <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
|
+ <rect key="contentRect" x="517" y="330" width="776" height="608"/>
|
|
+ <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1177"/>
|
|
+ <view key="contentView" id="2">
|
|
+ <rect key="frame" x="0.0" y="0.0" width="776" height="608"/>
|
|
+ <autoresizingMask key="autoresizingMask"/>
|
|
+ <subviews>
|
|
+ <customView id="9">
|
|
+ <rect key="frame" x="0.0" y="0.0" width="776" height="608"/>
|
|
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
|
+ </customView>
|
|
+ </subviews>
|
|
+ </view>
|
|
+ <toolbar key="toolbar" implicitIdentifier="994A0CB1-7575-4F39-A65B-7165AB1E8015" displayMode="iconOnly" sizeMode="regular" id="48">
|
|
+ <allowedToolbarItems>
|
|
+ <toolbarItem implicitItemIdentifier="73DE9F4B-73E2-4036-A134-2D9E029DA980" label="Go Back" paletteLabel="Go Back" image="NSGoLeftTemplate" id="56" customClass="MBToolbarItem">
|
|
+ <nil key="toolTip"/>
|
|
+ <size key="minSize" width="32" height="27"/>
|
|
+ <size key="maxSize" width="32" height="25"/>
|
|
+ <button key="view" verticalHuggingPriority="750" id="40">
|
|
+ <rect key="frame" x="10" y="14" width="32" height="25"/>
|
|
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
|
+ <buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="NSGoLeftTemplate" imagePosition="overlaps" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="41">
|
|
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
|
+ <font key="font" metaFont="system"/>
|
|
+ </buttonCell>
|
|
+ </button>
|
|
+ <connections>
|
|
+ <action selector="goBack:" target="-2" id="61"/>
|
|
+ </connections>
|
|
+ </toolbarItem>
|
|
+ <toolbarItem implicitItemIdentifier="E1A9D32A-59E3-467B-9ABA-A95780416E69" label="Go Forward" paletteLabel="Go Forward" image="NSGoRightTemplate" id="57" customClass="MBToolbarItem">
|
|
+ <nil key="toolTip"/>
|
|
+ <size key="minSize" width="32" height="27"/>
|
|
+ <size key="maxSize" width="32" height="27"/>
|
|
+ <button key="view" verticalHuggingPriority="750" id="42">
|
|
+ <rect key="frame" x="18" y="14" width="32" height="25"/>
|
|
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
|
+ <buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="NSGoRightTemplate" imagePosition="overlaps" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="43">
|
|
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
|
+ <font key="font" metaFont="system"/>
|
|
+ </buttonCell>
|
|
+ </button>
|
|
+ <connections>
|
|
+ <action selector="goForward:" target="-2" id="62"/>
|
|
+ </connections>
|
|
+ </toolbarItem>
|
|
+ <toolbarItem implicitItemIdentifier="88C16109-D40F-4682-BCE4-CBEE2EDE32D2" label="Refresh" paletteLabel="Refresh" image="NSRefreshTemplate" id="58" customClass="MBToolbarItem">
|
|
+ <nil key="toolTip"/>
|
|
+ <size key="minSize" width="29" height="27"/>
|
|
+ <size key="maxSize" width="29" height="27"/>
|
|
+ <button key="view" verticalHuggingPriority="750" id="23">
|
|
+ <rect key="frame" x="10" y="14" width="29" height="25"/>
|
|
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
|
+ <buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="NSRefreshTemplate" imagePosition="overlaps" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="24">
|
|
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
|
+ <font key="font" metaFont="system"/>
|
|
+ </buttonCell>
|
|
+ <connections>
|
|
+ <action selector="reload:" target="-2" id="35"/>
|
|
+ </connections>
|
|
+ </button>
|
|
+ </toolbarItem>
|
|
+ <toolbarItem implicitItemIdentifier="F1738B7F-895C-48F7-955D-0915E150BE1B" label="Share" paletteLabel="Share" image="NSShareTemplate" id="dJx-dw-gcC" customClass="MBToolbarItem">
|
|
+ <nil key="toolTip"/>
|
|
+ <size key="minSize" width="29" height="27"/>
|
|
+ <size key="maxSize" width="29" height="27"/>
|
|
+ <button key="view" verticalHuggingPriority="750" id="1hB-AH-eUl">
|
|
+ <rect key="frame" x="5" y="14" width="29" height="25"/>
|
|
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
|
+ <buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="NSShareTemplate" imagePosition="overlaps" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="S1v-UD-QhI">
|
|
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
|
+ <font key="font" metaFont="system"/>
|
|
+ <connections>
|
|
+ <action selector="share:" target="-2" id="5e3-hg-bKN"/>
|
|
+ </connections>
|
|
+ </buttonCell>
|
|
+ </button>
|
|
+ </toolbarItem>
|
|
+ <toolbarItem implicitItemIdentifier="255D29F2-C9AA-4B4B-BB43-B38FCD6A0BBB" label="Location" paletteLabel="Location" id="59">
|
|
+ <nil key="toolTip"/>
|
|
+ <size key="minSize" width="200" height="22"/>
|
|
+ <size key="maxSize" width="100000" height="22"/>
|
|
+ <textField key="view" verticalHuggingPriority="750" id="10">
|
|
+ <rect key="frame" x="0.0" y="14" width="565" height="22"/>
|
|
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
|
+ <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="11">
|
|
+ <font key="font" metaFont="system"/>
|
|
+ <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
|
+ <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
|
+ </textFieldCell>
|
|
+ <connections>
|
|
+ <action selector="fetch:" target="-2" id="36"/>
|
|
+ </connections>
|
|
+ </textField>
|
|
+ </toolbarItem>
|
|
+ <toolbarItem implicitItemIdentifier="86912BAA-B8D0-400F-BFEE-71FC166986E6" label="Progress" paletteLabel="Progress" tag="-1" id="60">
|
|
+ <nil key="toolTip"/>
|
|
+ <size key="minSize" width="16" height="16"/>
|
|
+ <size key="maxSize" width="16" height="16"/>
|
|
+ <progressIndicator key="view" horizontalHuggingPriority="750" verticalHuggingPriority="750" maxValue="1" displayedWhenStopped="NO" bezeled="NO" controlSize="small" style="spinning" id="21">
|
|
+ <rect key="frame" x="19" y="14" width="16" height="16"/>
|
|
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
|
|
+ </progressIndicator>
|
|
+ </toolbarItem>
|
|
+ </allowedToolbarItems>
|
|
+ <defaultToolbarItems>
|
|
+ <toolbarItem reference="56"/>
|
|
+ <toolbarItem reference="57"/>
|
|
+ <toolbarItem reference="58"/>
|
|
+ <toolbarItem reference="59"/>
|
|
+ <toolbarItem reference="60"/>
|
|
+ <toolbarItem reference="dJx-dw-gcC"/>
|
|
+ </defaultToolbarItems>
|
|
+ </toolbar>
|
|
+ <connections>
|
|
+ <outlet property="delegate" destination="-2" id="4"/>
|
|
+ </connections>
|
|
+ </window>
|
|
+ </objects>
|
|
+ <resources>
|
|
+ <image name="NSEnterFullScreenTemplate" width="15" height="15"/>
|
|
+ <image name="NSGoLeftTemplate" width="9" height="12"/>
|
|
+ <image name="NSGoRightTemplate" width="9" height="12"/>
|
|
+ <image name="NSRefreshTemplate" width="11" height="15"/>
|
|
+ <image name="NSShareTemplate" width="11" height="16"/>
|
|
+ </resources>
|
|
+</document>
|
|
diff --git a/Tools/Playwright/mac/BrowserWindowController.h b/Tools/Playwright/mac/BrowserWindowController.h
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..4dbf13c8fb31a745ae8e1965a457d4fbcd8e5866
|
|
--- /dev/null
|
|
+++ b/Tools/Playwright/mac/BrowserWindowController.h
|
|
@@ -0,0 +1,46 @@
|
|
+/*
|
|
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions
|
|
+ * are met:
|
|
+ * 1. Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * 2. Redistributions in binary form must reproduce the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer in the
|
|
+ * documentation and/or other materials provided with the distribution.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
|
|
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
|
|
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
+ * THE POSSIBILITY OF SUCH DAMAGE.
|
|
+ */
|
|
+
|
|
+@class WKWebView;
|
|
+
|
|
+@interface BrowserWindowController : NSWindowController
|
|
+
|
|
+- (IBAction)goBack:(id)sender;
|
|
+- (IBAction)goForward:(id)sender;
|
|
+- (IBAction)reload:(id)sender;
|
|
+- (IBAction)saveAsPDF:(id)sender;
|
|
+- (IBAction)saveAsWebArchive:(id)sender;
|
|
+- (IBAction)zoomIn:(id)sender;
|
|
+- (IBAction)zoomOut:(id)sender;
|
|
+- (IBAction)resetZoom:(id)sender;
|
|
+- (IBAction)showHideWebInspector:(id)sender;
|
|
+
|
|
+- (IBAction)setPageScale:(id)sender;
|
|
+- (IBAction)setViewScale:(id)sender;
|
|
+- (instancetype)initWithConfiguration:(WKWebViewConfiguration *)configuration;
|
|
+- (void)loadURLString:(NSString *)urlString;
|
|
+- (WKWebView *)webView;
|
|
+
|
|
+@end
|
|
diff --git a/Tools/Playwright/mac/BrowserWindowController.m b/Tools/Playwright/mac/BrowserWindowController.m
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..7a745879d076017df30afd77ded881ddbc19bb45
|
|
--- /dev/null
|
|
+++ b/Tools/Playwright/mac/BrowserWindowController.m
|
|
@@ -0,0 +1,834 @@
|
|
+/*
|
|
+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions
|
|
+ * are met:
|
|
+ * 1. Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * 2. Redistributions in binary form must reproduce the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer in the
|
|
+ * documentation and/or other materials provided with the distribution.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
|
|
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
|
|
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
+ * THE POSSIBILITY OF SUCH DAMAGE.
|
|
+ */
|
|
+
|
|
+#import "BrowserWindowController.h"
|
|
+
|
|
+#import "AppDelegate.h"
|
|
+#import <WebKit/WKFrameInfo.h>
|
|
+#import <WebKit/WKNavigationActionPrivate.h>
|
|
+#import <WebKit/WKNavigationDelegate.h>
|
|
+#import <WebKit/WKPreferencesPrivate.h>
|
|
+#import <WebKit/WKUIDelegate.h>
|
|
+#import <WebKit/WKUIDelegatePrivate.h>
|
|
+#import <WebKit/WKWebViewConfigurationPrivate.h>
|
|
+#import <WebKit/WKWebViewPrivate.h>
|
|
+#import <WebKit/WKWebViewPrivateForTesting.h>
|
|
+#import <WebKit/WKWebsiteDataStorePrivate.h>
|
|
+#import <WebKit/WebNSURLExtras.h>
|
|
+#import <WebKit/_WKIconLoadingDelegate.h>
|
|
+#import <WebKit/_WKInspector.h>
|
|
+#import <WebKit/_WKLinkIconParameters.h>
|
|
+#import <WebKit/_WKUserInitiatedAction.h>
|
|
+
|
|
+static void* keyValueObservingContext = &keyValueObservingContext;
|
|
+
|
|
+@interface PlaywrightNSTextFinder : NSTextFinder
|
|
+
|
|
+@property (nonatomic, copy) dispatch_block_t hideInterfaceCallback;
|
|
+
|
|
+@end
|
|
+
|
|
+@implementation PlaywrightNSTextFinder
|
|
+
|
|
+- (void)performAction:(NSTextFinderAction)op
|
|
+{
|
|
+ [super performAction:op];
|
|
+
|
|
+ if (op == NSTextFinderActionHideFindInterface && _hideInterfaceCallback)
|
|
+ _hideInterfaceCallback();
|
|
+}
|
|
+
|
|
+@end
|
|
+
|
|
+@interface BrowserWindowController () <NSTextFinderBarContainer, WKNavigationDelegate, WKUIDelegate, _WKIconLoadingDelegate, NSSharingServicePickerDelegate, NSSharingServiceDelegate>
|
|
+@end
|
|
+
|
|
+@implementation BrowserWindowController {
|
|
+ IBOutlet NSProgressIndicator *progressIndicator;
|
|
+ IBOutlet NSButton *reloadButton;
|
|
+ IBOutlet NSButton *backButton;
|
|
+ IBOutlet NSButton *forwardButton;
|
|
+ IBOutlet NSButton *share;
|
|
+ IBOutlet NSToolbar *toolbar;
|
|
+ IBOutlet NSTextField *urlText;
|
|
+ IBOutlet NSView *containerView;
|
|
+ IBOutlet NSButton *toggleUseShrinkToFitButton;
|
|
+
|
|
+ WKWebViewConfiguration *_configuration;
|
|
+ WKWebView *_webView;
|
|
+ BOOL _zoomTextOnly;
|
|
+ BOOL _isPrivateBrowsingWindow;
|
|
+ NSAlert* _alert;
|
|
+
|
|
+ BOOL _useShrinkToFit;
|
|
+
|
|
+ PlaywrightNSTextFinder *_textFinder;
|
|
+ NSView *_textFindBarView;
|
|
+ BOOL _findBarVisible;
|
|
+}
|
|
+
|
|
+- (id)initWithWindow:(NSWindow *)window
|
|
+{
|
|
+ self = [super initWithWindow:window];
|
|
+ return self;
|
|
+}
|
|
+
|
|
+- (void)windowDidLoad
|
|
+{
|
|
+ [share sendActionOn:NSEventMaskLeftMouseDown];
|
|
+ [super windowDidLoad];
|
|
+}
|
|
+
|
|
+- (IBAction)openLocation:(id)sender
|
|
+{
|
|
+ [[self window] makeFirstResponder:urlText];
|
|
+}
|
|
+
|
|
+- (NSString *)addProtocolIfNecessary:(NSString *)address
|
|
+{
|
|
+ if ([address rangeOfString:@"://"].length > 0)
|
|
+ return address;
|
|
+
|
|
+ if ([address hasPrefix:@"data:"])
|
|
+ return address;
|
|
+
|
|
+ if ([address hasPrefix:@"about:"])
|
|
+ return address;
|
|
+
|
|
+ return [@"http://" stringByAppendingString:address];
|
|
+}
|
|
+
|
|
+- (IBAction)share:(id)sender
|
|
+{
|
|
+ NSSharingServicePicker *picker = [[NSSharingServicePicker alloc] initWithItems:@[ self.currentURL ]];
|
|
+ picker.delegate = self;
|
|
+ [picker showRelativeToRect:NSZeroRect ofView:sender preferredEdge:NSRectEdgeMinY];
|
|
+}
|
|
+
|
|
+- (IBAction)showHideWebView:(id)sender
|
|
+{
|
|
+ self.mainContentView.hidden = !self.mainContentView.isHidden;
|
|
+}
|
|
+
|
|
+- (CGFloat)pageScaleForMenuItemTag:(NSInteger)tag
|
|
+{
|
|
+ if (tag == 1)
|
|
+ return 1;
|
|
+ if (tag == 2)
|
|
+ return 1.25;
|
|
+ if (tag == 3)
|
|
+ return 1.5;
|
|
+ if (tag == 4)
|
|
+ return 2.0;
|
|
+
|
|
+ return 1;
|
|
+}
|
|
+
|
|
+- (void)awakeFromNib
|
|
+{
|
|
+ self.window.styleMask &= ~NSWindowStyleMaskFullSizeContentView;
|
|
+
|
|
+ _webView = [[WKWebView alloc] initWithFrame:[containerView bounds] configuration:_configuration];
|
|
+ _webView._windowOcclusionDetectionEnabled = NO;
|
|
+
|
|
+ _webView.allowsMagnification = YES;
|
|
+ _webView.allowsBackForwardNavigationGestures = YES;
|
|
+
|
|
+ [_webView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
|
|
+ [containerView addSubview:_webView];
|
|
+
|
|
+ [progressIndicator bind:NSHiddenBinding toObject:_webView withKeyPath:@"loading" options:@{ NSValueTransformerNameBindingOption : NSNegateBooleanTransformerName }];
|
|
+ [progressIndicator bind:NSValueBinding toObject:_webView withKeyPath:@"estimatedProgress" options:nil];
|
|
+
|
|
+ [_webView addObserver:self forKeyPath:@"title" options:0 context:keyValueObservingContext];
|
|
+ [_webView addObserver:self forKeyPath:@"URL" options:0 context:keyValueObservingContext];
|
|
+
|
|
+ _webView.navigationDelegate = self;
|
|
+ _webView.UIDelegate = self;
|
|
+
|
|
+ _webView._observedRenderingProgressEvents = _WKRenderingProgressEventFirstLayout
|
|
+ | _WKRenderingProgressEventFirstVisuallyNonEmptyLayout
|
|
+ | _WKRenderingProgressEventFirstPaintWithSignificantArea
|
|
+ | _WKRenderingProgressEventFirstLayoutAfterSuppressedIncrementalRendering
|
|
+ | _WKRenderingProgressEventFirstPaintAfterSuppressedIncrementalRendering;
|
|
+
|
|
+ _webView.customUserAgent = @"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15";
|
|
+
|
|
+ _webView._usePlatformFindUI = NO;
|
|
+
|
|
+ _textFinder = [[PlaywrightNSTextFinder alloc] init];
|
|
+ _textFinder.incrementalSearchingEnabled = YES;
|
|
+ _textFinder.incrementalSearchingShouldDimContentView = NO;
|
|
+ _textFinder.client = _webView;
|
|
+ _textFinder.findBarContainer = self;
|
|
+ _textFinder.hideInterfaceCallback = ^{
|
|
+ [_webView _hideFindUI];
|
|
+ };
|
|
+
|
|
+ _zoomTextOnly = NO;
|
|
+}
|
|
+
|
|
+- (instancetype)initWithConfiguration:(WKWebViewConfiguration *)configuration
|
|
+{
|
|
+ if (!(self = [super initWithWindowNibName:@"BrowserWindow"]))
|
|
+ return nil;
|
|
+ _configuration = [configuration copy];
|
|
+ _isPrivateBrowsingWindow = !_configuration.websiteDataStore.isPersistent;
|
|
+ return self;
|
|
+}
|
|
+
|
|
+- (void)dealloc
|
|
+{
|
|
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
+
|
|
+ [progressIndicator unbind:NSHiddenBinding];
|
|
+ [progressIndicator unbind:NSValueBinding];
|
|
+
|
|
+ [_textFinder release];
|
|
+ [_webView release];
|
|
+ [_configuration release];
|
|
+
|
|
+ [super dealloc];
|
|
+}
|
|
+
|
|
+- (IBAction)fetch:(id)sender
|
|
+{
|
|
+ [urlText setStringValue:[self addProtocolIfNecessary:urlText.stringValue]];
|
|
+ NSURL *url = [NSURL _webkit_URLWithUserTypedString:urlText.stringValue];
|
|
+ [_webView loadRequest:[NSURLRequest requestWithURL:url]];
|
|
+}
|
|
+
|
|
+- (IBAction)setPageScale:(id)sender
|
|
+{
|
|
+ CGFloat scale = [self pageScaleForMenuItemTag:[sender tag]];
|
|
+ [_webView _setPageScale:scale withOrigin:CGPointZero];
|
|
+}
|
|
+
|
|
+- (CGFloat)viewScaleForMenuItemTag:(NSInteger)tag
|
|
+{
|
|
+ if (tag == 1)
|
|
+ return 1;
|
|
+ if (tag == 2)
|
|
+ return 0.75;
|
|
+ if (tag == 3)
|
|
+ return 0.5;
|
|
+ if (tag == 4)
|
|
+ return 0.25;
|
|
+
|
|
+ return 1;
|
|
+}
|
|
+
|
|
+- (IBAction)setViewScale:(id)sender
|
|
+{
|
|
+ CGFloat scale = [self viewScaleForMenuItemTag:[sender tag]];
|
|
+ CGFloat oldScale = [_webView _viewScale];
|
|
+
|
|
+ if (scale == oldScale)
|
|
+ return;
|
|
+
|
|
+ [_webView _setLayoutMode:_WKLayoutModeDynamicSizeComputedFromViewScale];
|
|
+
|
|
+ NSRect oldFrame = self.window.frame;
|
|
+ NSSize newFrameSize = NSMakeSize(oldFrame.size.width * (scale / oldScale), oldFrame.size.height * (scale / oldScale));
|
|
+ [self.window setFrame:NSMakeRect(oldFrame.origin.x, oldFrame.origin.y - (newFrameSize.height - oldFrame.size.height), newFrameSize.width, newFrameSize.height) display:NO animate:NO];
|
|
+
|
|
+ [_webView _setViewScale:scale];
|
|
+}
|
|
+
|
|
+static BOOL areEssentiallyEqual(double a, double b)
|
|
+{
|
|
+ double tolerance = 0.001;
|
|
+ return (fabs(a - b) <= tolerance);
|
|
+}
|
|
+
|
|
+#pragma GCC diagnostic push
|
|
+#pragma GCC diagnostic ignored "-Wdeprecated-implementations"
|
|
+- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
|
|
+#pragma GCC diagnostic pop
|
|
+{
|
|
+ SEL action = menuItem.action;
|
|
+
|
|
+ if (action == @selector(saveAsPDF:))
|
|
+ return YES;
|
|
+ if (action == @selector(saveAsWebArchive:))
|
|
+ return YES;
|
|
+
|
|
+ if (action == @selector(zoomIn:))
|
|
+ return [self canZoomIn];
|
|
+ if (action == @selector(zoomOut:))
|
|
+ return [self canZoomOut];
|
|
+ if (action == @selector(resetZoom:))
|
|
+ return [self canResetZoom];
|
|
+
|
|
+ if (action == @selector(toggleZoomMode:))
|
|
+ [menuItem setState:_zoomTextOnly ? NSControlStateValueOn : NSControlStateValueOff];
|
|
+ else if (action == @selector(showHideWebInspector:))
|
|
+ [menuItem setTitle:_webView._inspector.isVisible ? @"Close Web Inspector" : @"Show Web Inspector"];
|
|
+
|
|
+ if (action == @selector(setPageScale:))
|
|
+ [menuItem setState:areEssentiallyEqual([_webView _pageScale], [self pageScaleForMenuItemTag:[menuItem tag]])];
|
|
+
|
|
+ if (action == @selector(setViewScale:))
|
|
+ [menuItem setState:areEssentiallyEqual([_webView _viewScale], [self viewScaleForMenuItemTag:[menuItem tag]])];
|
|
+
|
|
+ return YES;
|
|
+}
|
|
+
|
|
+- (IBAction)reload:(id)sender
|
|
+{
|
|
+ [_webView reload];
|
|
+}
|
|
+
|
|
+- (IBAction)goBack:(id)sender
|
|
+{
|
|
+ [_webView goBack];
|
|
+}
|
|
+
|
|
+- (IBAction)goForward:(id)sender
|
|
+{
|
|
+ [_webView goForward];
|
|
+}
|
|
+
|
|
+- (IBAction)toggleZoomMode:(id)sender
|
|
+{
|
|
+ if (_zoomTextOnly) {
|
|
+ _zoomTextOnly = NO;
|
|
+ double currentTextZoom = _webView._textZoomFactor;
|
|
+ _webView._textZoomFactor = 1;
|
|
+ _webView.pageZoom = currentTextZoom;
|
|
+ } else {
|
|
+ _zoomTextOnly = YES;
|
|
+ double currentPageZoom = _webView._pageZoomFactor;
|
|
+ _webView._textZoomFactor = currentPageZoom;
|
|
+ _webView.pageZoom = 1;
|
|
+ }
|
|
+}
|
|
+
|
|
+- (IBAction)resetZoom:(id)sender
|
|
+{
|
|
+ if (![self canResetZoom])
|
|
+ return;
|
|
+
|
|
+ if (_zoomTextOnly)
|
|
+ _webView._textZoomFactor = 1;
|
|
+ else
|
|
+ _webView.pageZoom = 1;
|
|
+}
|
|
+
|
|
+- (BOOL)canResetZoom
|
|
+{
|
|
+ return _zoomTextOnly ? (_webView._textZoomFactor != 1) : (_webView.pageZoom != 1);
|
|
+}
|
|
+
|
|
+- (IBAction)showHideWebInspector:(id)sender
|
|
+{
|
|
+ _WKInspector *inspector = _webView._inspector;
|
|
+ if (inspector.isVisible)
|
|
+ [inspector hide];
|
|
+ else
|
|
+ [inspector show];
|
|
+}
|
|
+
|
|
+- (NSURL *)currentURL
|
|
+{
|
|
+ return _webView.URL;
|
|
+}
|
|
+
|
|
+- (NSView *)mainContentView
|
|
+{
|
|
+ return _webView;
|
|
+}
|
|
+
|
|
+- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item
|
|
+{
|
|
+ SEL action = item.action;
|
|
+
|
|
+ if (action == @selector(goBack:) || action == @selector(goForward:))
|
|
+ return [_webView validateUserInterfaceItem:item];
|
|
+
|
|
+ return YES;
|
|
+}
|
|
+
|
|
+- (void)validateToolbar
|
|
+{
|
|
+ [toolbar validateVisibleItems];
|
|
+}
|
|
+
|
|
+- (BOOL)windowShouldClose:(id)sender
|
|
+{
|
|
+ return YES;
|
|
+}
|
|
+
|
|
+- (void)windowWillClose:(NSNotification *)notification
|
|
+{
|
|
+ [[[NSApplication sharedApplication] browserAppDelegate] 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)
|
|
+
|
|
+- (CGFloat)currentZoomFactor
|
|
+{
|
|
+ return _zoomTextOnly ? _webView._textZoomFactor : _webView.pageZoom;
|
|
+}
|
|
+
|
|
+- (void)setCurrentZoomFactor:(CGFloat)factor
|
|
+{
|
|
+ if (_zoomTextOnly)
|
|
+ _webView._textZoomFactor = factor;
|
|
+ else
|
|
+ _webView.pageZoom = factor;
|
|
+}
|
|
+
|
|
+- (BOOL)canZoomIn
|
|
+{
|
|
+ return self.currentZoomFactor * DefaultZoomFactorRatio < DefaultMaximumZoomFactor;
|
|
+}
|
|
+
|
|
+- (void)zoomIn:(id)sender
|
|
+{
|
|
+ if (!self.canZoomIn)
|
|
+ return;
|
|
+
|
|
+ self.currentZoomFactor *= DefaultZoomFactorRatio;
|
|
+}
|
|
+
|
|
+- (BOOL)canZoomOut
|
|
+{
|
|
+ return self.currentZoomFactor / DefaultZoomFactorRatio > DefaultMinimumZoomFactor;
|
|
+}
|
|
+
|
|
+- (void)zoomOut:(id)sender
|
|
+{
|
|
+ if (!self.canZoomIn)
|
|
+ return;
|
|
+
|
|
+ self.currentZoomFactor /= DefaultZoomFactorRatio;
|
|
+}
|
|
+
|
|
+- (void)updateTitle:(NSString *)title
|
|
+{
|
|
+ if (!title) {
|
|
+ NSURL *url = _webView.URL;
|
|
+ title = url.lastPathComponent ?: url._web_userVisibleString;
|
|
+ }
|
|
+
|
|
+ self.window.title = [NSString stringWithFormat:@"%@%@ [%d]%@", _isPrivateBrowsingWindow ? @"🙈 " : @"", title, _webView._webProcessIdentifier, @""];
|
|
+}
|
|
+
|
|
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
|
|
+{
|
|
+ if (context != keyValueObservingContext || object != _webView)
|
|
+ return;
|
|
+
|
|
+ if ([keyPath isEqualToString:@"title"])
|
|
+ [self updateTitle:_webView.title];
|
|
+ else if ([keyPath isEqualToString:@"URL"])
|
|
+ [self updateTextFieldFromURL:_webView.URL];
|
|
+}
|
|
+
|
|
+- (nullable WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures
|
|
+{
|
|
+ BrowserWindowController *controller = [[BrowserWindowController alloc] initWithConfiguration:configuration];
|
|
+ [controller awakeFromNib];
|
|
+ [controller.window makeKeyAndOrderFront:self];
|
|
+
|
|
+ return controller->_webView;
|
|
+}
|
|
+
|
|
+- (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(void))completionHandler
|
|
+{
|
|
+ NSAlert* alert = [[NSAlert alloc] init];
|
|
+
|
|
+ [alert setMessageText:[NSString stringWithFormat:@"JavaScript alert dialog from %@.", [frame.request.URL absoluteString]]];
|
|
+ [alert setInformativeText:message];
|
|
+ [alert addButtonWithTitle:@"OK"];
|
|
+
|
|
+ _alert = alert;
|
|
+ [alert beginSheetModalForWindow:self.window completionHandler:^void (NSModalResponse response) {
|
|
+ completionHandler();
|
|
+ [alert release];
|
|
+ _alert = nil;
|
|
+ }];
|
|
+}
|
|
+
|
|
+- (void)webView:(WKWebView *)webView runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(BOOL result))completionHandler
|
|
+{
|
|
+ NSAlert* alert = [[NSAlert alloc] init];
|
|
+
|
|
+ [alert setMessageText:[NSString stringWithFormat:@"JavaScript confirm dialog from %@.", [frame.request.URL absoluteString]]];
|
|
+ [alert setInformativeText:message];
|
|
+
|
|
+ [alert addButtonWithTitle:@"OK"];
|
|
+ [alert addButtonWithTitle:@"Cancel"];
|
|
+
|
|
+ _alert = alert;
|
|
+ [alert beginSheetModalForWindow:self.window completionHandler:^void (NSModalResponse response) {
|
|
+ completionHandler(response == NSAlertFirstButtonReturn);
|
|
+ [alert release];
|
|
+ _alert = nil;
|
|
+ }];
|
|
+}
|
|
+
|
|
+- (void)webView:(WKWebView *)webView runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(NSString *result))completionHandler
|
|
+{
|
|
+ NSAlert* alert = [[NSAlert alloc] init];
|
|
+
|
|
+ [alert setMessageText:[NSString stringWithFormat:@"JavaScript prompt dialog from %@.", [frame.request.URL absoluteString]]];
|
|
+ [alert setInformativeText:prompt];
|
|
+
|
|
+ [alert addButtonWithTitle:@"OK"];
|
|
+ [alert addButtonWithTitle:@"Cancel"];
|
|
+
|
|
+ NSTextField* input = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 200, 24)];
|
|
+ [input setStringValue:defaultText];
|
|
+ [alert setAccessoryView:input];
|
|
+
|
|
+ _alert = alert;
|
|
+ [alert beginSheetModalForWindow:self.window completionHandler:^void (NSModalResponse response) {
|
|
+ [input validateEditing];
|
|
+ completionHandler(response == NSAlertFirstButtonReturn ? [input stringValue] : nil);
|
|
+ [alert release];
|
|
+ _alert = nil;
|
|
+ }];
|
|
+}
|
|
+
|
|
+- (void)webView:(WKWebView *)webView handleJavaScriptDialog:(BOOL)accept value:(NSString *)value
|
|
+{
|
|
+ if (!_alert)
|
|
+ return;
|
|
+ NSTextField* input = (NSTextField*)_alert.accessoryView;
|
|
+ if (accept && input && value)
|
|
+ [input setStringValue:value];
|
|
+ [self.window endSheet:_alert.window returnCode: accept ? NSAlertFirstButtonReturn : NSModalResponseCancel];
|
|
+}
|
|
+
|
|
+#if __has_feature(objc_generics)
|
|
+- (void)webView:(WKWebView *)webView runOpenPanelWithParameters:(WKOpenPanelParameters *)parameters initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(NSArray<NSURL *> * URLs))completionHandler
|
|
+#else
|
|
+- (void)webView:(WKWebView *)webView runOpenPanelWithParameters:(WKOpenPanelParameters *)parameters initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(NSArray *URLs))completionHandler
|
|
+#endif
|
|
+{
|
|
+ NSOpenPanel *openPanel = [NSOpenPanel openPanel];
|
|
+
|
|
+ openPanel.allowsMultipleSelection = parameters.allowsMultipleSelection;
|
|
+
|
|
+ [openPanel beginSheetModalForWindow:webView.window completionHandler:^(NSInteger result) {
|
|
+ if (result == NSModalResponseOK)
|
|
+ completionHandler(openPanel.URLs);
|
|
+ else
|
|
+ completionHandler(nil);
|
|
+ }];
|
|
+}
|
|
+
|
|
+- (void)_webView:(WebView *)sender runBeforeUnloadConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(BOOL result))completionHandler
|
|
+{
|
|
+ NSAlert *alert = [[NSAlert alloc] init];
|
|
+
|
|
+ alert.messageText = [NSString stringWithFormat:@"JavaScript before unload dialog from %@.", [frame.request.URL absoluteString]];
|
|
+ alert.informativeText = message;
|
|
+
|
|
+ [alert addButtonWithTitle:@"Leave Page"];
|
|
+ [alert addButtonWithTitle:@"Stay On Page"];
|
|
+
|
|
+ [alert beginSheetModalForWindow:self.window completionHandler:^void (NSModalResponse response) {
|
|
+ completionHandler(response == NSAlertFirstButtonReturn);
|
|
+ [alert release];
|
|
+ }];
|
|
+}
|
|
+
|
|
+- (WKDragDestinationAction)_webView:(WKWebView *)webView dragDestinationActionMaskForDraggingInfo:(id)draggingInfo
|
|
+{
|
|
+ return WKDragDestinationActionAny;
|
|
+}
|
|
+
|
|
+- (void)updateTextFieldFromURL:(NSURL *)URL
|
|
+{
|
|
+ if (!URL)
|
|
+ return;
|
|
+
|
|
+ if (!URL.absoluteString.length)
|
|
+ return;
|
|
+
|
|
+ urlText.stringValue = [URL _web_userVisibleString];
|
|
+}
|
|
+
|
|
+- (void)loadURLString:(NSString *)urlString
|
|
+{
|
|
+ // FIXME: We shouldn't have to set the url text here.
|
|
+ [urlText setStringValue:urlString];
|
|
+ [self fetch:nil];
|
|
+}
|
|
+
|
|
+- (void)loadHTMLString:(NSString *)HTMLString
|
|
+{
|
|
+ [_webView loadHTMLString:HTMLString baseURL:nil];
|
|
+}
|
|
+
|
|
+static NSSet *dataTypes()
|
|
+{
|
|
+ return [WKWebsiteDataStore allWebsiteDataTypes];
|
|
+}
|
|
+
|
|
+- (IBAction)fetchWebsiteData:(id)sender
|
|
+{
|
|
+ [_configuration.websiteDataStore _fetchDataRecordsOfTypes:dataTypes() withOptions:_WKWebsiteDataStoreFetchOptionComputeSizes completionHandler:^(NSArray *websiteDataRecords) {
|
|
+ NSLog(@"did fetch website data %@.", websiteDataRecords);
|
|
+ }];
|
|
+}
|
|
+
|
|
+- (IBAction)fetchAndClearWebsiteData:(id)sender
|
|
+{
|
|
+ [_configuration.websiteDataStore fetchDataRecordsOfTypes:dataTypes() completionHandler:^(NSArray *websiteDataRecords) {
|
|
+ [_configuration.websiteDataStore removeDataOfTypes:dataTypes() forDataRecords:websiteDataRecords completionHandler:^{
|
|
+ [_configuration.websiteDataStore fetchDataRecordsOfTypes:dataTypes() completionHandler:^(NSArray *websiteDataRecords) {
|
|
+ NSLog(@"did clear website data, after clearing data is %@.", websiteDataRecords);
|
|
+ }];
|
|
+ }];
|
|
+ }];
|
|
+}
|
|
+
|
|
+- (IBAction)clearWebsiteData:(id)sender
|
|
+{
|
|
+ [_configuration.websiteDataStore removeDataOfTypes:dataTypes() modifiedSince:[NSDate distantPast] completionHandler:^{
|
|
+ NSLog(@"Did clear website data.");
|
|
+ }];
|
|
+}
|
|
+
|
|
+- (IBAction)printWebView:(id)sender
|
|
+{
|
|
+ [[_webView printOperationWithPrintInfo:[NSPrintInfo sharedPrintInfo]] runOperationModalForWindow:self.window delegate:nil didRunSelector:nil contextInfo:nil];
|
|
+}
|
|
+
|
|
+#pragma mark WKNavigationDelegate
|
|
+
|
|
+- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
|
|
+{
|
|
+ LOG(@"decidePolicyForNavigationAction");
|
|
+
|
|
+ if (navigationAction._canHandleRequest) {
|
|
+ decisionHandler(WKNavigationActionPolicyAllow);
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ if (navigationAction._userInitiatedAction && !navigationAction._userInitiatedAction.isConsumed) {
|
|
+ [navigationAction._userInitiatedAction consume];
|
|
+ [[NSWorkspace sharedWorkspace] openURL:navigationAction.request.URL];
|
|
+ }
|
|
+
|
|
+ decisionHandler(WKNavigationActionPolicyCancel);
|
|
+}
|
|
+
|
|
+- (void)webView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler
|
|
+{
|
|
+ LOG(@"decidePolicyForNavigationResponse");
|
|
+ decisionHandler(WKNavigationResponsePolicyAllow);
|
|
+}
|
|
+
|
|
+- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation
|
|
+{
|
|
+ LOG(@"didStartProvisionalNavigation: %@", navigation);
|
|
+}
|
|
+
|
|
+- (void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavigation:(WKNavigation *)navigation
|
|
+{
|
|
+ LOG(@"didReceiveServerRedirectForProvisionalNavigation: %@", navigation);
|
|
+}
|
|
+
|
|
+- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error
|
|
+{
|
|
+ LOG(@"didFailProvisionalNavigation: %@navigation, error: %@", navigation, error);
|
|
+}
|
|
+
|
|
+- (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation
|
|
+{
|
|
+ LOG(@"didCommitNavigation: %@", navigation);
|
|
+ [self updateTitle:nil];
|
|
+}
|
|
+
|
|
+- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
|
|
+{
|
|
+ LOG(@"didFinishNavigation: %@", navigation);
|
|
+}
|
|
+
|
|
+- (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *__nullable credential))completionHandler
|
|
+{
|
|
+ LOG(@"didReceiveAuthenticationChallenge: %@", challenge);
|
|
+ if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodHTTPBasic]) {
|
|
+ NSAlert *alert = [[NSAlert alloc] init];
|
|
+ NSView *container = [[[NSView alloc] initWithFrame:NSMakeRect(0, 0, 200, 48)] autorelease];
|
|
+ NSTextField *userInput = [[[NSTextField alloc] initWithFrame:NSMakeRect(0, 24, 200, 24)] autorelease];
|
|
+ NSTextField *passwordInput = [[[NSSecureTextField alloc] initWithFrame:NSMakeRect(0, 0, 200, 24)] autorelease];
|
|
+
|
|
+ [alert setMessageText:[NSString stringWithFormat:@"Log in to %@:%lu.", challenge.protectionSpace.host, challenge.protectionSpace.port]];
|
|
+ [alert addButtonWithTitle:@"Log in"];
|
|
+ [alert addButtonWithTitle:@"Cancel"];
|
|
+ [container addSubview:userInput];
|
|
+ [container addSubview:passwordInput];
|
|
+ [alert setAccessoryView:container];
|
|
+ [userInput setNextKeyView:passwordInput];
|
|
+ [alert.window setInitialFirstResponder:userInput];
|
|
+
|
|
+ [alert beginSheetModalForWindow:self.window completionHandler:^(NSModalResponse response) {
|
|
+ [userInput validateEditing];
|
|
+ if (response == NSAlertFirstButtonReturn)
|
|
+ completionHandler(NSURLSessionAuthChallengeUseCredential, [[[NSURLCredential alloc] initWithUser:[userInput stringValue] password:[passwordInput stringValue] persistence:NSURLCredentialPersistenceForSession] autorelease]);
|
|
+ else
|
|
+ completionHandler(NSURLSessionAuthChallengeRejectProtectionSpace, nil);
|
|
+ [alert release];
|
|
+ }];
|
|
+ return;
|
|
+ }
|
|
+ completionHandler(NSURLSessionAuthChallengeRejectProtectionSpace, nil);
|
|
+}
|
|
+
|
|
+- (void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error
|
|
+{
|
|
+ LOG(@"didFailNavigation: %@, error %@", navigation, error);
|
|
+}
|
|
+
|
|
+- (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView
|
|
+{
|
|
+ NSLog(@"WebContent process crashed; reloading");
|
|
+ [self reload:nil];
|
|
+}
|
|
+
|
|
+- (void)_webView:(WKWebView *)webView renderingProgressDidChange:(_WKRenderingProgressEvents)progressEvents
|
|
+{
|
|
+ if (progressEvents & _WKRenderingProgressEventFirstLayout)
|
|
+ LOG(@"renderingProgressDidChange: %@", @"first layout");
|
|
+
|
|
+ if (progressEvents & _WKRenderingProgressEventFirstVisuallyNonEmptyLayout)
|
|
+ LOG(@"renderingProgressDidChange: %@", @"first visually non-empty layout");
|
|
+
|
|
+ if (progressEvents & _WKRenderingProgressEventFirstPaintWithSignificantArea)
|
|
+ LOG(@"renderingProgressDidChange: %@", @"first paint with significant area");
|
|
+
|
|
+ if (progressEvents & _WKRenderingProgressEventFirstLayoutAfterSuppressedIncrementalRendering)
|
|
+ LOG(@"renderingProgressDidChange: %@", @"first layout after suppressed incremental rendering");
|
|
+
|
|
+ if (progressEvents & _WKRenderingProgressEventFirstPaintAfterSuppressedIncrementalRendering)
|
|
+ LOG(@"renderingProgressDidChange: %@", @"first paint after suppressed incremental rendering");
|
|
+}
|
|
+
|
|
+- (void)webView:(WKWebView *)webView shouldLoadIconWithParameters:(_WKLinkIconParameters *)parameters completionHandler:(void (^)(void (^)(NSData*)))completionHandler
|
|
+{
|
|
+ completionHandler(^void (NSData *data) {
|
|
+ LOG(@"Icon URL %@ received icon data of length %u", parameters.url, (unsigned)data.length);
|
|
+ });
|
|
+}
|
|
+
|
|
+#pragma mark Find in Page
|
|
+
|
|
+- (IBAction)performTextFinderAction:(id)sender
|
|
+{
|
|
+ [_textFinder performAction:[sender tag]];
|
|
+}
|
|
+
|
|
+- (NSView *)findBarView
|
|
+{
|
|
+ return _textFindBarView;
|
|
+}
|
|
+
|
|
+- (void)setFindBarView:(NSView *)findBarView
|
|
+{
|
|
+ _textFindBarView = findBarView;
|
|
+ _findBarVisible = YES;
|
|
+ [_textFindBarView setFrame:NSMakeRect(0, 0, containerView.bounds.size.width, _textFindBarView.frame.size.height)];
|
|
+}
|
|
+
|
|
+- (BOOL)isFindBarVisible
|
|
+{
|
|
+ return _findBarVisible;
|
|
+}
|
|
+
|
|
+- (void)setFindBarVisible:(BOOL)findBarVisible
|
|
+{
|
|
+ _findBarVisible = findBarVisible;
|
|
+ if (findBarVisible)
|
|
+ [containerView addSubview:_textFindBarView];
|
|
+ else
|
|
+ [_textFindBarView removeFromSuperview];
|
|
+}
|
|
+
|
|
+- (NSView *)contentView
|
|
+{
|
|
+ return _webView;
|
|
+}
|
|
+
|
|
+- (void)findBarViewDidChangeHeight
|
|
+{
|
|
+}
|
|
+
|
|
+- (void)_webView:(WKWebView *)webView requestMediaCaptureAuthorization: (_WKCaptureDevices)devices decisionHandler:(void (^)(BOOL authorized))decisionHandler
|
|
+{
|
|
+ decisionHandler(true);
|
|
+}
|
|
+
|
|
+- (void)_webView:(WKWebView *)webView includeSensitiveMediaDeviceDetails:(void (^)(BOOL includeSensitiveDetails))decisionHandler
|
|
+{
|
|
+ decisionHandler(false);
|
|
+}
|
|
+
|
|
+- (IBAction)saveAsPDF:(id)sender
|
|
+{
|
|
+ NSSavePanel *panel = [NSSavePanel savePanel];
|
|
+ panel.allowedFileTypes = @[ @"pdf" ];
|
|
+ [panel beginSheetModalForWindow:self.window completionHandler:^(NSInteger result) {
|
|
+ if (result == NSModalResponseOK) {
|
|
+ [_webView createPDFWithConfiguration:nil completionHandler:^(NSData *pdfSnapshotData, NSError *error) {
|
|
+ [pdfSnapshotData writeToURL:[panel URL] options:0 error:nil];
|
|
+ }];
|
|
+ }
|
|
+ }];
|
|
+}
|
|
+
|
|
+- (IBAction)saveAsWebArchive:(id)sender
|
|
+{
|
|
+ NSSavePanel *panel = [NSSavePanel savePanel];
|
|
+ panel.allowedFileTypes = @[ @"webarchive" ];
|
|
+ [panel beginSheetModalForWindow:self.window completionHandler:^(NSInteger result) {
|
|
+ if (result == NSModalResponseOK) {
|
|
+ [_webView createWebArchiveDataWithCompletionHandler:^(NSData *archiveData, NSError *error) {
|
|
+ [archiveData writeToURL:[panel URL] options:0 error:nil];
|
|
+ }];
|
|
+ }
|
|
+ }];
|
|
+}
|
|
+
|
|
+- (WKWebView *)webView
|
|
+{
|
|
+ return _webView;
|
|
+}
|
|
+
|
|
+@end
|
|
diff --git a/Tools/Playwright/mac/CMakeLists.txt b/Tools/Playwright/mac/CMakeLists.txt
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..410d47425b79367114b17274355350894a70a5e6
|
|
--- /dev/null
|
|
+++ b/Tools/Playwright/mac/CMakeLists.txt
|
|
@@ -0,0 +1,43 @@
|
|
+set(PLAYWRIGHT_DIR "${TOOLS_DIR}/Playwright/mac")
|
|
+
|
|
+#FIXME: This should not need WEBCORE_EXPORT defined. This means we are including WebCore headers, and we should not.
|
|
+add_definitions("-include Playwright_Prefix.pch -DWEBCORE_EXPORT=")
|
|
+
|
|
+set(Playwright_SOURCES
|
|
+ ${PLAYWRIGHT_DIR}/AppDelegate.m
|
|
+ ${PLAYWRIGHT_DIR}/BrowserWindowController.m
|
|
+ ${PLAYWRIGHT_DIR}/main.m
|
|
+ ${TOOLS_DIR}/Playwright/MBToolbarItem.m
|
|
+)
|
|
+
|
|
+set(Playwright_INCLUDE_DIRECTORIES
|
|
+ ${CMAKE_SOURCE_DIR}/Source
|
|
+ ${FORWARDING_HEADERS_DIR}
|
|
+ ${PLAYWRIGHT_DIR}
|
|
+)
|
|
+
|
|
+set(Playwright_LIBRARIES
|
|
+ WebKit
|
|
+)
|
|
+
|
|
+set(CMAKE_EXE_LINKER_FLAGS "-framework Cocoa")
|
|
+
|
|
+set(EXECUTABLE_NAME Playwright)
|
|
+set(PRODUCT_NAME Playwright)
|
|
+
|
|
+set(Playwright_Contents_Directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Playwright.app/Contents)
|
|
+make_directory(${Playwright_Contents_Directory}/Resources)
|
|
+add_custom_command(OUTPUT ${Playwright_Contents_Directory}/Resources/BrowserWindow.nib
|
|
+ COMMAND ibtool --compile ${Playwright_Contents_Directory}/Resources/BrowserWindow.nib ${PLAYWRIGHT_DIR}/BrowserWindow.xib VERBATIM)
|
|
+add_custom_command(OUTPUT ${Playwright_Contents_Directory}/Resources/MainMenu.nib
|
|
+ COMMAND ibtool --compile ${Playwright_Contents_Directory}/Resources/MainMenu.nib ${PLAYWRIGHT_DIR}/MainMenu.xib VERBATIM)
|
|
+add_custom_target(PlaywrightNibs ALL DEPENDS
|
|
+ ${Playwright_Contents_Directory}/Resources/BrowserWindow.nib
|
|
+ ${Playwright_Contents_Directory}/Resources/MainMenu.nib
|
|
+)
|
|
+
|
|
+include_directories(${Playwright_INCLUDE_DIRECTORIES})
|
|
+add_executable(Playwright MACOSX_BUNDLE ${Playwright_SOURCES})
|
|
+set_target_properties(Playwright PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${PLAYWRIGHT_DIR}/Info.plist)
|
|
+target_link_libraries(Playwright ${Playwright_LIBRARIES})
|
|
+add_dependencies(Playwright PlaywrightNibs)
|
|
diff --git a/Tools/Playwright/mac/Info.plist b/Tools/Playwright/mac/Info.plist
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..4ed50c40f2f0dfd0ddf7c546b3451ab426c0501e
|
|
--- /dev/null
|
|
+++ b/Tools/Playwright/mac/Info.plist
|
|
@@ -0,0 +1,56 @@
|
|
+<?xml version="1.0" encoding="UTF-8"?>
|
|
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
+<plist version="1.0">
|
|
+<dict>
|
|
+ <key>CFBundleDevelopmentRegion</key>
|
|
+ <string>English</string>
|
|
+ <key>CFBundleExecutable</key>
|
|
+ <string>${EXECUTABLE_NAME}</string>
|
|
+ <key>CFBundleIconFile</key>
|
|
+ <string>WebKit Browser</string>
|
|
+ <key>CFBundleIdentifier</key>
|
|
+ <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
|
|
+ <key>CFBundleInfoDictionaryVersion</key>
|
|
+ <string>6.0</string>
|
|
+ <key>CFBundleName</key>
|
|
+ <string>${PRODUCT_NAME}</string>
|
|
+ <key>CFBundlePackageType</key>
|
|
+ <string>APPL</string>
|
|
+ <key>CFBundleSignature</key>
|
|
+ <string>????</string>
|
|
+ <key>CFBundleShortVersionString</key>
|
|
+ <string>1.0</string>
|
|
+ <key>LSMinimumSystemVersion</key>
|
|
+ <string>${MACOSX_DEPLOYMENT_TARGET}</string>
|
|
+ <key>CFBundleVersion</key>
|
|
+ <string>1</string>
|
|
+ <key>NSMainNibFile</key>
|
|
+ <string>MainMenu</string>
|
|
+ <key>NSPrincipalClass</key>
|
|
+ <string>NSApplication</string>
|
|
+ <key>NSAppTransportSecurity</key>
|
|
+ <dict>
|
|
+ <key>NSAllowsArbitraryLoads</key>
|
|
+ <true/>
|
|
+ </dict>
|
|
+ <key>NSSupportsAutomaticGraphicsSwitching</key>
|
|
+ <true/>
|
|
+ <key>CFBundleDocumentTypes</key>
|
|
+ <array>
|
|
+ <dict>
|
|
+ <key>CFBundleTypeExtensions</key>
|
|
+ <array>
|
|
+ <string>html</string>
|
|
+ </array>
|
|
+ <key>CFBundleTypeMIMETypes</key>
|
|
+ <array>
|
|
+ <string>text/html</string>
|
|
+ </array>
|
|
+ <key>CFBundleTypeName</key>
|
|
+ <string>HTML</string>
|
|
+ <key>CFBundleTypeRole</key>
|
|
+ <string>Editor</string>
|
|
+ </dict>
|
|
+ </array>
|
|
+</dict>
|
|
+</plist>
|
|
diff --git a/Tools/Playwright/mac/MainMenu.xib b/Tools/Playwright/mac/MainMenu.xib
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..a291f32251271200132b8eb08d513f6936e5a0a5
|
|
--- /dev/null
|
|
+++ b/Tools/Playwright/mac/MainMenu.xib
|
|
@@ -0,0 +1,366 @@
|
|
+<?xml version="1.0" encoding="UTF-8"?>
|
|
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="15505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
|
+ <dependencies>
|
|
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15505"/>
|
|
+ </dependencies>
|
|
+ <objects>
|
|
+ <customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
|
|
+ <connections>
|
|
+ <outlet property="delegate" destination="494" id="495"/>
|
|
+ </connections>
|
|
+ </customObject>
|
|
+ <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
|
+ <customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
|
+ <menu title="AMainMenu" systemMenu="main" id="29">
|
|
+ <items>
|
|
+ <menuItem title="Playwright" id="56">
|
|
+ <menu key="submenu" title="Playwright" systemMenu="apple" id="57">
|
|
+ <items>
|
|
+ <menuItem title="About Playwright" id="58">
|
|
+ <modifierMask key="keyEquivalentModifierMask"/>
|
|
+ <connections>
|
|
+ <action selector="orderFrontStandardAboutPanel:" target="-2" id="142"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem isSeparatorItem="YES" id="236">
|
|
+ <modifierMask key="keyEquivalentModifierMask" command="YES"/>
|
|
+ </menuItem>
|
|
+ <menuItem title="Preferences…" keyEquivalent="," id="129"/>
|
|
+ <menuItem isSeparatorItem="YES" id="143">
|
|
+ <modifierMask key="keyEquivalentModifierMask" command="YES"/>
|
|
+ </menuItem>
|
|
+ <menuItem title="Services" id="131">
|
|
+ <menu key="submenu" title="Services" systemMenu="services" id="130"/>
|
|
+ </menuItem>
|
|
+ <menuItem isSeparatorItem="YES" id="144">
|
|
+ <modifierMask key="keyEquivalentModifierMask" command="YES"/>
|
|
+ </menuItem>
|
|
+ <menuItem title="Hide Playwright" keyEquivalent="h" id="134">
|
|
+ <connections>
|
|
+ <action selector="hide:" target="-1" id="367"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="Hide Others" keyEquivalent="h" id="145">
|
|
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
|
+ <connections>
|
|
+ <action selector="hideOtherApplications:" target="-1" id="368"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="Show All" id="150">
|
|
+ <connections>
|
|
+ <action selector="unhideAllApplications:" target="-1" id="370"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem isSeparatorItem="YES" id="149">
|
|
+ <modifierMask key="keyEquivalentModifierMask" command="YES"/>
|
|
+ </menuItem>
|
|
+ <menuItem title="Quit Playwright" keyEquivalent="q" id="136">
|
|
+ <connections>
|
|
+ <action selector="terminate:" target="-3" id="449"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ </items>
|
|
+ </menu>
|
|
+ </menuItem>
|
|
+ <menuItem title="File" id="83">
|
|
+ <menu key="submenu" title="File" id="81">
|
|
+ <items>
|
|
+ <menuItem title="Open Location " tag="1" keyEquivalent="l" id="82">
|
|
+ <connections>
|
|
+ <action selector="openLocation:" target="-1" id="575"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="New Window" tag="2" keyEquivalent="n" id="571">
|
|
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
|
+ <connections>
|
|
+ <action selector="newWindow:" target="-1" id="572"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="New Private Window" tag="2" id="Zqs-AO-XAX">
|
|
+ <modifierMask key="keyEquivalentModifierMask"/>
|
|
+ <connections>
|
|
+ <action selector="newPrivateWindow:" target="-1" id="mf5-zi-a5R"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="Open…" keyEquivalent="o" id="72">
|
|
+ <connections>
|
|
+ <action selector="openDocument:" target="-1" id="374"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="Open Recent" id="124">
|
|
+ <menu key="submenu" title="Open Recent" systemMenu="recentDocuments" id="125">
|
|
+ <items>
|
|
+ <menuItem title="Clear Menu" id="126">
|
|
+ <connections>
|
|
+ <action selector="clearRecentDocuments:" target="-1" id="127"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ </items>
|
|
+ </menu>
|
|
+ </menuItem>
|
|
+ <menuItem isSeparatorItem="YES" id="79">
|
|
+ <modifierMask key="keyEquivalentModifierMask" command="YES"/>
|
|
+ </menuItem>
|
|
+ <menuItem title="Close" keyEquivalent="w" id="73">
|
|
+ <connections>
|
|
+ <action selector="performClose:" target="-1" id="193"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="Save" keyEquivalent="s" id="75">
|
|
+ <connections>
|
|
+ <action selector="saveDocument:" target="-1" id="362"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="Save As…" keyEquivalent="S" id="80">
|
|
+ <modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
|
|
+ <connections>
|
|
+ <action selector="saveDocumentAs:" target="-1" id="363"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="Save As PDF…" keyEquivalent="S" id="gmS-3Q-oLs">
|
|
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
|
+ <connections>
|
|
+ <action selector="saveAsPDF:" target="-1" id="25T-Id-334"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="Save As WebArchive..." id="112">
|
|
+ <modifierMask key="keyEquivalentModifierMask"/>
|
|
+ <connections>
|
|
+ <action selector="saveAsWebArchive:" target="-1" id="AGx-3e-6Nt"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem isSeparatorItem="YES" id="74">
|
|
+ <modifierMask key="keyEquivalentModifierMask" command="YES"/>
|
|
+ </menuItem>
|
|
+ <menuItem title="Page Setup..." keyEquivalent="P" id="77">
|
|
+ <modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
|
|
+ <connections>
|
|
+ <action selector="runPageLayout:" target="-1" id="87"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="Print…" keyEquivalent="p" id="78">
|
|
+ <connections>
|
|
+ <action selector="printWebView:" target="-1" id="86"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ </items>
|
|
+ </menu>
|
|
+ </menuItem>
|
|
+ <menuItem title="Edit" id="217">
|
|
+ <menu key="submenu" title="Edit" id="205">
|
|
+ <items>
|
|
+ <menuItem title="Undo" keyEquivalent="z" id="207">
|
|
+ <connections>
|
|
+ <action selector="undo:" target="-1" id="223"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="Redo" keyEquivalent="Z" id="215">
|
|
+ <modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
|
|
+ <connections>
|
|
+ <action selector="redo:" target="-1" id="231"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem isSeparatorItem="YES" id="206">
|
|
+ <modifierMask key="keyEquivalentModifierMask" command="YES"/>
|
|
+ </menuItem>
|
|
+ <menuItem title="Cut" keyEquivalent="x" id="199">
|
|
+ <connections>
|
|
+ <action selector="cut:" target="-1" id="228"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="Copy" keyEquivalent="c" id="197">
|
|
+ <connections>
|
|
+ <action selector="copy:" target="-1" id="224"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="Paste" keyEquivalent="v" id="203">
|
|
+ <connections>
|
|
+ <action selector="paste:" target="-1" id="226"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="Delete" id="202">
|
|
+ <connections>
|
|
+ <action selector="delete:" target="-1" id="235"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="Select All" keyEquivalent="a" id="198">
|
|
+ <connections>
|
|
+ <action selector="selectAll:" target="-1" id="232"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem isSeparatorItem="YES" id="214">
|
|
+ <modifierMask key="keyEquivalentModifierMask" command="YES"/>
|
|
+ </menuItem>
|
|
+ <menuItem title="Find" id="218">
|
|
+ <menu key="submenu" title="Find" id="220">
|
|
+ <items>
|
|
+ <menuItem title="Find…" tag="1" keyEquivalent="f" id="209">
|
|
+ <connections>
|
|
+ <action selector="performTextFinderAction:" target="-1" id="241"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="Find Next" tag="2" keyEquivalent="g" id="208">
|
|
+ <connections>
|
|
+ <action selector="performTextFinderAction:" target="-1" id="487"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="Find Previous" tag="3" keyEquivalent="G" id="213">
|
|
+ <modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
|
|
+ <connections>
|
|
+ <action selector="performTextFinderAction:" target="-1" id="488"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="221">
|
|
+ <connections>
|
|
+ <action selector="performTextFinderAction:" target="-1" id="489"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="Jump to Selection" keyEquivalent="j" id="210">
|
|
+ <connections>
|
|
+ <action selector="centerSelectionInVisibleArea:" target="-1" id="245"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ </items>
|
|
+ </menu>
|
|
+ </menuItem>
|
|
+ </items>
|
|
+ </menu>
|
|
+ </menuItem>
|
|
+ <menuItem title="View" id="295">
|
|
+ <menu key="submenu" title="View" id="296">
|
|
+ <items>
|
|
+ <menuItem title="Zoom In" keyEquivalent="+" id="555">
|
|
+ <connections>
|
|
+ <action selector="zoomIn:" target="-1" id="559"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="Zoom Out" keyEquivalent="-" id="557">
|
|
+ <connections>
|
|
+ <action selector="zoomOut:" target="-1" id="560"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="Reset Zoom" keyEquivalent="0" id="558">
|
|
+ <connections>
|
|
+ <action selector="resetZoom:" target="-1" id="561"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="Zoom Text Only" id="562">
|
|
+ <modifierMask key="keyEquivalentModifierMask"/>
|
|
+ <connections>
|
|
+ <action selector="toggleZoomMode:" target="-1" id="564"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="Page Scale" id="Hzb-c3-Qfv">
|
|
+ <modifierMask key="keyEquivalentModifierMask"/>
|
|
+ <menu key="submenu" title="Page Scale" id="jdo-5V-3CM">
|
|
+ <items>
|
|
+ <menuItem title="100%" state="on" tag="1" keyEquivalent="1" id="wHb-mR-Fv0">
|
|
+ <connections>
|
|
+ <action selector="setPageScale:" target="-1" id="uMw-eY-289"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="125%" tag="2" keyEquivalent="2" id="u4i-F7-rPb">
|
|
+ <connections>
|
|
+ <action selector="setPageScale:" target="-1" id="IbE-Ep-hfc"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="150%" tag="3" keyEquivalent="3" id="fwT-Iy-oK9">
|
|
+ <connections>
|
|
+ <action selector="setPageScale:" target="-1" id="9c0-eN-0f5"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="200%" tag="4" keyEquivalent="4" id="R5e-ct-O2u">
|
|
+ <connections>
|
|
+ <action selector="setPageScale:" target="-1" id="mkk-gh-dlN"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ </items>
|
|
+ </menu>
|
|
+ </menuItem>
|
|
+ <menuItem title="View Scale" id="8UY-Pj-H13">
|
|
+ <modifierMask key="keyEquivalentModifierMask"/>
|
|
+ <menu key="submenu" title="View Scale" id="Ml8-mk-ffu">
|
|
+ <items>
|
|
+ <menuItem title="100%" state="on" tag="1" id="EAm-Xn-VrC">
|
|
+ <modifierMask key="keyEquivalentModifierMask"/>
|
|
+ <connections>
|
|
+ <action selector="setViewScale:" target="-1" id="dkW-CI-RG4"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="75%" tag="2" id="jcA-I1-Cbq">
|
|
+ <modifierMask key="keyEquivalentModifierMask"/>
|
|
+ <connections>
|
|
+ <action selector="setViewScale:" target="-1" id="BAF-Ym-IqV"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="50%" tag="3" id="BRM-D5-YNO">
|
|
+ <modifierMask key="keyEquivalentModifierMask"/>
|
|
+ <connections>
|
|
+ <action selector="setViewScale:" target="-1" id="nXy-2b-9Zz"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="25%" tag="4" id="gzk-YK-x0W">
|
|
+ <modifierMask key="keyEquivalentModifierMask"/>
|
|
+ <connections>
|
|
+ <action selector="setViewScale:" target="-1" id="KXK-f6-24N"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ </items>
|
|
+ </menu>
|
|
+ </menuItem>
|
|
+ <menuItem title="Reload Page" keyEquivalent="r" id="579">
|
|
+ <connections>
|
|
+ <action selector="reload:" target="-1" id="582"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ </items>
|
|
+ </menu>
|
|
+ </menuItem>
|
|
+ <menuItem title="Debug" id="534">
|
|
+ <modifierMask key="keyEquivalentModifierMask"/>
|
|
+ <menu key="submenu" title="Debug" id="535">
|
|
+ <items>
|
|
+ <menuItem title="Show Web Inspector" keyEquivalent="i" id="xso-9z-R4u">
|
|
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
|
+ <connections>
|
|
+ <action selector="showHideWebInspector:" target="-1" id="Cmx-g7-EPb"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ </items>
|
|
+ </menu>
|
|
+ </menuItem>
|
|
+ <menuItem title="Window" id="19">
|
|
+ <menu key="submenu" title="Window" systemMenu="window" id="24">
|
|
+ <items>
|
|
+ <menuItem title="Minimize" keyEquivalent="m" id="23">
|
|
+ <connections>
|
|
+ <action selector="performMiniaturize:" target="-1" id="37"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem title="Zoom" id="239">
|
|
+ <connections>
|
|
+ <action selector="performZoom:" target="-1" id="240"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ <menuItem isSeparatorItem="YES" id="92">
|
|
+ <modifierMask key="keyEquivalentModifierMask" command="YES"/>
|
|
+ </menuItem>
|
|
+ <menuItem title="Bring All to Front" id="5">
|
|
+ <connections>
|
|
+ <action selector="arrangeInFront:" target="-1" id="39"/>
|
|
+ </connections>
|
|
+ </menuItem>
|
|
+ </items>
|
|
+ </menu>
|
|
+ </menuItem>
|
|
+ </items>
|
|
+ <point key="canvasLocation" x="139" y="-50"/>
|
|
+ </menu>
|
|
+ <customObject id="494" customClass="BrowserAppDelegate">
|
|
+ <connections>
|
|
+ <outlet property="_newWebKit2WindowItem" destination="571" id="1Gv-mK-aul"/>
|
|
+ </connections>
|
|
+ </customObject>
|
|
+ <customObject id="420" customClass="NSFontManager"/>
|
|
+ </objects>
|
|
+</document>
|
|
diff --git a/Tools/Playwright/mac/Playwright_Prefix.pch b/Tools/Playwright/mac/Playwright_Prefix.pch
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..ab6e9bce9a41291bb35664c2c63751c3413601f2
|
|
--- /dev/null
|
|
+++ b/Tools/Playwright/mac/Playwright_Prefix.pch
|
|
@@ -0,0 +1,37 @@
|
|
+/*
|
|
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions
|
|
+ * are met:
|
|
+ * 1. Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * 2. Redistributions in binary form must reproduce the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer in the
|
|
+ * documentation and/or other materials provided with the distribution.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
|
|
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
|
|
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
+ * THE POSSIBILITY OF SUCH DAMAGE.
|
|
+ */
|
|
+
|
|
+#ifdef __OBJC__
|
|
+#import <Cocoa/Cocoa.h>
|
|
+#import <WebKit/WebKit.h>
|
|
+#endif
|
|
+
|
|
+#define ENABLE_LOGGING 0
|
|
+
|
|
+#if ENABLE_LOGGING
|
|
+#define LOG NSLog
|
|
+#else
|
|
+#define LOG(...) ((void)0)
|
|
+#endif
|
|
diff --git a/Tools/Playwright/mac/main.m b/Tools/Playwright/mac/main.m
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..ba2ca12482c0ab809998131f693c876019c595f1
|
|
--- /dev/null
|
|
+++ b/Tools/Playwright/mac/main.m
|
|
@@ -0,0 +1,33 @@
|
|
+/*
|
|
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions
|
|
+ * are met:
|
|
+ * 1. Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * 2. Redistributions in binary form must reproduce the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer in the
|
|
+ * documentation and/or other materials provided with the distribution.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
|
|
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
|
|
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
+ * THE POSSIBILITY OF SUCH DAMAGE.
|
|
+ */
|
|
+
|
|
+#import <Cocoa/Cocoa.h>
|
|
+
|
|
+int main(int argc, char *argv[])
|
|
+{
|
|
+ [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"WebKitLinkedOnOrAfterEverything"];
|
|
+
|
|
+ return NSApplicationMain(argc, (const char **) argv);
|
|
+}
|
|
diff --git a/Tools/Scripts/build-webkit b/Tools/Scripts/build-webkit
|
|
index fc0664a6505546f428c7514b9675119b75a62140..14556b3742856ba88d9363957ea97f337fe63191 100755
|
|
--- a/Tools/Scripts/build-webkit
|
|
+++ b/Tools/Scripts/build-webkit
|
|
@@ -246,7 +246,7 @@ if (isAppleCocoaWebKit()) {
|
|
push @projects, ("Source/WebKit");
|
|
|
|
if (!isIOSWebKit()) {
|
|
- push @projects, ("Tools/MiniBrowser");
|
|
+ push @projects, ("Tools/Playwright");
|
|
|
|
# WebInspectorUI must come after JavaScriptCore and WebCore but before WebKit and WebKit2
|
|
my $webKitIndex = first { $projects[$_] eq "Source/WebKitLegacy" } 0..$#projects;
|
|
diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp
|
|
index ecb882fbe072bb046e54950f826a10d1bbc958fb..d61d873088f5be31682b733d800cbbfa7d5818b5 100644
|
|
--- a/Tools/WebKitTestRunner/TestController.cpp
|
|
+++ b/Tools/WebKitTestRunner/TestController.cpp
|
|
@@ -718,7 +718,8 @@ void TestController::createWebViewWithOptions(const TestOptions& options)
|
|
0, // didResignInputElementStrongPasswordAppearance
|
|
0, // requestStorageAccessConfirm
|
|
shouldAllowDeviceOrientationAndMotionAccess,
|
|
- runWebAuthenticationPanel
|
|
+ runWebAuthenticationPanel,
|
|
+ 0 // handleJavaScriptDialog
|
|
};
|
|
WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient.base);
|
|
|
|
diff --git a/Tools/WebKitTestRunner/win/EventSenderProxyWin.cpp b/Tools/WebKitTestRunner/win/EventSenderProxyWin.cpp
|
|
index 06f19261b387ce02a44c319bd7016e824847ad24..c4e2f8f8816b06a105c18872e735ae4dbca6fe68 100644
|
|
--- a/Tools/WebKitTestRunner/win/EventSenderProxyWin.cpp
|
|
+++ b/Tools/WebKitTestRunner/win/EventSenderProxyWin.cpp
|
|
@@ -312,4 +312,59 @@ void EventSenderProxy::keyDown(WKStringRef keyRef, WKEventModifiers wkModifiers,
|
|
SetKeyboardState(keyState);
|
|
}
|
|
|
|
+void EventSenderProxy::addTouchPoint(int, int)
|
|
+{
|
|
+ notImplemented();
|
|
+}
|
|
+
|
|
+void EventSenderProxy::updateTouchPoint(int, int, int)
|
|
+{
|
|
+ notImplemented();
|
|
+}
|
|
+
|
|
+void EventSenderProxy::setTouchModifier(WKEventModifiers, bool)
|
|
+{
|
|
+ notImplemented();
|
|
+}
|
|
+
|
|
+void EventSenderProxy::setTouchPointRadius(int, int)
|
|
+{
|
|
+ notImplemented();
|
|
+}
|
|
+
|
|
+void EventSenderProxy::touchStart()
|
|
+{
|
|
+ notImplemented();
|
|
+}
|
|
+
|
|
+void EventSenderProxy::touchMove()
|
|
+{
|
|
+ notImplemented();
|
|
+}
|
|
+
|
|
+void EventSenderProxy::touchEnd()
|
|
+{
|
|
+ notImplemented();
|
|
+}
|
|
+
|
|
+void EventSenderProxy::touchCancel()
|
|
+{
|
|
+ notImplemented();
|
|
+}
|
|
+
|
|
+void EventSenderProxy::clearTouchPoints()
|
|
+{
|
|
+ notImplemented();
|
|
+}
|
|
+
|
|
+void EventSenderProxy::releaseTouchPoint(int)
|
|
+{
|
|
+ notImplemented();
|
|
+}
|
|
+
|
|
+void EventSenderProxy::cancelTouchPoint(int)
|
|
+{
|
|
+ notImplemented();
|
|
+}
|
|
+
|
|
} // namespace WTR
|
|
diff --git a/Tools/wpe/backends/CMakeLists.txt b/Tools/wpe/backends/CMakeLists.txt
|
|
index 9788ab56abeb2f769d615029f615844a24d89cc2..fb32c4ff95e67b2e764e902dc0000d255b46ed17 100644
|
|
--- a/Tools/wpe/backends/CMakeLists.txt
|
|
+++ b/Tools/wpe/backends/CMakeLists.txt
|
|
@@ -10,6 +10,7 @@ file(MAKE_DIRECTORY ${DERIVED_SOURCES_WPETOOLINGBACKENDS_DIR})
|
|
set(WPEToolingBackends_SOURCES
|
|
${DERIVED_SOURCES_WPETOOLINGBACKENDS_DIR}/xdg-shell-unstable-v6-protocol.c
|
|
${TOOLS_DIR}/wpe/backends/HeadlessViewBackend.cpp
|
|
+ ${TOOLS_DIR}/wpe/backends/NullViewBackend.cpp
|
|
${TOOLS_DIR}/wpe/backends/ViewBackend.cpp
|
|
${TOOLS_DIR}/wpe/backends/WebKitAccessibleApplication.cpp
|
|
${TOOLS_DIR}/wpe/backends/WindowViewBackend.cpp
|
|
diff --git a/Tools/wpe/backends/NullViewBackend.cpp b/Tools/wpe/backends/NullViewBackend.cpp
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..033ff802d3971a455667cd64c0e68dd10f448aa7
|
|
--- /dev/null
|
|
+++ b/Tools/wpe/backends/NullViewBackend.cpp
|
|
@@ -0,0 +1,41 @@
|
|
+/*
|
|
+ * Copyright (C) Microsoft Corporation.
|
|
+ *
|
|
+ * 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 "NullViewBackend.h"
|
|
+
|
|
+#include <wpe/fdo-egl.h>
|
|
+
|
|
+namespace WPEToolingBackends {
|
|
+
|
|
+NullViewBackend::NullViewBackend()
|
|
+ : ViewBackend(1, 1)
|
|
+{
|
|
+ static struct wpe_view_backend_exportable_fdo_egl_client exportableClient = { nullptr, nullptr, nullptr, nullptr, nullptr };
|
|
+ m_exportable = wpe_view_backend_exportable_fdo_egl_create(&exportableClient, this, 1, 1);
|
|
+ initializeAccessibility();
|
|
+ addActivityState(wpe_view_activity_state_visible | wpe_view_activity_state_focused | wpe_view_activity_state_in_window);
|
|
+}
|
|
+
|
|
+} // namespace WPEToolingBackends
|
|
diff --git a/Tools/wpe/backends/NullViewBackend.h b/Tools/wpe/backends/NullViewBackend.h
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..c4489294acfe73adcb3593f2d54a3be625307f28
|
|
--- /dev/null
|
|
+++ b/Tools/wpe/backends/NullViewBackend.h
|
|
@@ -0,0 +1,46 @@
|
|
+/*
|
|
+ * Copyright (C) Microsoft Corporation.
|
|
+ *
|
|
+ * 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.
|
|
+ */
|
|
+
|
|
+#pragma once
|
|
+
|
|
+#include "ViewBackend.h"
|
|
+#include <cairo.h>
|
|
+#include <glib.h>
|
|
+#include <unordered_map>
|
|
+
|
|
+namespace WPEToolingBackends {
|
|
+
|
|
+class NullViewBackend final : public ViewBackend {
|
|
+public:
|
|
+ NullViewBackend();
|
|
+ virtual ~NullViewBackend() = default;
|
|
+private:
|
|
+ void displayBuffer(struct wpe_fdo_egl_exported_image*) override { };
|
|
+#if WPE_FDO_CHECK_VERSION(1, 5, 0)
|
|
+ void displayBuffer(struct wpe_fdo_shm_exported_buffer*) override { };
|
|
+#endif
|
|
+};
|
|
+
|
|
+} // namespace WPEToolingBackends
|