WebKit Bugzilla
Attachment 359000 Details for
Bug 193262
: Web Inspector: expose Audit and Recording versions to the frontend
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
[Patch] Command Version
193262.diff (text/plain), 18.82 KB, created by
Devin Rousso
on 2019-01-12 20:10:39 PST
(
hide
)
Description:
[Patch] Command Version
Filename:
MIME Type:
Creator:
Devin Rousso
Created:
2019-01-12 20:10:39 PST
Size:
18.82 KB
patch
obsolete
>diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 894f88e6b6c..4a344ebe9e8 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,16 @@ >+2019-01-12 Devin Rousso <drousso@apple.com> >+ >+ Web Inspector: expose Audit and Recording versions to the frontend >+ https://bugs.webkit.org/show_bug.cgi?id=193262 >+ <rdar://problem/47130684> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * inspector/audit/getAuditSystemVersion.html: Added. >+ * inspector/audit/getAuditSystemVersion-expected.txt: Added. >+ * inspector/canvas/getRecordingSystemVersion.html: Added. >+ * inspector/canvas/getRecordingSystemVersion-expected.txt: Added. >+ > 2019-01-10 Devin Rousso <drousso@apple.com> > > Web Inspector: Audit: create new IDL type for exposing special functionality in test context >diff --git a/LayoutTests/inspector/audit/getAuditSystemVersion-expected.txt b/LayoutTests/inspector/audit/getAuditSystemVersion-expected.txt >new file mode 100644 >index 00000000000..0c36518d1cf >--- /dev/null >+++ b/LayoutTests/inspector/audit/getAuditSystemVersion-expected.txt >@@ -0,0 +1,7 @@ >+Tests Audit.getAuditSystemVersion command. >+ >+ >+== Running test suite: Audit.getAuditSystemVersion >+-- Running test case: Audit.getAuditSystemVersion.MatchesFrontend >+PASS: The audit system version should match the frontend version. >+ >diff --git a/LayoutTests/inspector/audit/getAuditSystemVersion.html b/LayoutTests/inspector/audit/getAuditSystemVersion.html >new file mode 100644 >index 00000000000..a9ac52e7d2f >--- /dev/null >+++ b/LayoutTests/inspector/audit/getAuditSystemVersion.html >@@ -0,0 +1,26 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../http/tests/inspector/resources/inspector-test.js"></script> >+<script> >+function test() >+{ >+ let suite = InspectorTest.createAsyncSuite("Audit.getAuditSystemVersion"); >+ >+ suite.addTestCase({ >+ name: "Audit.getAuditSystemVersion.MatchesFrontend", >+ description: "Check that the audit system version is in sync with the frontend version.", >+ async test() { >+ let systemVersion = await WI.auditManager.getAuditSystemVersion(); >+ InspectorTest.expectEqual(systemVersion, WI.AuditTestCase.Version, "The audit system version should match the frontend version."); >+ }, >+ }); >+ >+ suite.runTestCasesAndFinish(); >+} >+</script> >+</head> >+<body onload="runTest()"> >+ <p>Tests Audit.getAuditSystemVersion command.</p> >+</body> >+</html> >diff --git a/LayoutTests/inspector/canvas/getRecordingSystemVersion-expected.txt b/LayoutTests/inspector/canvas/getRecordingSystemVersion-expected.txt >new file mode 100644 >index 00000000000..c13182482ca >--- /dev/null >+++ b/LayoutTests/inspector/canvas/getRecordingSystemVersion-expected.txt >@@ -0,0 +1,7 @@ >+Tests Canvas.getRecordingSystemVersion command. >+ >+ >+== Running test suite: Canvas.getRecordingSystemVersion >+-- Running test case: Canvas.getRecordingSystemVersion.MatchesFrontend >+PASS: The canvas recording system version should match the frontend version. >+ >diff --git a/LayoutTests/inspector/canvas/getRecordingSystemVersion.html b/LayoutTests/inspector/canvas/getRecordingSystemVersion.html >new file mode 100644 >index 00000000000..f61108bce4c >--- /dev/null >+++ b/LayoutTests/inspector/canvas/getRecordingSystemVersion.html >@@ -0,0 +1,26 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../http/tests/inspector/resources/inspector-test.js"></script> >+<script> >+function test() >+{ >+ let suite = InspectorTest.createAsyncSuite("Canvas.getRecordingSystemVersion"); >+ >+ suite.addTestCase({ >+ name: "Canvas.getRecordingSystemVersion.MatchesFrontend", >+ description: "Check that the canvas recording system version is in sync with the frontend version.", >+ async test() { >+ let systemVersion = await WI.canvasManager.getRecordingSystemVersion(); >+ InspectorTest.expectEqual(systemVersion, WI.Recording.Version, "The canvas recording system version should match the frontend version."); >+ }, >+ }); >+ >+ suite.runTestCasesAndFinish(); >+} >+</script> >+</head> >+<body onload="runTest()"> >+ <p>Tests Canvas.getRecordingSystemVersion command.</p> >+</body> >+</html> >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index db9f6731573..a42ffe245b5 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,20 @@ >+2019-01-12 Devin Rousso <drousso@apple.com> >+ >+ Web Inspector: expose Audit and Recording versions to the frontend >+ https://bugs.webkit.org/show_bug.cgi?id=193262 >+ <rdar://problem/47130684> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * inspector/protocol/Audit.json: >+ * inspector/protocol/Canvas.json: >+ * inspector/protocol/Recording.json: >+ Add `Version` types and getters that return a value of that type. >+ >+ * inspector/agents/InspectorAuditAgent.h: >+ * inspector/agents/InspectorAuditAgent.cpp: >+ (Inspector::InspectorAuditAgent::getAuditSystemVersion): Added. >+ > 2019-01-10 Devin Rousso <drousso@apple.com> > > Web Inspector: Audit: create new IDL type for exposing special functionality in test context >diff --git a/Source/JavaScriptCore/inspector/agents/InspectorAuditAgent.cpp b/Source/JavaScriptCore/inspector/agents/InspectorAuditAgent.cpp >index 308d45df403..f9ecfecb731 100644 >--- a/Source/JavaScriptCore/inspector/agents/InspectorAuditAgent.cpp >+++ b/Source/JavaScriptCore/inspector/agents/InspectorAuditAgent.cpp >@@ -40,6 +40,9 @@ namespace Inspector { > > using namespace JSC; > >+// Keep this in sync with WI.AuditTestCase.Version. >+#define INSPECTOR_AUDIT_SYSTEM_VERSION 1 >+ > InspectorAuditAgent::InspectorAuditAgent(AgentContext& context) > : InspectorAgentBase("Audit"_s) > , m_backendDispatcher(AuditBackendDispatcher::create(context.backendDispatcher, this)) >@@ -56,6 +59,11 @@ void InspectorAuditAgent::willDestroyFrontendAndBackend(DisconnectReason) > { > } > >+void InspectorAuditAgent::getAuditSystemVersion(ErrorString&, double* version) >+{ >+ *version = INSPECTOR_AUDIT_SYSTEM_VERSION; >+} >+ > void InspectorAuditAgent::setup(ErrorString& errorString, const int* executionContextId) > { > if (hasActiveAudit()) { >diff --git a/Source/JavaScriptCore/inspector/agents/InspectorAuditAgent.h b/Source/JavaScriptCore/inspector/agents/InspectorAuditAgent.h >index 5dd4fa2b1d4..577905d1324 100644 >--- a/Source/JavaScriptCore/inspector/agents/InspectorAuditAgent.h >+++ b/Source/JavaScriptCore/inspector/agents/InspectorAuditAgent.h >@@ -50,6 +50,7 @@ public: > void willDestroyFrontendAndBackend(DisconnectReason) override; > > // AuditBackendDispatcherHandler >+ void getAuditSystemVersion(ErrorString&, double* version) final; > void setup(ErrorString&, const int* executionContextId) final; > void run(ErrorString&, const String& test, const int* executionContextId, RefPtr<Protocol::Runtime::RemoteObject>& result, Optional<bool>& wasThrown) final; > void teardown(ErrorString&) final; >diff --git a/Source/JavaScriptCore/inspector/protocol/Audit.json b/Source/JavaScriptCore/inspector/protocol/Audit.json >index 718fcada43e..f6828c33042 100644 >--- a/Source/JavaScriptCore/inspector/protocol/Audit.json >+++ b/Source/JavaScriptCore/inspector/protocol/Audit.json >@@ -1,7 +1,20 @@ > { > "domain": "Audit", > "description": "", >+ "types": [ >+ { >+ "id": "Version", >+ "type": "number" >+ } >+ ], > "commands": [ >+ { >+ "name": "getAuditSystemVersion", >+ "description": "Requests the backend's audit system version number.", >+ "returns": [ >+ { "name": "version", "$ref": "Version" } >+ ] >+ }, > { > "name": "setup", > "description": "", >diff --git a/Source/JavaScriptCore/inspector/protocol/Canvas.json b/Source/JavaScriptCore/inspector/protocol/Canvas.json >index 1591d605e44..871b8b04eca 100644 >--- a/Source/JavaScriptCore/inspector/protocol/Canvas.json >+++ b/Source/JavaScriptCore/inspector/protocol/Canvas.json >@@ -104,6 +104,13 @@ > { "name": "object", "$ref": "Runtime.RemoteObject", "description": "JavaScript object wrapper for given canvas context." } > ] > }, >+ { >+ "name": "getRecordingSystemVersion", >+ "description": "Requests the backend's recording system version number.", >+ "returns": [ >+ { "name": "version", "$ref": "Recording.Version" } >+ ] >+ }, > { > "name": "setRecordingAutoCaptureFrameCount", > "description": "Tells the backend to record `count` frames whenever a new context is created.", >diff --git a/Source/JavaScriptCore/inspector/protocol/Recording.json b/Source/JavaScriptCore/inspector/protocol/Recording.json >index 853710e89ed..cd33f805879 100644 >--- a/Source/JavaScriptCore/inspector/protocol/Recording.json >+++ b/Source/JavaScriptCore/inspector/protocol/Recording.json >@@ -3,6 +3,10 @@ > "description": "General types used for recordings of actions performed in the inspected page.", > "availability": ["web"], > "types": [ >+ { >+ "id": "Version", >+ "type": "number" >+ }, > { > "id": "Type", > "type": "string", >@@ -39,7 +43,7 @@ > "id": "Recording", > "type": "object", > "properties": [ >- { "name": "version", "type": "integer", "description": "Used for future/backwards compatibility." }, >+ { "name": "version", "$ref": "Version", "description": "Used for future/backwards compatibility." }, > { "name": "type", "$ref": "Type" }, > { "name": "initialState", "$ref": "InitialState", "description": "JSON data of inital state of object before recording." }, > { "name": "data", "type": "array", "items": { "type": "any" }, "description": "Array of objects that can be referenced by index. Used to avoid duplicating objects." }, >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index fa6dbcd19ee..135078024f8 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,19 @@ >+2019-01-12 Devin Rousso <drousso@apple.com> >+ >+ Web Inspector: expose Audit and Recording versions to the frontend >+ https://bugs.webkit.org/show_bug.cgi?id=193262 >+ <rdar://problem/47130684> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Tests: inspector/audit/getAuditSystemVersion.html >+ inspector/canvas/getRecordingSystemVersion.html >+ >+ * inspector/agents/InspectorCanvasAgent.h: >+ * inspector/agents/InspectorCanvasAgent.cpp: >+ (WebCore::InspectorCanvasAgent::getRecordingSystemVersion): Added. >+ (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame): >+ > 2019-01-10 Devin Rousso <drousso@apple.com> > > Web Inspector: Audit: create new IDL type for exposing special functionality in test context >diff --git a/Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp b/Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp >index e38d1a383d3..625667f2915 100644 >--- a/Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp >+++ b/Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp >@@ -65,6 +65,9 @@ namespace WebCore { > > using namespace Inspector; > >+// Keep this in sync with WI.Recording.Version. >+#define INSPECTOR_CANVAS_RECORDING_SYSTEM_VERSION 1 >+ > InspectorCanvasAgent::InspectorCanvasAgent(WebAgentContext& context) > : InspectorAgentBase("Canvas"_s, context) > , m_frontendDispatcher(std::make_unique<Inspector::CanvasFrontendDispatcher>(context.frontendRouter)) >@@ -265,6 +268,11 @@ void InspectorCanvasAgent::resolveCanvasContext(ErrorString& errorString, const > result = injectedScript.wrapObject(value, objectGroupName); > } > >+void InspectorCanvasAgent::getRecordingSystemVersion(ErrorString&, double* version) >+{ >+ *version = INSPECTOR_CANVAS_RECORDING_SYSTEM_VERSION; >+} >+ > void InspectorCanvasAgent::setRecordingAutoCaptureFrameCount(ErrorString&, int count) > { > if (count > 0) >@@ -558,7 +566,7 @@ void InspectorCanvasAgent::didFinishRecordingCanvasFrame(CanvasRenderingContext& > } > > auto recording = Inspector::Protocol::Recording::Recording::create() >- .setVersion(1) >+ .setVersion(INSPECTOR_CANVAS_RECORDING_SYSTEM_VERSION) > .setType(type) > .setInitialState(inspectorCanvas->releaseInitialState()) > .setData(inspectorCanvas->releaseData()) >diff --git a/Source/WebCore/inspector/agents/InspectorCanvasAgent.h b/Source/WebCore/inspector/agents/InspectorCanvasAgent.h >index fa3ff7964be..90a3e2d97eb 100644 >--- a/Source/WebCore/inspector/agents/InspectorCanvasAgent.h >+++ b/Source/WebCore/inspector/agents/InspectorCanvasAgent.h >@@ -73,6 +73,7 @@ public: > void requestContent(ErrorString&, const String& canvasId, String* content) override; > void requestCSSCanvasClientNodes(ErrorString&, const String& canvasId, RefPtr<JSON::ArrayOf<int>>&) override; > void resolveCanvasContext(ErrorString&, const String& canvasId, const String* objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>&) override; >+ void getRecordingSystemVersion(ErrorString&, double* version) override; > void setRecordingAutoCaptureFrameCount(ErrorString&, int count) override; > void startRecording(ErrorString&, const String& canvasId, const int* frameCount, const int* memoryLimit) override; > void stopRecording(ErrorString&, const String& canvasId) override; >diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog >index 808bc98b3a2..c6c49e12f99 100644 >--- a/Source/WebInspectorUI/ChangeLog >+++ b/Source/WebInspectorUI/ChangeLog >@@ -1,3 +1,24 @@ >+2019-01-12 Devin Rousso <drousso@apple.com> >+ >+ Web Inspector: expose Audit and Recording versions to the frontend >+ https://bugs.webkit.org/show_bug.cgi?id=193262 >+ <rdar://problem/47130684> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * UserInterface/Models/AuditTestCase.js: >+ * UserInterface/Models/Recording.js: >+ (WI.Recording.fromPayload): >+ Add "Interface" version values. >+ >+ * UserInterface/Controllers/AuditManager.js: >+ (WI.AuditManager): >+ (WI.AuditManager.prototype.async getAuditSystemVersion): Added. >+ * UserInterface/Controllers/CanvasManager.js: >+ (WI.CanvasManager): >+ (WI.CanvasManager.prototype.async getRecordingSystemVersion): Added. >+ Add "System" version getters. >+ > 2019-01-10 Devin Rousso <drousso@apple.com> > > Web Inspector: Audit: create new IDL type for exposing special functionality in test context >diff --git a/Source/WebInspectorUI/UserInterface/Controllers/AuditManager.js b/Source/WebInspectorUI/UserInterface/Controllers/AuditManager.js >index 3732c55852e..5a684ab7f88 100644 >--- a/Source/WebInspectorUI/UserInterface/Controllers/AuditManager.js >+++ b/Source/WebInspectorUI/UserInterface/Controllers/AuditManager.js >@@ -36,10 +36,13 @@ WI.AuditManager = class AuditManager extends WI.Object > this._runningTests = []; > > this._disabledDefaultTestsSetting = new WI.Setting("audit-disabled-default-tests", []); >+ this._auditSystemVersion = undefined; > > WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._handleFrameMainResourceDidChange, this); > } > >+ // Static >+ > static synthesizeError(message) > { > let consoleMessage = new WI.ConsoleMessage(WI.mainTarget, WI.ConsoleMessage.MessageSource.Other, WI.ConsoleMessage.MessageLevel.Error, WI.UIString("Audit error: %s").format(message)); >@@ -235,6 +238,18 @@ WI.AuditManager = class AuditManager extends WI.Object > WI.objectStores.audits.deleteObject(test); > } > >+ async getAuditSystemVersion() >+ { >+ if (this._auditSystemVersion === undefined) { >+ if (InspectorBackend.domains.Audit && InspectorBackend.domains.Audit.getAuditSystemVersion) { >+ let {version} = await AuditAgent.getAuditSystemVersion(); >+ this._auditSystemVersion = version; >+ } else >+ this._auditSystemVersion = 0; >+ } >+ return this._auditSystemVersion; >+ } >+ > // Private > > _addTest(test) >diff --git a/Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js b/Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js >index 317815d309f..5846cb6a9c8 100644 >--- a/Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js >+++ b/Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js >@@ -36,6 +36,8 @@ WI.CanvasManager = class CanvasManager extends WI.Object > this._canvasIdentifierMap = new Map; > this._shaderProgramIdentifierMap = new Map; > this._importedRecordings = new Set; >+ >+ this._recordingSystemVersion = undefined; > } > > // Target >@@ -90,6 +92,18 @@ WI.CanvasManager = class CanvasManager extends WI.Object > this.dispatchEventToListeners(WI.CanvasManager.Event.RecordingImported, {recording, initiatedByUser: true}); > } > >+ async getRecordingSystemVersion() >+ { >+ if (this._recordingSystemVersion === undefined) { >+ if (!InspectorBackend.domains.Canvas || !InspectorBackend.domains.Canvas.getRecordingSystemVersion) >+ return null; >+ >+ let {version} = await CanvasAgent.getRecordingSystemVersion(); >+ this._recordingSystemVersion = version; >+ } >+ return this._recordingSystemVersion; >+ } >+ > setRecordingAutoCaptureFrameCount(enabled, count) > { > console.assert(!isNaN(count) && count >= 0); >diff --git a/Source/WebInspectorUI/UserInterface/Models/AuditTestCase.js b/Source/WebInspectorUI/UserInterface/Models/AuditTestCase.js >index 92b2faddb11..168f74e03b4 100644 >--- a/Source/WebInspectorUI/UserInterface/Models/AuditTestCase.js >+++ b/Source/WebInspectorUI/UserInterface/Models/AuditTestCase.js >@@ -279,4 +279,7 @@ WI.AuditTestCase = class AuditTestCase extends WI.AuditTestBase > } > }; > >+// Keep this in sync with INSPECTOR_AUDIT_SYSTEM_VERSION. >+WI.AuditTestCase.Version = 1; >+ > WI.AuditTestCase.TypeIdentifier = "test-case"; >diff --git a/Source/WebInspectorUI/UserInterface/Models/Recording.js b/Source/WebInspectorUI/UserInterface/Models/Recording.js >index d05f104155d..e2a560d44d7 100644 >--- a/Source/WebInspectorUI/UserInterface/Models/Recording.js >+++ b/Source/WebInspectorUI/UserInterface/Models/Recording.js >@@ -51,7 +51,7 @@ WI.Recording = class Recording extends WI.Object > if (typeof payload !== "object" || payload === null) > return null; > >- if (isNaN(payload.version) || payload.version <= 0) >+ if (isNaN(payload.version) || payload.version <= 0 || payload.version > WI.Recording.Version) > return null; > > let type = null; >@@ -472,6 +472,9 @@ WI.Recording = class Recording extends WI.Object > } > }; > >+// Keep this in sync with INSPECTOR_CANVAS_RECORDING_SYSTEM_VERSION. >+WI.Recording.Version = 1; >+ > WI.Recording.Event = { > ProcessedAction: "recording-processed-action", > StartProcessingFrame: "recording-start-processing-frame",
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193262
:
358648
|
358649
|
359000
|
359252
|
359254
|
359790
|
359837