⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 245909 in webkit


Ignore:
Timestamp:
May 30, 2019, 4:15:09 PM (7 years ago)
Author:
Devin Rousso
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/JavaScriptCore:

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:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r245905 r245909  
     12019-05-30  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Audit: tests are unable to get the current Audit version
     4        https://bugs.webkit.org/show_bug.cgi?id=198270
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        * inspector/audit/run.html:
     9        * inspector/audit/run-expected.txt:
     10        * inspector/audit/version.html:
     11
    1122019-05-30  Justin Fan  <justin_fan@apple.com>
    213
  • trunk/LayoutTests/inspector/audit/run-expected.txt

    r239976 r245909  
    3939Audit teardown...
    4040
     41-- Running test case: Audit.run.Valid.InjectedObject.Resources
     42Audit setup...
     43Audit run "function() { return WebInspectorAudit.Resources; }"...
     44PASS: The injected WebInspectorAudit should hold an instance of InspectorAuditResourcesObject.
     45Audit teardown...
     46
     47-- Running test case: Audit.run.Valid.InjectedObject.Version
     48Audit setup...
     49Audit run "function() { return WebInspectorAudit.Version; }"...
     50PASS: The injected WebInspectorAudit should hold the current Audit::Version.
     51Audit teardown...
     52
    4153-- Running test case: Audit.run.Invalid
    4254TypeError: eval(`(42)`) is not a function. (In 'eval(`(42)`)(WebInspectorAudit)', 'eval(`(42)`)' is 42)
  • trunk/LayoutTests/inspector/audit/run.html

    r239976 r245909  
    9393
    9494    suite.addTestCase({
     95        name: "Audit.run.Valid.InjectedObject.Resources",
     96        description: "Check that the injected object holds an instance of InspectorAuditResourcesObject.",
     97        async test() {
     98            await InspectorTest.Audit.setupAudit();
     99            await auditRun(`function() { return WebInspectorAudit.Resources; }`, (result) => {
     100                InspectorTest.expectEqual(result.description, "InspectorAuditResourcesObject", "The injected WebInspectorAudit should hold an instance of InspectorAuditResourcesObject.");
     101            });
     102            await InspectorTest.Audit.teardownAudit();
     103        },
     104    });
     105
     106    suite.addTestCase({
     107        name: "Audit.run.Valid.InjectedObject.Version",
     108        description: "Check that the injected object holds the current Audit::VERSION value.",
     109        async test() {
     110            await InspectorTest.Audit.setupAudit();
     111            await auditRun(`function() { return WebInspectorAudit.Version; }`, (result) => {
     112                InspectorTest.expectEqual(result.value, InspectorBackend.domains.Audit.VERSION, "The injected WebInspectorAudit should hold the current Audit::Version.");
     113            });
     114            await InspectorTest.Audit.teardownAudit();
     115        },
     116    });
     117
     118    suite.addTestCase({
    95119        name: "Audit.run.Invalid",
    96120        description: "Check that an error is thrown when trying to execute a non-function.",
  • trunk/LayoutTests/inspector/audit/version.html

    r240469 r245909  
    1212        description: "Check that the audit system version is in sync with the frontend version.",
    1313        test() {
    14             InspectorTest.expectEqual(AuditAgent.VERSION, WI.AuditTestBase.Version, "The audit system version should match the frontend version.");
     14            InspectorTest.expectEqual(InspectorBackend.domains.Audit.VERSION, WI.AuditTestBase.Version, "The audit system version should match the frontend version.");
    1515            return true;
    1616        },
  • trunk/Source/JavaScriptCore/ChangeLog

    r245906 r245909  
     12019-05-30  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Audit: tests are unable to get the current Audit version
     4        https://bugs.webkit.org/show_bug.cgi?id=198270
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        Expose the Audit version number through the `WebInspectorObject` that's injected into tests
     9        so that they can decide at runtime whether they're supported (e.g. the `unsupported` result).
     10
     11        * inspector/agents/InspectorAuditAgent.h:
     12        * inspector/agents/InspectorAuditAgent.cpp:
     13        (Inspector::InspectorAuditAgent::populateAuditObject):
     14
    1152019-05-30  Tadeu Zagallo  <tzagallo@apple.com> and Yusuke Suzuki  <ysuzuki@apple.com>
    216
  • trunk/Source/JavaScriptCore/inspector/agents/InspectorAuditAgent.cpp

    r239976 r245909  
    131131}
    132132
     133void InspectorAuditAgent::populateAuditObject(JSC::ExecState* execState, JSC::Strong<JSC::JSObject>& auditObject)
     134{
     135    ASSERT(execState);
     136    if (!execState)
     137        return;
     138
     139    JSC::JSLockHolder lock(execState);
     140
     141    auditObject->putDirect(execState->vm(), JSC::Identifier::fromString(execState, "Version"), JSC::JSValue(Inspector::Protocol::Audit::VERSION));
     142}
     143
    133144} // namespace Inspector
  • trunk/Source/JavaScriptCore/inspector/agents/InspectorAuditAgent.h

    r239976 r245909  
    6464    virtual InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) = 0;
    6565
    66     virtual void populateAuditObject(JSC::ExecState*, JSC::Strong<JSC::JSObject>& /* auditObject */) { };
     66    virtual void populateAuditObject(JSC::ExecState*, JSC::Strong<JSC::JSObject>& auditObject);
    6767
    6868    virtual void muteConsole() { };
Note: See TracChangeset for help on using the changeset viewer.