Title: [245909] trunk
Revision
245909
Author
[email protected]
Date
2019-05-30 16:15:09 -0700 (Thu, 30 May 2019)

Log Message

Web Inspector: Audit: tests are unable to get the current Audit version
https://bugs.webkit.org/show_bug.cgi?id=198270

Reviewed by Timothy Hatcher.

Source/_javascript_Core:

Expose the Audit version number through the `WebInspectorObject` that's injected into tests
so that they can decide at runtime whether they're supported (e.g. the `unsupported` result).

* inspector/agents/InspectorAuditAgent.h:
* inspector/agents/InspectorAuditAgent.cpp:
(Inspector::InspectorAuditAgent::populateAuditObject):

LayoutTests:

* inspector/audit/run.html:
* inspector/audit/run-expected.txt:
* inspector/audit/version.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (245908 => 245909)


--- trunk/LayoutTests/ChangeLog	2019-05-30 23:07:27 UTC (rev 245908)
+++ trunk/LayoutTests/ChangeLog	2019-05-30 23:15:09 UTC (rev 245909)
@@ -1,3 +1,14 @@
+2019-05-30  Devin Rousso  <[email protected]>
+
+        Web Inspector: Audit: tests are unable to get the current Audit version
+        https://bugs.webkit.org/show_bug.cgi?id=198270
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/audit/run.html:
+        * inspector/audit/run-expected.txt:
+        * inspector/audit/version.html:
+
 2019-05-30  Justin Fan  <[email protected]>
 
         [Web GPU] Vertex Buffers/Input State API updates

Modified: trunk/LayoutTests/inspector/audit/run-expected.txt (245908 => 245909)


--- trunk/LayoutTests/inspector/audit/run-expected.txt	2019-05-30 23:07:27 UTC (rev 245908)
+++ trunk/LayoutTests/inspector/audit/run-expected.txt	2019-05-30 23:15:09 UTC (rev 245909)
@@ -38,6 +38,18 @@
 PASS: The injected WebInspectorAudit should hold an instance of InspectorAuditDOMObject.
 Audit teardown...
 
+-- Running test case: Audit.run.Valid.InjectedObject.Resources
+Audit setup...
+Audit run "function() { return WebInspectorAudit.Resources; }"...
+PASS: The injected WebInspectorAudit should hold an instance of InspectorAuditResourcesObject.
+Audit teardown...
+
+-- Running test case: Audit.run.Valid.InjectedObject.Version
+Audit setup...
+Audit run "function() { return WebInspectorAudit.Version; }"...
+PASS: The injected WebInspectorAudit should hold the current Audit::Version.
+Audit teardown...
+
 -- Running test case: Audit.run.Invalid
 TypeError: eval(`(42)`) is not a function. (In 'eval(`(42)`)(WebInspectorAudit)', 'eval(`(42)`)' is 42)
 

Modified: trunk/LayoutTests/inspector/audit/run.html (245908 => 245909)


--- trunk/LayoutTests/inspector/audit/run.html	2019-05-30 23:07:27 UTC (rev 245908)
+++ trunk/LayoutTests/inspector/audit/run.html	2019-05-30 23:15:09 UTC (rev 245909)
@@ -92,6 +92,30 @@
     });
 
     suite.addTestCase({
+        name: "Audit.run.Valid.InjectedObject.Resources",
+        description: "Check that the injected object holds an instance of InspectorAuditResourcesObject.",
+        async test() {
+            await InspectorTest.Audit.setupAudit();
+            await auditRun(`function() { return WebInspectorAudit.Resources; }`, (result) => {
+                InspectorTest.expectEqual(result.description, "InspectorAuditResourcesObject", "The injected WebInspectorAudit should hold an instance of InspectorAuditResourcesObject.");
+            });
+            await InspectorTest.Audit.teardownAudit();
+        },
+    });
+
+    suite.addTestCase({
+        name: "Audit.run.Valid.InjectedObject.Version",
+        description: "Check that the injected object holds the current Audit::VERSION value.",
+        async test() {
+            await InspectorTest.Audit.setupAudit();
+            await auditRun(`function() { return WebInspectorAudit.Version; }`, (result) => {
+                InspectorTest.expectEqual(result.value, InspectorBackend.domains.Audit.VERSION, "The injected WebInspectorAudit should hold the current Audit::Version.");
+            });
+            await InspectorTest.Audit.teardownAudit();
+        },
+    });
+
+    suite.addTestCase({
         name: "Audit.run.Invalid",
         description: "Check that an error is thrown when trying to execute a non-function.",
         async test() {

Modified: trunk/LayoutTests/inspector/audit/version.html (245908 => 245909)


--- trunk/LayoutTests/inspector/audit/version.html	2019-05-30 23:07:27 UTC (rev 245908)
+++ trunk/LayoutTests/inspector/audit/version.html	2019-05-30 23:15:09 UTC (rev 245909)
@@ -11,7 +11,7 @@
         name: "Audit.VERSION.MatchesFrontend",
         description: "Check that the audit system version is in sync with the frontend version.",
         test() {
-            InspectorTest.expectEqual(AuditAgent.VERSION, WI.AuditTestBase.Version, "The audit system version should match the frontend version.");
+            InspectorTest.expectEqual(InspectorBackend.domains.Audit.VERSION, WI.AuditTestBase.Version, "The audit system version should match the frontend version.");
             return true;
         },
     });

Modified: trunk/Source/_javascript_Core/ChangeLog (245908 => 245909)


--- trunk/Source/_javascript_Core/ChangeLog	2019-05-30 23:07:27 UTC (rev 245908)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-05-30 23:15:09 UTC (rev 245909)
@@ -1,3 +1,17 @@
+2019-05-30  Devin Rousso  <[email protected]>
+
+        Web Inspector: Audit: tests are unable to get the current Audit version
+        https://bugs.webkit.org/show_bug.cgi?id=198270
+
+        Reviewed by Timothy Hatcher.
+
+        Expose the Audit version number through the `WebInspectorObject` that's injected into tests
+        so that they can decide at runtime whether they're supported (e.g. the `unsupported` result).
+
+        * inspector/agents/InspectorAuditAgent.h:
+        * inspector/agents/InspectorAuditAgent.cpp:
+        (Inspector::InspectorAuditAgent::populateAuditObject):
+
 2019-05-30  Tadeu Zagallo  <[email protected]> and Yusuke Suzuki  <[email protected]>
 
         [JSC] Implement op_wide16 / op_wide32 and introduce 16bit version bytecode

Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorAuditAgent.cpp (245908 => 245909)


--- trunk/Source/_javascript_Core/inspector/agents/InspectorAuditAgent.cpp	2019-05-30 23:07:27 UTC (rev 245908)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorAuditAgent.cpp	2019-05-30 23:15:09 UTC (rev 245909)
@@ -130,4 +130,15 @@
     return !!m_injectedWebInspectorAuditValue;
 }
 
+void InspectorAuditAgent::populateAuditObject(JSC::ExecState* execState, JSC::Strong<JSC::JSObject>& auditObject)
+{
+    ASSERT(execState);
+    if (!execState)
+        return;
+
+    JSC::JSLockHolder lock(execState);
+
+    auditObject->putDirect(execState->vm(), JSC::Identifier::fromString(execState, "Version"), JSC::JSValue(Inspector::Protocol::Audit::VERSION));
+}
+
 } // namespace Inspector

Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorAuditAgent.h (245908 => 245909)


--- trunk/Source/_javascript_Core/inspector/agents/InspectorAuditAgent.h	2019-05-30 23:07:27 UTC (rev 245908)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorAuditAgent.h	2019-05-30 23:15:09 UTC (rev 245909)
@@ -63,7 +63,7 @@
 
     virtual InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) = 0;
 
-    virtual void populateAuditObject(JSC::ExecState*, JSC::Strong<JSC::JSObject>& /* auditObject */) { };
+    virtual void populateAuditObject(JSC::ExecState*, JSC::Strong<JSC::JSObject>& auditObject);
 
     virtual void muteConsole() { };
     virtual void unmuteConsole() { };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to