Title: [240188] trunk/Source/WebCore
Revision
240188
Author
drou...@apple.com
Date
2019-01-18 16:13:28 -0800 (Fri, 18 Jan 2019)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (240187 => 240188)


--- trunk/Source/WebCore/ChangeLog	2019-01-19 00:10:19 UTC (rev 240187)
+++ trunk/Source/WebCore/ChangeLog	2019-01-19 00:13:28 UTC (rev 240188)
@@ -1,3 +1,21 @@
+2019-01-18  Devin Rousso  <drou...@apple.com>
+
+        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):
+
 2019-01-18  Daniel Bates  <daba...@apple.com>
 
         Another attempt to fix the iOS build following <https://trac.webkit.org/changeset/240174>

Modified: trunk/Source/WebCore/inspector/agents/page/PageAuditAgent.cpp (240187 => 240188)


--- trunk/Source/WebCore/inspector/agents/page/PageAuditAgent.cpp	2019-01-19 00:10:19 UTC (rev 240187)
+++ trunk/Source/WebCore/inspector/agents/page/PageAuditAgent.cpp	2019-01-19 00:13:28 UTC (rev 240188)
@@ -26,6 +26,8 @@
 #include "config.h"
 #include "PageAuditAgent.h"
 
+#include "InspectorAuditAccessibilityObject.h"
+#include "InspectorAuditDOMObject.h"
 #include "JSInspectorAuditAccessibilityObject.h"
 #include "JSInspectorAuditDOMObject.h"
 #include "Page.h"
@@ -81,15 +83,11 @@
     if (auto* globalObject = JSC::jsCast<JSDOMGlobalObject*>(execState->lexicalGlobalObject())) {
         JSC::JSLockHolder lock(execState);
 
-#define ADD_AUDIT_OBJECT(name) \
-        if (!m_audit##name##Object) \
-            m_audit##name##Object = InspectorAudit##name##Object::create(*this); \
-        if (JSC::JSValue inspectorAudit##name##Object = toJS(execState, globalObject, *m_audit##name##Object)) \
-            auditObject->putDirect(execState->vm(), JSC::Identifier::fromString(execState, "" #name ""), inspectorAudit##name##Object);
+        if (JSC::JSValue jsInspectorAuditAccessibilityObject = toJSNewlyCreated(execState, globalObject, InspectorAuditAccessibilityObject::create(*this))) \
+            auditObject->putDirect(execState->vm(), JSC::Identifier::fromString(execState, "Accessibility"), jsInspectorAuditAccessibilityObject);
 
-        ADD_AUDIT_OBJECT(Accessibility);
-        ADD_AUDIT_OBJECT(DOM);
-#undef ADD_AUDIT_OBJECT
+        if (JSC::JSValue jsInspectorAuditDOMObject = toJSNewlyCreated(execState, globalObject, InspectorAuditDOMObject::create(*this))) \
+            auditObject->putDirect(execState->vm(), JSC::Identifier::fromString(execState, "DOM"), jsInspectorAuditDOMObject);
     }
 }
 

Modified: trunk/Source/WebCore/inspector/agents/page/PageAuditAgent.h (240187 => 240188)


--- trunk/Source/WebCore/inspector/agents/page/PageAuditAgent.h	2019-01-19 00:10:19 UTC (rev 240187)
+++ trunk/Source/WebCore/inspector/agents/page/PageAuditAgent.h	2019-01-19 00:13:28 UTC (rev 240188)
@@ -25,8 +25,6 @@
 
 #pragma once
 
-#include "InspectorAuditAccessibilityObject.h"
-#include "InspectorAuditDOMObject.h"
 #include "InspectorWebAgentBase.h"
 #include <_javascript_Core/InspectorAuditAgent.h>
 
@@ -50,8 +48,6 @@
     void unmuteConsole() override;
 
     Page& m_inspectedPage;
-    RefPtr<InspectorAuditAccessibilityObject> m_auditAccessibilityObject;
-    RefPtr<InspectorAuditDOMObject> m_auditDOMObject;
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to