Web Inspector: Audit: create new IDL type for exposing special functionality in test...
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Jan 2019 08:25:33 +0000 (08:25 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Jan 2019 08:25:33 +0000 (08:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=193149
<rdar://problem/46801218>

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

Create a new `AuditAgent` (and various subclasses for different inspection targets)

* inspector/protocol/Audit.json: Added.
Add a `run` command that is a simpler version of `Runtime.evaluate`, except that it expects
a function string instead of an arbitrary JavaScript expression.
Add `setup` and `teardown` commands that create a JavaScript object that will be passed in
to the test as an argument. Keep this object alive so that tests can add to the object and
have later tests use what was added.

* inspector/agents/InspectorAuditAgent.h: Added.
* inspector/agents/InspectorAuditAgent.cpp: Added.
(Inspector::InspectorAuditAgent::InspectorAuditAgent):
(Inspector::InspectorAuditAgent::didCreateFrontendAndBackend):
(Inspector::InspectorAuditAgent::willDestroyFrontendAndBackend):
(Inspector::InspectorAuditAgent::setup):
(Inspector::InspectorAuditAgent::run):
(Inspector::InspectorAuditAgent::teardown):
(Inspector::InspectorAuditAgent::hasActiveAudit):
(Inspector::InspectorAuditAgent::populateAuditObject):

* inspector/agents/JSGlobalObjectAuditAgent.h: Added.
* inspector/agents/JSGlobalObjectAuditAgent.cpp: Added.
(Inspector::JSGlobalObjectAuditAgent::JSGlobalObjectAuditAgent):
(Inspector::JSGlobalObjectAuditAgent::injectedScriptForEval):

* inspector/JSGlobalObjectInspectorController.h:
* inspector/JSGlobalObjectInspectorController.cpp:
(Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController):
(Inspector::JSGlobalObjectInspectorController::connectFrontend):
(Inspector::JSGlobalObjectInspectorController::jsAgentContext): Added.
(Inspector::JSGlobalObjectInspectorController::createLazyAgents): Added.

* inspector/InjectedScript.h:
* inspector/InjectedScript.cpp:
(Inspector::InjectedScript::execute): Added.
(Inspector::InjectedScript::arrayFromVector): Added.
Create a version of `evaluate` that accepts a list of values to be passed in as arguments
to the function that was created by the `eval` of the given `functionString`.

* inspector/InjectedScriptSource.js:
(InjectedScript.prototype.execute): Added.
(InjectedScript.prototype.evaluate):
(InjectedScript.prototype.evaluateOnCallFrame):
(InjectedScript.prototype._evaluateAndWrap):
(InjectedScript.prototype._wrapAndSaveCall): Added.
(InjectedScript.prototype._wrapCall): Added.
(InjectedScript.prototype._evaluateOn):
Refactor the `eval` and `saveResult` logic to allow for more flexibility for other callers.

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources.make:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Sources.txt:
* UnifiedSources-input.xcfilelist:

Source/WebCore:

Tests: inspector/audit/run.html
       inspector/audit/setup.html
       inspector/audit/teardown.html

Create a new `AuditAgent` (and various subclasses for different inspection targets), as well
as `InspectorAuditAccessibilityObject` and `InspectorAuditDOMObject` objects that will
be injected into the test function to allow for more advanced testing.

* inspector/InspectorAuditAccessibilityObject.idl: Added.
* inspector/InspectorAuditAccessibilityObject.h: Added.
(WebCore::InspectorAuditAccessibilityObject::create):
* inspector/InspectorAuditAccessibilityObject.cpp: Added.
(WebCore::InspectorAuditAccessibilityObject::InspectorAuditAccessibilityObject):

* inspector/InspectorAuditDOMObject.idl: Added.
* inspector/InspectorAuditDOMObject.h: Added.
(WebCore::InspectorAuditDOMObject::create):
* inspector/InspectorAuditDOMObject.cpp: Added.
(WebCore::InspectorAuditDOMObject::InspectorAuditDOMObject):

* inspector/agents/page/PageAuditAgent.h: Added.
* inspector/agents/page/PageAuditAgent.cpp: Added.
(WebCore::PageAuditAgent::PageAuditAgent):
(WebCore::PageAuditAgent::injectedScriptForEval):
(WebCore::PageAuditAgent::populateAuditObject):
(WebCore::PageAuditAgent::muteConsole):
(WebCore::PageAuditAgent::unmuteConsole):

* inspector/agents/worker/WorkerAuditAgent.h: Added.
* inspector/agents/worker/WorkerAuditAgent.cpp: Added.
(WebCore::WorkerAuditAgent::WorkerAuditAgent):
(WebCore::WorkerAuditAgent::injectedScriptForEval):

* inspector/InspectorController.cpp:
(WebCore::InspectorController::createLazyAgents):

* inspector/WorkerInspectorController.cpp:
(WebCore::WorkerInspectorController::createLazyAgents):

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Sources.txt:
* UnifiedSources-input.xcfilelist:
* WebCore.xcodeproj/project.pbxproj:

Source/WebInspectorUI:

Add `AuditAgent` getters and plumbing.

* UserInterface/Protocol/Target.js:
(WI.Target.prototype.get AuditAgent): Added.

* UserInterface/Models/AuditTestCase.js:
(WI.AuditTestCase.prototype.async run):

* UserInterface/Controllers/AuditManager.js:
(WI.AuditManager.prototype.async start):

* .eslintrc:

LayoutTests:

* inspector/audit/resources/audit-utilities.js:
(TestPage.registerInitializer.InspectorTest.Audit.setupAudit): Added.
(TestPage.registerInitializer.InspectorTest.Audit.teardownAudit): Added.

* inspector/audit/run.html: Added.
* inspector/audit/run-expected.txt: Added.
* inspector/audit/setup.html: Added.
* inspector/audit/setup-expected.txt: Added.
* inspector/audit/teardown.html: Added.
* inspector/audit/teardown-expected.txt: Added.

* inspector/canvas/create-context-2d-expected.txt:
* inspector/canvas/create-context-bitmaprenderer-expected.txt:
* inspector/canvas/create-context-webgl-expected.txt:
* inspector/canvas/create-context-webgl2-expected.txt:
* inspector/canvas/create-context-webmetal-expected.txt:
* inspector/canvas/recording-2d-expected.txt:
* inspector/canvas/recording-webgl-expected.txt:
* inspector/canvas/recording-webgl-snapshots-expected.txt:
* inspector/model/remote-object-expected.txt:
* inspector/model/stack-trace-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239976 268f45cc-cd09-0410-ab3c-d52691b4dbfc

60 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/audit/resources/audit-utilities.js
LayoutTests/inspector/audit/run-expected.txt [new file with mode: 0644]
LayoutTests/inspector/audit/run.html [new file with mode: 0644]
LayoutTests/inspector/audit/setup-expected.txt [new file with mode: 0644]
LayoutTests/inspector/audit/setup.html [new file with mode: 0644]
LayoutTests/inspector/audit/teardown-expected.txt [new file with mode: 0644]
LayoutTests/inspector/audit/teardown.html [new file with mode: 0644]
LayoutTests/inspector/canvas/create-context-2d-expected.txt
LayoutTests/inspector/canvas/create-context-bitmaprenderer-expected.txt
LayoutTests/inspector/canvas/create-context-webgl-expected.txt
LayoutTests/inspector/canvas/create-context-webgl2-expected.txt
LayoutTests/inspector/canvas/create-context-webmetal-expected.txt
LayoutTests/inspector/canvas/recording-2d-expected.txt
LayoutTests/inspector/canvas/recording-webgl-expected.txt
LayoutTests/inspector/canvas/recording-webgl-snapshots-expected.txt
LayoutTests/inspector/model/remote-object-expected.txt
LayoutTests/inspector/model/stack-trace-expected.txt
Source/JavaScriptCore/CMakeLists.txt
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/DerivedSources-input.xcfilelist
Source/JavaScriptCore/DerivedSources.make
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/Sources.txt
Source/JavaScriptCore/UnifiedSources-input.xcfilelist
Source/JavaScriptCore/inspector/InjectedScript.cpp
Source/JavaScriptCore/inspector/InjectedScript.h
Source/JavaScriptCore/inspector/InjectedScriptSource.js
Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp
Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.h
Source/JavaScriptCore/inspector/agents/InspectorAuditAgent.cpp [new file with mode: 0644]
Source/JavaScriptCore/inspector/agents/InspectorAuditAgent.h [new file with mode: 0644]
Source/JavaScriptCore/inspector/agents/JSGlobalObjectAuditAgent.cpp [new file with mode: 0644]
Source/JavaScriptCore/inspector/agents/JSGlobalObjectAuditAgent.h [new file with mode: 0644]
Source/JavaScriptCore/inspector/protocol/Audit.json [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources-input.xcfilelist
Source/WebCore/DerivedSources-output.xcfilelist
Source/WebCore/DerivedSources.make
Source/WebCore/Sources.txt
Source/WebCore/UnifiedSources-input.xcfilelist
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/inspector/InspectorAuditAccessibilityObject.cpp [new file with mode: 0644]
Source/WebCore/inspector/InspectorAuditAccessibilityObject.h [new file with mode: 0644]
Source/WebCore/inspector/InspectorAuditAccessibilityObject.idl [new file with mode: 0644]
Source/WebCore/inspector/InspectorAuditDOMObject.cpp [new file with mode: 0644]
Source/WebCore/inspector/InspectorAuditDOMObject.h [new file with mode: 0644]
Source/WebCore/inspector/InspectorAuditDOMObject.idl [new file with mode: 0644]
Source/WebCore/inspector/InspectorController.cpp
Source/WebCore/inspector/WorkerInspectorController.cpp
Source/WebCore/inspector/agents/page/PageAuditAgent.cpp [new file with mode: 0644]
Source/WebCore/inspector/agents/page/PageAuditAgent.h [new file with mode: 0644]
Source/WebCore/inspector/agents/worker/WorkerAuditAgent.cpp [new file with mode: 0644]
Source/WebCore/inspector/agents/worker/WorkerAuditAgent.h [new file with mode: 0644]
Source/WebInspectorUI/.eslintrc
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Controllers/AuditManager.js
Source/WebInspectorUI/UserInterface/Models/AuditTestCase.js
Source/WebInspectorUI/UserInterface/Protocol/Target.js

index efffecf..d0d13a9 100644 (file)
@@ -1,3 +1,33 @@
+2019-01-15  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: Audit: create new IDL type for exposing special functionality in test context
+        https://bugs.webkit.org/show_bug.cgi?id=193149
+        <rdar://problem/46801218>
+
+        Reviewed by Joseph Pecoraro.
+
+        * inspector/audit/resources/audit-utilities.js:
+        (TestPage.registerInitializer.InspectorTest.Audit.setupAudit): Added.
+        (TestPage.registerInitializer.InspectorTest.Audit.teardownAudit): Added.
+
+        * inspector/audit/run.html: Added.
+        * inspector/audit/run-expected.txt: Added.
+        * inspector/audit/setup.html: Added.
+        * inspector/audit/setup-expected.txt: Added.
+        * inspector/audit/teardown.html: Added.
+        * inspector/audit/teardown-expected.txt: Added.
+
+        * inspector/canvas/create-context-2d-expected.txt:
+        * inspector/canvas/create-context-bitmaprenderer-expected.txt:
+        * inspector/canvas/create-context-webgl-expected.txt:
+        * inspector/canvas/create-context-webgl2-expected.txt:
+        * inspector/canvas/create-context-webmetal-expected.txt:
+        * inspector/canvas/recording-2d-expected.txt:
+        * inspector/canvas/recording-webgl-expected.txt:
+        * inspector/canvas/recording-webgl-snapshots-expected.txt:
+        * inspector/model/remote-object-expected.txt:
+        * inspector/model/stack-trace-expected.txt:
+
 2019-01-14  Alex Christensen  <achristensen@webkit.org>
 
         Bulgarian TLD should not punycode-encode URLs with Bulgarian Cyrillic characters
index 8279464..5cf3a2b 100644 (file)
@@ -24,7 +24,17 @@ TestPage.registerInitializer(() => {
     InspectorTest.Audit.createSuite = function(name) {
         suite = InspectorTest.createAsyncSuite(name);
         return suite;
-    }
+    };
+
+    InspectorTest.Audit.setupAudit = async function() {
+        InspectorTest.log("Audit setup...");
+        await AuditAgent.setup();
+    };
+
+    InspectorTest.Audit.teardownAudit = async function() {
+        InspectorTest.log("Audit teardown...");
+        await AuditAgent.teardown();
+    };
 
     InspectorTest.Audit.addTest = function(name, test, level, logs = {}) {
         suite.addTestCase({
diff --git a/LayoutTests/inspector/audit/run-expected.txt b/LayoutTests/inspector/audit/run-expected.txt
new file mode 100644 (file)
index 0000000..b1fd72d
--- /dev/null
@@ -0,0 +1,43 @@
+Tests for the Audit.run command.
+
+
+== Running test suite: Audit.run
+-- Running test case: Audit.run.Valid
+Audit run "function() { return 42; }"...
+PASS: Run should send back 42.
+
+-- Running test case: Audit.run.Valid.InjectedObject
+Audit setup...
+Audit run "function() { return WebInspectorAudit; }"...
+PASS: The injected WebInspectorAudit should be an object.
+PASS: The injected WebInspectorAudit should be a basic object.
+Audit teardown...
+
+-- Running test case: Audit.run.Valid.InjectedObject.Persistence
+Audit setup...
+Audit run "function() { WebInspectorAudit.foo = 42; return 10; }"...
+PASS: Run should send back 10.
+Audit run "function() { return WebInspectorAudit.foo; }"...
+PASS: Run should send back 42.
+Audit teardown...
+Triggering GC...
+Audit setup...
+Audit run "function() { return WebInspectorAudit.foo; }"...
+PASS: Run should send back undefined.
+Audit teardown...
+
+-- Running test case: Audit.run.Valid.InjectedObject.Accessibility
+Audit setup...
+Audit run "function() { return WebInspectorAudit.Accessibility; }"...
+PASS: The injected WebInspectorAudit should hold an instance of InspectorAuditAccessibilityObject.
+Audit teardown...
+
+-- Running test case: Audit.run.Valid.InjectedObject.DOM
+Audit setup...
+Audit run "function() { return WebInspectorAudit.DOM; }"...
+PASS: The injected WebInspectorAudit should hold an instance of InspectorAuditDOMObject.
+Audit teardown...
+
+-- Running test case: Audit.run.Invalid
+TypeError: eval(`(42)`) is not a function. (In 'eval(`(42)`)(WebInspectorAudit)', 'eval(`(42)`)' is 42)
+
diff --git a/LayoutTests/inspector/audit/run.html b/LayoutTests/inspector/audit/run.html
new file mode 100644 (file)
index 0000000..d15b718
--- /dev/null
@@ -0,0 +1,114 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
+<script src="resources/audit-utilities.js"></script>
+<script>
+
+function test()
+{
+    async function auditRun(functionString, check) {
+        InspectorTest.log(`Audit run "${functionString}"...`);
+
+        let {result, wasThrown} = await AuditAgent.run(functionString);
+        InspectorTest.assert(!wasThrown, "Should not throw an exception.");
+        if (!wasThrown)
+            check(result);
+        else
+            InspectorTest.log(result.description);
+    }
+
+    let suite = InspectorTest.Audit.createSuite("Audit.run");
+
+    suite.addTestCase({
+        name: "Audit.run.Valid",
+        description: "Check that Audit.run is able to respond with a RemoteObject.",
+        async test() {
+            await auditRun(`function() { return 42; }`, (result) => {
+                InspectorTest.expectEqual(result.value, 42, "Run should send back 42.");
+            });
+        },
+    });
+
+    suite.addTestCase({
+        name: "Audit.run.Valid.InjectedObject",
+        description: "Check that an object is injected into the function that is executed.",
+        async test() {
+            await InspectorTest.Audit.setupAudit();
+            await auditRun(`function() { return WebInspectorAudit; }`, (result) => {
+                InspectorTest.expectEqual(result.type, "object", "The injected WebInspectorAudit should be an object.");
+                InspectorTest.expectFalse(result.subtype, "The injected WebInspectorAudit should be a basic object.");
+            });
+            await InspectorTest.Audit.teardownAudit();
+        },
+    });
+
+    suite.addTestCase({
+        name: "Audit.run.Valid.InjectedObject.Persistence",
+        description: "Check that the injected object is preserved between test runs.",
+        async test() {
+            await InspectorTest.Audit.setupAudit();
+            await auditRun(`function() { WebInspectorAudit.foo = 42; return 10; }`, (result) => {
+                InspectorTest.expectEqual(result.value, 10, "Run should send back 10.");
+            });
+            await auditRun(`function() { return WebInspectorAudit.foo; }`, (result) => {
+                InspectorTest.expectEqual(result.value, 42, "Run should send back 42.");
+            });
+            await InspectorTest.Audit.teardownAudit();
+
+            InspectorTest.log("Triggering GC...");
+            await HeapAgent.gc();
+
+            await InspectorTest.Audit.setupAudit();
+            await auditRun(`function() { return WebInspectorAudit.foo; }`, (result) => {
+                InspectorTest.expectEqual(result.value, undefined, "Run should send back undefined.");
+            });
+            await InspectorTest.Audit.teardownAudit();
+        },
+    });
+
+    suite.addTestCase({
+        name: "Audit.run.Valid.InjectedObject.Accessibility",
+        description: "Check that the injected object holds an instance of InspectorAuditAccessibilityObject.",
+        async test() {
+            await InspectorTest.Audit.setupAudit();
+            await auditRun(`function() { return WebInspectorAudit.Accessibility; }`, (result) => {
+                InspectorTest.expectEqual(result.description, "InspectorAuditAccessibilityObject", "The injected WebInspectorAudit should hold an instance of InspectorAuditAccessibilityObject.");
+            });
+            await InspectorTest.Audit.teardownAudit();
+        },
+    });
+
+    suite.addTestCase({
+        name: "Audit.run.Valid.InjectedObject.DOM",
+        description: "Check that the injected object holds an instance of InspectorAuditDOMObject.",
+        async test() {
+            await InspectorTest.Audit.setupAudit();
+            await auditRun(`function() { return WebInspectorAudit.DOM; }`, (result) => {
+                InspectorTest.expectEqual(result.description, "InspectorAuditDOMObject", "The injected WebInspectorAudit should hold an instance of InspectorAuditDOMObject.");
+            });
+            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() {
+            let {result, wasThrown} = await AuditAgent.run(`42`);
+            InspectorTest.assert(wasThrown, "Should throw an exception.");
+            if (wasThrown)
+                InspectorTest.log(result.description);
+            else
+                InspectorTest.log(result);
+        },
+    });
+
+    suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body onload="runTest()">
+    <p>Tests for the Audit.run command.</p>
+</body>
+</html>
diff --git a/LayoutTests/inspector/audit/setup-expected.txt b/LayoutTests/inspector/audit/setup-expected.txt
new file mode 100644 (file)
index 0000000..d7258a9
--- /dev/null
@@ -0,0 +1,11 @@
+Tests for the Audit.setup command.
+
+
+== Running test suite: Audit.setup
+-- Running test case: Audit.setup.Invalid.SequentialCalls
+Audit setup...
+Audit setup...
+PASS: Should produce an exception.
+Error: Must call teardown before calling setup again.
+Audit teardown...
+
diff --git a/LayoutTests/inspector/audit/setup.html b/LayoutTests/inspector/audit/setup.html
new file mode 100644 (file)
index 0000000..cb74913
--- /dev/null
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
+<script src="resources/audit-utilities.js"></script>
+<script>
+
+function test()
+{
+    let suite = InspectorTest.Audit.createSuite("Audit.setup");
+
+    suite.addTestCase({
+        name: "Audit.setup.Invalid.SequentialCalls",
+        description: "Check that additional calls to Audit.setup fail.",
+        async test() {
+            await InspectorTest.Audit.setupAudit();
+            await InspectorTest.expectException(async () => {
+                await InspectorTest.Audit.setupAudit();
+            });
+            await InspectorTest.Audit.teardownAudit();
+        },
+    });
+
+    suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body onload="runTest()">
+    <p>Tests for the Audit.setup command.</p>
+</body>
+</html>
diff --git a/LayoutTests/inspector/audit/teardown-expected.txt b/LayoutTests/inspector/audit/teardown-expected.txt
new file mode 100644 (file)
index 0000000..f910249
--- /dev/null
@@ -0,0 +1,16 @@
+Tests for the Audit.teardown command.
+
+
+== Running test suite: Audit.teardown
+-- Running test case: Audit.teardown.Invalid.WithoutSetup
+Audit teardown...
+PASS: Should produce an exception.
+Error: Must call setup before calling teardown.
+
+-- Running test case: Audit.teardown.Invalid.SequentialCalls
+Audit setup...
+Audit teardown...
+Audit teardown...
+PASS: Should produce an exception.
+Error: Must call setup before calling teardown.
+
diff --git a/LayoutTests/inspector/audit/teardown.html b/LayoutTests/inspector/audit/teardown.html
new file mode 100644 (file)
index 0000000..7e41222
--- /dev/null
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
+<script src="resources/audit-utilities.js"></script>
+<script>
+
+function test()
+{
+    let suite = InspectorTest.Audit.createSuite("Audit.teardown");
+
+    suite.addTestCase({
+        name: "Audit.teardown.Invalid.WithoutSetup",
+        description: "Check that Audit.teardown fails if called before Audit.setup.",
+        async test() {
+            await InspectorTest.expectException(async () => {
+                await InspectorTest.Audit.teardownAudit();
+            });
+        },
+    });
+
+    suite.addTestCase({
+        name: "Audit.teardown.Invalid.SequentialCalls",
+        description: "Check that additional calls to Audit.teardown fail.",
+        async test() {
+            await InspectorTest.Audit.setupAudit();
+            await InspectorTest.Audit.teardownAudit();
+            await InspectorTest.expectException(async () => {
+                await InspectorTest.Audit.teardownAudit();
+            });
+        },
+    });
+
+    suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body onload="runTest()">
+    <p>Tests for the Audit.teardown command.</p>
+</body>
+</html>
index f3c8b75..0e8c224 100644 (file)
@@ -11,8 +11,8 @@ PASS: Canvas context should be 2D.
   1: createAttachedCanvas - inspector/canvas/resources/create-context-utilities.js:4:36
   2: Global Code - [program code]
   3: evaluateWithScopeExtension - [native code]
-  4: _evaluateOn - [native code]
-  5: _evaluateAndWrap - [native code]
+  4: (anonymous function) - [native code]
+  5: _wrapCall - [native code]
 
 PASS: Removed canvas has expected ID.
 
@@ -22,8 +22,8 @@ PASS: Canvas context should be 2D.
   1: createDetachedCanvas - inspector/canvas/resources/create-context-utilities.js:8:62
   2: Global Code - [program code]
   3: evaluateWithScopeExtension - [native code]
-  4: _evaluateOn - [native code]
-  5: _evaluateAndWrap - [native code]
+  4: (anonymous function) - [native code]
+  5: _wrapCall - [native code]
 
 PASS: Removed canvas has expected ID.
 
@@ -34,8 +34,8 @@ PASS: Canvas context should be 2D.
   1: createCSSCanvas - inspector/canvas/resources/create-context-utilities.js:12:47
   2: Global Code - [program code]
   3: evaluateWithScopeExtension - [native code]
-  4: _evaluateOn - [native code]
-  5: _evaluateAndWrap - [native code]
+  4: (anonymous function) - [native code]
+  5: _wrapCall - [native code]
 
 PASS: Canvas name should equal the identifier passed to -webkit-canvas.
 
index 8adada0..33d8a86 100644 (file)
@@ -11,8 +11,8 @@ PASS: Canvas context should be Bitmap Renderer.
   1: createAttachedCanvas - inspector/canvas/resources/create-context-utilities.js:4:36
   2: Global Code - [program code]
   3: evaluateWithScopeExtension - [native code]
-  4: _evaluateOn - [native code]
-  5: _evaluateAndWrap - [native code]
+  4: (anonymous function) - [native code]
+  5: _wrapCall - [native code]
 
 PASS: Removed canvas has expected ID.
 
@@ -22,8 +22,8 @@ PASS: Canvas context should be Bitmap Renderer.
   1: createDetachedCanvas - inspector/canvas/resources/create-context-utilities.js:8:62
   2: Global Code - [program code]
   3: evaluateWithScopeExtension - [native code]
-  4: _evaluateOn - [native code]
-  5: _evaluateAndWrap - [native code]
+  4: (anonymous function) - [native code]
+  5: _wrapCall - [native code]
 
 PASS: Removed canvas has expected ID.
 
index 4fa9440..b84c311 100644 (file)
@@ -11,8 +11,8 @@ PASS: Canvas context should be WebGL.
   1: createAttachedCanvas - inspector/canvas/resources/create-context-utilities.js:4:36
   2: Global Code - [program code]
   3: evaluateWithScopeExtension - [native code]
-  4: _evaluateOn - [native code]
-  5: _evaluateAndWrap - [native code]
+  4: (anonymous function) - [native code]
+  5: _wrapCall - [native code]
 
 PASS: Removed canvas has expected ID.
 
@@ -22,8 +22,8 @@ PASS: Canvas context should be WebGL.
   1: createDetachedCanvas - inspector/canvas/resources/create-context-utilities.js:8:62
   2: Global Code - [program code]
   3: evaluateWithScopeExtension - [native code]
-  4: _evaluateOn - [native code]
-  5: _evaluateAndWrap - [native code]
+  4: (anonymous function) - [native code]
+  5: _wrapCall - [native code]
 
 PASS: Removed canvas has expected ID.
 
@@ -34,8 +34,8 @@ PASS: Canvas context should be WebGL.
   1: createCSSCanvas - inspector/canvas/resources/create-context-utilities.js:12:47
   2: Global Code - [program code]
   3: evaluateWithScopeExtension - [native code]
-  4: _evaluateOn - [native code]
-  5: _evaluateAndWrap - [native code]
+  4: (anonymous function) - [native code]
+  5: _wrapCall - [native code]
 
 PASS: Canvas name should equal the identifier passed to -webkit-canvas.
 
index e02d886..a3d700b 100644 (file)
@@ -11,8 +11,8 @@ PASS: Canvas context should be WebGL2.
   1: createAttachedCanvas - inspector/canvas/resources/create-context-utilities.js:4:36
   2: Global Code - [program code]
   3: evaluateWithScopeExtension - [native code]
-  4: _evaluateOn - [native code]
-  5: _evaluateAndWrap - [native code]
+  4: (anonymous function) - [native code]
+  5: _wrapCall - [native code]
 
 PASS: Removed canvas has expected ID.
 
@@ -22,8 +22,8 @@ PASS: Canvas context should be WebGL2.
   1: createDetachedCanvas - inspector/canvas/resources/create-context-utilities.js:8:62
   2: Global Code - [program code]
   3: evaluateWithScopeExtension - [native code]
-  4: _evaluateOn - [native code]
-  5: _evaluateAndWrap - [native code]
+  4: (anonymous function) - [native code]
+  5: _wrapCall - [native code]
 
 PASS: Removed canvas has expected ID.
 
@@ -34,8 +34,8 @@ PASS: Canvas context should be WebGL2.
   1: createCSSCanvas - inspector/canvas/resources/create-context-utilities.js:12:47
   2: Global Code - [program code]
   3: evaluateWithScopeExtension - [native code]
-  4: _evaluateOn - [native code]
-  5: _evaluateAndWrap - [native code]
+  4: (anonymous function) - [native code]
+  5: _wrapCall - [native code]
 
 PASS: Canvas name should equal the identifier passed to -webkit-canvas.
 
index 4534719..54e675a 100644 (file)
@@ -11,8 +11,8 @@ PASS: Canvas context should be WebMetal.
   1: createAttachedCanvas - inspector/canvas/resources/create-context-utilities.js:4:36
   2: Global Code - [program code]
   3: evaluateWithScopeExtension - [native code]
-  4: _evaluateOn - [native code]
-  5: _evaluateAndWrap - [native code]
+  4: (anonymous function) - [native code]
+  5: _wrapCall - [native code]
 
 PASS: Removed canvas has expected ID.
 
@@ -22,8 +22,8 @@ PASS: Canvas context should be WebMetal.
   1: createDetachedCanvas - inspector/canvas/resources/create-context-utilities.js:8:62
   2: Global Code - [program code]
   3: evaluateWithScopeExtension - [native code]
-  4: _evaluateOn - [native code]
-  5: _evaluateAndWrap - [native code]
+  4: (anonymous function) - [native code]
+  5: _wrapCall - [native code]
 
 PASS: Removed canvas has expected ID.
 
@@ -34,8 +34,8 @@ PASS: Canvas context should be WebMetal.
   1: createCSSCanvas - inspector/canvas/resources/create-context-utilities.js:12:47
   2: Global Code - [program code]
   3: evaluateWithScopeExtension - [native code]
-  4: _evaluateOn - [native code]
-  5: _evaluateAndWrap - [native code]
+  4: (anonymous function) - [native code]
+  5: _wrapCall - [native code]
 
 PASS: Canvas name should equal the identifier passed to -webkit-canvas.
 
index 082f21d..ce92ca7 100644 (file)
@@ -45,8 +45,8 @@ frames:
         5: performActions
         6: Global Code
         7: evaluateWithScopeExtension
-        8: _evaluateOn
-        9: _evaluateAndWrap
+        8: (anonymous function)
+        9: _wrapCall
     1: arc(6, 7, 8, 9, 10, true)
       swizzleTypes: [Number, Number, Number, Number, Number, Boolean]
       trace:
@@ -58,8 +58,8 @@ frames:
         5: performActions
         6: Global Code
         7: evaluateWithScopeExtension
-        8: _evaluateOn
-        9: _evaluateAndWrap
+        8: (anonymous function)
+        9: _wrapCall
 
 -- Running test case: Canvas.recording2D.multipleFrames
 initialState:
@@ -104,8 +104,8 @@ frames:
         5: performActions
         6: Global Code
         7: evaluateWithScopeExtension
-        8: _evaluateOn
-        9: _evaluateAndWrap
+        8: (anonymous function)
+        9: _wrapCall
     1: arc(6, 7, 8, 9, 10, true)
       swizzleTypes: [Number, Number, Number, Number, Number, Boolean]
       trace:
@@ -117,8 +117,8 @@ frames:
         5: performActions
         6: Global Code
         7: evaluateWithScopeExtension
-        8: _evaluateOn
-        9: _evaluateAndWrap
+        8: (anonymous function)
+        9: _wrapCall
   1: (duration)
     0: arcTo(1, 2, 3, 4, 5)
       swizzleTypes: [Number, Number, Number, Number, Number]
@@ -1131,8 +1131,8 @@ frames:
         5: performActions
         6: Global Code
         7: evaluateWithScopeExtension
-        8: _evaluateOn
-        9: _evaluateAndWrap
+        8: (anonymous function)
+        9: _wrapCall
 
 -- Running test case: Canvas.recording2D.Console
 PASS: The recording should have the name "TEST".
index d8bc49c..8821e93 100644 (file)
@@ -21,8 +21,8 @@ frames:
         3: performActions
         4: Global Code
         5: evaluateWithScopeExtension
-        6: _evaluateOn
-        7: _evaluateAndWrap
+        6: (anonymous function)
+        7: _wrapCall
 
 -- Running test case: Canvas.recordingWebGL.multipleFrames
 initialState:
@@ -43,8 +43,8 @@ frames:
         3: performActions
         4: Global Code
         5: evaluateWithScopeExtension
-        6: _evaluateOn
-        7: _evaluateAndWrap
+        6: (anonymous function)
+        7: _wrapCall
   1: (duration)
     0: attachShader(0, 0)
       swizzleTypes: [WebGLProgram, WebGLShader]
@@ -1046,8 +1046,8 @@ frames:
         3: performActions
         4: Global Code
         5: evaluateWithScopeExtension
-        6: _evaluateOn
-        7: _evaluateAndWrap
+        6: (anonymous function)
+        7: _wrapCall
 
 -- Running test case: Canvas.recordingWebGL.Console
 PASS: The recording should have the name "TEST".
index 51cfda8..7fe4dc6 100644 (file)
@@ -19,8 +19,8 @@ frames:
         1: performActions
         2: Global Code
         3: evaluateWithScopeExtension
-        4: _evaluateOn
-        5: _evaluateAndWrap
+        4: (anonymous function)
+        5: _wrapCall
     1: clearColor(0, 0, 0, 1)
       swizzleTypes: [Number, Number, Number, Number]
       trace:
@@ -29,8 +29,8 @@ frames:
         2: performActions
         3: Global Code
         4: evaluateWithScopeExtension
-        5: _evaluateOn
-        6: _evaluateAndWrap
+        5: (anonymous function)
+        6: _wrapCall
     2: clear(16384)
       swizzleTypes: [Number]
       trace:
@@ -39,8 +39,8 @@ frames:
         2: performActions
         3: Global Code
         4: evaluateWithScopeExtension
-        5: _evaluateOn
-        6: _evaluateAndWrap
+        5: (anonymous function)
+        6: _wrapCall
       snapshot: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAACWCAYAAABkW7XSAAAAAXNSR0IArs4c6QAABGxJREFUeAHt1MEJwDAMBEHF/fec5OEitDAG/485cc/MvP/3CBAgsF7grE8oIAECBK6AwXIKBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIGyw0QIJARMFiZqgQlQMBguQECBDICBitTlaAECBgsN0CAQEbAYGWqEpQAAYPlBggQyAgYrExVghIgYLDcAAECGQGDlalKUAIEDJYbIEAgI2CwMlUJSoCAwXIDBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIGyw0QIJARMFiZqgQlQMBguQECBDICBitTlaAECBgsN0CAQEbAYGWqEpQAAYPlBggQyAgYrExVghIgYLDcAAECGQGDlalKUAIEDJYbIEAgI2CwMlUJSoCAwXIDBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIGyw0QIJARMFiZqgQlQMBguQECBDICBitTlaAECBgsN0CAQEbAYGWqEpQAAYPlBggQyAgYrExVghIgYLDcAAECGQGDlalKUAIEDJYbIEAgI2CwMlUJSoCAwXIDBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIGyw0QIJARMFiZqgQlQMBguQECBDICBitTlaAECBgsN0CAQEbAYGWqEpQAAYPlBggQyAgYrExVghIgYLDcAAECGQGDlalKUAIEDJYbIEAgI2CwMlUJSoCAwXIDBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIGyw0QIJARMFiZqgQlQMBguQECBDICBitTlaAECBgsN0CAQEbAYGWqEpQAAYPlBggQyAgYrExVghIgYLDcAAECGQGDlalKUAIEDJYbIEAgI2CwMlUJSoCAwXIDBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIGyw0QIJARMFiZqgQlQMBguQECBDICBitTlaAECBgsN0CAQEbAYGWqEpQAAYPlBggQyAgYrExVghIgYLDcAAECGQGDlalKUAIEDJYbIEAgI2CwMlUJSoCAwXIDBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIGyw0QIJARMFiZqgQlQMBguQECBDICBitTlaAECBgsN0CAQEbAYGWqEpQAAYPlBggQyAgYrExVghIgYLDcAAECGQGDlalKUAIEDJYbIEAgI2CwMlUJSoCAwXIDBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIGyw0QIJARMFiZqgQlQMBguQECBDICBitTlaAECBgsN0CAQEbAYGWqEpQAAYPlBggQyAgYrExVghIgYLDcAAECGQGDlalKUAIEDJYbIEAgI2CwMlUJSoCAwXIDBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIGyw0QIJARMFiZqgQlQMBguQECBDICBitTlaAECBgsN0CAQEbAYGWqEpQAAYPlBggQyAgYrExVghIgYLDcAAECGQGDlalKUAIEDJYbIEAgI2CwMlUJSoCAwXIDBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIfSAwCK2+QFXIAAAAASUVORK5CYII="
     3: bufferData(34962, 0, 35044)
       swizzleTypes: [Number, TypedArray, Number]
@@ -50,8 +50,8 @@ frames:
         2: performActions
         3: Global Code
         4: evaluateWithScopeExtension
-        5: _evaluateOn
-        6: _evaluateAndWrap
+        5: (anonymous function)
+        6: _wrapCall
     4: drawArrays(4, 0, 3)
       swizzleTypes: [Number, Number, Number]
       trace:
@@ -60,8 +60,8 @@ frames:
         2: performActions
         3: Global Code
         4: evaluateWithScopeExtension
-        5: _evaluateOn
-        6: _evaluateAndWrap
+        5: (anonymous function)
+        6: _wrapCall
       snapshot: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAACWCAYAAABkW7XSAAAAAXNSR0IArs4c6QAAB4lJREFUeAHt3GtSG1kMgFEnlYV5a14Z7IyYFDeAXy01bVvqPlSlGoxMLkd3vpo/M792u93b8Y8PAgQIlBf4Xf6EDkiAAIEPAcFyFQgQaCMgWG1W5aAECAiWO0CAQBsBwWqzKgclQECw3AECBNoICFabVTkoAQKC5Q4QINBGQLDarMpBCRAQLHeAAIE2AoLVZlUOSoCAYLkDBAi0ERCsNqtyUAIEBMsdIECgjYBgtVmVgxIgIFjuAAECbQQEq82qHJQAAcFyBwgQaCMgWG1W5aAECAiWO0CAQBsBwWqzKgclQECw3AECBNoICFabVTkoAQKC5Q4QINBGQLDarMpBCRAQLHeAAIE2AoLVZlUOSoCAYLkDBAi0ERCsNqtyUAIEBMsdIECgjYBgtVmVgxIgIFjuAAECbQQEq82qHJQAAcFyBwgQaCMgWG1W5aAECAiWO0CAQBsBwUqsar/fJ6aNEiCwtIBgJURfXl5273+EK4FmlMDCAm/Hn+dPwODty8cxXG/HcHELuLlf/vla8A7AjGJ+6dX/T4XL/YneH3OL3JVFfsgm/k3jf6UufCJc7pEgPeQOPOQvWUXQLnTq7CXhcp+E66534K4/fBWhGhfwrE43XhAu92rcG89F78KiP2xVgTq9aDf6dPVbwuV+nd4jX//oTvzozasO1OnFulqlwDeEyz07vU++nnUnZr1pU6EaFyvQpckR4XLfxn3ynHUXZr1JsCbTdHtAuNw7wZp1B2a9SbBu9yj8XeFy/4QrdQdSw5sM1bhQ4QrNGBQu93DcM8+bd+HmNzcdqNOLM6ND6bcIl/t4eu98/e1OfPtCoG78t3Hp+vzgDcLlXgrV+R349YFyfPiYEjj2Z2pk8e+/vr7uDofD7v3pg8DWBQQrcQOeEaxxPOEaEp5bFhCsxPafGaxxTOEaEp5bFBCsxNYrBGscV7iGhOeWBAQrse1KwRrHFq4h4bkFAcFKbLlisMbxhWtIeK5ZQLAS260crPFrCNeQ8FyjgGAlttohWOPXEa4h4bkmAcFKbLNTsMavJVxDwnMNAoKV2GLHYI1fT7iGhGdnAcFKbK9zsMavKVxDwrOjgGAltraGYI1fV7iGhGcnAcFKbGtNwRq/tnANCc8OAoKV2NIagzV+feEaEp6VBQQrsZ01B2swCNeQ8KwoIFiJrWwhWINDuIaEZyUBwUpsY0vBGizCNSQ8KwgIVmILWwzW4BGuIeH5TAHBSuhvOViDSbiGhOczBAQroS5Yn1jC9Wnhs8cJCFbCWrDOsYTr3MQr9xMQrIStYF3HEq7rNr6znIBgJSwFaxpLuKaNTMwXEKyEnWDFsYQrbmUyLiBYcaudYCWwPkaFK2/mHdcFBOu6zdl3BOuMJPyCcIWpDN4QEKwbOKffEqxTkfzXwpU3845PAcH6tJj8TLAmicIDwhWmMvhFQLC+YEx9KlhTQvnvC1febMvvEKzE9gUrgZUcFa4k2EbHBSuxeMFKYM0cFa6ZcBt5m2AlFi1YCawfjgrXDwFX+nbBSixWsBJYC40K10KQK/kxgpVYpGAlsBYeFa6FQZv+OMFKLE6wElh3GhWuO8E2+bGClViUYCWw7jwqXHcGLvrjBSuxGMFKYD1oVLgeBF3krxGsxCIEK4H14FHhejD4k/46wUrAC1YC60mjwvUk+Af9tYKVgBasBNaTR4XryQu4018vWAlYwUpgFRkVriKLWOgYgpWAFKwEVrFR4Sq2kJnHEawEnGAlsIqOClfRxQSPJVhBqPcxwUpgFR8VruILunI8wboCc+llwbqk0vs14eq1P8FK7EuwEljNRoWrx8IEK7EnwUpgNR0VrtqLE6zEfgQrgdV8VLhqLlCwEnsRrATWSkaFq9YiBSuxD8FKYK1sVLhqLFSwEnsQrATWSkeF67mLFayEv2AlsFY+KlzPWbBgJdwFK4G1kVHheuyiBSvhLVgJrI2NCtdjFi5YCWfBSmBtdFS47rt4wUr4ClYCa+OjwnWfCyBYCVfBSmAZ/ScgXMteBMFKeApWAsvoNwHh+sYx+wvBStAJVgLL6EUB4brIEn5RsMJU/n9YCSqjEwLCNQF05dt/rrzu5QsCh8PhwqteIjBPYL/f/3vje7x8xAT8G1bMyRQBAgUEfhc4gyMQIEAgJCBYISZDBAhUEBCsCltwBgIEQgKCFWIyRIBABQHBqrAFZyBAICQgWCEmQwQIVBAQrApbcAYCBEICghViMkSAQAUBwaqwBWcgQCAkIFghJkMECFQQEKwKW3AGAgRCAoIVYjJEgEAFAcGqsAVnIEAgJCBYISZDBAhUEBCsCltwBgIEQgKCFWIyRIBABQHBqrAFZyBAICQgWCEmQwQIVBAQrApbcAYCBEICghViMkSAQAUBwaqwBWcgQCAkIFghJkMECFQQEKwKW3AGAgRCAoIVYjJEgEAFAcGqsAVnIEAgJCBYISZDBAhUEBCsCltwBgIEQgKCFWIyRIBABQHBqrAFZyBAICQgWCEmQwQIVBAQrApbcAYCBEICghViMkSAQAUBwaqwBWcgQCAkIFghJkMECFQQEKwKW3AGAgRCAoIVYjJEgEAFgb/VewCWguWlCQAAAABJRU5ErkJggg=="
     5: clearColor(0, 0, 0, 1)
       swizzleTypes: [Number, Number, Number, Number]
@@ -71,8 +71,8 @@ frames:
         2: performActions
         3: Global Code
         4: evaluateWithScopeExtension
-        5: _evaluateOn
-        6: _evaluateAndWrap
+        5: (anonymous function)
+        6: _wrapCall
     6: clear(16384)
       swizzleTypes: [Number]
       trace:
@@ -81,8 +81,8 @@ frames:
         2: performActions
         3: Global Code
         4: evaluateWithScopeExtension
-        5: _evaluateOn
-        6: _evaluateAndWrap
+        5: (anonymous function)
+        6: _wrapCall
       snapshot: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAACWCAYAAABkW7XSAAAAAXNSR0IArs4c6QAABGxJREFUeAHt1MEJwDAMBEHF/fec5OEitDAG/485cc/MvP/3CBAgsF7grE8oIAECBK6AwXIKBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIGyw0QIJARMFiZqgQlQMBguQECBDICBitTlaAECBgsN0CAQEbAYGWqEpQAAYPlBggQyAgYrExVghIgYLDcAAECGQGDlalKUAIEDJYbIEAgI2CwMlUJSoCAwXIDBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIGyw0QIJARMFiZqgQlQMBguQECBDICBitTlaAECBgsN0CAQEbAYGWqEpQAAYPlBggQyAgYrExVghIgYLDcAAECGQGDlalKUAIEDJYbIEAgI2CwMlUJSoCAwXIDBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIGyw0QIJARMFiZqgQlQMBguQECBDICBitTlaAECBgsN0CAQEbAYGWqEpQAAYPlBggQyAgYrExVghIgYLDcAAECGQGDlalKUAIEDJYbIEAgI2CwMlUJSoCAwXIDBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIGyw0QIJARMFiZqgQlQMBguQECBDICBitTlaAECBgsN0CAQEbAYGWqEpQAAYPlBggQyAgYrExVghIgYLDcAAECGQGDlalKUAIEDJYbIEAgI2CwMlUJSoCAwXIDBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIGyw0QIJARMFiZqgQlQMBguQECBDICBitTlaAECBgsN0CAQEbAYGWqEpQAAYPlBggQyAgYrExVghIgYLDcAAECGQGDlalKUAIEDJYbIEAgI2CwMlUJSoCAwXIDBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIGyw0QIJARMFiZqgQlQMBguQECBDICBitTlaAECBgsN0CAQEbAYGWqEpQAAYPlBggQyAgYrExVghIgYLDcAAECGQGDlalKUAIEDJYbIEAgI2CwMlUJSoCAwXIDBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIGyw0QIJARMFiZqgQlQMBguQECBDICBitTlaAECBgsN0CAQEbAYGWqEpQAAYPlBggQyAgYrExVghIgYLDcAAECGQGDlalKUAIEDJYbIEAgI2CwMlUJSoCAwXIDBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIGyw0QIJARMFiZqgQlQMBguQECBDICBitTlaAECBgsN0CAQEbAYGWqEpQAAYPlBggQyAgYrExVghIgYLDcAAECGQGDlalKUAIEDJYbIEAgI2CwMlUJSoCAwXIDBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIGyw0QIJARMFiZqgQlQMBguQECBDICBitTlaAECBgsN0CAQEbAYGWqEpQAAYPlBggQyAgYrExVghIgYLDcAAECGQGDlalKUAIEDJYbIEAgI2CwMlUJSoCAwXIDBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIfSAwCK2+QFXIAAAAASUVORK5CYII="
     7: bufferData(34962, 0, 35044)
       swizzleTypes: [Number, TypedArray, Number]
@@ -92,8 +92,8 @@ frames:
         2: performActions
         3: Global Code
         4: evaluateWithScopeExtension
-        5: _evaluateOn
-        6: _evaluateAndWrap
+        5: (anonymous function)
+        6: _wrapCall
     8: bufferData(34963, 0, 35044)
       swizzleTypes: [Number, TypedArray, Number]
       trace:
@@ -102,8 +102,8 @@ frames:
         2: performActions
         3: Global Code
         4: evaluateWithScopeExtension
-        5: _evaluateOn
-        6: _evaluateAndWrap
+        5: (anonymous function)
+        6: _wrapCall
     9: drawElements(4, 3, 5123, 0)
       swizzleTypes: [Number, Number, Number, Number]
       trace:
@@ -112,8 +112,8 @@ frames:
         2: performActions
         3: Global Code
         4: evaluateWithScopeExtension
-        5: _evaluateOn
-        6: _evaluateAndWrap
+        5: (anonymous function)
+        6: _wrapCall
       snapshot: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAACWCAYAAABkW7XSAAAAAXNSR0IArs4c6QAABodJREFUeAHt1I1OG0kQhVGI9r2BJyesEhQCJhhXT3XfnhNptcG4f+bU5Lu/u7t7fvnPHwIECCwv8GP5G7ogAQIEfgsIlleBAIEYAcGKGZWLEiAgWN4BAgRiBAQrZlQuSoCAYHkHCBCIERCsmFG5KAECguUdIEAgRkCwYkblogQICJZ3gACBGAHBihmVixIgIFjeAQIEYgQEK2ZULkqAgGB5BwgQiBEQrJhRuSgBAoLlHSBAIEZAsGJG5aIECAiWd4AAgRgBwYoZlYsSICBY3gECBGIEBCtmVC5KgIBgeQcIEIgREKyYUbkoAQKC5R0gQCBGQLBiRuWiBAgIlneAAIEYAcGKGZWLEiAgWN4BAgRiBAQrZlQuSoCAYHkHCBCIERCsmFG5KAECguUdIEAgRkCwYkblogQICJZ3gACBGAHBihmVixIgIFjeAQIEYgQEK2ZULrqjwOPj446Pddgz3b/s/HzY7jYmQOCiwGuoHh4e7u7v//9n6M81Av9d8yXfIUBgjMDbUI3Z8Vy7CNa55u1pJwkI1Rh4wRrjaBcCFwWE6iLLzR8K1s10FhL4XECoPrep/EawKnrWEngnIFTvQAb/KFiDQW13TgGh6pm7YPU4O2VTAaHqHaxg9Xo7bRMBoZozSMGa4+7UUAGhmjs4wZrr7/QQAaFaY1CCtcYc3GJRAaFaazCCtdY83GYRAaFaZBDvriFY70D8eG4BoVp7/oK19nzcrklAqJqgi8cIVhHQ8mwBocqan2BlzcttBwkI1SDI5m0EqxnccXMFhGquf/V0waoKWh8hIFQRY/rykoL1JZEvJAsIVfL0Pt5dsD6a+GQDAaHaYIgXHkGwLqD4KFdAqHJnd83NBesaJd9ZXkColh/RkAsK1hBGm8wSEKpZ8nPOFaw57k4tCghVETB0uWCFDu6s1xaqs07+13ML1rnnH/P0QhUzqkMvKliH8tq8KiBUVcG91gvWXvPc5mmEaptRDn0QwRrKabOqgFBVBfdeL1h7zzfm6YQqZlRTLypYU/kdLlTege8ICNZ3tHx3mIBQDaM81UaCdapxz39YoZo/g+QbCFby9ILuLlRBw1r4qoK18HB2uJpQ7TDFdZ5BsNaZxVY3EaqtxrnMwwjWMqPY4yJCtcccV30KwVp1MmH3EqqwgYVeV7BCB7fKtYVqlUmc4x6CdY45D39KoRpOasMrBATrCiRf+SMgVH8s/K1fQLD6zSNPFKrIsW13acHabqRjH0ioxnrarSYgWDW/bVcL1bajjX4wwYoe3/jLC9V4UzuOExCscZbROwlV9PhOc3nBOs2oLz+oUF128emaAoK15lwOv5VQHU7sgAMEBOsA1JW3FKqVp+NuXwkI1ldCm/xeqDYZ5MkfQ7A2fwGEavMBn+zxBGvTgQvVpoM9+WMJ1mYvgFBtNlCP85eAYP3FkfuDUOXOzs2vFxCs662W/KZQLTkWlzpIQLAOgj16W6E6Wtj+KwoI1opT+cedhOofOH61vYBghYxYqEIG5ZqHCgjWobz1zYWqbmiHfQQEa9FZCtWig3GtqQKCNZX/4+FC9dHEJwReBQTrVWLy/4Vq8gAcHyEgWJPHJFSTB+D4KAHBmjQuoZoE79hoAcFqHp9QNYM7bisBwWoap1A1QTtmawHBOni8QnUwsO1PJSBYB41bqA6Cte2pBQRr8PiFajCo7Qi8ERCsNxiVvwpVRc9aAtcJCNZ1Tp9+S6g+pfELAsMFBOtGUqG6Ec4yAgUBwfomnlB9E8zXCQwUEKwbMZ+enm5caRkBArcK3L8sfL51sXUECBDoFPjReZizCBAgUBEQrIqetQQItAoIViu3wwgQqAgIVkXPWgIEWgUEq5XbYQQIVAQEq6JnLQECrQKC1crtMAIEKgKCVdGzlgCBVgHBauV2GAECFQHBquhZS4BAq4BgtXI7jACBioBgVfSsJUCgVUCwWrkdRoBARUCwKnrWEiDQKiBYrdwOI0CgIiBYFT1rCRBoFRCsVm6HESBQERCsip61BAi0CghWK7fDCBCoCAhWRc9aAgRaBQSrldthBAhUBASromctAQKtAoLVyu0wAgQqAoJV0bOWAIFWAcFq5XYYAQIVAcGq6FlLgECrgGC1cjuMAIGKgGBV9KwlQKBVQLBauR1GgEBFQLAqetYSINAqIFit3A4jQKAiIFgVPWsJEGgVEKxWbocRIFAREKyKnrUECLQKCFYrt8MIEKgICFZFz1oCBFoFfgJUguTj1eIlHgAAAABJRU5ErkJggg=="
     10: clearColor(0, 0, 0, 1)
       swizzleTypes: [Number, Number, Number, Number]
@@ -123,8 +123,8 @@ frames:
         2: performActions
         3: Global Code
         4: evaluateWithScopeExtension
-        5: _evaluateOn
-        6: _evaluateAndWrap
+        5: (anonymous function)
+        6: _wrapCall
     11: clear(16384)
       swizzleTypes: [Number]
       trace:
@@ -133,7 +133,7 @@ frames:
         2: performActions
         3: Global Code
         4: evaluateWithScopeExtension
-        5: _evaluateOn
-        6: _evaluateAndWrap
+        5: (anonymous function)
+        6: _wrapCall
       snapshot: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAACWCAYAAABkW7XSAAAAAXNSR0IArs4c6QAABGxJREFUeAHt1MEJwDAMBEHF/fec5OEitDAG/485cc/MvP/3CBAgsF7grE8oIAECBK6AwXIKBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIGyw0QIJARMFiZqgQlQMBguQECBDICBitTlaAECBgsN0CAQEbAYGWqEpQAAYPlBggQyAgYrExVghIgYLDcAAECGQGDlalKUAIEDJYbIEAgI2CwMlUJSoCAwXIDBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIGyw0QIJARMFiZqgQlQMBguQECBDICBitTlaAECBgsN0CAQEbAYGWqEpQAAYPlBggQyAgYrExVghIgYLDcAAECGQGDlalKUAIEDJYbIEAgI2CwMlUJSoCAwXIDBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIGyw0QIJARMFiZqgQlQMBguQECBDICBitTlaAECBgsN0CAQEbAYGWqEpQAAYPlBggQyAgYrExVghIgYLDcAAECGQGDlalKUAIEDJYbIEAgI2CwMlUJSoCAwXIDBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIGyw0QIJARMFiZqgQlQMBguQECBDICBitTlaAECBgsN0CAQEbAYGWqEpQAAYPlBggQyAgYrExVghIgYLDcAAECGQGDlalKUAIEDJYbIEAgI2CwMlUJSoCAwXIDBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIGyw0QIJARMFiZqgQlQMBguQECBDICBitTlaAECBgsN0CAQEbAYGWqEpQAAYPlBggQyAgYrExVghIgYLDcAAECGQGDlalKUAIEDJYbIEAgI2CwMlUJSoCAwXIDBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIGyw0QIJARMFiZqgQlQMBguQECBDICBitTlaAECBgsN0CAQEbAYGWqEpQAAYPlBggQyAgYrExVghIgYLDcAAECGQGDlalKUAIEDJYbIEAgI2CwMlUJSoCAwXIDBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIGyw0QIJARMFiZqgQlQMBguQECBDICBitTlaAECBgsN0CAQEbAYGWqEpQAAYPlBggQyAgYrExVghIgYLDcAAECGQGDlalKUAIEDJYbIEAgI2CwMlUJSoCAwXIDBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIGyw0QIJARMFiZqgQlQMBguQECBDICBitTlaAECBgsN0CAQEbAYGWqEpQAAYPlBggQyAgYrExVghIgYLDcAAECGQGDlalKUAIEDJYbIEAgI2CwMlUJSoCAwXIDBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIGyw0QIJARMFiZqgQlQMBguQECBDICBitTlaAECBgsN0CAQEbAYGWqEpQAAYPlBggQyAgYrExVghIgYLDcAAECGQGDlalKUAIEDJYbIEAgI2CwMlUJSoCAwXIDBAhkBAxWpipBCRAwWG6AAIGMgMHKVCUoAQIfSAwCK2+QFXIAAAAASUVORK5CYII="
 
index 37de7f9..9a1bc25 100644 (file)
@@ -1656,7 +1656,7 @@ EXPRESSION: error = null; try { [].x.x; } catch (e) { error = e; }; error
       {
         "_name": "stack",
         "_type": "string",
-        "_value": "global code\nevaluateWithScopeExtension@[native code]\n_evaluateOn\n_evaluateAndWrap"
+        "_value": "global code\nevaluateWithScopeExtension@[native code]\n\n_wrapCall"
       }
     ],
     "_entries": null
@@ -1695,7 +1695,7 @@ EXPRESSION: error = null; try { eval("if()"); } catch (e) { error = e; }; error
       {
         "_name": "stack",
         "_type": "string",
-        "_value": "eval@[native code]\nglobal code\nevaluateWithScopeExtension@[native code]\n_evaluateOn\n_evaluateAndWrap"
+        "_value": "eval@[native code]\nglobal code\nevaluateWithScopeExtension@[native code]\n\n_wrapCall"
       }
     ],
     "_entries": null
@@ -1729,7 +1729,7 @@ EXPRESSION: error = null; try { document.createTextNode("").splitText(100); } ca
       {
         "_name": "stack",
         "_type": "string",
-        "_value": "splitText@[native code]\nglobal code\nevaluateWithSc…ension@[native code]\n_evaluateOn\n_evaluateAndWrap"
+        "_value": "splitText@[native code]\nglobal code\nevaluateWithSc…ension@[native code]\n\n_wrapCall"
       },
       {
         "_name": "code",
index 28de476..7f98eb4 100644 (file)
@@ -17,6 +17,6 @@ StackTrace: 10
   6: triggerConsoleMessage (stack-trace.html:9) - nativeCode (false) programCode (false)
   7: Global Code (Anonymous Script 2 (line 1)) - nativeCode (false) programCode (true)
   8: evaluateWithScopeExtension - nativeCode (true) programCode (false)
-  9: _evaluateOn - nativeCode (true) programCode (false)
-  10: _evaluateAndWrap - nativeCode (true) programCode (false)
+  9:  - nativeCode (true) programCode (false)
+  10: _wrapCall - nativeCode (true) programCode (false)
 
index 79cab0b..555ac6c 100644 (file)
@@ -634,6 +634,7 @@ set(JavaScriptCore_PRIVATE_FRAMEWORK_HEADERS
     inspector/ScriptDebugServer.h
 
     inspector/agents/InspectorAgent.h
+    inspector/agents/InspectorAuditAgent.h
     inspector/agents/InspectorConsoleAgent.h
     inspector/agents/InspectorDebuggerAgent.h
     inspector/agents/InspectorHeapAgent.h
@@ -1063,6 +1064,7 @@ set(JavaScriptCore_INSPECTOR_PROTOCOL_SCRIPTS
 
 set(JavaScriptCore_INSPECTOR_DOMAINS
     ${JAVASCRIPTCORE_DIR}/inspector/protocol/ApplicationCache.json
+    ${JAVASCRIPTCORE_DIR}/inspector/protocol/Audit.json
     ${JAVASCRIPTCORE_DIR}/inspector/protocol/CSS.json
     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Canvas.json
     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Console.json
index 8362ccb..e906a92 100644 (file)
@@ -1,3 +1,67 @@
+2019-01-15  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: Audit: create new IDL type for exposing special functionality in test context
+        https://bugs.webkit.org/show_bug.cgi?id=193149
+        <rdar://problem/46801218>
+
+        Reviewed by Joseph Pecoraro.
+
+        Create a new `AuditAgent` (and various subclasses for different inspection targets)
+
+        * inspector/protocol/Audit.json: Added.
+        Add a `run` command that is a simpler version of `Runtime.evaluate`, except that it expects
+        a function string instead of an arbitrary JavaScript expression.
+        Add `setup` and `teardown` commands that create a JavaScript object that will be passed in
+        to the test as an argument. Keep this object alive so that tests can add to the object and
+        have later tests use what was added.
+
+        * inspector/agents/InspectorAuditAgent.h: Added.
+        * inspector/agents/InspectorAuditAgent.cpp: Added.
+        (Inspector::InspectorAuditAgent::InspectorAuditAgent):
+        (Inspector::InspectorAuditAgent::didCreateFrontendAndBackend):
+        (Inspector::InspectorAuditAgent::willDestroyFrontendAndBackend):
+        (Inspector::InspectorAuditAgent::setup):
+        (Inspector::InspectorAuditAgent::run):
+        (Inspector::InspectorAuditAgent::teardown):
+        (Inspector::InspectorAuditAgent::hasActiveAudit):
+        (Inspector::InspectorAuditAgent::populateAuditObject):
+
+        * inspector/agents/JSGlobalObjectAuditAgent.h: Added.
+        * inspector/agents/JSGlobalObjectAuditAgent.cpp: Added.
+        (Inspector::JSGlobalObjectAuditAgent::JSGlobalObjectAuditAgent):
+        (Inspector::JSGlobalObjectAuditAgent::injectedScriptForEval):
+
+        * inspector/JSGlobalObjectInspectorController.h:
+        * inspector/JSGlobalObjectInspectorController.cpp:
+        (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController):
+        (Inspector::JSGlobalObjectInspectorController::connectFrontend):
+        (Inspector::JSGlobalObjectInspectorController::jsAgentContext): Added.
+        (Inspector::JSGlobalObjectInspectorController::createLazyAgents): Added.
+
+        * inspector/InjectedScript.h:
+        * inspector/InjectedScript.cpp:
+        (Inspector::InjectedScript::execute): Added.
+        (Inspector::InjectedScript::arrayFromVector): Added.
+        Create a version of `evaluate` that accepts a list of values to be passed in as arguments
+        to the function that was created by the `eval` of the given `functionString`.
+
+        * inspector/InjectedScriptSource.js:
+        (InjectedScript.prototype.execute): Added.
+        (InjectedScript.prototype.evaluate):
+        (InjectedScript.prototype.evaluateOnCallFrame):
+        (InjectedScript.prototype._evaluateAndWrap):
+        (InjectedScript.prototype._wrapAndSaveCall): Added.
+        (InjectedScript.prototype._wrapCall): Added.
+        (InjectedScript.prototype._evaluateOn):
+        Refactor the `eval` and `saveResult` logic to allow for more flexibility for other callers.
+
+        * CMakeLists.txt:
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources.make:
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * Sources.txt:
+        * UnifiedSources-input.xcfilelist:
+
 2019-01-14  Michael Saboff  <msaboff@apple.com>
 
         Add option to JSC to dump memory footprint on script completion
index 583b193..20e86fd 100644 (file)
@@ -76,6 +76,7 @@ $(PROJECT_DIR)/generator/Type.rb
 $(PROJECT_DIR)/generator/main.rb
 $(PROJECT_DIR)/inspector/InjectedScriptSource.js
 $(PROJECT_DIR)/inspector/protocol/ApplicationCache.json
+$(PROJECT_DIR)/inspector/protocol/Audit.json
 $(PROJECT_DIR)/inspector/protocol/CSS.json
 $(PROJECT_DIR)/inspector/protocol/Canvas.json
 $(PROJECT_DIR)/inspector/protocol/Console.json
index f8435ae..47d2517 100644 (file)
@@ -227,6 +227,7 @@ $(BYTECODE_FILES_PATTERNS): $(wildcard $(JavaScriptCore)/generator/*.rb) $(JavaS
 
 INSPECTOR_DOMAINS := \
     $(JavaScriptCore)/inspector/protocol/ApplicationCache.json \
+    $(JavaScriptCore)/inspector/protocol/Audit.json \
     $(JavaScriptCore)/inspector/protocol/CSS.json \
     $(JavaScriptCore)/inspector/protocol/Canvas.json \
     $(JavaScriptCore)/inspector/protocol/Console.json \
index 19c24ca..405eed6 100644 (file)
                8BC064961E1D845C00B2B8CA /* AsyncIteratorPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BC064941E1D828B00B2B8CA /* AsyncIteratorPrototype.h */; settings = {ATTRIBUTES = (Private, ); }; };
                90213E3E123A40C200D422F3 /* MemoryStatistics.h in Headers */ = {isa = PBXBuildFile; fileRef = 90213E3C123A40C200D422F3 /* MemoryStatistics.h */; settings = {ATTRIBUTES = (Private, ); }; };
                9064337DD4B0402BAF34A592 /* JSScriptFetcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BA93C9590484C5BAD9316EA /* JSScriptFetcher.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               91278D5521DEB82600B57184 /* InspectorAuditAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 91278D5321DEB82500B57184 /* InspectorAuditAgent.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               91278D5821DEDA9600B57184 /* JSGlobalObjectAuditAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 91278D5621DEDA9400B57184 /* JSGlobalObjectAuditAgent.h */; };
                93052C350FB792190048FDC3 /* ParserArena.h in Headers */ = {isa = PBXBuildFile; fileRef = 93052C330FB792190048FDC3 /* ParserArena.h */; settings = {ATTRIBUTES = (Private, ); }; };
                932F5BD30822A1C700736975 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6560A4CF04B3B3E7008AE952 /* CoreFoundation.framework */; };
                932F5BD60822A1C700736975 /* libobjc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 51F0EC0705C86C9A00E6DF1B /* libobjc.dylib */; };
                8BC064951E1D838B00B2B8CA /* AsyncIteratorPrototype.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = AsyncIteratorPrototype.js; sourceTree = "<group>"; };
                90213E3B123A40C200D422F3 /* MemoryStatistics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemoryStatistics.cpp; sourceTree = "<group>"; };
                90213E3C123A40C200D422F3 /* MemoryStatistics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryStatistics.h; sourceTree = "<group>"; };
+               91278D5221DEB82400B57184 /* InspectorAuditAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorAuditAgent.cpp; sourceTree = "<group>"; };
+               91278D5321DEB82500B57184 /* InspectorAuditAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorAuditAgent.h; sourceTree = "<group>"; };
+               91278D5621DEDA9400B57184 /* JSGlobalObjectAuditAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalObjectAuditAgent.h; sourceTree = "<group>"; };
+               91278D5721DEDA9500B57184 /* JSGlobalObjectAuditAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGlobalObjectAuditAgent.cpp; sourceTree = "<group>"; };
                93052C320FB792190048FDC3 /* ParserArena.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParserArena.cpp; sourceTree = "<group>"; };
                93052C330FB792190048FDC3 /* ParserArena.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParserArena.h; sourceTree = "<group>"; };
                930DAD030FB1EB1A0082D205 /* NodeConstructors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeConstructors.h; sourceTree = "<group>"; };
                        children = (
                                A5CEEE12187F3BAD00E55C99 /* InspectorAgent.cpp */,
                                A5CEEE13187F3BAD00E55C99 /* InspectorAgent.h */,
+                               91278D5221DEB82400B57184 /* InspectorAuditAgent.cpp */,
+                               91278D5321DEB82500B57184 /* InspectorAuditAgent.h */,
                                A5FD007F189B191A00633231 /* InspectorConsoleAgent.cpp */,
                                A5FD0080189B191A00633231 /* InspectorConsoleAgent.h */,
                                A57D23E31890CEBF0031C7FA /* InspectorDebuggerAgent.cpp */,
                                A55165D11BDEFDBD003B75C1 /* InspectorScriptProfilerAgent.h */,
                                A555FF3C2159D41E00FCD826 /* InspectorTargetAgent.cpp */,
                                A555FF3D2159D41E00FCD826 /* InspectorTargetAgent.h */,
+                               91278D5721DEDA9500B57184 /* JSGlobalObjectAuditAgent.cpp */,
+                               91278D5621DEDA9400B57184 /* JSGlobalObjectAuditAgent.h */,
                                A57D23E71891B0770031C7FA /* JSGlobalObjectDebuggerAgent.cpp */,
                                A57D23E81891B0770031C7FA /* JSGlobalObjectDebuggerAgent.h */,
                                A50E4B5F18809DD50068A46D /* JSGlobalObjectRuntimeAgent.cpp */,
                                A593CF7F1840362C00BFCE27 /* InspectorAgentBase.h in Headers */,
                                A593CF87184038CA00BFCE27 /* InspectorAgentRegistry.h in Headers */,
                                A5EA710E19F6DF810098F5EC /* InspectorAlternateBackendDispatchers.h in Headers */,
+                               91278D5521DEB82600B57184 /* InspectorAuditAgent.h in Headers */,
                                996231E918D1804200C03FDA /* InspectorBackendCommands.js in Headers */,
                                A593CF7D1840360300BFCE27 /* InspectorBackendDispatcher.h in Headers */,
                                A532438818568335002ED692 /* InspectorBackendDispatchers.h in Headers */,
                                797E07AA1B8FCFB9008400BA /* JSGlobalLexicalEnvironment.h in Headers */,
                                BC18C4210E16F5CD00B34460 /* JSGlobalObject.h in Headers */,
                                996B731D1BDA08EF00331B84 /* JSGlobalObject.lut.h in Headers */,
+                               91278D5821DEDA9600B57184 /* JSGlobalObjectAuditAgent.h in Headers */,
                                A5C3A1A618C0490200C9593A /* JSGlobalObjectConsoleClient.h in Headers */,
                                A59455931824744700CC3843 /* JSGlobalObjectDebuggable.h in Headers */,
                                A57D23EA1891B0770031C7FA /* JSGlobalObjectDebuggerAgent.h in Headers */,
index 38791ac..4ab5934 100644 (file)
@@ -579,12 +579,14 @@ inspector/InspectorFrontendDispatchers.cpp
 inspector/InspectorProtocolObjects.cpp
 
 inspector/agents/InspectorAgent.cpp
+inspector/agents/InspectorAuditAgent.cpp
 inspector/agents/InspectorConsoleAgent.cpp
 inspector/agents/InspectorDebuggerAgent.cpp
 inspector/agents/InspectorHeapAgent.cpp
 inspector/agents/InspectorRuntimeAgent.cpp
 inspector/agents/InspectorScriptProfilerAgent.cpp
 inspector/agents/InspectorTargetAgent.cpp
+inspector/agents/JSGlobalObjectAuditAgent.cpp
 inspector/agents/JSGlobalObjectDebuggerAgent.cpp
 inspector/agents/JSGlobalObjectRuntimeAgent.cpp
 
index a5a88cb..e630d63 100644 (file)
@@ -544,12 +544,14 @@ $(SRCROOT)/inspector/ScriptCallStack.cpp
 $(SRCROOT)/inspector/ScriptCallStackFactory.cpp
 $(SRCROOT)/inspector/ScriptDebugServer.cpp
 $(SRCROOT)/inspector/agents/InspectorAgent.cpp
+$(SRCROOT)/inspector/agents/InspectorAuditAgent.cpp
 $(SRCROOT)/inspector/agents/InspectorConsoleAgent.cpp
 $(SRCROOT)/inspector/agents/InspectorDebuggerAgent.cpp
 $(SRCROOT)/inspector/agents/InspectorHeapAgent.cpp
 $(SRCROOT)/inspector/agents/InspectorRuntimeAgent.cpp
 $(SRCROOT)/inspector/agents/InspectorScriptProfilerAgent.cpp
 $(SRCROOT)/inspector/agents/InspectorTargetAgent.cpp
+$(SRCROOT)/inspector/agents/JSGlobalObjectAuditAgent.cpp
 $(SRCROOT)/inspector/agents/JSGlobalObjectDebuggerAgent.cpp
 $(SRCROOT)/inspector/agents/JSGlobalObjectRuntimeAgent.cpp
 $(SRCROOT)/inspector/remote/RemoteAutomationTarget.cpp
index 0a5a6d7..9423331 100644 (file)
 #include "InjectedScript.h"
 
 #include "JSCInlines.h"
+#include "JSLock.h"
 #include "ScriptFunctionCall.h"
 #include "ScriptObject.h"
 #include <wtf/JSONValues.h>
+#include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
 
 namespace Inspector {
@@ -54,6 +56,19 @@ InjectedScript::~InjectedScript()
 {
 }
 
+void InjectedScript::execute(ErrorString& errorString, const String& functionString, ExecuteOptions&& options, RefPtr<Protocol::Runtime::RemoteObject>& result, Optional<bool>& wasThrown, Optional<int>& savedResultIndex)
+{
+    Deprecated::ScriptFunctionCall function(injectedScriptObject(), "execute"_s, inspectorEnvironment()->functionCallHandler());
+    function.appendArgument(functionString);
+    function.appendArgument(options.objectGroup);
+    function.appendArgument(options.includeCommandLineAPI);
+    function.appendArgument(options.returnByValue);
+    function.appendArgument(options.generatePreview);
+    function.appendArgument(options.saveResult);
+    function.appendArgument(arrayFromVector(WTFMove(options.args)));
+    makeEvalCall(errorString, function, result, wasThrown, savedResultIndex);
+}
+
 void InjectedScript::evaluate(ErrorString& errorString, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, bool saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, Optional<bool>& wasThrown, Optional<int>& savedResultIndex)
 {
     Deprecated::ScriptFunctionCall function(injectedScriptObject(), "evaluate"_s, inspectorEnvironment()->functionCallHandler());
@@ -386,5 +401,23 @@ void InjectedScript::releaseObjectGroup(const String& objectGroup)
     ASSERT(!hadException);
 }
 
+JSC::JSValue InjectedScript::arrayFromVector(Vector<JSC::JSValue>&& vector)
+{
+    JSC::ExecState* execState = scriptState();
+    if (!execState)
+        return JSC::jsUndefined();
+
+    JSC::JSLockHolder lock(execState);
+
+    JSC::JSArray* array = JSC::constructEmptyArray(execState, nullptr);
+    if (!array)
+        return JSC::jsUndefined();
+
+    for (auto& item : vector)
+        array->putDirectIndex(execState, array->length(), item);
+
+    return array;
+}
+
 } // namespace Inspector
 
index f2ba842..a8db2d2 100644 (file)
@@ -51,6 +51,16 @@ public:
     InjectedScript(Deprecated::ScriptObject, InspectorEnvironment*);
     virtual ~InjectedScript();
 
+    struct ExecuteOptions {
+        String objectGroup;
+        bool includeCommandLineAPI { false };
+        bool returnByValue { false };
+        bool generatePreview { false };
+        bool saveResult { false };
+        Vector<JSC::JSValue> args;
+    };
+    void execute(ErrorString&, const String& functionString, ExecuteOptions&&, RefPtr<Protocol::Runtime::RemoteObject>& result, Optional<bool>& wasThrown, Optional<int>& savedResultIndex);
+
     void evaluate(ErrorString&, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, bool saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, Optional<bool>& wasThrown, Optional<int>& savedResultIndex);
     void awaitPromise(const String& promiseObjectId, bool returnByValue, bool generatePreview, bool saveResult, AsyncCallCallback&&);
     void evaluateOnCallFrame(ErrorString&, JSC::JSValue callFrames, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, bool saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, Optional<bool>& wasThrown, Optional<int>& savedResultIndex);
@@ -79,6 +89,8 @@ public:
     void releaseObjectGroup(const String& objectGroup);
 
 private:
+    JSC::JSValue arrayFromVector(Vector<JSC::JSValue>&&);
+
     friend class InjectedScriptModule;
 };
 
index 01c1abe..813e9dc 100644 (file)
@@ -103,9 +103,18 @@ let InjectedScript = class InjectedScript
 
     // InjectedScript C++ API
 
-    evaluate(expression, objectGroup, injectCommandLineAPI, returnByValue, generatePreview, saveResult)
+    execute(functionString, objectGroup, includeCommandLineAPI, returnByValue, generatePreview, saveResult, args)
     {
-        return this._evaluateAndWrap(InjectedScriptHost.evaluateWithScopeExtension, InjectedScriptHost, expression, objectGroup, false, injectCommandLineAPI, returnByValue, generatePreview, saveResult);
+        return this._wrapAndSaveCall(objectGroup, returnByValue, generatePreview, saveResult, () => {
+            const isEvalOnCallFrame = false;
+            return this._evaluateOn(InjectedScriptHost.evaluateWithScopeExtension, InjectedScriptHost, functionString, isEvalOnCallFrame, includeCommandLineAPI).apply(undefined, args);
+        });
+    }
+
+    evaluate(expression, objectGroup, includeCommandLineAPI, returnByValue, generatePreview, saveResult)
+    {
+        const isEvalOnCallFrame = false;
+        return this._evaluateAndWrap(InjectedScriptHost.evaluateWithScopeExtension, InjectedScriptHost, expression, objectGroup, isEvalOnCallFrame, includeCommandLineAPI, returnByValue, generatePreview, saveResult);
     }
 
     awaitPromise(promiseObjectId, returnByValue, generatePreview, saveResult, callback)
@@ -145,12 +154,13 @@ let InjectedScript = class InjectedScript
         promiseObject.then(resolve, reject);
     }
 
-    evaluateOnCallFrame(topCallFrame, callFrameId, expression, objectGroup, injectCommandLineAPI, returnByValue, generatePreview, saveResult)
+    evaluateOnCallFrame(topCallFrame, callFrameId, expression, objectGroup, includeCommandLineAPI, returnByValue, generatePreview, saveResult)
     {
         let callFrame = this._callFrameForId(topCallFrame, callFrameId);
         if (!callFrame)
             return "Could not find call frame with given id";
-        return this._evaluateAndWrap(callFrame.evaluateWithScopeExtension, callFrame, expression, objectGroup, true, injectCommandLineAPI, returnByValue, generatePreview, saveResult);
+        const isEvalOnCallFrame = true;
+        return this._evaluateAndWrap(callFrame.evaluateWithScopeExtension, callFrame, expression, objectGroup, isEvalOnCallFrame, includeCommandLineAPI, returnByValue, generatePreview, saveResult);
     }
 
     callFunctionOn(objectId, expression, args, returnByValue, generatePreview)
@@ -501,14 +511,31 @@ let InjectedScript = class InjectedScript
         };
     }
 
-    _evaluateAndWrap(evalFunction, object, expression, objectGroup, isEvalOnCallFrame, injectCommandLineAPI, returnByValue, generatePreview, saveResult)
+    _evaluateAndWrap(evalFunction, object, expression, objectGroup, isEvalOnCallFrame, includeCommandLineAPI, returnByValue, generatePreview, saveResult)
+    {
+        return this._wrapAndSaveCall(objectGroup, returnByValue, generatePreview, saveResult, () => {
+            return this._evaluateOn(evalFunction, object, expression, isEvalOnCallFrame, includeCommandLineAPI);
+        });
+    }
+
+    _wrapAndSaveCall(objectGroup, returnByValue, generatePreview, saveResult, func)
+    {
+        return this._wrapCall(objectGroup, returnByValue, generatePreview, saveResult, () => {
+            let result = func();
+            if (saveResult)
+                this._saveResult(result);
+            return result;
+        });
+    }
+
+    _wrapCall(objectGroup, returnByValue, generatePreview, saveResult, func)
     {
         try {
             this._savedResultIndex = 0;
 
             let returnObject = {
                 wasThrown: false,
-                result: RemoteObject.create(this._evaluateOn(evalFunction, object, objectGroup, expression, isEvalOnCallFrame, injectCommandLineAPI, saveResult), objectGroup, returnByValue, generatePreview)
+                result: RemoteObject.create(func(), objectGroup, returnByValue, generatePreview)
             };
 
             if (saveResult && this._savedResultIndex)
@@ -520,20 +547,17 @@ let InjectedScript = class InjectedScript
         }
     }
 
-    _evaluateOn(evalFunction, object, objectGroup, expression, isEvalOnCallFrame, injectCommandLineAPI, saveResult)
+    _evaluateOn(evalFunction, object, expression, isEvalOnCallFrame, includeCommandLineAPI)
     {
         let commandLineAPI = null;
-        if (injectCommandLineAPI) {
+        if (includeCommandLineAPI) {
             if (this.CommandLineAPI)
                 commandLineAPI = new this.CommandLineAPI(this._commandLineAPIImpl, isEvalOnCallFrame ? object : null);
             else
                 commandLineAPI = new BasicCommandLineAPI(isEvalOnCallFrame ? object : null);
         }
 
-        let result = evalFunction.call(object, expression, commandLineAPI);
-        if (saveResult)
-            this._saveResult(result);
-        return result;
+        return evalFunction.call(object, expression, commandLineAPI);
     }
 
     _callFrameForId(topCallFrame, callFrameId)
index ad45f6f..0e62aa4 100644 (file)
@@ -42,6 +42,7 @@
 #include "InspectorScriptProfilerAgent.h"
 #include "JSCInlines.h"
 #include "JSGlobalObject.h"
+#include "JSGlobalObjectAuditAgent.h"
 #include "JSGlobalObjectConsoleClient.h"
 #include "JSGlobalObjectDebuggerAgent.h"
 #include "JSGlobalObjectRuntimeAgent.h"
@@ -68,17 +69,7 @@ JSGlobalObjectInspectorController::JSGlobalObjectInspectorController(JSGlobalObj
     , m_frontendRouter(FrontendRouter::create())
     , m_backendDispatcher(BackendDispatcher::create(m_frontendRouter.copyRef()))
 {
-    AgentContext baseContext = {
-        *this,
-        *m_injectedScriptManager,
-        m_frontendRouter.get(),
-        m_backendDispatcher.get()
-    };
-
-    JSAgentContext context = {
-        baseContext,
-        globalObject
-    };
+    auto context = jsAgentContext();
 
     auto inspectorAgent = std::make_unique<InspectorAgent>(context);
     auto runtimeAgent = std::make_unique<JSGlobalObjectRuntimeAgent>(context);
@@ -124,6 +115,8 @@ void JSGlobalObjectInspectorController::connectFrontend(FrontendChannel& fronten
     m_isAutomaticInspection = isAutomaticInspection;
     m_pauseAfterInitialization = immediatelyPause;
 
+    createLazyAgents();
+
     bool connectedFirstFrontend = !m_frontendRouter->hasFrontends();
     m_frontendRouter->connectFrontend(frontendChannel);
 
@@ -295,4 +288,33 @@ void JSGlobalObjectInspectorController::appendExtraAgent(std::unique_ptr<Inspect
 }
 #endif
 
+JSAgentContext JSGlobalObjectInspectorController::jsAgentContext()
+{
+    AgentContext baseContext = {
+        *this,
+        *m_injectedScriptManager,
+        m_frontendRouter.get(),
+        m_backendDispatcher.get()
+    };
+
+    JSAgentContext context = {
+        baseContext,
+        m_globalObject
+    };
+
+    return context;
+}
+
+void JSGlobalObjectInspectorController::createLazyAgents()
+{
+    if (m_didCreateLazyAgents)
+        return;
+
+    m_didCreateLazyAgents = true;
+
+    auto context = jsAgentContext();
+
+    m_agents.append(std::make_unique<JSGlobalObjectAuditAgent>(context));
+}
+
 } // namespace Inspector
index c2188d8..1aa05b5 100644 (file)
@@ -55,6 +55,7 @@ class InspectorDebuggerAgent;
 class InspectorScriptProfilerAgent;
 class JSGlobalObjectConsoleClient;
 class ScriptCallStack;
+struct JSAgentContext;
 
 class JSGlobalObjectInspectorController final
     : public InspectorEnvironment
@@ -103,6 +104,9 @@ public:
 private:
     void appendAPIBacktrace(ScriptCallStack&);
 
+    JSAgentContext jsAgentContext();
+    void createLazyAgents();
+
     JSC::JSGlobalObject& m_globalObject;
     std::unique_ptr<InjectedScriptManager> m_injectedScriptManager;
     std::unique_ptr<JSGlobalObjectConsoleClient> m_consoleClient;
@@ -124,6 +128,7 @@ private:
     bool m_includeNativeCallStackWithExceptions { true };
     bool m_isAutomaticInspection { false };
     bool m_pauseAfterInitialization { false };
+    bool m_didCreateLazyAgents { false };
 
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
     AugmentableInspectorControllerClient* m_augmentingClient { nullptr };
diff --git a/Source/JavaScriptCore/inspector/agents/InspectorAuditAgent.cpp b/Source/JavaScriptCore/inspector/agents/InspectorAuditAgent.cpp
new file mode 100644 (file)
index 0000000..86d6731
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "InspectorAuditAgent.h"
+
+#include "InjectedScript.h"
+#include "InjectedScriptManager.h"
+#include "JSLock.h"
+#include "ObjectConstructor.h"
+#include "ScriptDebugServer.h"
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+#include <wtf/text/StringBuilder.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+using namespace JSC;
+
+InspectorAuditAgent::InspectorAuditAgent(AgentContext& context)
+    : InspectorAgentBase("Audit"_s)
+    , m_backendDispatcher(AuditBackendDispatcher::create(context.backendDispatcher, this))
+    , m_injectedScriptManager(context.injectedScriptManager)
+    , m_scriptDebugServer(context.environment.scriptDebugServer())
+{
+}
+
+void InspectorAuditAgent::didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*)
+{
+}
+
+void InspectorAuditAgent::willDestroyFrontendAndBackend(DisconnectReason)
+{
+}
+
+void InspectorAuditAgent::setup(ErrorString& errorString, const int* executionContextId)
+{
+    if (hasActiveAudit()) {
+        errorString = "Must call teardown before calling setup again."_s;
+        return;
+    }
+
+    InjectedScript injectedScript = injectedScriptForEval(errorString, executionContextId);
+    if (injectedScript.hasNoValue())
+        return;
+
+    JSC::ExecState* execState = injectedScript.scriptState();
+    if (!execState) {
+        errorString = "Missing execution state for injected script."_s;
+        return;
+    }
+
+    VM& vm = execState->vm();
+
+    JSC::JSLockHolder lock(execState);
+
+    m_injectedWebInspectorAuditValue.set(vm, constructEmptyObject(execState));
+    if (!m_injectedWebInspectorAuditValue) {
+        errorString = "Unable to construct injected WebInspectorAudit object."_s;
+        return;
+    }
+
+    populateAuditObject(execState, m_injectedWebInspectorAuditValue);
+}
+
+void InspectorAuditAgent::run(ErrorString& errorString, const String& test, const int* executionContextId, RefPtr<Protocol::Runtime::RemoteObject>& result, Optional<bool>& wasThrown)
+{
+    InjectedScript injectedScript = injectedScriptForEval(errorString, executionContextId);
+    if (injectedScript.hasNoValue())
+        return;
+
+    StringBuilder functionString;
+    functionString.appendLiteral("(function(WebInspectorAudit) { \"use strict\"; return eval(`(");
+    functionString.append(test.isolatedCopy().replace('`', "\\`"));
+    functionString.appendLiteral(")`)(WebInspectorAudit); })");
+
+    InjectedScript::ExecuteOptions options;
+    options.objectGroup = "audit"_s;
+    if (m_injectedWebInspectorAuditValue)
+        options.args = { m_injectedWebInspectorAuditValue.get() };
+
+    Optional<int> savedResultIndex;
+
+    ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = m_scriptDebugServer.pauseOnExceptionsState();
+
+    m_scriptDebugServer.setPauseOnExceptionsState(ScriptDebugServer::DontPauseOnExceptions);
+    muteConsole();
+
+    injectedScript.execute(errorString, functionString.toString(), WTFMove(options), result, wasThrown, savedResultIndex);
+
+    unmuteConsole();
+    m_scriptDebugServer.setPauseOnExceptionsState(previousPauseOnExceptionsState);
+}
+
+void InspectorAuditAgent::teardown(ErrorString& errorString)
+{
+    if (!hasActiveAudit()) {
+        errorString = "Must call setup before calling teardown."_s;
+        return;
+    }
+
+    m_injectedWebInspectorAuditValue.clear();
+}
+
+bool InspectorAuditAgent::hasActiveAudit() const
+{
+    return !!m_injectedWebInspectorAuditValue;
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/agents/InspectorAuditAgent.h b/Source/JavaScriptCore/inspector/agents/InspectorAuditAgent.h
new file mode 100644 (file)
index 0000000..44a8ff9
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "InspectorAgentBase.h"
+#include "InspectorBackendDispatchers.h"
+#include "JSCInlines.h"
+#include <wtf/FastMalloc.h>
+#include <wtf/Forward.h>
+#include <wtf/Noncopyable.h>
+
+namespace Inspector {
+
+class InjectedScript;
+class InjectedScriptManager;
+class ScriptDebugServer;
+typedef String ErrorString;
+
+class JS_EXPORT_PRIVATE InspectorAuditAgent : public InspectorAgentBase, public AuditBackendDispatcherHandler {
+    WTF_MAKE_NONCOPYABLE(InspectorAuditAgent);
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    virtual ~InspectorAuditAgent() = default;
+
+    // InspectorAgentBase
+    void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) override;
+    void willDestroyFrontendAndBackend(DisconnectReason) override;
+
+    // AuditBackendDispatcherHandler
+    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;
+
+    bool hasActiveAudit() const;
+
+protected:
+    explicit InspectorAuditAgent(AgentContext&);
+
+    InjectedScriptManager& injectedScriptManager() { return m_injectedScriptManager; }
+
+    virtual InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) = 0;
+
+    virtual void populateAuditObject(JSC::ExecState*, JSC::Strong<JSC::JSObject>& /* auditObject */) { };
+
+    virtual void muteConsole() { };
+    virtual void unmuteConsole() { };
+
+private:
+    RefPtr<AuditBackendDispatcher> m_backendDispatcher;
+    InjectedScriptManager& m_injectedScriptManager;
+    ScriptDebugServer& m_scriptDebugServer;
+
+    JSC::Strong<JSC::JSObject> m_injectedWebInspectorAuditValue;
+};
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/agents/JSGlobalObjectAuditAgent.cpp b/Source/JavaScriptCore/inspector/agents/JSGlobalObjectAuditAgent.cpp
new file mode 100644 (file)
index 0000000..86e767b
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSGlobalObjectAuditAgent.h"
+
+#include "InjectedScript.h"
+#include "InjectedScriptManager.h"
+#include "JSCInlines.h"
+#include "JSGlobalObject.h"
+#include <wtf/Ref.h>
+#include <wtf/RefPtr.h>
+#include <wtf/text/WTFString.h>
+
+using namespace JSC;
+
+namespace Inspector {
+
+JSGlobalObjectAuditAgent::JSGlobalObjectAuditAgent(JSAgentContext& context)
+    : InspectorAuditAgent(context)
+    , m_globalObject(context.inspectedGlobalObject)
+{
+}
+
+InjectedScript JSGlobalObjectAuditAgent::injectedScriptForEval(ErrorString& errorString, const int* executionContextId)
+{
+    if (executionContextId) {
+        errorString = "Execution context id is not supported for JSContexts as there is only one execution context."_s;
+        return InjectedScript();
+    }
+
+    JSC::ExecState* scriptState = m_globalObject.globalExec();
+    InjectedScript injectedScript = injectedScriptManager().injectedScriptFor(scriptState);
+    if (injectedScript.hasNoValue())
+        errorString = "Internal error: main world execution context not found."_s;
+
+    return injectedScript;
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/agents/JSGlobalObjectAuditAgent.h b/Source/JavaScriptCore/inspector/agents/JSGlobalObjectAuditAgent.h
new file mode 100644 (file)
index 0000000..c1cad32
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "InspectorAuditAgent.h"
+
+namespace JSC {
+class JSGlobalObject;
+}
+
+namespace Inspector {
+
+class JSGlobalObjectAuditAgent final : public InspectorAuditAgent {
+    WTF_MAKE_NONCOPYABLE(JSGlobalObjectAuditAgent);
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    explicit JSGlobalObjectAuditAgent(JSAgentContext&);
+
+private:
+    InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) override;
+
+    JSC::JSGlobalObject& m_globalObject;
+};
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/protocol/Audit.json b/Source/JavaScriptCore/inspector/protocol/Audit.json
new file mode 100644 (file)
index 0000000..1637a9e
--- /dev/null
@@ -0,0 +1,29 @@
+{
+    "domain": "Audit",
+    "description": "",
+    "commands": [
+        {
+            "name": "setup",
+            "description": "Creates the `WebInspectorAudit` object that is passed to run. Must call teardown before calling setup more than once.",
+            "parameters": [
+                { "name": "contextId", "$ref": "Runtime.ExecutionContextId", "optional": true, "description": "Specifies in which isolated context to run the test. Each content script lives in an isolated context and this parameter may be used to specify one of those contexts. If the parameter is omitted or 0 the evaluation will be performed in the context of the inspected page." }
+            ]
+        },
+        {
+            "name": "run",
+            "description": "Parses and evaluates the given test string and sends back the result. Returned values are saved to the \"audit\" object group. Call setup before and teardown after if the `WebInspectorAudit` object should be passed into the test.",
+            "parameters": [
+                { "name": "test", "type": "string", "description": "Test string to parse and evaluate." },
+                { "name": "contextId", "$ref": "Runtime.ExecutionContextId", "optional": true, "description": "Specifies in which isolated context to run the test. Each content script lives in an isolated context and this parameter may be used to specify one of those contexts. If the parameter is omitted or 0 the evaluation will be performed in the context of the inspected page." }
+            ],
+            "returns": [
+                { "name": "result", "$ref": "Runtime.RemoteObject", "description": "Evaluation result." },
+                { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True if the result was thrown during the evaluation." }
+            ]
+        },
+        {
+            "name": "teardown",
+            "description": "Destroys the `WebInspectorAudit` object that is passed to run. Must call setup before calling teardown."
+        }
+    ]
+}
index d019ada..0de5943 100644 (file)
@@ -888,6 +888,8 @@ set(WebCore_NON_SVG_IDL_FILES
     html/canvas/WebMetalTextureDescriptor.idl
 
     inspector/CommandLineAPIHost.idl
+    inspector/InspectorAuditAccessibilityObject.idl
+    inspector/InspectorAuditDOMObject.idl
     inspector/InspectorFrontendHost.idl
 
     loader/appcache/DOMApplicationCache.idl
index ad82af5..89ea6c9 100644 (file)
@@ -1,3 +1,58 @@
+2019-01-15  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: Audit: create new IDL type for exposing special functionality in test context
+        https://bugs.webkit.org/show_bug.cgi?id=193149
+        <rdar://problem/46801218>
+
+        Reviewed by Joseph Pecoraro.
+
+        Tests: inspector/audit/run.html
+               inspector/audit/setup.html
+               inspector/audit/teardown.html
+
+        Create a new `AuditAgent` (and various subclasses for different inspection targets), as well
+        as `InspectorAuditAccessibilityObject` and `InspectorAuditDOMObject` objects that will
+        be injected into the test function to allow for more advanced testing.
+
+        * inspector/InspectorAuditAccessibilityObject.idl: Added.
+        * inspector/InspectorAuditAccessibilityObject.h: Added.
+        (WebCore::InspectorAuditAccessibilityObject::create):
+        * inspector/InspectorAuditAccessibilityObject.cpp: Added.
+        (WebCore::InspectorAuditAccessibilityObject::InspectorAuditAccessibilityObject):
+
+        * inspector/InspectorAuditDOMObject.idl: Added.
+        * inspector/InspectorAuditDOMObject.h: Added.
+        (WebCore::InspectorAuditDOMObject::create):
+        * inspector/InspectorAuditDOMObject.cpp: Added.
+        (WebCore::InspectorAuditDOMObject::InspectorAuditDOMObject):
+
+        * inspector/agents/page/PageAuditAgent.h: Added.
+        * inspector/agents/page/PageAuditAgent.cpp: Added.
+        (WebCore::PageAuditAgent::PageAuditAgent):
+        (WebCore::PageAuditAgent::injectedScriptForEval):
+        (WebCore::PageAuditAgent::populateAuditObject):
+        (WebCore::PageAuditAgent::muteConsole):
+        (WebCore::PageAuditAgent::unmuteConsole):
+
+        * inspector/agents/worker/WorkerAuditAgent.h: Added.
+        * inspector/agents/worker/WorkerAuditAgent.cpp: Added.
+        (WebCore::WorkerAuditAgent::WorkerAuditAgent):
+        (WebCore::WorkerAuditAgent::injectedScriptForEval):
+
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::createLazyAgents):
+
+        * inspector/WorkerInspectorController.cpp:
+        (WebCore::WorkerInspectorController::createLazyAgents):
+
+        * CMakeLists.txt:
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * Sources.txt:
+        * UnifiedSources-input.xcfilelist:
+        * WebCore.xcodeproj/project.pbxproj:
+
 2019-01-14  Myles C. Maxfield  <mmaxfield@apple.com>
 
         [WHLSL] Implement the Type Checker
index fff1d07..262b0d2 100644 (file)
@@ -808,6 +808,8 @@ $(PROJECT_DIR)/html/track/VideoTrack.idl
 $(PROJECT_DIR)/html/track/VideoTrackList.idl
 $(PROJECT_DIR)/inspector/CommandLineAPIHost.idl
 $(PROJECT_DIR)/inspector/CommandLineAPIModuleSource.js
+$(PROJECT_DIR)/inspector/InspectorAuditAccessibilityObject.idl
+$(PROJECT_DIR)/inspector/InspectorAuditDOMObject.idl
 $(PROJECT_DIR)/inspector/InspectorFrontendHost.idl
 $(PROJECT_DIR)/inspector/InspectorOverlayPage.css
 $(PROJECT_DIR)/inspector/InspectorOverlayPage.html
index 8d2ac9d..b71a016 100644 (file)
@@ -814,6 +814,10 @@ $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSImageSmoothingQuality.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSImageSmoothingQuality.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSInputEvent.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSInputEvent.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSInspectorAuditAccessibilityObject.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSInspectorAuditAccessibilityObject.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSInspectorAuditDOMObject.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSInspectorAuditDOMObject.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSInspectorFrontendHost.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSInspectorFrontendHost.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSInternalSettings.cpp
index 69278db..cd67576 100644 (file)
@@ -839,6 +839,8 @@ JS_BINDING_IDLS = \
     $(WebCore)/html/track/VideoTrack.idl \
     $(WebCore)/html/track/VideoTrackList.idl \
     $(WebCore)/inspector/CommandLineAPIHost.idl \
+    $(WebCore)/inspector/InspectorAuditAccessibilityObject.idl \
+    $(WebCore)/inspector/InspectorAuditDOMObject.idl \
     $(WebCore)/inspector/InspectorFrontendHost.idl \
     $(WebCore)/loader/appcache/DOMApplicationCache.idl \
     $(WebCore)/page/BarProp.idl \
index 63f0961..03a45de 100644 (file)
@@ -1248,6 +1248,8 @@ inspector/CommandLineAPIHost.cpp
 inspector/CommandLineAPIModule.cpp
 inspector/DOMEditor.cpp
 inspector/DOMPatchSupport.cpp
+inspector/InspectorAuditAccessibilityObject.cpp
+inspector/InspectorAuditDOMObject.cpp
 inspector/InspectorCanvas.cpp
 inspector/InspectorClient.cpp
 inspector/InspectorController.cpp
@@ -1288,6 +1290,7 @@ inspector/agents/WebConsoleAgent.cpp
 inspector/agents/WebDebuggerAgent.cpp
 inspector/agents/WebHeapAgent.cpp
 
+inspector/agents/page/PageAuditAgent.cpp
 inspector/agents/page/PageConsoleAgent.cpp
 inspector/agents/page/PageDebuggerAgent.cpp
 inspector/agents/page/PageHeapAgent.cpp
@@ -1295,6 +1298,7 @@ inspector/agents/page/PageNetworkAgent.cpp
 inspector/agents/page/PageRuntimeAgent.cpp
 
 inspector/agents/worker/ServiceWorkerAgent.cpp
+inspector/agents/worker/WorkerAuditAgent.cpp
 inspector/agents/worker/WorkerConsoleAgent.cpp
 inspector/agents/worker/WorkerDebuggerAgent.cpp
 inspector/agents/worker/WorkerNetworkAgent.cpp
@@ -2850,6 +2854,8 @@ JSImageBitmapRenderingContextSettings.cpp
 JSImageData.cpp
 JSImageSmoothingQuality.cpp
 JSInputEvent.cpp
+JSInspectorAuditAccessibilityObject.cpp
+JSInspectorAuditDOMObject.cpp
 JSInspectorFrontendHost.cpp
 JSIntersectionObserver.cpp
 JSIntersectionObserverCallback.cpp
index 07ce946..c6f19a6 100644 (file)
@@ -391,6 +391,8 @@ $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSImageBitmapRenderingContextSettin
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSImageData.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSImageSmoothingQuality.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSInputEvent.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSInspectorAuditAccessibilityObject.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSInspectorAuditDOMObject.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSInspectorFrontendHost.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSIntersectionObserver.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSIntersectionObserverCallback.cpp
@@ -2175,6 +2177,8 @@ $(SRCROOT)/inspector/CommandLineAPIHost.cpp
 $(SRCROOT)/inspector/CommandLineAPIModule.cpp
 $(SRCROOT)/inspector/DOMEditor.cpp
 $(SRCROOT)/inspector/DOMPatchSupport.cpp
+$(SRCROOT)/inspector/InspectorAuditAccessibilityObject.cpp
+$(SRCROOT)/inspector/InspectorAuditDOMObject.cpp
 $(SRCROOT)/inspector/InspectorCanvas.cpp
 $(SRCROOT)/inspector/InspectorClient.cpp
 $(SRCROOT)/inspector/InspectorController.cpp
@@ -2213,12 +2217,14 @@ $(SRCROOT)/inspector/agents/InspectorWorkerAgent.cpp
 $(SRCROOT)/inspector/agents/WebConsoleAgent.cpp
 $(SRCROOT)/inspector/agents/WebDebuggerAgent.cpp
 $(SRCROOT)/inspector/agents/WebHeapAgent.cpp
+$(SRCROOT)/inspector/agents/page/PageAuditAgent.cpp
 $(SRCROOT)/inspector/agents/page/PageConsoleAgent.cpp
 $(SRCROOT)/inspector/agents/page/PageDebuggerAgent.cpp
 $(SRCROOT)/inspector/agents/page/PageHeapAgent.cpp
 $(SRCROOT)/inspector/agents/page/PageNetworkAgent.cpp
 $(SRCROOT)/inspector/agents/page/PageRuntimeAgent.cpp
 $(SRCROOT)/inspector/agents/worker/ServiceWorkerAgent.cpp
+$(SRCROOT)/inspector/agents/worker/WorkerAuditAgent.cpp
 $(SRCROOT)/inspector/agents/worker/WorkerConsoleAgent.cpp
 $(SRCROOT)/inspector/agents/worker/WorkerDebuggerAgent.cpp
 $(SRCROOT)/inspector/agents/worker/WorkerNetworkAgent.cpp
index 93a4a53..7de2a16 100644 (file)
                9001774012E0347800648462 /* OESStandardDerivatives.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9001773D12E0347800648462 /* OESStandardDerivatives.cpp */; };
                9001774112E0347800648462 /* OESStandardDerivatives.h in Headers */ = {isa = PBXBuildFile; fileRef = 9001773E12E0347800648462 /* OESStandardDerivatives.h */; };
                9001788112E0370700648462 /* JSOESStandardDerivatives.h in Headers */ = {isa = PBXBuildFile; fileRef = 9001787F12E0370700648462 /* JSOESStandardDerivatives.h */; };
+               91278D5E21DEDAD600B57184 /* PageAuditAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 91278D5C21DEDAD500B57184 /* PageAuditAgent.h */; };
+               91278D6221DEDAF000B57184 /* WorkerAuditAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 91278D6021DEDAF000B57184 /* WorkerAuditAgent.h */; };
+               9175CE5C21E281ED00DF2C27 /* InspectorAuditDOMObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 9175CE5821E281EC00DF2C27 /* InspectorAuditDOMObject.h */; };
+               9175CE5C21E281ED00DF2C28 /* JSInspectorAuditDOMObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 9175CE5821E281EC00DF2C28 /* InspectorAuditDOMObject.h */; };
+               9175CE5E21E281ED00DF2C27 /* InspectorAuditAccessibilityObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 9175CE5A21E281ED00DF2C27 /* InspectorAuditAccessibilityObject.h */; };
+               9175CE5E21E281ED00DF2C28 /* JSInspectorAuditAccessibilityObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 9175CE5A21E281ED00DF2C28 /* InspectorAuditAccessibilityObject.h */; };
                91B8F0B521953D65000C2B00 /* CertificateInfoBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 91B8F0B321953D65000C2B00 /* CertificateInfoBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
                91B952241F58A58F00931DC2 /* RecordingSwizzleTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 91B952221F58A58000931DC2 /* RecordingSwizzleTypes.h */; };
                91C9F2F91AE3BEB00095B61C /* AXTextStateChangeIntent.h in Headers */ = {isa = PBXBuildFile; fileRef = 91C9F2F81AE3BE240095B61C /* AXTextStateChangeIntent.h */; settings = {ATTRIBUTES = (Private, ); }; };
                9001773F12E0347800648462 /* OESStandardDerivatives.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = OESStandardDerivatives.idl; sourceTree = "<group>"; };
                9001787E12E0370700648462 /* JSOESStandardDerivatives.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSOESStandardDerivatives.cpp; sourceTree = "<group>"; };
                9001787F12E0370700648462 /* JSOESStandardDerivatives.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSOESStandardDerivatives.h; sourceTree = "<group>"; };
+               91278D5A21DEDAD500B57184 /* PageAuditAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageAuditAgent.cpp; sourceTree = "<group>"; };
+               91278D5C21DEDAD500B57184 /* PageAuditAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageAuditAgent.h; sourceTree = "<group>"; };
+               91278D5F21DEDAEF00B57184 /* WorkerAuditAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkerAuditAgent.cpp; sourceTree = "<group>"; };
+               91278D6021DEDAF000B57184 /* WorkerAuditAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerAuditAgent.h; sourceTree = "<group>"; };
+               9175CE5721E281EB00DF2C27 /* InspectorAuditDOMObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorAuditDOMObject.cpp; sourceTree = "<group>"; };
+               9175CE5721E281EB00DF2C28 /* JSInspectorAuditDOMObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorAuditDOMObject.cpp; sourceTree = "<group>"; };
+               9175CE5821E281EC00DF2C27 /* InspectorAuditDOMObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorAuditDOMObject.h; sourceTree = "<group>"; };
+               9175CE5821E281EC00DF2C28 /* JSInspectorAuditDOMObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorAuditDOMObject.h; sourceTree = "<group>"; };
+               9175CE5921E281EC00DF2C27 /* InspectorAuditAccessibilityObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorAuditAccessibilityObject.cpp; sourceTree = "<group>"; };
+               9175CE5921E281EC00DF2C28 /* JSInspectorAuditAccessibilityObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorAuditAccessibilityObject.cpp; sourceTree = "<group>"; };
+               9175CE5A21E281ED00DF2C27 /* InspectorAuditAccessibilityObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorAuditAccessibilityObject.h; sourceTree = "<group>"; };
+               9175CE5A21E281ED00DF2C28 /* JSInspectorAuditAccessibilityObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorAuditAccessibilityObject.h; sourceTree = "<group>"; };
                91B8F0B321953D65000C2B00 /* CertificateInfoBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CertificateInfoBase.h; sourceTree = "<group>"; };
                91B952221F58A58000931DC2 /* RecordingSwizzleTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RecordingSwizzleTypes.h; sourceTree = "<group>"; };
                91C9F2F81AE3BE240095B61C /* AXTextStateChangeIntent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AXTextStateChangeIntent.h; sourceTree = "<group>"; };
                                A584FE2518637DAB00843B10 /* CommandLineAPIModuleSource.h */,
                                A584FE391864E2D800843B10 /* JSCommandLineAPIHost.cpp */,
                                A584FE3A1864E2D800843B10 /* JSCommandLineAPIHost.h */,
+                               9175CE5921E281EC00DF2C28 /* JSInspectorAuditAccessibilityObject.cpp */,
+                               9175CE5A21E281ED00DF2C28 /* JSInspectorAuditAccessibilityObject.h */,
+                               9175CE5721E281EB00DF2C28 /* JSInspectorAuditDOMObject.cpp */,
+                               9175CE5821E281EC00DF2C28 /* JSInspectorAuditDOMObject.h */,
                                7A0E771C10C00DB100A0276E /* JSInspectorFrontendHost.cpp */,
                                7A0E771D10C00DB100A0276E /* JSInspectorFrontendHost.h */,
                        );
                                7AABA25814BC613300AA9A11 /* DOMEditor.h */,
                                7A54881614E432A1006AE05A /* DOMPatchSupport.cpp */,
                                7A54881514E432A1006AE05A /* DOMPatchSupport.h */,
+                               9175CE5921E281EC00DF2C27 /* InspectorAuditAccessibilityObject.cpp */,
+                               9175CE5A21E281ED00DF2C27 /* InspectorAuditAccessibilityObject.h */,
+                               9175CE5721E281EB00DF2C27 /* InspectorAuditDOMObject.cpp */,
+                               9175CE5821E281EC00DF2C27 /* InspectorAuditDOMObject.h */,
                                6A22E8721F1042C400F546C3 /* InspectorCanvas.cpp */,
                                6A22E86F1F10418600F546C3 /* InspectorCanvas.h */,
                                7A1F2B51126C61B20006A7E6 /* InspectorClient.cpp */,
                A5B81CB91FAA44820037D1E6 /* page */ = {
                        isa = PBXGroup;
                        children = (
+                               91278D5A21DEDAD500B57184 /* PageAuditAgent.cpp */,
+                               91278D5C21DEDAD500B57184 /* PageAuditAgent.h */,
                                A5B81CC01FAA44B70037D1E6 /* PageConsoleAgent.cpp */,
                                A5B81CBB1FAA44B70037D1E6 /* PageConsoleAgent.h */,
                                A5B81CBD1FAA44B70037D1E6 /* PageDebuggerAgent.cpp */,
                        children = (
                                A581ED121FB288C900CED4EC /* ServiceWorkerAgent.cpp */,
                                A581ED101FB288C800CED4EC /* ServiceWorkerAgent.h */,
+                               91278D5F21DEDAEF00B57184 /* WorkerAuditAgent.cpp */,
+                               91278D6021DEDAF000B57184 /* WorkerAuditAgent.h */,
                                A5B81CCB1FAA44DA0037D1E6 /* WorkerConsoleAgent.cpp */,
                                A5B81CCA1FAA44DA0037D1E6 /* WorkerConsoleAgent.h */,
                                A5B81CC81FAA44DA0037D1E6 /* WorkerDebuggerAgent.cpp */,
                                93309DF0099E64920056E581 /* InsertParagraphSeparatorCommand.h in Headers */,
                                93309DF2099E64920056E581 /* InsertTextCommand.h in Headers */,
                                A5B81CA71FAA44620037D1E6 /* InspectorApplicationCacheAgent.h in Headers */,
+                               9175CE5E21E281ED00DF2C27 /* InspectorAuditAccessibilityObject.h in Headers */,
+                               9175CE5C21E281ED00DF2C27 /* InspectorAuditDOMObject.h in Headers */,
                                6A22E8701F10418600F546C3 /* InspectorCanvas.h in Headers */,
                                A5B81CA81FAA44620037D1E6 /* InspectorCanvasAgent.h in Headers */,
                                1C81B95C0E97330800266E07 /* InspectorClient.h in Headers */,
                                A77979290D6B9E64003851B9 /* JSImageData.h in Headers */,
                                7C193C011F5E11050088F3E6 /* JSImageSmoothingQuality.h in Headers */,
                                A86629D309DA2B48009633A6 /* JSInputEvent.h in Headers */,
+                               9175CE5E21E281ED00DF2C28 /* JSInspectorAuditAccessibilityObject.h in Headers */,
+                               9175CE5C21E281ED00DF2C28 /* JSInspectorAuditDOMObject.h in Headers */,
                                7A0E771F10C00DB100A0276E /* JSInspectorFrontendHost.h in Headers */,
                                0F4710E61DB700C7002DCEC3 /* JSIntersectionObserver.h in Headers */,
                                0F8B45761DC41DBA00443C3F /* JSIntersectionObserverCallback.h in Headers */,
                                1A0D57370A5C77FE007EDD4C /* OverflowEvent.h in Headers */,
                                3774ABA50FA21EB400AD7DE9 /* OverlapTestRequestClient.h in Headers */,
                                65A21468097A329100B9050A /* Page.h in Headers */,
+                               91278D5E21DEDAD600B57184 /* PageAuditAgent.h in Headers */,
                                1477E7770BF4134A00152872 /* PageCache.h in Headers */,
                                CD5E5B5F1A15CE54000C609E /* PageConfiguration.h in Headers */,
                                A5B81CC21FAA44BC0037D1E6 /* PageConsoleAgent.h in Headers */,
                                A14832C6187F668F00DA63A6 /* WKViewPrivate.h in Headers */,
                                379919971200DDF400EA041C /* WOFFFileFormat.h in Headers */,
                                2E4346460F546A8200B0F1BA /* Worker.h in Headers */,
+                               91278D6221DEDAF000B57184 /* WorkerAuditAgent.h in Headers */,
                                41A7D3531F438D16008988DE /* WorkerCacheStorageConnection.h in Headers */,
                                A5B81CCD1FAA44DE0037D1E6 /* WorkerConsoleAgent.h in Headers */,
                                A55639D11C6F09E300806D8E /* WorkerConsoleClient.h in Headers */,
diff --git a/Source/WebCore/inspector/InspectorAuditAccessibilityObject.cpp b/Source/WebCore/inspector/InspectorAuditAccessibilityObject.cpp
new file mode 100644 (file)
index 0000000..fcc59b1
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "config.h"
+#include "InspectorAuditAccessibilityObject.h"
+
+namespace WebCore {
+
+using namespace Inspector;
+
+InspectorAuditAccessibilityObject::InspectorAuditAccessibilityObject()
+{
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/inspector/InspectorAuditAccessibilityObject.h b/Source/WebCore/inspector/InspectorAuditAccessibilityObject.h
new file mode 100644 (file)
index 0000000..1036fc0
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <JavaScriptCore/InspectorAuditAgent.h>
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class InspectorAuditAccessibilityObject : public RefCounted<InspectorAuditAccessibilityObject> {
+public:
+    static Ref<InspectorAuditAccessibilityObject> create(Inspector::InspectorAuditAgent&)
+    {
+        return adoptRef(*new InspectorAuditAccessibilityObject());
+    }
+
+private:
+    explicit InspectorAuditAccessibilityObject();
+};
+
+} // namespace WebCore
diff --git a/Source/WebCore/inspector/InspectorAuditAccessibilityObject.idl b/Source/WebCore/inspector/InspectorAuditAccessibilityObject.idl
new file mode 100644 (file)
index 0000000..24d0398
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    ImplementationLacksVTable,
+    JSGenerateToJSObject,
+    NoInterfaceObject,
+] interface InspectorAuditAccessibilityObject {
+};
diff --git a/Source/WebCore/inspector/InspectorAuditDOMObject.cpp b/Source/WebCore/inspector/InspectorAuditDOMObject.cpp
new file mode 100644 (file)
index 0000000..99ea133
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "config.h"
+#include "InspectorAuditDOMObject.h"
+
+namespace WebCore {
+
+using namespace Inspector;
+
+InspectorAuditDOMObject::InspectorAuditDOMObject()
+{
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/inspector/InspectorAuditDOMObject.h b/Source/WebCore/inspector/InspectorAuditDOMObject.h
new file mode 100644 (file)
index 0000000..d76252d
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <JavaScriptCore/InspectorAuditAgent.h>
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class InspectorAuditDOMObject : public RefCounted<InspectorAuditDOMObject> {
+public:
+    static Ref<InspectorAuditDOMObject> create(Inspector::InspectorAuditAgent&)
+    {
+        return adoptRef(*new InspectorAuditDOMObject());
+    }
+
+private:
+    explicit InspectorAuditDOMObject();
+};
+
+} // namespace WebCore
diff --git a/Source/WebCore/inspector/InspectorAuditDOMObject.idl b/Source/WebCore/inspector/InspectorAuditDOMObject.idl
new file mode 100644 (file)
index 0000000..e6e383b
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    ImplementationLacksVTable,
+    JSGenerateToJSObject,
+    NoInterfaceObject,
+] interface InspectorAuditDOMObject {
+};
index 44aa81b..866210c 100644 (file)
@@ -60,6 +60,7 @@
 #include "JSDOMWindowCustom.h"
 #include "JSExecState.h"
 #include "Page.h"
+#include "PageAuditAgent.h"
 #include "PageConsoleAgent.h"
 #include "PageDebuggerAgent.h"
 #include "PageHeapAgent.h"
@@ -206,6 +207,7 @@ void InspectorController::createLazyAgents()
 #if ENABLE(RESOURCE_USAGE)
     m_agents.append(std::make_unique<InspectorMemoryAgent>(pageContext));
 #endif
+    m_agents.append(std::make_unique<PageAuditAgent>(pageContext));
 }
 
 void InspectorController::inspectedPageDestroyed()
index d2c023f..3597e1b 100644 (file)
@@ -32,6 +32,7 @@
 #include "WebHeapAgent.h"
 #include "WebInjectedScriptHost.h"
 #include "WebInjectedScriptManager.h"
+#include "WorkerAuditAgent.h"
 #include "WorkerConsoleAgent.h"
 #include "WorkerDebuggerAgent.h"
 #include "WorkerGlobalScope.h"
@@ -168,13 +169,16 @@ void WorkerInspectorController::createLazyAgents()
 
     m_didCreateLazyAgents = true;
 
-#if ENABLE(SERVICE_WORKER)
     auto workerContext = workerAgentContext();
+
+#if ENABLE(SERVICE_WORKER)
     if (is<ServiceWorkerGlobalScope>(m_workerGlobalScope)) {
         m_agents.append(std::make_unique<ServiceWorkerAgent>(workerContext));
         m_agents.append(std::make_unique<WorkerNetworkAgent>(workerContext));
     }
 #endif
+
+    m_agents.append(std::make_unique<WorkerAuditAgent>(workerContext));
 }
 
 InspectorFunctionCallHandler WorkerInspectorController::functionCallHandler() const
diff --git a/Source/WebCore/inspector/agents/page/PageAuditAgent.cpp b/Source/WebCore/inspector/agents/page/PageAuditAgent.cpp
new file mode 100644 (file)
index 0000000..9172b6c
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PageAuditAgent.h"
+
+#include "JSInspectorAuditAccessibilityObject.h"
+#include "JSInspectorAuditDOMObject.h"
+#include "Page.h"
+#include "PageConsoleClient.h"
+#include <JavaScriptCore/CallFrame.h>
+#include <JavaScriptCore/InjectedScript.h>
+#include <JavaScriptCore/InjectedScriptManager.h>
+#include <JavaScriptCore/JSLock.h>
+#include <wtf/Ref.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+using namespace Inspector;
+
+PageAuditAgent::PageAuditAgent(PageAgentContext& context)
+    : InspectorAuditAgent(context)
+    , m_inspectedPage(context.inspectedPage)
+{
+}
+
+InjectedScript PageAuditAgent::injectedScriptForEval(const int* executionContextId)
+{
+    if (executionContextId)
+        return injectedScriptManager().injectedScriptForId(*executionContextId);
+
+    JSC::ExecState* scriptState = mainWorldExecState(&m_inspectedPage.mainFrame());
+    return injectedScriptManager().injectedScriptFor(scriptState);
+}
+
+InjectedScript PageAuditAgent::injectedScriptForEval(ErrorString& errorString, const int* executionContextId)
+{
+    InjectedScript injectedScript = injectedScriptForEval(executionContextId);
+    if (injectedScript.hasNoValue()) {
+        if (executionContextId)
+            errorString = "Execution context with given id not found."_s;
+        else
+            errorString = "Internal error: main world execution context not found."_s;
+    }
+    return injectedScript;
+}
+
+void PageAuditAgent::populateAuditObject(JSC::ExecState* execState, JSC::Strong<JSC::JSObject>& auditObject)
+{
+    InspectorAuditAgent::populateAuditObject(execState, auditObject);
+
+    ASSERT(execState);
+    if (!execState)
+        return;
+
+    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);
+
+        ADD_AUDIT_OBJECT(Accessibility);
+        ADD_AUDIT_OBJECT(DOM);
+#undef ADD_AUDIT_OBJECT
+    }
+}
+
+void PageAuditAgent::muteConsole()
+{
+    InspectorAuditAgent::muteConsole();
+    PageConsoleClient::mute();
+}
+
+void PageAuditAgent::unmuteConsole()
+{
+    PageConsoleClient::unmute();
+    InspectorAuditAgent::unmuteConsole();
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/inspector/agents/page/PageAuditAgent.h b/Source/WebCore/inspector/agents/page/PageAuditAgent.h
new file mode 100644 (file)
index 0000000..b96768f
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "InspectorAuditAccessibilityObject.h"
+#include "InspectorAuditDOMObject.h"
+#include "InspectorWebAgentBase.h"
+#include <JavaScriptCore/InspectorAuditAgent.h>
+
+namespace WebCore {
+
+class Page;
+
+class PageAuditAgent final : public Inspector::InspectorAuditAgent {
+    WTF_MAKE_NONCOPYABLE(PageAuditAgent);
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    explicit PageAuditAgent(PageAgentContext&);
+
+private:
+    Inspector::InjectedScript injectedScriptForEval(const int* executionContextId);
+    Inspector::InjectedScript injectedScriptForEval(Inspector::ErrorString&, const int* executionContextId) override;
+
+    void populateAuditObject(JSC::ExecState*, JSC::Strong<JSC::JSObject>& auditObject) override;
+
+    void muteConsole() override;
+    void unmuteConsole() override;
+
+    Page& m_inspectedPage;
+    RefPtr<InspectorAuditAccessibilityObject> m_auditAccessibilityObject;
+    RefPtr<InspectorAuditDOMObject> m_auditDOMObject;
+};
+
+} // namespace WebCore
diff --git a/Source/WebCore/inspector/agents/worker/WorkerAuditAgent.cpp b/Source/WebCore/inspector/agents/worker/WorkerAuditAgent.cpp
new file mode 100644 (file)
index 0000000..854c245
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WorkerAuditAgent.h"
+
+#include "WorkerGlobalScope.h"
+#include <JavaScriptCore/InjectedScript.h>
+#include <JavaScriptCore/InjectedScriptManager.h>
+#include <JavaScriptCore/JSCInlines.h>
+#include <wtf/Ref.h>
+#include <wtf/RefPtr.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+using namespace Inspector;
+
+WorkerAuditAgent::WorkerAuditAgent(WorkerAgentContext& context)
+    : InspectorAuditAgent(context)
+    , m_workerGlobalScope(context.workerGlobalScope)
+{
+    ASSERT(context.workerGlobalScope.isContextThread());
+}
+
+InjectedScript WorkerAuditAgent::injectedScriptForEval(ErrorString& errorString, const int* executionContextId)
+{
+    if (executionContextId) {
+        errorString = "Execution context id is not supported for workers as there is only one execution context."_s;
+        return InjectedScript();
+    }
+
+    JSC::ExecState* scriptState = execStateFromWorkerGlobalScope(m_workerGlobalScope);
+    return injectedScriptManager().injectedScriptFor(scriptState);
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/inspector/agents/worker/WorkerAuditAgent.h b/Source/WebCore/inspector/agents/worker/WorkerAuditAgent.h
new file mode 100644 (file)
index 0000000..1b8d9ff
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "InspectorWebAgentBase.h"
+#include <JavaScriptCore/InspectorAuditAgent.h>
+
+namespace WebCore {
+
+class WorkerGlobalScope;
+
+class WorkerAuditAgent final : public Inspector::InspectorAuditAgent {
+    WTF_MAKE_NONCOPYABLE(WorkerAuditAgent);
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    explicit WorkerAuditAgent(WorkerAgentContext&);
+
+private:
+    Inspector::InjectedScript injectedScriptForEval(Inspector::ErrorString&, const int* executionContextId) override;
+
+    WorkerGlobalScope& m_workerGlobalScope;
+};
+
+} // namespace WebCore
index 75ea80b..a8c04dd 100644 (file)
@@ -35,6 +35,7 @@
     },
     "globals": {
         // Agents
+        "AuditAgent": true,
         "ApplicationCacheAgent": true,
         "CSSAgent": true,
         "CanvasAgent": true,
index 302abba..0c84317 100644 (file)
@@ -1,3 +1,24 @@
+2019-01-15  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: Audit: create new IDL type for exposing special functionality in test context
+        https://bugs.webkit.org/show_bug.cgi?id=193149
+        <rdar://problem/46801218>
+
+        Reviewed by Joseph Pecoraro.
+
+        Add `AuditAgent` getters and plumbing.
+
+        * UserInterface/Protocol/Target.js:
+        (WI.Target.prototype.get AuditAgent): Added.
+
+        * UserInterface/Models/AuditTestCase.js:
+        (WI.AuditTestCase.prototype.async run):
+
+        * UserInterface/Controllers/AuditManager.js:
+        (WI.AuditManager.prototype.async start):
+
+        * .eslintrc:
+
 2019-01-14  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: Event breakpoints: typing uppercase "DOM" doesn't show completions for events that start with "DOM"
index 6d0c7e6..3732c55 100644 (file)
@@ -110,6 +110,7 @@ WI.AuditManager = class AuditManager extends WI.Object
         else
             tests = this._tests;
 
+        console.assert(tests.length);
         if (!tests.length)
             return;
 
@@ -122,7 +123,18 @@ WI.AuditManager = class AuditManager extends WI.Object
 
         this.dispatchEventToListeners(WI.AuditManager.Event.TestScheduled);
 
-        await Promise.chain(this._runningTests.map((test) => () => this._runningState === WI.AuditManager.RunningState.Active ? test.start() : null));
+        await Promise.chain(this._runningTests.map((test) => async () => {
+            if (this._runningState !== WI.AuditManager.RunningState.Active)
+                return;
+
+            if (InspectorBackend.domains.Audit)
+                await AuditAgent.setup();
+
+            await test.start();
+
+            if (InspectorBackend.domains.Audit)
+                await AuditAgent.teardown();
+        }));
 
         let result = this._runningTests.map((test) => test.result).filter((result) => !!result);
 
index 128b5b7..92b2fad 100644 (file)
@@ -108,12 +108,6 @@ WI.AuditTestCase = class AuditTestCase extends WI.AuditTestBase
             data.errors.push(value);
         }
 
-        let evaluateArguments = {
-            expression: `(function() { "use strict"; return eval(${this._test})(); })()`,
-            objectGroup: "audit",
-            doNotPauseOnExceptionsAndMuteConsole: true,
-        };
-
         async function parseResponse(response) {
             let remoteObject = WI.RemoteObject.fromPayload(response.result, WI.mainTarget);
             if (response.wasThrown || (remoteObject.type === "object" && remoteObject.subtype === "error"))
@@ -234,9 +228,21 @@ WI.AuditTestCase = class AuditTestCase extends WI.AuditTestBase
                 addError(WI.UIString("Return value is not an object, string, or boolean"));
         }
 
+        let agentCommandFunction = null;
+        let agentCommandArguments = {};
+        if (InspectorBackend.domains.Audit) {
+            agentCommandFunction = AuditAgent.run;
+            agentCommandArguments.test = this._test;
+        } else {
+            agentCommandFunction = RuntimeAgent.evaluate;
+            agentCommandArguments.expression = `(function() { "use strict"; return eval(\`(${this._test.replace(/`/g, "\\`")})\`)(); })()`;
+            agentCommandArguments.objectGroup = "audit";
+            agentCommandArguments.doNotPauseOnExceptionsAndMuteConsole = true;
+        }
+
         try {
             metadata.startTimestamp = new Date;
-            let response = await RuntimeAgent.evaluate.invoke(evaluateArguments);
+            let response = await agentCommandFunction.invoke(agentCommandArguments);
             metadata.endTimestamp = new Date;
 
             if (response.result.type === "object" && response.result.className === "Promise") {
index dc79952..b0ea5ea 100644 (file)
@@ -109,6 +109,7 @@ WI.Target = class Target extends WI.Object
 
     // Agents
 
+    get AuditAgent() { return this._agents.Audit; }
     get ApplicationCacheAgent() { return this._agents.ApplicationCache; }
     get CSSAgent() { return this._agents.CSS; }
     get CanvasAgent() { return this._agents.Canvas; }