Diff
Modified: trunk/LayoutTests/ChangeLog (292083 => 292084)
--- trunk/LayoutTests/ChangeLog 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/LayoutTests/ChangeLog 2022-03-30 00:12:28 UTC (rev 292084)
@@ -1,3 +1,19 @@
+2022-03-29 Devin Rousso <[email protected]>
+
+ Web Inspector: Sources: allow Response Local Overrides to map to a file on disk
+ https://bugs.webkit.org/show_bug.cgi?id=238236
+ <rdar://problem/59009154>
+
+ Reviewed by Patrick Angle.
+
+ * http/tests/inspector/network/local-resource-override-mapped-to-file.html: Added.
+ * http/tests/inspector/network/local-resource-override-mapped-to-file-expected.txt: Added.
+
+ * TestExpectations:
+ * platform/mac-wk1/TestExpectations:
+ * platform/mac-wk2/TestExpectations:
+ Skip this test everywhere except mac-wk2.
+
2022-03-29 Matt Woodrow <[email protected]>
Don't mutate children during RenderGrid::computeIntrinsicLogicalWidths unless we're about to re-layout.
Modified: trunk/LayoutTests/TestExpectations (292083 => 292084)
--- trunk/LayoutTests/TestExpectations 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/LayoutTests/TestExpectations 2022-03-30 00:12:28 UTC (rev 292084)
@@ -1243,6 +1243,9 @@
inspector/page/overrideSetting-PrivateClickMeasurementDebugModeEnabled.html [ Skip ]
inspector/page/overrideSetting-ITPDebugModeEnabled.html [ Skip ]
+# Network interception with a mapped file is only mac-wk2 for now.
+http/tests/inspector/network/local-resource-override-mapped-to-file.html [ Skip ]
+
# These conformance tests are no longer in sync with the latest specification
# and expect compareDocumentPosition() to return:
# DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | DOCUMENT_POSITION_DISCONNECTED
Added: trunk/LayoutTests/http/tests/inspector/network/local-resource-override-mapped-to-file-expected.txt (0 => 292084)
--- trunk/LayoutTests/http/tests/inspector/network/local-resource-override-mapped-to-file-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/network/local-resource-override-mapped-to-file-expected.txt 2022-03-30 00:12:28 UTC (rev 292084)
@@ -0,0 +1,39 @@
+Tests for LocalResourceOverride being mapped to a file.
+
+
+== Running test suite: LocalResourceOverride
+-- Running test case: LocalResourceOverride.MappedToFile.Valid
+Creating Local Resource Override for: http://127.0.0.1:8000/inspector/network/resources/override.txt
+Linking to file...
+Triggering load...
+PASS: Resource Loaded.
+Resource Content: 'PASS: Should load from file.'
+Local Resource Override Content: 'PASS: Should load from file.'
+
+-- Running test case: LocalResourceOverride.MappedToFile.MappedFileChanged
+Creating Local Resource Override for: http://127.0.0.1:8000/inspector/network/resources/override.txt
+Linking to file...
+Triggering load...
+PASS: Resource Loaded.
+Resource Content: 'PASS: Should load from file.'
+Local Resource Override Content: 'PASS: Should load from file.'
+
+-- Running test case: LocalResourceOverride.MappedToFile.MappedFileDeleted
+Creating Local Resource Override for: http://127.0.0.1:8000/inspector/network/resources/override.txt
+Linking to file...
+Triggering load...
+WARN: Local Override: could not load “DOES NOT EXIST”
+PASS: Resource Loaded.
+Resource Content: 'PASS: Should not load from file.'
+Local Resource Override Content: 'PASS: Should not load from file.'
+
+-- Running test case: LocalResourceOverride.MappedToFile.Invalid
+Creating Local Resource Override for: http://127.0.0.1:8000/inspector/network/resources/override.txt
+Linking to file...
+Triggering load...
+WARN: Local Override: could not load “DOES NOT EXIST”
+WARN: Local Override: could not load “DOES NOT EXIST”
+PASS: Resource Loaded.
+Resource Content: 'PASS: Should not load from file.'
+Local Resource Override Content: 'PASS: Should not load from file.'
+
Added: trunk/LayoutTests/http/tests/inspector/network/local-resource-override-mapped-to-file.html (0 => 292084)
--- trunk/LayoutTests/http/tests/inspector/network/local-resource-override-mapped-to-file.html (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/network/local-resource-override-mapped-to-file.html 2022-03-30 00:12:28 UTC (rev 292084)
@@ -0,0 +1,183 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src=""
+<script>
+function createTemporaryFile(name, contents) {
+ if (!window.internals)
+ return "";
+
+ let path = window.internals.createTemporaryFile(name, contents);
+ if (!path) {
+ TestPage.addResult(`FAIL: could not create file`);
+ return "";
+ }
+
+ return path;
+}
+
+function triggerOverrideLoad() {
+ fetch("http://127.0.0.1:8000/inspector/network/resources/override.txt").then(() => {
+ TestPage.dispatchEventToFrontend("LoadComplete");
+ });
+}
+
+function test()
+{
+ let suite = InspectorTest.createAsyncSuite("LocalResourceOverride");
+
+ suite.addTestCase({
+ name: "LocalResourceOverride.MappedToFile.Valid",
+ description: "Test that `WI.LocalResource.prototype.mapToFile` correctly loads a file that exists.",
+ async test() {
+ const url = ""
+
+ InspectorTest.log("Creating Local Resource Override for: " + url);
+ let localResourceOverride = WI.LocalResourceOverride.create(url, WI.LocalResourceOverride.InterceptType.Response, {
+ responseMIMEType: "text/plain",
+ responseContent: "FAIL: Should load from file.",
+ });
+ WI.networkManager.addLocalResourceOverride(localResourceOverride);
+
+ InspectorTest.log("Linking to file...");
+ localResourceOverride.localResource.mappedFilePath = await InspectorTest.evaluateInPage(`createTemporaryFile("LocalResourceOverride_MappedToFile_Valid", "PASS: Should load from file.")`);
+
+ InspectorTest.log("Triggering load...");
+ let [resourceWasAddedEvent, responseReceivedEvent, loadCompleteEvent] = await Promise.all([
+ WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded),
+ WI.Resource.awaitEvent(WI.Resource.Event.ResponseReceived),
+ InspectorTest.awaitEvent("LoadComplete"),
+ InspectorTest.evaluateInPage(`triggerOverrideLoad()`),
+ ]);
+
+ InspectorTest.pass("Resource Loaded.");
+ let resource = resourceWasAddedEvent.data.resource;
+ let {rawContent, rawBase64Encoded} = await resource.requestContent();
+ InspectorTest.log(`Resource Content: '${rawBase64Encoded ? "[base64] " : ""}${rawContent}'`);
+
+ let localResourceCurrentRevision = localResourceOverride.localResource.currentRevision;
+ InspectorTest.log(`Local Resource Override Content: '${localResourceCurrentRevision.base64Encoded ? "[base64] " : ""}${localResourceCurrentRevision.content}'`)
+
+ WI.networkManager.removeLocalResourceOverride(localResourceOverride);
+ }
+ });
+
+ suite.addTestCase({
+ name: "LocalResourceOverride.MappedToFile.MappedFileChanged",
+ description: "Test that `WI.LocalResource.prototype.mapToFile` correctly re-loads the mapped file.",
+ async test() {
+ const url = ""
+
+ InspectorTest.log("Creating Local Resource Override for: " + url);
+ let localResourceOverride = WI.LocalResourceOverride.create(url, WI.LocalResourceOverride.InterceptType.Response, {
+ responseMIMEType: "text/plain",
+ responseContent: "FAIL: Should load from file.",
+ });
+ WI.networkManager.addLocalResourceOverride(localResourceOverride);
+
+ InspectorTest.log("Linking to file...");
+ // Simulate the file contents changing after the frontend has already loaded it, as `set mappedFilePath` will immediately attempt to load the file's contents.
+ localResourceOverride.localResource._mappedFilePath = await InspectorTest.evaluateInPage(`createTemporaryFile("LocalResourceOverride_MappedToFile_MappedFileChanged", "PASS: Should load from file.")`);
+
+ InspectorTest.log("Triggering load...");
+ let [resourceWasAddedEvent, responseReceivedEvent, loadCompleteEvent] = await Promise.all([
+ WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded),
+ WI.Resource.awaitEvent(WI.Resource.Event.ResponseReceived),
+ InspectorTest.awaitEvent("LoadComplete"),
+ InspectorTest.evaluateInPage(`triggerOverrideLoad()`),
+ ]);
+
+ InspectorTest.pass("Resource Loaded.");
+ let resource = resourceWasAddedEvent.data.resource;
+ let {rawContent, rawBase64Encoded} = await resource.requestContent();
+ InspectorTest.log(`Resource Content: '${rawBase64Encoded ? "[base64] " : ""}${rawContent}'`);
+
+ let localResourceCurrentRevision = localResourceOverride.localResource.currentRevision;
+ InspectorTest.log(`Local Resource Override Content: '${localResourceCurrentRevision.base64Encoded ? "[base64] " : ""}${localResourceCurrentRevision.content}'`)
+
+ WI.networkManager.removeLocalResourceOverride(localResourceOverride);
+ }
+ });
+
+ suite.addTestCase({
+ name: "LocalResourceOverride.MappedToFile.MappedFileDeleted",
+ description: "Test that `WI.LocalResource.prototype.mapToFile` does not crash if the previously mapped file no longer exists.",
+ async test() {
+ const url = ""
+
+ InspectorTest.log("Creating Local Resource Override for: " + url);
+ let localResourceOverride = WI.LocalResourceOverride.create(url, WI.LocalResourceOverride.InterceptType.Response, {
+ responseMIMEType: "text/plain",
+ responseContent: "PASS: Should not load from file.",
+ });
+ WI.networkManager.addLocalResourceOverride(localResourceOverride);
+
+ InspectorTest.log("Linking to file...");
+ // Simulate the file being deleted after the frontend has already loaded it, as `set mappedFilePath` will immediately attempt to load the file's contents.
+ localResourceOverride.localResource._mappedFilePath = "DOES NOT EXIST";
+
+ InspectorTest.log("Triggering load...");
+ let [resourceWasAddedEvent, responseReceivedEvent, loadCompleteEvent] = await Promise.all([
+ WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded),
+ WI.Resource.awaitEvent(WI.Resource.Event.ResponseReceived),
+ InspectorTest.awaitEvent("LoadComplete"),
+ InspectorTest.evaluateInPage(`triggerOverrideLoad()`),
+ ]);
+
+ InspectorTest.pass("Resource Loaded.");
+ let resource = resourceWasAddedEvent.data.resource;
+ let {rawContent, rawBase64Encoded} = await resource.requestContent();
+ InspectorTest.log(`Resource Content: '${rawBase64Encoded ? "[base64] " : ""}${rawContent}'`);
+
+ let localResourceCurrentRevision = localResourceOverride.localResource.currentRevision;
+ InspectorTest.log(`Local Resource Override Content: '${localResourceCurrentRevision.base64Encoded ? "[base64] " : ""}${localResourceCurrentRevision.content}'`)
+
+ WI.networkManager.removeLocalResourceOverride(localResourceOverride);
+ }
+ });
+
+ suite.addTestCase({
+ name: "LocalResourceOverride.MappedToFile.Invalid",
+ description: "Test that `WI.LocalResource.prototype.mapToFile` does not crash when attempting to load a file that does not exist.",
+ async test() {
+ const url = ""
+
+ InspectorTest.log("Creating Local Resource Override for: " + url);
+ let localResourceOverride = WI.LocalResourceOverride.create(url, WI.LocalResourceOverride.InterceptType.Response, {
+ responseMIMEType: "text/plain",
+ responseContent: "PASS: Should not load from file.",
+ });
+ WI.networkManager.addLocalResourceOverride(localResourceOverride);
+
+ InspectorTest.log("Linking to file...");
+ localResourceOverride.localResource.mappedFilePath = "DOES NOT EXIST";
+
+ InspectorTest.log("Triggering load...");
+ let [resourceWasAddedEvent, responseReceivedEvent, loadCompleteEvent] = await Promise.all([
+ WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded),
+ WI.Resource.awaitEvent(WI.Resource.Event.ResponseReceived),
+ InspectorTest.awaitEvent("LoadComplete"),
+ InspectorTest.evaluateInPage(`triggerOverrideLoad()`),
+ ]);
+
+ InspectorTest.pass("Resource Loaded.");
+ let resource = resourceWasAddedEvent.data.resource;
+ let {rawContent, rawBase64Encoded} = await resource.requestContent();
+ InspectorTest.log(`Resource Content: '${rawBase64Encoded ? "[base64] " : ""}${rawContent}'`);
+
+ let localResourceCurrentRevision = localResourceOverride.localResource.currentRevision;
+ InspectorTest.log(`Local Resource Override Content: '${localResourceCurrentRevision.base64Encoded ? "[base64] " : ""}${localResourceCurrentRevision.content}'`)
+
+ WI.networkManager.removeLocalResourceOverride(localResourceOverride);
+ }
+ });
+
+ suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Tests for LocalResourceOverride being mapped to a file.</p>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (292083 => 292084)
--- trunk/LayoutTests/platform/mac-wk1/TestExpectations 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations 2022-03-30 00:12:28 UTC (rev 292084)
@@ -925,6 +925,7 @@
http/tests/inspector/network/intercept-request-with-response.html [ Skip ]
http/tests/inspector/network/local-resource-override-basic.html [ Skip ]
http/tests/inspector/network/local-resource-override-main-resource.html [ Skip ]
+http/tests/inspector/network/local-resource-override-mapped-to-file.html [ Skip ]
http/tests/inspector/network/local-resource-override-script-tag.html [ Skip ]
http/tests/inspector/network/resource-response-inspector-override.html [ Skip ]
inspector/network/intercept-aborted-request.html [ Skip ]
Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (292083 => 292084)
--- trunk/LayoutTests/platform/mac-wk2/TestExpectations 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations 2022-03-30 00:12:28 UTC (rev 292084)
@@ -691,6 +691,9 @@
# Accessibility isolated tree mode is enabled in Big Sur and beyond, no in Catalina and before.
[ Mojave Catalina ] accessibility/mac/isolated-tree-mode-on-off.html [ Skip ]
+# Network interception with a mapped file is only mac-wk2 for now.
+http/tests/inspector/network/local-resource-override-mapped-to-file.html [ Pass ]
+
# Content Extensions tests must be enabled explicitly on mac-wk2.
http/tests/contentextensions [ Pass ]
http/tests/inspector/network/contentextensions [ Pass ]
Modified: trunk/Source/WebCore/ChangeLog (292083 => 292084)
--- trunk/Source/WebCore/ChangeLog 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebCore/ChangeLog 2022-03-30 00:12:28 UTC (rev 292084)
@@ -1,3 +1,38 @@
+2022-03-29 Devin Rousso <[email protected]>
+
+ Web Inspector: Sources: allow Response Local Overrides to map to a file on disk
+ https://bugs.webkit.org/show_bug.cgi?id=238236
+ <rdar://problem/59009154>
+
+ Reviewed by Patrick Angle.
+
+ This makes Response Local Overrides even more powerful by allowing developers to map the
+ contents of the (Local Override) resource to a file on disk (e.g. a local copy of the file),
+ meaning that they can use their preferred editor of choice (and all the tools that may come
+ with it) to make changes instead of having to stay within Web Inspector.
+
+ Test: http/tests/inspector/network/local-resource-override-mapped-to-file.html
+
+ * inspector/InspectorFrontendHost.idl:
+ * inspector/InspectorFrontendHost.h:
+ * inspector/InspectorFrontendHost.cpp:
+ (WebCore::InspectorFrontendHost::canLoad): Added.
+ (WebCore::InspectorFrontendHost::load): Added.
+ (WebCore::InspectorFrontendHost::getPath): Added.
+ Add helpers for loading the contents of a file on disk and getting the full path of a `File`.
+
+ * inspector/InspectorFrontendClient.h:
+ * inspector/InspectorFrontendClientLocal.h:
+ (WebCore::InspectorFrontendClientLocal::canLoad): Added.
+ (WebCore::InspectorFrontendClientLocal::load): Added.
+ Do not allow file mapping in tests (and WK1).
+
+ * testing/Internals.idl:
+ * testing/Internals.h:
+ * testing/Internals.cpp:
+ (WebCore::Internals::createTemporaryFile): Added.
+ Add a way for tests to create a temporary file with given contents.
+
2022-03-29 Matt Woodrow <[email protected]>
Don't mutate children during RenderGrid::computeIntrinsicLogicalWidths unless we're about to re-layout.
Modified: trunk/Source/WebCore/inspector/InspectorFrontendClient.h (292083 => 292084)
--- trunk/Source/WebCore/inspector/InspectorFrontendClient.h 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClient.h 2022-03-30 00:12:28 UTC (rev 292084)
@@ -109,6 +109,8 @@
virtual bool canSave() = 0;
virtual void save(const String& url, const String& content, bool base64Encoded, bool forceSaveAs) = 0;
virtual void append(const String& url, const String& content) = 0;
+ virtual bool canLoad() = 0;
+ virtual void load(const String& path, CompletionHandler<void(const String&)>&&) = 0;
virtual void inspectedURLChanged(const String&) = 0;
virtual void showCertificate(const CertificateInfo&) = 0;
Modified: trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h (292083 => 292084)
--- trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h 2022-03-30 00:12:28 UTC (rev 292084)
@@ -83,6 +83,8 @@
bool canSave() override { return false; }
void save(const String&, const String&, bool, bool) override { }
void append(const String&, const String&) override { }
+ bool canLoad() override { return false; }
+ void load(const String&, CompletionHandler<void(const String&)>&& completionHandler) override { completionHandler(nullString()); }
virtual void attachWindow(DockSide) = 0;
virtual void detachWindow() = 0;
Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp (292083 => 292084)
--- trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp 2022-03-30 00:12:28 UTC (rev 292084)
@@ -39,6 +39,7 @@
#include "Document.h"
#include "Editor.h"
#include "Event.h"
+#include "File.h"
#include "FloatRect.h"
#include "FocusController.h"
#include "Frame.h"
@@ -49,6 +50,7 @@
#include "InspectorFrontendClient.h"
#include "JSDOMConvertInterface.h"
#include "JSDOMExceptionHandling.h"
+#include "JSDOMPromiseDeferred.h"
#include "JSExecState.h"
#include "JSInspectorFrontendHost.h"
#include "MouseEvent.h"
@@ -460,10 +462,37 @@
m_client->append(url, content);
}
+bool InspectorFrontendHost::canLoad()
+{
+ if (m_client)
+ return m_client->canLoad();
+ return false;
+}
+
+void InspectorFrontendHost::load(const String& path, Ref<DeferredPromise>&& promise)
+{
+ if (!m_client) {
+ promise->reject(InvalidStateError);
+ return;
+ }
+
+ m_client->load(path, [promise = WTFMove(promise)](const String& content) {
+ if (!content)
+ promise->reject(NotFoundError);
+ else
+ promise->resolve<IDLDOMString>(content);
+ });
+}
+
void InspectorFrontendHost::close(const String&)
{
}
+String InspectorFrontendHost::getPath(const File& file)
+{
+ return file.path();
+}
+
void InspectorFrontendHost::sendMessageToBackend(const String& message)
{
if (m_client)
Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.h (292083 => 292084)
--- trunk/Source/WebCore/inspector/InspectorFrontendHost.h 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.h 2022-03-30 00:12:28 UTC (rev 292084)
@@ -38,7 +38,9 @@
namespace WebCore {
class DOMWrapperWorld;
+class DeferredPromise;
class Event;
+class File;
class FrontendMenuProvider;
class HTMLIFrameElement;
class InspectorFrontendClient;
@@ -109,8 +111,12 @@
bool canSave();
void save(const String& url, const String& content, bool base64Encoded, bool forceSaveAs);
void append(const String& url, const String& content);
+ bool canLoad();
+ void load(const String& path, Ref<DeferredPromise>&&);
void close(const String& url);
+ String getPath(const File&);
+
struct ContextMenuItem {
String type;
String label;
Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.idl (292083 => 292084)
--- trunk/Source/WebCore/inspector/InspectorFrontendHost.idl 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.idl 2022-03-30 00:12:28 UTC (rev 292084)
@@ -74,8 +74,12 @@
boolean canSave();
undefined save(DOMString url, DOMString content, boolean base64Encoded, boolean forceSaveAs);
undefined append(DOMString url, DOMString content);
+ boolean canLoad();
+ [NewObject] Promise<DOMString> load(DOMString path);
undefined close(DOMString url);
+ DOMString getPath(File file);
+
readonly attribute DOMString port;
readonly attribute DOMString platform;
readonly attribute DOMString platformVersionName;
Modified: trunk/Source/WebCore/testing/Internals.cpp (292083 => 292084)
--- trunk/Source/WebCore/testing/Internals.cpp 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebCore/testing/Internals.cpp 2022-03-30 00:12:28 UTC (rev 292084)
@@ -234,6 +234,7 @@
#include <_javascript_Core/InspectorFrontendChannel.h>
#include <_javascript_Core/JSCInlines.h>
#include <_javascript_Core/JSCJSValue.h>
+#include <wtf/FileSystem.h>
#include <wtf/HexNumber.h>
#include <wtf/JSONValues.h>
#include <wtf/Language.h>
@@ -4871,6 +4872,24 @@
return File::create(document, url.fileSystemPath());
}
+String Internals::createTemporaryFile(const String& name, const String& contents)
+{
+ if (name.isEmpty())
+ return nullString();
+
+ auto file = FileSystem::invalidPlatformFileHandle;
+ auto path = FileSystem::openTemporaryFile(makeString("WebCoreTesting-", name), file);
+ if (!FileSystem::isHandleValid(file))
+ return nullString();
+
+ auto contentsUTF8 = contents.utf8();
+ FileSystem::writeToFile(file, contentsUTF8.data(), contentsUTF8.length());
+
+ FileSystem::closeFile(file);
+
+ return path;
+}
+
void Internals::queueMicroTask(int testNumber)
{
Document* document = contextDocument();
Modified: trunk/Source/WebCore/testing/Internals.h (292083 => 292084)
--- trunk/Source/WebCore/testing/Internals.h 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebCore/testing/Internals.h 2022-03-30 00:12:28 UTC (rev 292084)
@@ -776,6 +776,8 @@
ExceptionOr<bool> pageDefersLoading();
RefPtr<File> createFile(const String&);
+ String createTemporaryFile(const String& name, const String& contents);
+
void queueMicroTask(int);
bool testPreloaderSettingViewport();
Modified: trunk/Source/WebCore/testing/Internals.idl (292083 => 292084)
--- trunk/Source/WebCore/testing/Internals.idl 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebCore/testing/Internals.idl 2022-03-30 00:12:28 UTC (rev 292084)
@@ -842,6 +842,8 @@
boolean pageDefersLoading();
File? createFile(DOMString url);
+ DOMString createTemporaryFile(DOMString name, DOMString contents);
+
undefined queueMicroTask(long testNumber);
boolean testPreloaderSettingViewport();
Modified: trunk/Source/WebInspectorUI/ChangeLog (292083 => 292084)
--- trunk/Source/WebInspectorUI/ChangeLog 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebInspectorUI/ChangeLog 2022-03-30 00:12:28 UTC (rev 292084)
@@ -1,3 +1,62 @@
+2022-03-29 Devin Rousso <[email protected]>
+
+ Web Inspector: Sources: allow Response Local Overrides to map to a file on disk
+ https://bugs.webkit.org/show_bug.cgi?id=238236
+ <rdar://problem/59009154>
+
+ Reviewed by Patrick Angle.
+
+ This makes Response Local Overrides even more powerful by allowing developers to map the
+ contents of the (Local Override) resource to a file on disk (e.g. a local copy of the file),
+ meaning that they can use their preferred editor of choice (and all the tools that may come
+ with it) to make changes instead of having to stay within Web Inspector.
+
+ * UserInterface/Models/LocalResource.js:
+ (WI.LocalResource):
+ (WI.LocalResource.canMapToFile): Added.
+ (WI.LocalResource.prototype.toJSON):
+ (WI.LocalResource.prototype.get mappedFilePath): Added.
+ (WI.LocalResource.prototype.set mappedFilePath): Added.
+ (WI.LocalResource.prototype.async requestContent):
+ (WI.LocalResource.prototype.async _loadFromFileSystem): Added.
+ * UserInterface/Models/LocalResourceOverride.js:
+ (WI.LocalResourceOverride.prototype.get canMapToFile): Added.
+ Save the given local file path as a member variable and use `InspectorFrontendHost.load` to
+ grab its contents (saving it inside the `WI.LocalResource` so that it can still be used in
+ case the file is moved/deleted) whenever anyone `requestContent`.
+
+ * UserInterface/Views/ResourceContentView.js:
+ (WI.ResourceContentView):
+ (WI.ResourceContentView.prototype.get navigationItems):
+ (WI.ResourceContentView.prototype.showMessage):
+ (WI.ResourceContentView.prototype.addIssue):
+ (WI.ResourceContentView.prototype._contentAvailable):
+ (WI.ResourceContentView.prototype.async _handleMapLocalResourceOverrideToFile): Added.
+ (WI.ResourceContentView.prototype._handleMappedFilePathChanged): Added.
+ Add a new "[Disk.svg] Map to File" navigation item when viewing Response Local Overrides. If
+ the Response Local Override has already been mapped to a file, show the path of the file
+ instead of the contents of the resource. This allows us to not have to monitor the file for
+ changes, instead only grabbing the current contents when necessary (i.e. when replacing the
+ response of an intercepted network request).
+
+ * UserInterface/Views/ResourceContentView.css: Added.
+ (.content-view.resource > .local-resource-override-label-view + .message-text-view):
+ Still show the Local Override banner if the Local Override has been mapped to a file.
+
+ * UserInterface/Views/TextResourceContentView.js:
+ (WI.TextResourceContentView.prototype._contentWillPopulate):
+ Don't show the `WI.SourceCodeTextEditor` if there's already something else being shown.
+
+ * UserInterface/Controllers/NetworkManager.js:
+ (WI.NetworkManager.prototype.async requestIntercepted):
+ (WI.NetworkManager.prototype.async responseIntercepted):
+ Make sure to `requestContent` before using the `currentRevision` so that any file-mapped
+ `WI.LocalResource` have a chance to load from disk before handling the interception.
+
+ * Localizations/en.lproj/localizedStrings.js:
+ * UserInterface/Main.html:
+ * UserInterface/Images/Disk.svg: Added.
+
2022-03-29 Patrick Angle <[email protected]>
Web Inspector: [Cocoa] Indicate a request was sent through proxy/private relay in Network tab
Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (292083 => 292084)
--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2022-03-30 00:12:28 UTC (rev 292084)
@@ -889,6 +889,7 @@
localizedStrings["Loading for %s"] = "Loading for %s";
localizedStrings["Local File"] = "Local File";
localizedStrings["Local Override"] = "Local Override";
+localizedStrings["Local Override: could not load \u201C%s\u201D"] = "Local Override: could not load \u201C%s\u201D";
localizedStrings["Local Override\u2026"] = "Local Override\u2026";
localizedStrings["Local Overrides"] = "Local Overrides";
localizedStrings["Local Storage"] = "Local Storage";
@@ -922,6 +923,8 @@
localizedStrings["Main Thread"] = "Main Thread";
localizedStrings["Main: %s"] = "Main: %s";
localizedStrings["Manifest URL"] = "Manifest URL";
+localizedStrings["Map to File"] = "Map to File";
+localizedStrings["Mapped to \u201C%s\u201D"] = "Mapped to \u201C%s\u201D";
localizedStrings["Mass"] = "Mass";
localizedStrings["Matching"] = "Matching";
localizedStrings["Max Comparison"] = "Max Comparison";
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js (292083 => 292084)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js 2022-03-30 00:12:28 UTC (rev 292084)
@@ -946,7 +946,7 @@
this._resourceRequestIdentifierMap.delete(requestIdentifier);
}
- requestIntercepted(target, requestId, request)
+ async requestIntercepted(target, requestId, request)
{
let url = ""
for (let localResourceOverride of this.localResourceOverridesForURL(url)) {
@@ -954,6 +954,8 @@
continue;
let localResource = localResourceOverride.localResource;
+ await localResource.requestContent();
+
let revision = localResource.currentRevision;
switch (localResourceOverride.type) {
@@ -992,7 +994,7 @@
});
}
- responseIntercepted(target, requestId, response)
+ async responseIntercepted(target, requestId, response)
{
let url = ""
for (let localResourceOverride of this.localResourceOverridesForURL(url)) {
@@ -1000,6 +1002,8 @@
continue;
let localResource = localResourceOverride.localResource;
+ await localResource.requestContent();
+
let revision = localResource.currentRevision;
switch (localResourceOverride.type) {
Added: trunk/Source/WebInspectorUI/UserInterface/Images/Disk.svg (0 => 292084)
--- trunk/Source/WebInspectorUI/UserInterface/Images/Disk.svg (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Images/Disk.svg 2022-03-30 00:12:28 UTC (rev 292084)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright © 2022 Apple Inc. All rights reserved. -->
+<svg xmlns="http://www.w3.org/2000/svg" id="root" viewBox="0 0 15 15">
+ <path fill="none" stroke="currentColor" d="M5.240,3.215 L9.784,3.215 C10.594,3.215 11.325,3.705 11.633,4.455 L13.521,9.047 C13.941,10.069 13.454,11.238 12.432,11.658 C12.191,11.757 11.932,11.808 11.672,11.808 L3.337,11.808 C2.233,11.808 1.337,10.912 1.337,9.808 C1.337,9.545 1.389,9.285 1.490,9.042 L3.393,4.449 C3.702,3.702 4.432,3.215 5.240,3.215 Z"/>
+ <rect fill="none" width="12.219" height="4.137" x="1.395" y="7.671" stroke="currentColor" rx="2"/>
+ <line x1="11.5" x2="11.5" y1="9.5" y2="10" stroke="currentColor" stroke-linecap="round"/>
+ <line x1="10" x2="10" y1="9.5" y2="10" stroke="currentColor" stroke-linecap="round"/>
+ <line x1="8.5" x2="8.5" y1="9.5" y2="10" stroke="currentColor" stroke-linecap="round"/>
+</svg>
Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (292083 => 292084)
--- trunk/Source/WebInspectorUI/UserInterface/Main.html 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html 2022-03-30 00:12:28 UTC (rev 292084)
@@ -194,6 +194,7 @@
<link rel="stylesheet" href=""
<link rel="stylesheet" href=""
<link rel="stylesheet" href=""
+ <link rel="stylesheet" href=""
<link rel="stylesheet" href=""
<link rel="stylesheet" href=""
<link rel="stylesheet" href=""
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/LocalResource.js (292083 => 292084)
--- trunk/Source/WebInspectorUI/UserInterface/Models/LocalResource.js 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/LocalResource.js 2022-03-30 00:12:28 UTC (rev 292084)
@@ -36,7 +36,7 @@
WI.LocalResource = class LocalResource extends WI.Resource
{
- constructor({request, response, metrics, timing})
+ constructor({request, response, metrics, timing, mappedFilePath})
{
console.assert(request);
console.assert(typeof request.url ="" "string");
@@ -87,10 +87,17 @@
let base64Encoded = response.base64Encoded || false;
this._originalRevision = new WI.SourceCodeRevision(this, content, base64Encoded, this._mimeType);
this._currentRevision = this._originalRevision;
+
+ this._mappedFilePath = mappedFilePath || null;
}
// Static
+ static canMapToFile()
+ {
+ return InspectorFrontendHost.canLoad();
+ }
+
static headersArrayToHeadersObject(headers)
{
let result = {};
@@ -227,6 +234,7 @@
content: this.currentRevision.content,
base64Encoded: this.currentRevision.base64Encoded,
},
+ mappedFilePath: this._mappedFilePath,
};
}
@@ -234,8 +242,36 @@
get localResourceOverride() { return this._localResourceOverride; }
+ get mappedFilePath()
+ {
+ return this._mappedFilePath;
+ }
+
+ set mappedFilePath(mappedFilePath)
+ {
+ console.assert(WI.LocalResource.canMapToFile());
+ console.assert(mappedFilePath);
+
+ if (mappedFilePath === this._mappedFilePath)
+ return;
+
+ this._mappedFilePath = mappedFilePath;
+
+ const forceUpdate = true;
+ this._loadFromFileSystem(forceUpdate).then(() => {
+ this.dispatchEventToListeners(WI.LocalResource.Event.MappedFilePathChanged);
+ });
+ }
+
// Protected
+ async requestContent()
+ {
+ await this._loadFromFileSystem();
+
+ return super.requestContent();
+ }
+
requestContentFromBackend()
{
return Promise.resolve({
@@ -252,4 +288,47 @@
this.dispatchEventToListeners(WI.Resource.Event.MIMETypeDidChange, {oldMIMEType});
}
}
+
+ // Private
+
+ async _loadFromFileSystem(forceUpdate)
+ {
+ if (!this._mappedFilePath)
+ return;
+
+ let content = "";
+ try {
+ content = await InspectorFrontendHost.load(this._mappedFilePath);
+ } catch {
+ if (this._didWarnAboutFailureToLoadFromFileSystem)
+ return;
+
+ this._didWarnAboutFailureToLoadFromFileSystem = true;
+ setTimeout(() => {
+ this._didWarnAboutFailureToLoadFromFileSystem = false;
+ });
+
+ let message = WI.UIString("Local Override: could not load \u201C%s\u201D").format(this._mappedFilePath);
+
+ if (window.InspectorTest) {
+ console.warn(message);
+ return;
+ }
+
+ let consoleMessage = new WI.ConsoleMessage(WI.mainTarget, WI.ConsoleMessage.MessageSource.Other, WI.ConsoleMessage.MessageLevel.Warning, message);
+ consoleMessage.shouldRevealConsole = true;
+
+ WI.consoleLogViewController.appendConsoleMessage(consoleMessage);
+ return;
+ }
+
+ if (!forceUpdate && content === this.currentRevision.content)
+ return;
+
+ this.editableRevision.updateRevisionContent(content);
+ }
};
+
+WI.LocalResource.Event = {
+ MappedFilePathChanged: "local-resource-mapped-file-path-changed",
+};
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/LocalResourceOverride.js (292083 => 292084)
--- trunk/Source/WebInspectorUI/UserInterface/Models/LocalResourceOverride.js 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/LocalResourceOverride.js 2022-03-30 00:12:28 UTC (rev 292084)
@@ -164,6 +164,24 @@
return displayName;
}
+ get canMapToFile()
+ {
+ if (!WI.LocalResource.canMapToFile())
+ return false;
+
+ switch (this._type) {
+ case WI.LocalResourceOverride.InterceptType.Request:
+ return false;
+
+ case WI.LocalResourceOverride.InterceptType.Response:
+ case WI.LocalResourceOverride.InterceptType.ResponseSkippingNetwork:
+ return true;
+ }
+
+ console.assert(false, "not reached");
+ return false;
+ }
+
matches(url)
{
if (this._isRegex) {
Copied: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.css (from rev 292083, trunk/Source/WebKit/WebProcess/Inspector/win/WebInspectorUIWin.cpp) (0 => 292084)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.css (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.css 2022-03-30 00:12:28 UTC (rev 292084)
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+.content-view.resource > .local-resource-override-label-view + .message-text-view {
+ top: var(--navigation-bar-height);
+}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js (292083 => 292084)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js 2022-03-30 00:12:28 UTC (rev 292084)
@@ -37,10 +37,12 @@
this.element.classList.add(styleClassName, "resource");
this._spinnerTimeout = setTimeout(() => {
- // Append a spinner while waiting for contentAvailable. Subclasses are responsible for
- // removing the spinner before showing the resource content by calling removeLoadingIndicator.
- let spinner = new WI.IndeterminateProgressSpinner;
- this.element.appendChild(spinner.element);
+ if (!this._hasContent()) {
+ // Append a spinner while waiting for contentAvailable. Subclasses are responsible for
+ // removing the spinner before showing the resource content by calling removeLoadingIndicator.
+ let spinner = new WI.IndeterminateProgressSpinner;
+ this.element.appendChild(spinner.element);
+ }
this._spinnerTimeout = undefined;
}, 100);
@@ -67,6 +69,15 @@
this._importLocalResourceOverrideButtonNavigationItem.visibilityPriority = WI.NavigationItem.VisibilityPriority.Low;
this._importLocalResourceOverrideButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._handleImportLocalResourceOverride, this);
+ if (resource.localResourceOverride.canMapToFile) {
+ this._mapLocalResourceOverrideToFileButtonNavigationItem = new WI.ButtonNavigationItem("map-local-resource-override", WI.UIString("Map to File"), "Images/Disk.svg", 15, 15);
+ this._mapLocalResourceOverrideToFileButtonNavigationItem.buttonStyle = WI.ButtonNavigationItem.Style.ImageAndText;
+ this._mapLocalResourceOverrideToFileButtonNavigationItem.visibilityPriority = WI.NavigationItem.VisibilityPriority.Low;
+ this._mapLocalResourceOverrideToFileButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._handleMapLocalResourceOverrideToFile, this);
+
+ resource.addEventListener(WI.LocalResource.Event.MappedFilePathChanged, this._handleMappedFilePathChanged, this);
+ }
+
this._removeLocalResourceOverrideButtonNavigationItem = new WI.ButtonNavigationItem("remove-local-resource-override", WI.UIString("Delete Local Override"), "Images/NavigationItemTrash.svg", 15, 15);
this._removeLocalResourceOverrideButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._handleRemoveLocalResourceOverride, this);
this._removeLocalResourceOverrideButtonNavigationItem.visibilityPriority = WI.NavigationItem.VisibilityPriority.Low;
@@ -96,7 +107,13 @@
let items = [];
if (this._importLocalResourceOverrideButtonNavigationItem)
- items.push(this._importLocalResourceOverrideButtonNavigationItem, new WI.DividerNavigationItem);
+ items.push(this._importLocalResourceOverrideButtonNavigationItem);
+ if (this._mapLocalResourceOverrideToFileButtonNavigationItem)
+ items.push(this._mapLocalResourceOverrideToFileButtonNavigationItem);
+
+ if (items.length)
+ items.push(new WI.DividerNavigationItem);
+
if (this._removeLocalResourceOverrideButtonNavigationItem)
items.push(this._removeLocalResourceOverrideButtonNavigationItem);
if (this._createLocalResourceOverrideButtonNavigationItem)
@@ -172,7 +189,8 @@
showMessage(message)
{
- this.element.removeChildren();
+ this.removeAllSubviews();
+
this.element.appendChild(WI.createMessageTextView(message));
}
@@ -179,7 +197,8 @@
addIssue(issue)
{
// This generically shows only the last issue, subclasses can override for better handling.
- this.element.removeChildren();
+ this.removeAllSubviews();
+
this.element.appendChild(WI.createMessageTextView(issue.text, issue.level === WI.IssueMessage.Level.Error));
}
@@ -231,6 +250,13 @@
return;
}
+ if (parameters.sourceCode instanceof WI.LocalResource) {
+ if (this.resource.mappedFilePath) {
+ this._handleMappedFilePathChanged();
+ return;
+ }
+ }
+
// The view maybe populated with inline scripts content by the time resource
// content arrives. SourceCodeTextEditor will handle that.
if (this._hasContent())
@@ -347,6 +373,25 @@
});
}
+ _handleMapLocalResourceOverrideToFile(event)
+ {
+ WI.FileUtilities.import((files) => {
+ console.assert(files.length === 1, files);
+
+ this.resource.mappedFilePath = InspectorFrontendHost.getPath(files[0]);
+ });
+ }
+
+ _handleMappedFilePathChanged(event)
+ {
+ this.showMessage(WI.UIString("Mapped to \u201C%s\u201D").format(this.resource.mappedFilePath));
+
+ if (this._localResourceOverrideBannerView) {
+ this.element.insertBefore(this._localResourceOverrideBannerView.element, this.element.firstChild);
+ this.addSubview(this._localResourceOverrideBannerView);
+ }
+ }
+
_handleRemoveLocalResourceOverride(event)
{
let localResourceOverride = this.resource.localResourceOverride || WI.networkManager.localResourceOverridesForURL(this._resource.url)[0];
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js (292083 => 292084)
--- trunk/Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js 2022-03-30 00:12:28 UTC (rev 292084)
@@ -223,6 +223,9 @@
if (this._textEditor.parentView === this)
return;
+ if (this._hasContent())
+ return;
+
this.removeLoadingIndicator();
this.addSubview(this._textEditor);
Modified: trunk/Source/WebKit/ChangeLog (292083 => 292084)
--- trunk/Source/WebKit/ChangeLog 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebKit/ChangeLog 2022-03-30 00:12:28 UTC (rev 292084)
@@ -1,3 +1,65 @@
+2022-03-29 Devin Rousso <[email protected]>
+
+ Web Inspector: Sources: allow Response Local Overrides to map to a file on disk
+ https://bugs.webkit.org/show_bug.cgi?id=238236
+ <rdar://problem/59009154>
+
+ Reviewed by Patrick Angle.
+
+ This makes Response Local Overrides even more powerful by allowing developers to map the
+ contents of the (Local Override) resource to a file on disk (e.g. a local copy of the file),
+ meaning that they can use their preferred editor of choice (and all the tools that may come
+ with it) to make changes instead of having to stay within Web Inspector.
+
+ * WebProcess/Inspector/WebInspectorUI.h:
+ * WebProcess/Inspector/WebInspectorUI.cpp:
+ (WebKit::WebInspectorUI::load): Added.
+ (WebKit::WebInspectorUI::canLoad): Added.
+ * WebProcess/Inspector/gtk/WebInspectorUIGtk.cpp:
+ (WebKit::WebInspectorUI::canLoad): Added.
+ * WebProcess/Inspector/mac/WebInspectorUIMac.mm:
+ (WebKit::WebInspectorUI::canLoad): Added.
+ * WebProcess/Inspector/win/WebInspectorUIWin.cpp:
+ (WebKit::WebInspectorUI::canLoad): Added.
+ * WebProcess/Inspector/RemoteWebInspectorUI.h:
+ * WebProcess/Inspector/RemoteWebInspectorUI.cpp:
+ (WebKit::RemoteWebInspectorUI::load): Added.
+ * UIProcess/Inspector/WebInspectorUIProxy.messages.in:
+ * UIProcess/Inspector/WebInspectorUIProxy.h:
+ * UIProcess/Inspector/WebInspectorUIProxy.cpp:
+ (WebKit::WebInspectorUIProxy::load): Added.
+ (WebKit::WebInspectorUIProxy::platformLoad): Added.
+ * UIProcess/Inspector/gtk/WebInspectorUIProxyGtk.cpp:
+ (WebKit::WebInspectorUIProxy::platformLoad): Added.
+ * UIProcess/Inspector/mac/WebInspectorUIProxyMac.mm:
+ (WebKit::WebInspectorUIProxy::platformLoad): Added.
+ * UIProcess/Inspector/win/WebInspectorUIProxyWin.cpp:
+ (WebKit::WebInspectorUIProxy::platformLoad): Added.
+ * UIProcess/Inspector/RemoteWebInspectorUIProxy.messages.in:
+ * UIProcess/Inspector/RemoteWebInspectorUIProxy.h:
+ * UIProcess/Inspector/RemoteWebInspectorUIProxy.cpp:
+ (WebKit::RemoteWebInspectorUIProxy::initialize): Renamed from `load`.
+ (WebKit::RemoteWebInspectorUIProxy::reopen):
+ (WebKit::RemoteWebInspectorUIProxy::load): Added.
+ (WebKit::RemoteWebInspectorUIProxy::platformLoad): Added.
+ * UIProcess/Inspector/gtk/RemoteWebInspectorUIProxyGtk.cpp:
+ (WebKit::RemoteWebInspectorUIProxy::platformLoad): Added.
+ * UIProcess/Inspector/mac/RemoteWebInspectorUIProxyMac.mm:
+ (WebKit::RemoteWebInspectorUIProxy::platformLoad): Added.
+ * UIProcess/Inspector/win/RemoteWebInspectorUIProxyWin.cpp:
+ (WebKit::RemoteWebInspectorUIProxy::platformLoad): Added.
+ Add helpers for loading the contents of a file on disk.
+
+ * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm:
+ (-[_WKRemoteWebInspectorViewController loadForDebuggable:backendCommandsURL:]):
+ * UIProcess/Inspector/glib/RemoteInspectorClient.cpp:
+ (WebKit::RemoteInspectorProxy::initialize): Renamed from `load`.
+ (WebKit::RemoteInspectorClient::inspect):
+ * UIProcess/Inspector/socket/RemoteInspectorClient.cpp:
+ (WebKit::RemoteInspectorProxy::initialize): Renamed from `load`.
+ (WebKit::RemoteInspectorClient::inspect):
+ Use renamed `WebKit::RemoteWebInspectorUIProxy::initialize`.
+
2022-03-29 Jigen Zhou <[email protected]>
[Playstation] Fix build break after r292041 when ENABLE_SERVICE_WORKER is off
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm (292083 => 292084)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm 2022-03-30 00:12:28 UTC (rev 292084)
@@ -123,7 +123,7 @@
- (void)loadForDebuggable:(_WKInspectorDebuggableInfo *)debuggableInfo backendCommandsURL:(NSURL *)backendCommandsURL
{
- m_remoteInspectorProxy->load(static_cast<API::DebuggableInfo&>([debuggableInfo _apiObject]), backendCommandsURL.absoluteString);
+ m_remoteInspectorProxy->initialize(static_cast<API::DebuggableInfo&>([debuggableInfo _apiObject]), backendCommandsURL.absoluteString);
}
- (void)close
Modified: trunk/Source/WebKit/UIProcess/Inspector/RemoteWebInspectorUIProxy.cpp (292083 => 292084)
--- trunk/Source/WebKit/UIProcess/Inspector/RemoteWebInspectorUIProxy.cpp 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebKit/UIProcess/Inspector/RemoteWebInspectorUIProxy.cpp 2022-03-30 00:12:28 UTC (rev 292084)
@@ -67,7 +67,7 @@
#endif
}
-void RemoteWebInspectorUIProxy::load(Ref<API::DebuggableInfo>&& debuggableInfo, const String& backendCommandsURL)
+void RemoteWebInspectorUIProxy::initialize(Ref<API::DebuggableInfo>&& debuggableInfo, const String& backendCommandsURL)
{
m_debuggableInfo = WTFMove(debuggableInfo);
m_backendCommandsURL = backendCommandsURL;
@@ -131,7 +131,7 @@
ASSERT(!m_backendCommandsURL.isEmpty());
closeFrontendPageAndWindow();
- load(m_debuggableInfo.copyRef(), m_backendCommandsURL);
+ initialize(m_debuggableInfo.copyRef(), m_backendCommandsURL);
}
void RemoteWebInspectorUIProxy::resetState()
@@ -154,6 +154,11 @@
platformAppend(suggestedURL, content);
}
+void RemoteWebInspectorUIProxy::load(const String& path, CompletionHandler<void(const String&)>&& completionHandler)
+{
+ platformLoad(path, WTFMove(completionHandler));
+}
+
void RemoteWebInspectorUIProxy::setSheetRect(const FloatRect& rect)
{
platformSetSheetRect(rect);
@@ -233,6 +238,7 @@
void RemoteWebInspectorUIProxy::platformBringToFront() { }
void RemoteWebInspectorUIProxy::platformSave(const String&, const String&, bool, bool) { }
void RemoteWebInspectorUIProxy::platformAppend(const String&, const String&) { }
+void RemoteWebInspectorUIProxy::platformLoad(const String&, CompletionHandler<void(const String&)>&& completionHandler) { completionHandler(nullString()); }
void RemoteWebInspectorUIProxy::platformSetSheetRect(const FloatRect&) { }
void RemoteWebInspectorUIProxy::platformSetForcedAppearance(InspectorFrontendClient::Appearance) { }
void RemoteWebInspectorUIProxy::platformStartWindowDrag() { }
Modified: trunk/Source/WebKit/UIProcess/Inspector/RemoteWebInspectorUIProxy.h (292083 => 292084)
--- trunk/Source/WebKit/UIProcess/Inspector/RemoteWebInspectorUIProxy.h 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebKit/UIProcess/Inspector/RemoteWebInspectorUIProxy.h 2022-03-30 00:12:28 UTC (rev 292084)
@@ -85,7 +85,7 @@
void invalidate();
- void load(Ref<API::DebuggableInfo>&&, const String& backendCommandsURL);
+ void initialize(Ref<API::DebuggableInfo>&&, const String& backendCommandsURL);
void closeFromBackend();
void show();
void showConsole();
@@ -133,6 +133,7 @@
void bringToFront();
void save(const String& filename, const String& content, bool base64Encoded, bool forceSaveAs);
void append(const String& filename, const String& content);
+ void load(const String& path, CompletionHandler<void(const String&)>&&);
void setSheetRect(const WebCore::FloatRect&);
void setForcedAppearance(WebCore::InspectorFrontendClient::Appearance);
void startWindowDrag();
@@ -150,6 +151,7 @@
void platformBringToFront();
void platformSave(const String& filename, const String& content, bool base64Encoded, bool forceSaveAs);
void platformAppend(const String& filename, const String& content);
+ void platformLoad(const String& path, CompletionHandler<void(const String&)>&&);
void platformSetSheetRect(const WebCore::FloatRect&);
void platformSetForcedAppearance(WebCore::InspectorFrontendClient::Appearance);
void platformStartWindowDrag();
Modified: trunk/Source/WebKit/UIProcess/Inspector/RemoteWebInspectorUIProxy.messages.in (292083 => 292084)
--- trunk/Source/WebKit/UIProcess/Inspector/RemoteWebInspectorUIProxy.messages.in 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebKit/UIProcess/Inspector/RemoteWebInspectorUIProxy.messages.in 2022-03-30 00:12:28 UTC (rev 292084)
@@ -29,6 +29,7 @@
Save(String filename, String content, bool base64Encoded, bool forceSaveAs)
Append(String filename, String content)
+ Load(String path) -> (String content)
SetForcedAppearance(WebCore::InspectorFrontendClient::Appearance appearance)
Modified: trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIProxy.cpp (292083 => 292084)
--- trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIProxy.cpp 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIProxy.cpp 2022-03-30 00:12:28 UTC (rev 292084)
@@ -729,6 +729,18 @@
platformAppend(filename, content);
}
+void WebInspectorUIProxy::load(const String& path, CompletionHandler<void(const String&)>&& completionHandler)
+{
+ if (!m_inspectedPage->preferences().developerExtrasEnabled())
+ return;
+
+ ASSERT(!path.isEmpty());
+ if (path.isEmpty())
+ return;
+
+ platformLoad(path, WTFMove(completionHandler));
+}
+
bool WebInspectorUIProxy::shouldOpenAttached()
{
return inspectorPagePreferences().inspectorStartsAttached() && canAttach();
@@ -823,6 +835,12 @@
notImplemented();
}
+void WebInspectorUIProxy::platformLoad(const String& path, CompletionHandler<void(const String&)>&& completionHandler)
+{
+ notImplemented();
+ completionHandler(nullString());
+}
+
unsigned WebInspectorUIProxy::platformInspectedWindowHeight()
{
notImplemented();
Modified: trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIProxy.h (292083 => 292084)
--- trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIProxy.h 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIProxy.h 2022-03-30 00:12:28 UTC (rev 292084)
@@ -236,6 +236,7 @@
void platformStartWindowDrag();
void platformSave(const String& filename, const String& content, bool base64Encoded, bool forceSaveAs);
void platformAppend(const String& filename, const String& content);
+ void platformLoad(const String& path, CompletionHandler<void(const String&)>&&);
#if PLATFORM(MAC)
bool platformCanAttach(bool webProcessCanAttach);
@@ -262,6 +263,7 @@
void save(const String& filename, const String& content, bool base64Encoded, bool forceSaveAs);
void append(const String& filename, const String& content);
+ void load(const String& path, CompletionHandler<void(const String&)>&&);
bool canAttach() const { return m_canAttach; }
bool shouldOpenAttached();
Modified: trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIProxy.messages.in (292083 => 292084)
--- trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIProxy.messages.in 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUIProxy.messages.in 2022-03-30 00:12:28 UTC (rev 292084)
@@ -44,6 +44,7 @@
Save(String filename, String content, bool base64Encoded, bool forceSaveAs)
Append(String filename, String content)
+ Load(String path) -> (String content)
AttachBottom()
AttachRight()
Modified: trunk/Source/WebKit/UIProcess/Inspector/glib/RemoteInspectorClient.cpp (292083 => 292084)
--- trunk/Source/WebKit/UIProcess/Inspector/glib/RemoteInspectorClient.cpp 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebKit/UIProcess/Inspector/glib/RemoteInspectorClient.cpp 2022-03-30 00:12:28 UTC (rev 292084)
@@ -60,7 +60,7 @@
RemoteInspectorHTTPServer::singleton().targetDidClose(m_connectionID, m_targetID);
}
- void load(Inspector::DebuggableType debuggableType)
+ void initialize(Inspector::DebuggableType debuggableType)
{
m_proxy = RemoteWebInspectorUIProxy::create();
m_proxy->setClient(this);
@@ -67,7 +67,7 @@
// FIXME <https://webkit.org/b/205536>: this should infer more useful data about the debug target.
Ref<API::DebuggableInfo> debuggableInfo = API::DebuggableInfo::create(DebuggableInfoData::empty());
debuggableInfo->setDebuggableType(debuggableType);
- m_proxy->load(WTFMove(debuggableInfo), m_inspectorClient.backendCommandsURL());
+ m_proxy->initialize(WTFMove(debuggableInfo), m_inspectorClient.backendCommandsURL());
}
void show()
@@ -243,7 +243,7 @@
m_socketConnection->sendMessage("Setup", g_variant_new("(tt)", connectionID, targetID));
if (inspectorType == InspectorType::UI)
- addResult.iterator->value->load(debuggableType(targetType));
+ addResult.iterator->value->initialize(debuggableType(targetType));
}
void RemoteInspectorClient::sendMessageToBackend(uint64_t connectionID, uint64_t targetID, const String& message)
Modified: trunk/Source/WebKit/UIProcess/Inspector/gtk/RemoteWebInspectorUIProxyGtk.cpp (292083 => 292084)
--- trunk/Source/WebKit/UIProcess/Inspector/gtk/RemoteWebInspectorUIProxyGtk.cpp 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebKit/UIProcess/Inspector/gtk/RemoteWebInspectorUIProxyGtk.cpp 2022-03-30 00:12:28 UTC (rev 292084)
@@ -162,6 +162,11 @@
{
}
+void RemoteWebInspectorUIProxy::platformLoad(const String&, CompletionHandler<void(const String&)>&& completionHandler)
+{
+ completionHandler(nullString());
+}
+
void RemoteWebInspectorUIProxy::platformSetSheetRect(const FloatRect&)
{
}
Modified: trunk/Source/WebKit/UIProcess/Inspector/gtk/WebInspectorUIProxyGtk.cpp (292083 => 292084)
--- trunk/Source/WebKit/UIProcess/Inspector/gtk/WebInspectorUIProxyGtk.cpp 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebKit/UIProcess/Inspector/gtk/WebInspectorUIProxyGtk.cpp 2022-03-30 00:12:28 UTC (rev 292084)
@@ -562,6 +562,12 @@
notImplemented();
}
+void WebInspectorUIProxy::platformLoad(const String&, CompletionHandler<void(const String&)>&& completionHandler)
+{
+ notImplemented();
+ completionHandler(nullString());
+}
+
void WebInspectorUIProxy::platformAttachAvailabilityChanged(bool available)
{
if (m_client)
Modified: trunk/Source/WebKit/UIProcess/Inspector/mac/RemoteWebInspectorUIProxyMac.mm (292083 => 292084)
--- trunk/Source/WebKit/UIProcess/Inspector/mac/RemoteWebInspectorUIProxyMac.mm 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebKit/UIProcess/Inspector/mac/RemoteWebInspectorUIProxyMac.mm 2022-03-30 00:12:28 UTC (rev 292084)
@@ -233,6 +233,14 @@
inspectorPage->send(Messages::RemoteWebInspectorUI::DidAppend([actualURL absoluteString]));
}
+void RemoteWebInspectorUIProxy::platformLoad(const String& path, CompletionHandler<void(const String&)>&& completionHandler)
+{
+ if (auto contents = FileSystem::readEntireFile(path))
+ completionHandler(String::adopt(WTFMove(*contents)));
+ else
+ completionHandler(nullString());
+}
+
void RemoteWebInspectorUIProxy::platformSetSheetRect(const FloatRect& rect)
{
m_sheetRect = rect;
Modified: trunk/Source/WebKit/UIProcess/Inspector/mac/WebInspectorUIProxyMac.mm (292083 => 292084)
--- trunk/Source/WebKit/UIProcess/Inspector/mac/WebInspectorUIProxyMac.mm 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebKit/UIProcess/Inspector/mac/WebInspectorUIProxyMac.mm 2022-03-30 00:12:28 UTC (rev 292084)
@@ -577,6 +577,14 @@
m_inspectorPage->send(Messages::WebInspectorUI::DidAppend([actualURL absoluteString]));
}
+void WebInspectorUIProxy::platformLoad(const String& path, CompletionHandler<void(const String&)>&& completionHandler)
+{
+ if (auto contents = FileSystem::readEntireFile(path))
+ completionHandler(String::adopt(WTFMove(*contents)));
+ else
+ completionHandler(nullString());
+}
+
void WebInspectorUIProxy::windowFrameDidChange()
{
ASSERT(!m_isAttached);
Modified: trunk/Source/WebKit/UIProcess/Inspector/socket/RemoteInspectorClient.cpp (292083 => 292084)
--- trunk/Source/WebKit/UIProcess/Inspector/socket/RemoteInspectorClient.cpp 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebKit/UIProcess/Inspector/socket/RemoteInspectorClient.cpp 2022-03-30 00:12:28 UTC (rev 292084)
@@ -55,12 +55,12 @@
m_proxy->invalidate();
}
- void load()
+ void initialize()
{
// FIXME <https://webkit.org/b/205537>: this should infer more useful data about the debug target.
Ref<API::DebuggableInfo> debuggableInfo = API::DebuggableInfo::create(DebuggableInfoData::empty());
debuggableInfo->setDebuggableType(m_debuggableType);
- m_proxy->load(WTFMove(debuggableInfo), m_inspectorClient.backendCommandsURL());
+ m_proxy->initialize(WTFMove(debuggableInfo), m_inspectorClient.backendCommandsURL());
}
void show()
@@ -177,7 +177,7 @@
setupEvent->setInteger("targetID"_s, targetID);
sendWebInspectorEvent(setupEvent->toJSONString());
- addResult.iterator->value->load();
+ addResult.iterator->value->initialize();
}
void RemoteInspectorClient::sendMessageToBackend(ConnectionID connectionID, TargetID targetID, const String& message)
Modified: trunk/Source/WebKit/UIProcess/Inspector/win/RemoteWebInspectorUIProxyWin.cpp (292083 => 292084)
--- trunk/Source/WebKit/UIProcess/Inspector/win/RemoteWebInspectorUIProxyWin.cpp 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebKit/UIProcess/Inspector/win/RemoteWebInspectorUIProxyWin.cpp 2022-03-30 00:12:28 UTC (rev 292084)
@@ -134,6 +134,7 @@
void RemoteWebInspectorUIProxy::platformBringToFront() { }
void RemoteWebInspectorUIProxy::platformSave(const String&, const String&, bool, bool) { }
void RemoteWebInspectorUIProxy::platformAppend(const String&, const String&) { }
+void RemoteWebInspectorUIProxy::platformLoad(const String&, CompletionHandler<void(const String&)>&& completionHandler) { completionHandler(nullString()); }
void RemoteWebInspectorUIProxy::platformSetSheetRect(const WebCore::FloatRect&) { }
void RemoteWebInspectorUIProxy::platformSetForcedAppearance(WebCore::InspectorFrontendClient::Appearance) { }
void RemoteWebInspectorUIProxy::platformStartWindowDrag() { }
Modified: trunk/Source/WebKit/UIProcess/Inspector/win/WebInspectorUIProxyWin.cpp (292083 => 292084)
--- trunk/Source/WebKit/UIProcess/Inspector/win/WebInspectorUIProxyWin.cpp 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebKit/UIProcess/Inspector/win/WebInspectorUIProxyWin.cpp 2022-03-30 00:12:28 UTC (rev 292084)
@@ -418,6 +418,12 @@
notImplemented();
}
+void WebInspectorUIProxy::platformLoad(const String&, CompletionHandler<void(const String&)>&& completionHandler)
+{
+ notImplemented();
+ completionHandler(nullString());
+}
+
void WebInspectorUIProxy::platformAttachAvailabilityChanged(bool /* available */)
{
notImplemented();
Modified: trunk/Source/WebKit/WebProcess/Inspector/RemoteWebInspectorUI.cpp (292083 => 292084)
--- trunk/Source/WebKit/WebProcess/Inspector/RemoteWebInspectorUI.cpp 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebKit/WebProcess/Inspector/RemoteWebInspectorUI.cpp 2022-03-30 00:12:28 UTC (rev 292084)
@@ -228,6 +228,11 @@
WebProcess::singleton().parentProcessConnection()->send(Messages::RemoteWebInspectorUIProxy::Append(filename, content), m_page.identifier());
}
+void RemoteWebInspectorUI::load(const String& path, CompletionHandler<void(const String&)>&& completionHandler)
+{
+ WebProcess::singleton().parentProcessConnection()->sendWithAsyncReply(Messages::RemoteWebInspectorUIProxy::Load(path), WTFMove(completionHandler), m_page.identifier());
+}
+
void RemoteWebInspectorUI::inspectedURLChanged(const String& urlString)
{
// Do nothing. The remote side can know if the main resource changed.
Modified: trunk/Source/WebKit/WebProcess/Inspector/RemoteWebInspectorUI.h (292083 => 292084)
--- trunk/Source/WebKit/WebProcess/Inspector/RemoteWebInspectorUI.h 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebKit/WebProcess/Inspector/RemoteWebInspectorUI.h 2022-03-30 00:12:28 UTC (rev 292084)
@@ -107,6 +107,7 @@
void openURLExternally(const String& url) override;
void save(const String& url, const String& content, bool base64Encoded, bool forceSaveAs) override;
void append(const String& url, const String& content) override;
+ void load(const String& path, CompletionHandler<void(const String&)>&&) override;
void inspectedURLChanged(const String&) override;
void showCertificate(const WebCore::CertificateInfo&) override;
void sendMessageToBackend(const String&) override;
@@ -128,6 +129,7 @@
#endif
bool canSave() override { return true; }
+ bool canLoad() override { return true; }
bool isUnderTest() override { return false; }
unsigned inspectionLevel() const override { return 1; }
void requestSetDockSide(DockSide) override { }
Modified: trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUI.cpp (292083 => 292084)
--- trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUI.cpp 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUI.cpp 2022-03-30 00:12:28 UTC (rev 292084)
@@ -327,6 +327,11 @@
WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorUIProxy::Append(filename, content), m_inspectedPageIdentifier);
}
+void WebInspectorUI::load(const WTF::String& path, CompletionHandler<void(const String&)>&& completionHandler)
+{
+ WebProcess::singleton().parentProcessConnection()->sendWithAsyncReply(Messages::WebInspectorUIProxy::Load(path), WTFMove(completionHandler), m_inspectedPageIdentifier);
+}
+
void WebInspectorUI::inspectedURLChanged(const String& urlString)
{
WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorUIProxy::InspectedURLChanged(urlString), m_inspectedPageIdentifier);
@@ -495,6 +500,12 @@
return false;
}
+bool WebInspectorUI::canLoad()
+{
+ notImplemented();
+ return false;
+}
+
String WebInspectorUI::localizedStringsURL() const
{
notImplemented();
Modified: trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUI.h (292083 => 292084)
--- trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUI.h 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUI.h 2022-03-30 00:12:28 UTC (rev 292084)
@@ -143,6 +143,8 @@
bool canSave() override;
void save(const WTF::String& url, const WTF::String& content, bool base64Encoded, bool forceSaveAs) override;
void append(const WTF::String& url, const WTF::String& content) override;
+ bool canLoad() override;
+ void load(const WTF::String& path, WTF::CompletionHandler<void(const WTF::String&)>&&) override;
void inspectedURLChanged(const String&) override;
void showCertificate(const WebCore::CertificateInfo&) override;
Modified: trunk/Source/WebKit/WebProcess/Inspector/gtk/WebInspectorUIGtk.cpp (292083 => 292084)
--- trunk/Source/WebKit/WebProcess/Inspector/gtk/WebInspectorUIGtk.cpp 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebKit/WebProcess/Inspector/gtk/WebInspectorUIGtk.cpp 2022-03-30 00:12:28 UTC (rev 292084)
@@ -39,6 +39,11 @@
return true;
}
+bool WebInspectorUI::canLoad()
+{
+ return false;
+}
+
String WebInspectorUI::localizedStringsURL() const
{
return String("resource:///org/webkit/inspector/Localizations/en.lproj/localizedStrings.js");
Modified: trunk/Source/WebKit/WebProcess/Inspector/mac/WebInspectorUIMac.mm (292083 => 292084)
--- trunk/Source/WebKit/WebProcess/Inspector/mac/WebInspectorUIMac.mm 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebKit/WebProcess/Inspector/mac/WebInspectorUIMac.mm 2022-03-30 00:12:28 UTC (rev 292084)
@@ -37,6 +37,11 @@
return true;
}
+bool WebInspectorUI::canLoad()
+{
+ return true;
+}
+
static String webInspectorUILocalizedStringsURL()
{
return [WKInspectorViewController URLForInspectorResource:@"localizedStrings.js"].absoluteString;
Modified: trunk/Source/WebKit/WebProcess/Inspector/win/WebInspectorUIWin.cpp (292083 => 292084)
--- trunk/Source/WebKit/WebProcess/Inspector/win/WebInspectorUIWin.cpp 2022-03-30 00:08:22 UTC (rev 292083)
+++ trunk/Source/WebKit/WebProcess/Inspector/win/WebInspectorUIWin.cpp 2022-03-30 00:12:28 UTC (rev 292084)
@@ -39,6 +39,11 @@
return false;
}
+bool WebInspectorUI::canLoad()
+{
+ return false;
+}
+
String WebInspectorUI::localizedStringsURL() const
{
return "inspector-resource:///localizedStrings.js"_s;