Changeset 240188 in webkit


Ignore:
Timestamp:
Jan 18, 2019 4:13:28 PM (5 years ago)
Author:
Devin Rousso
Message:

Web Inspector: Audit: don't keep the injected sub-objects alive between runs
https://bugs.webkit.org/show_bug.cgi?id=193594
<rdar://problem/47398091>

Reviewed by Joseph Pecoraro.

Rather than save the InspectorAuditAccessibilityObject and InspectorAuditDOMObject
between individual Audit.setup invocations, we should only keep them alive so long as the
injected WebInspectorAudit object is alive (e.g. from Audit.setup to Audit.teardown).

This change fixes inspector/audit/run-accessibility.html.

  • inspector/agents/page/PageAuditAgent.h:
  • inspector/agents/page/PageAuditAgent.cpp:

(WebCore::PageAuditAgent::populateAuditObject):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r240185 r240188  
     12019-01-18  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Audit: don't keep the injected sub-objects alive between runs
     4        https://bugs.webkit.org/show_bug.cgi?id=193594
     5        <rdar://problem/47398091>
     6
     7        Reviewed by Joseph Pecoraro.
     8
     9        Rather than save the `InspectorAuditAccessibilityObject` and `InspectorAuditDOMObject`
     10        between individual `Audit.setup` invocations, we should only keep them alive so long as the
     11        injected `WebInspectorAudit` object is alive (e.g. from `Audit.setup` to `Audit.teardown`).
     12
     13        This change fixes inspector/audit/run-accessibility.html.
     14
     15        * inspector/agents/page/PageAuditAgent.h:
     16        * inspector/agents/page/PageAuditAgent.cpp:
     17        (WebCore::PageAuditAgent::populateAuditObject):
     18
    1192019-01-18  Daniel Bates  <dabates@apple.com>
    220
  • trunk/Source/WebCore/inspector/agents/page/PageAuditAgent.cpp

    r239976 r240188  
    2727#include "PageAuditAgent.h"
    2828
     29#include "InspectorAuditAccessibilityObject.h"
     30#include "InspectorAuditDOMObject.h"
    2931#include "JSInspectorAuditAccessibilityObject.h"
    3032#include "JSInspectorAuditDOMObject.h"
     
    8284        JSC::JSLockHolder lock(execState);
    8385
    84 #define ADD_AUDIT_OBJECT(name) \
    85         if (!m_audit##name##Object) \
    86             m_audit##name##Object = InspectorAudit##name##Object::create(*this); \
    87         if (JSC::JSValue inspectorAudit##name##Object = toJS(execState, globalObject, *m_audit##name##Object)) \
    88             auditObject->putDirect(execState->vm(), JSC::Identifier::fromString(execState, "" #name ""), inspectorAudit##name##Object);
     86        if (JSC::JSValue jsInspectorAuditAccessibilityObject = toJSNewlyCreated(execState, globalObject, InspectorAuditAccessibilityObject::create(*this))) \
     87            auditObject->putDirect(execState->vm(), JSC::Identifier::fromString(execState, "Accessibility"), jsInspectorAuditAccessibilityObject);
    8988
    90         ADD_AUDIT_OBJECT(Accessibility);
    91         ADD_AUDIT_OBJECT(DOM);
    92 #undef ADD_AUDIT_OBJECT
     89        if (JSC::JSValue jsInspectorAuditDOMObject = toJSNewlyCreated(execState, globalObject, InspectorAuditDOMObject::create(*this))) \
     90            auditObject->putDirect(execState->vm(), JSC::Identifier::fromString(execState, "DOM"), jsInspectorAuditDOMObject);
    9391    }
    9492}
  • trunk/Source/WebCore/inspector/agents/page/PageAuditAgent.h

    r239976 r240188  
    2626#pragma once
    2727
    28 #include "InspectorAuditAccessibilityObject.h"
    29 #include "InspectorAuditDOMObject.h"
    3028#include "InspectorWebAgentBase.h"
    3129#include <JavaScriptCore/InspectorAuditAgent.h>
     
    5149
    5250    Page& m_inspectedPage;
    53     RefPtr<InspectorAuditAccessibilityObject> m_auditAccessibilityObject;
    54     RefPtr<InspectorAuditDOMObject> m_auditDOMObject;
    5551};
    5652
Note: See TracChangeset for help on using the changeset viewer.