Title: [269023] trunk
Revision
269023
Author
[email protected]
Date
2020-10-26 23:39:08 -0700 (Mon, 26 Oct 2020)

Log Message

Web Inspector: console command line API should be exposed to breakpoint conditions/actions
https://bugs.webkit.org/show_bug.cgi?id=218141
<rdar://problem/70636727>

Reviewed by Brian Burg.

Source/_javascript_Core:

* debugger/Debugger.h:
(JSC::Debugger::Client::scopeExtensionObject): Added.
* debugger/Debugger.cpp:
(JSC::Debugger::setClient): Added.
(JSC::Debugger::evaluateBreakpointCondition):
(JSC::Debugger::evaluateBreakpointActions):
Introduce an optional `Debugger::Client` virtual class that can be used to adjust behavior
in various situations. Right now it is used when evaluating breakpoint conditions/actions
to get a scope extension object.

* inspector/agents/InspectorDebuggerAgent.h:
* inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::InspectorDebuggerAgent::internalEnable):
(Inspector::InspectorDebuggerAgent::internalDisable):
(Inspector::InspectorDebuggerAgent::scopeExtensionObject): Added.
Implement `Debugger::Client` and provide a newly created `CommandLineAPI` instance.

* inspector/InjectedScript.h:
* inspector/InjectedScript.cpp:
(Inspector::InjectedScript::createCommandLineAPIObject const): Added.
* inspector/InjectedScriptSource.js:
(let.InjectedScript.prototype.createCommandLineAPIObject): Added.
(let.InjectedScript.prototype._evaluateOn):
Expose a way for the C++ to create `CommandLineAPI` instances.

Source/WebInspectorUI:

* UserInterface/Controllers/CodeMirrorCompletionController.js:
(WI.CodeMirrorCompletionController):
(WI.CodeMirrorCompletionController.prototype.get mode): Added.
(WI.CodeMirrorCompletionController.prototype.get delegate): Deleted.
* UserInterface/Controllers/_javascript_RuntimeCompletionProvider.js:
(WI._javascript_RuntimeCompletionProvider.prototype.completionControllerCompletionsNeeded):
(WI._javascript_RuntimeCompletionProvider.prototype.completionControllerCompletionsNeeded.shouldExposeEvent): Added.
(WI._javascript_RuntimeCompletionProvider.prototype.completionControllerCompletionsNeeded.shouldExposeException): Added.
(WI._javascript_RuntimeCompletionProvider.prototype.completionControllerCompletionsNeeded.receivedPropertyNames):
Introduce a `Mode` enum that can be fetched by completion providers to adjust functionality.

* UserInterface/Views/BreakpointPopover.js:
(WI.BreakpointPopover.appendContextMenuItems):
(WI.BreakpointPopover.prototype.show):
(WI.BreakpointPopover.prototype.breakpointActionViewCodeMirrorCompletionControllerMode): Added.
(WI.BreakpointPopover.prototype.get codeMirrorCompletionControllerMode): Added.
* UserInterface/Views/EventBreakpointPopover.js:
(WI.EventBreakpointPopover.prototype.get codeMirrorCompletionControllerMode): Added.
* UserInterface/Views/BreakpointActionView.js:
(WI.BreakpointActionView.prototype._updateBody):
Use a `Mode` that always exposes `$event`/`$exception` depending on the breakpoint type.

* UserInterface/Views/ConsolePrompt.js:
(WI.ConsolePrompt):
Use a `Mode` that only exposes `$event`/`$exception` when paused for an event/exeption.

* UserInterface/Views/ScopeChainDetailsSidebarPanel.js:
(WI.ScopeChainDetailsSidebarPanel.prototype._addWatchExpressionButtonClicked):
Use a `Mode` that always exposes `$event`/`$exception` since watch expressions track values
over time, and may therefore not always have an `$event`/`$exception` set.

* UserInterface/Views/TextEditor.js:
(WI.TextEditor):
Use the default `Mode` that never exposes `$event`/`$exception`.

LayoutTests:

* inspector/debugger/resources/breakpoint-options-utilities.js:
* inspector/debugger/break-on-exception-expected.txt:
* inspector/debugger/break-on-uncaught-exception-expected.txt:
* inspector/debugger/setPauseOnAssertions-expected.txt:
* inspector/debugger/setPauseOnDebuggerStatements-expected.txt:
* inspector/debugger/setPauseOnMicrotasks-expected.txt:
* inspector/dom-debugger/attribute-modified-style-expected.txt:
* inspector/dom-debugger/dom-breakpoint-attribute-modified-expected.txt:
* inspector/dom-debugger/dom-breakpoint-node-removed-ancestor-expected.txt:
* inspector/dom-debugger/dom-breakpoint-node-removed-direct-expected.txt:
* inspector/dom-debugger/dom-breakpoint-subtree-modified-add-expected.txt:
* inspector/dom-debugger/dom-breakpoint-subtree-modified-remove-expected.txt:
* inspector/dom-debugger/event-animation-frame-breakpoints-expected.txt:
* inspector/dom-debugger/event-interval-breakpoints-expected.txt:
* inspector/dom-debugger/event-listener-breakpoints-expected.txt:
* inspector/dom-debugger/event-timeout-breakpoints-expected.txt:
* inspector/dom-debugger/url-breakpoints-all-requests-expected.txt:
* inspector/dom-debugger/url-breakpoints-containing-expected.txt:
* inspector/dom-debugger/url-breakpoints-matching-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (269022 => 269023)


--- trunk/LayoutTests/ChangeLog	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/LayoutTests/ChangeLog	2020-10-27 06:39:08 UTC (rev 269023)
@@ -1,3 +1,31 @@
+2020-10-26  Devin Rousso  <[email protected]>
+
+        Web Inspector: console command line API should be exposed to breakpoint conditions/actions
+        https://bugs.webkit.org/show_bug.cgi?id=218141
+        <rdar://problem/70636727>
+
+        Reviewed by Brian Burg.
+
+        * inspector/debugger/resources/breakpoint-options-utilities.js:
+        * inspector/debugger/break-on-exception-expected.txt:
+        * inspector/debugger/break-on-uncaught-exception-expected.txt:
+        * inspector/debugger/setPauseOnAssertions-expected.txt:
+        * inspector/debugger/setPauseOnDebuggerStatements-expected.txt:
+        * inspector/debugger/setPauseOnMicrotasks-expected.txt:
+        * inspector/dom-debugger/attribute-modified-style-expected.txt:
+        * inspector/dom-debugger/dom-breakpoint-attribute-modified-expected.txt:
+        * inspector/dom-debugger/dom-breakpoint-node-removed-ancestor-expected.txt:
+        * inspector/dom-debugger/dom-breakpoint-node-removed-direct-expected.txt:
+        * inspector/dom-debugger/dom-breakpoint-subtree-modified-add-expected.txt:
+        * inspector/dom-debugger/dom-breakpoint-subtree-modified-remove-expected.txt:
+        * inspector/dom-debugger/event-animation-frame-breakpoints-expected.txt:
+        * inspector/dom-debugger/event-interval-breakpoints-expected.txt:
+        * inspector/dom-debugger/event-listener-breakpoints-expected.txt:
+        * inspector/dom-debugger/event-timeout-breakpoints-expected.txt:
+        * inspector/dom-debugger/url-breakpoints-all-requests-expected.txt:
+        * inspector/dom-debugger/url-breakpoints-containing-expected.txt:
+        * inspector/dom-debugger/url-breakpoints-matching-expected.txt:
+
 2020-10-26  Carlos Alberto Lopez Perez  <[email protected]>
 
         [GTK][WPE] Gardening of layout test failures.

Modified: trunk/LayoutTests/inspector/debugger/break-on-exception-expected.txt (269022 => 269023)


--- trunk/LayoutTests/inspector/debugger/break-on-exception-expected.txt	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/LayoutTests/inspector/debugger/break-on-exception-expected.txt	2020-10-27 06:39:08 UTC (rev 269023)
@@ -56,6 +56,26 @@
 Triggering breakpoint...
 PASS: Should pause.
 
+-- Running test case: BreakOnAnyException.Options.Condition.ConsoleCommandLineAPI
+Adding saved console value 'false'...
+
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Adding saved console value 'true'...
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should pause.
+
+Triggering breakpoint...
+PASS: Should pause.
+
 -- Running test case: BreakOnAnyException.Options.IgnoreCount
 
 Setting ignoreCount to '2'...
@@ -126,3 +146,34 @@
 PASS: Should execute breakpoint action.
 PASS: Should not pause.
 
+-- Running test case: BreakOnAnyException.Options.Actions.Evaluate.ConsoleCommandLineAPI
+Adding saved console value '1'...
+
+Adding evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '2'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '3'...
+Editing evaluate action using saved console value...
+Enabling auto-continue...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+
+Adding saved console value '4'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+

Modified: trunk/LayoutTests/inspector/debugger/break-on-uncaught-exception-expected.txt (269022 => 269023)


--- trunk/LayoutTests/inspector/debugger/break-on-uncaught-exception-expected.txt	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/LayoutTests/inspector/debugger/break-on-uncaught-exception-expected.txt	2020-10-27 06:39:08 UTC (rev 269023)
@@ -55,6 +55,26 @@
 Triggering breakpoint...
 PASS: Should pause.
 
+-- Running test case: BreakOnUncaughtException.Options.Condition.ConsoleCommandLineAPI
+Adding saved console value 'false'...
+
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Adding saved console value 'true'...
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should pause.
+
+Triggering breakpoint...
+PASS: Should pause.
+
 -- Running test case: BreakOnUncaughtException.Options.IgnoreCount
 
 Setting ignoreCount to '2'...
@@ -125,3 +145,34 @@
 PASS: Should execute breakpoint action.
 PASS: Should not pause.
 
+-- Running test case: BreakOnUncaughtException.Options.Actions.Evaluate.ConsoleCommandLineAPI
+Adding saved console value '1'...
+
+Adding evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '2'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '3'...
+Editing evaluate action using saved console value...
+Enabling auto-continue...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+
+Adding saved console value '4'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+

Modified: trunk/LayoutTests/inspector/debugger/resources/breakpoint-options-utilities.js (269022 => 269023)


--- trunk/LayoutTests/inspector/debugger/resources/breakpoint-options-utilities.js	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/LayoutTests/inspector/debugger/resources/breakpoint-options-utilities.js	2020-10-27 06:39:08 UTC (rev 269023)
@@ -56,6 +56,71 @@
             },
         });
 
+        suite.addTestCase({
+            name: suite.name + "." + testCaseNamePrefix + "Options.Condition.ConsoleCommandLineAPI",
+            description: "Check the console command line API is exposed to the breakpoint condition.",
+            async test() {
+                let pauseCount = 0;
+
+                let pausedListener = WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Paused, (event) => {
+                    ++pauseCount;
+                    WI.debuggerManager.resume();
+                });
+
+                InspectorTest.log("Adding saved console value 'false'...");
+                let firstEvaluateResult = await RuntimeAgent.evaluate.invoke({
+                    _expression_: "false",
+                    objectGroup: "test",
+                    includeCommandLineAPI: true,
+                    doNotPauseOnExceptionsAndMuteConsole: true,
+                    saveResult: true,
+                });
+                InspectorTest.assert(!firstEvaluateResult.wasThrown, "Should not throw.");
+                InspectorTest.assert(firstEvaluateResult.savedResultIndex, "Should have saved result index.");
+
+                let breakpoint = await createBreakpoint();
+
+                InspectorTest.newline();
+
+                InspectorTest.log("Setting condition to saved console value...");
+                breakpoint.condition = "$" + firstEvaluateResult.savedResultIndex;
+
+                for (let i = 1; i <= 4; ++i) {
+                    if (i === 3) {
+                        InspectorTest.newline();
+
+                        InspectorTest.log("Adding saved console value 'true'...");
+                        let secondEvaluateResult = await RuntimeAgent.evaluate.invoke({
+                            _expression_: "true",
+                            objectGroup: "test",
+                            includeCommandLineAPI: true,
+                            doNotPauseOnExceptionsAndMuteConsole: true,
+                            saveResult: true,
+                        });
+                        InspectorTest.assert(!secondEvaluateResult.wasThrown, "Should not throw.");
+                        InspectorTest.assert(secondEvaluateResult.savedResultIndex, "Should have saved result index.");
+
+                        InspectorTest.log("Setting condition to saved console value...");
+                        breakpoint.condition = "$" + secondEvaluateResult.savedResultIndex;
+                    }
+
+                    InspectorTest.newline();
+
+                    InspectorTest.log("Triggering breakpoint...");
+                    await triggerBreakpoint(breakpoint);
+
+                    if (i <= 2)
+                        InspectorTest.expectEqual(pauseCount, 0, "Should not pause.");
+                    else
+                        InspectorTest.expectEqual(pauseCount, i - 2, "Should pause.");
+                }
+
+                removeBreakpoint(breakpoint);
+
+                WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.Paused, pausedListener);
+            },
+        });
+
         if (!skip?.ignoreCount) {
             suite.addTestCase({
                 name: suite.name + "." + testCaseNamePrefix + "Options.IgnoreCount",
@@ -204,5 +269,79 @@
                 WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.Paused, pausedListener);
             },
         });
+
+        suite.addTestCase({
+            name: suite.name + "." + testCaseNamePrefix + "Options.Actions.Evaluate.ConsoleCommandLineAPI",
+            description: "Check the console command line API is exposed to breakpoint actions.",
+            async test() {
+                let pauseCount = 0;
+
+                let pausedListener = WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Paused, (event) => {
+                    ++pauseCount;
+                    WI.debuggerManager.resume();
+                });
+
+                InspectorTest.log("Adding saved console value '1'...");
+                let firstEvaluateResult = await RuntimeAgent.evaluate.invoke({
+                    _expression_: "1",
+                    objectGroup: "test",
+                    includeCommandLineAPI: true,
+                    doNotPauseOnExceptionsAndMuteConsole: true,
+                    saveResult: true,
+                });
+                InspectorTest.assert(!firstEvaluateResult.wasThrown, "Should not throw.");
+                InspectorTest.assert(firstEvaluateResult.savedResultIndex, "Should have saved result index.");
+
+                let breakpoint = await createBreakpoint();
+
+                InspectorTest.newline();
+
+                InspectorTest.log("Adding evaluate action using saved console value...");
+                let action = "" WI.BreakpointAction(WI.BreakpointAction.Type.Evaluate, {data: `window.BREAKPOINT_ACTION_EVALUATE = $${firstEvaluateResult.savedResultIndex};`});
+                breakpoint.addAction(action);
+
+                for (let i = 1; i <= 4; ++i) {
+                    if (i > 1) {
+                        InspectorTest.newline();
+
+                        InspectorTest.log(`Adding saved console value '${i}'...`);
+                        let secondEvaluateResult = await RuntimeAgent.evaluate.invoke({
+                            _expression_: String(i),
+                            objectGroup: "test",
+                            includeCommandLineAPI: true,
+                            doNotPauseOnExceptionsAndMuteConsole: true,
+                            saveResult: true,
+                        });
+                        InspectorTest.assert(!secondEvaluateResult.wasThrown, "Should not throw.");
+                        InspectorTest.assert(secondEvaluateResult.savedResultIndex, "Should have saved result index.");
+
+                        InspectorTest.log("Editing evaluate action using saved console value...");
+                        action.data = "" = $${secondEvaluateResult.savedResultIndex};`;
+
+                        if (i === 3) {
+                            InspectorTest.log("Enabling auto-continue...");
+                            breakpoint.autoContinue = true;
+                        }
+                    }
+
+                    InspectorTest.newline();
+
+                    InspectorTest.log("Triggering breakpoint...");
+                    await triggerBreakpoint(breakpoint);
+
+                    let breakpointActionEvaluateResult = await InspectorTest.evaluateInPage(`window.BREAKPOINT_ACTION_EVALUATE`);
+                    InspectorTest.expectEqual(breakpointActionEvaluateResult, i, "Should execute breakpoint action.");
+
+                    if (i <= 2)
+                        InspectorTest.expectEqual(pauseCount, i, "Should pause.");
+                    else
+                        InspectorTest.expectEqual(pauseCount, 2, "Should not pause.");
+                }
+
+                removeBreakpoint(breakpoint);
+
+                WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.Paused, pausedListener);
+            },
+        });
     };
 });

Modified: trunk/LayoutTests/inspector/debugger/setPauseOnAssertions-expected.txt (269022 => 269023)


--- trunk/LayoutTests/inspector/debugger/setPauseOnAssertions-expected.txt	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/LayoutTests/inspector/debugger/setPauseOnAssertions-expected.txt	2020-10-27 06:39:08 UTC (rev 269023)
@@ -8,6 +8,10 @@
 CONSOLE MESSAGE: Failing assertion
 CONSOLE MESSAGE: Failing assertion
 CONSOLE MESSAGE: Failing assertion
+CONSOLE MESSAGE: Failing assertion
+CONSOLE MESSAGE: Failing assertion
+CONSOLE MESSAGE: Failing assertion
+CONSOLE MESSAGE: Failing assertion
 CONSOLE MESSAGE: BREAKPOINT ACTION LOG 1
 CONSOLE MESSAGE: Failing assertion
 CONSOLE MESSAGE: BREAKPOINT ACTION LOG 2
@@ -20,6 +24,10 @@
 CONSOLE MESSAGE: Failing assertion
 CONSOLE MESSAGE: Failing assertion
 CONSOLE MESSAGE: Failing assertion
+CONSOLE MESSAGE: Failing assertion
+CONSOLE MESSAGE: Failing assertion
+CONSOLE MESSAGE: Failing assertion
+CONSOLE MESSAGE: Failing assertion
 Debugger.setPauseOnAssertions
 
 
@@ -48,6 +56,26 @@
 Triggering breakpoint...
 PASS: Should pause.
 
+-- Running test case: Debugger.setPauseOnAssertions.Options.Condition.ConsoleCommandLineAPI
+Adding saved console value 'false'...
+
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Adding saved console value 'true'...
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should pause.
+
+Triggering breakpoint...
+PASS: Should pause.
+
 -- Running test case: Debugger.setPauseOnAssertions.Options.IgnoreCount
 
 Setting ignoreCount to '2'...
@@ -118,3 +146,34 @@
 PASS: Should execute breakpoint action.
 PASS: Should not pause.
 
+-- Running test case: Debugger.setPauseOnAssertions.Options.Actions.Evaluate.ConsoleCommandLineAPI
+Adding saved console value '1'...
+
+Adding evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '2'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '3'...
+Editing evaluate action using saved console value...
+Enabling auto-continue...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+
+Adding saved console value '4'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+

Modified: trunk/LayoutTests/inspector/debugger/setPauseOnDebuggerStatements-expected.txt (269022 => 269023)


--- trunk/LayoutTests/inspector/debugger/setPauseOnDebuggerStatements-expected.txt	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/LayoutTests/inspector/debugger/setPauseOnDebuggerStatements-expected.txt	2020-10-27 06:39:08 UTC (rev 269023)
@@ -30,6 +30,26 @@
 Triggering breakpoint...
 PASS: Should pause.
 
+-- Running test case: Debugger.setPauseOnDebuggerStatements.Options.Condition.ConsoleCommandLineAPI
+Adding saved console value 'false'...
+
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Adding saved console value 'true'...
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should pause.
+
+Triggering breakpoint...
+PASS: Should pause.
+
 -- Running test case: Debugger.setPauseOnDebuggerStatements.Options.IgnoreCount
 
 Setting ignoreCount to '2'...
@@ -100,3 +120,34 @@
 PASS: Should execute breakpoint action.
 PASS: Should not pause.
 
+-- Running test case: Debugger.setPauseOnDebuggerStatements.Options.Actions.Evaluate.ConsoleCommandLineAPI
+Adding saved console value '1'...
+
+Adding evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '2'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '3'...
+Editing evaluate action using saved console value...
+Enabling auto-continue...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+
+Adding saved console value '4'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+

Modified: trunk/LayoutTests/inspector/debugger/setPauseOnMicrotasks-expected.txt (269022 => 269023)


--- trunk/LayoutTests/inspector/debugger/setPauseOnMicrotasks-expected.txt	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/LayoutTests/inspector/debugger/setPauseOnMicrotasks-expected.txt	2020-10-27 06:39:08 UTC (rev 269023)
@@ -42,6 +42,26 @@
 Triggering breakpoint...
 PASS: Should pause.
 
+-- Running test case: Debugger.setPauseOnMicrotasks.Options.Condition.ConsoleCommandLineAPI
+Adding saved console value 'false'...
+
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Adding saved console value 'true'...
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should pause.
+
+Triggering breakpoint...
+PASS: Should pause.
+
 -- Running test case: Debugger.setPauseOnMicrotasks.Options.IgnoreCount
 
 Setting ignoreCount to '2'...
@@ -112,3 +132,34 @@
 PASS: Should execute breakpoint action.
 PASS: Should not pause.
 
+-- Running test case: Debugger.setPauseOnMicrotasks.Options.Actions.Evaluate.ConsoleCommandLineAPI
+Adding saved console value '1'...
+
+Adding evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '2'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '3'...
+Editing evaluate action using saved console value...
+Enabling auto-continue...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+
+Adding saved console value '4'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+

Modified: trunk/LayoutTests/inspector/dom-debugger/attribute-modified-style-expected.txt (269022 => 269023)


--- trunk/LayoutTests/inspector/dom-debugger/attribute-modified-style-expected.txt	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/LayoutTests/inspector/dom-debugger/attribute-modified-style-expected.txt	2020-10-27 06:39:08 UTC (rev 269023)
@@ -90,6 +90,27 @@
 Triggering breakpoint...
 PASS: Should pause.
 
+-- Running test case: DOMBreakpoint.AttributeModified.Style.Options.Condition.ConsoleCommandLineAPI
+Adding saved console value 'false'...
+Adding "attribute-modified:1,HTML,1,BODY,1,DIV" DOM Breakpoint...
+
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Adding saved console value 'true'...
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should pause.
+
+Triggering breakpoint...
+PASS: Should pause.
+
 -- Running test case: DOMBreakpoint.AttributeModified.Style.Options.IgnoreCount
 Adding "attribute-modified:1,HTML,1,BODY,1,DIV" DOM Breakpoint...
 
@@ -163,3 +184,35 @@
 PASS: Should execute breakpoint action.
 PASS: Should not pause.
 
+-- Running test case: DOMBreakpoint.AttributeModified.Style.Options.Actions.Evaluate.ConsoleCommandLineAPI
+Adding saved console value '1'...
+Adding "attribute-modified:1,HTML,1,BODY,1,DIV" DOM Breakpoint...
+
+Adding evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '2'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '3'...
+Editing evaluate action using saved console value...
+Enabling auto-continue...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+
+Adding saved console value '4'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+

Modified: trunk/LayoutTests/inspector/dom-debugger/dom-breakpoint-attribute-modified-expected.txt (269022 => 269023)


--- trunk/LayoutTests/inspector/dom-debugger/dom-breakpoint-attribute-modified-expected.txt	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/LayoutTests/inspector/dom-debugger/dom-breakpoint-attribute-modified-expected.txt	2020-10-27 06:39:08 UTC (rev 269023)
@@ -58,6 +58,27 @@
 Triggering breakpoint...
 PASS: Should pause.
 
+-- Running test case: DOMBreakpoint.AttributeModified.Options.Condition.ConsoleCommandLineAPI
+Adding saved console value 'false'...
+Adding "attribute-modified:1,HTML,1,BODY,1,DIV,0,DIV" DOM Breakpoint...
+
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Adding saved console value 'true'...
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should pause.
+
+Triggering breakpoint...
+PASS: Should pause.
+
 -- Running test case: DOMBreakpoint.AttributeModified.Options.IgnoreCount
 Adding "attribute-modified:1,HTML,1,BODY,1,DIV,0,DIV" DOM Breakpoint...
 
@@ -131,3 +152,35 @@
 PASS: Should execute breakpoint action.
 PASS: Should not pause.
 
+-- Running test case: DOMBreakpoint.AttributeModified.Options.Actions.Evaluate.ConsoleCommandLineAPI
+Adding saved console value '1'...
+Adding "attribute-modified:1,HTML,1,BODY,1,DIV,0,DIV" DOM Breakpoint...
+
+Adding evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '2'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '3'...
+Editing evaluate action using saved console value...
+Enabling auto-continue...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+
+Adding saved console value '4'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+

Modified: trunk/LayoutTests/inspector/dom-debugger/dom-breakpoint-node-removed-ancestor-expected.txt (269022 => 269023)


--- trunk/LayoutTests/inspector/dom-debugger/dom-breakpoint-node-removed-ancestor-expected.txt	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/LayoutTests/inspector/dom-debugger/dom-breakpoint-node-removed-ancestor-expected.txt	2020-10-27 06:39:08 UTC (rev 269023)
@@ -59,6 +59,27 @@
 Triggering breakpoint...
 PASS: Should pause.
 
+-- Running test case: DOMBreakpoint.NodeRemoved.Ancestor.Options.Condition.ConsoleCommandLineAPI
+Adding saved console value 'false'...
+Adding "node-removed:1,HTML,1,BODY,1,DIV,0,DIV,0,DIV" DOM Breakpoint...
+
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Adding saved console value 'true'...
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should pause.
+
+Triggering breakpoint...
+PASS: Should pause.
+
 -- Running test case: DOMBreakpoint.NodeRemoved.Ancestor.Options.Action.Log
 Adding "node-removed:1,HTML,1,BODY,1,DIV,0,DIV,0,DIV" DOM Breakpoint...
 
@@ -115,3 +136,35 @@
 PASS: Should execute breakpoint action.
 PASS: Should not pause.
 
+-- Running test case: DOMBreakpoint.NodeRemoved.Ancestor.Options.Actions.Evaluate.ConsoleCommandLineAPI
+Adding saved console value '1'...
+Adding "node-removed:1,HTML,1,BODY,1,DIV,0,DIV,0,DIV" DOM Breakpoint...
+
+Adding evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '2'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '3'...
+Editing evaluate action using saved console value...
+Enabling auto-continue...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+
+Adding saved console value '4'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+

Modified: trunk/LayoutTests/inspector/dom-debugger/dom-breakpoint-node-removed-direct-expected.txt (269022 => 269023)


--- trunk/LayoutTests/inspector/dom-debugger/dom-breakpoint-node-removed-direct-expected.txt	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/LayoutTests/inspector/dom-debugger/dom-breakpoint-node-removed-direct-expected.txt	2020-10-27 06:39:08 UTC (rev 269023)
@@ -58,6 +58,27 @@
 Triggering breakpoint...
 PASS: Should pause.
 
+-- Running test case: DOMBreakpoint.NodeRemoved.Direct.Options.Condition.ConsoleCommandLineAPI
+Adding saved console value 'false'...
+Adding "node-removed:1,HTML,1,BODY,1,DIV,0,DIV" DOM Breakpoint...
+
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Adding saved console value 'true'...
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should pause.
+
+Triggering breakpoint...
+PASS: Should pause.
+
 -- Running test case: DOMBreakpoint.NodeRemoved.Direct.Options.Action.Log
 Adding "node-removed:1,HTML,1,BODY,1,DIV,0,DIV" DOM Breakpoint...
 
@@ -114,3 +135,35 @@
 PASS: Should execute breakpoint action.
 PASS: Should not pause.
 
+-- Running test case: DOMBreakpoint.NodeRemoved.Direct.Options.Actions.Evaluate.ConsoleCommandLineAPI
+Adding saved console value '1'...
+Adding "node-removed:1,HTML,1,BODY,1,DIV,0,DIV" DOM Breakpoint...
+
+Adding evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '2'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '3'...
+Editing evaluate action using saved console value...
+Enabling auto-continue...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+
+Adding saved console value '4'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+

Modified: trunk/LayoutTests/inspector/dom-debugger/dom-breakpoint-subtree-modified-add-expected.txt (269022 => 269023)


--- trunk/LayoutTests/inspector/dom-debugger/dom-breakpoint-subtree-modified-add-expected.txt	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/LayoutTests/inspector/dom-debugger/dom-breakpoint-subtree-modified-add-expected.txt	2020-10-27 06:39:08 UTC (rev 269023)
@@ -59,6 +59,27 @@
 Triggering breakpoint...
 PASS: Should pause.
 
+-- Running test case: DOMBreakpoint.SubtreeModified.Add.Options.Condition.ConsoleCommandLineAPI
+Adding saved console value 'false'...
+Adding "subtree-modified:1,HTML,1,BODY,1,DIV,0,DIV" DOM Breakpoint...
+
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Adding saved console value 'true'...
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should pause.
+
+Triggering breakpoint...
+PASS: Should pause.
+
 -- Running test case: DOMBreakpoint.SubtreeModified.Add.Options.IgnoreCount
 Adding "subtree-modified:1,HTML,1,BODY,1,DIV,0,DIV" DOM Breakpoint...
 
@@ -132,3 +153,35 @@
 PASS: Should execute breakpoint action.
 PASS: Should not pause.
 
+-- Running test case: DOMBreakpoint.SubtreeModified.Add.Options.Actions.Evaluate.ConsoleCommandLineAPI
+Adding saved console value '1'...
+Adding "subtree-modified:1,HTML,1,BODY,1,DIV,0,DIV" DOM Breakpoint...
+
+Adding evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '2'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '3'...
+Editing evaluate action using saved console value...
+Enabling auto-continue...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+
+Adding saved console value '4'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+

Modified: trunk/LayoutTests/inspector/dom-debugger/dom-breakpoint-subtree-modified-remove-expected.txt (269022 => 269023)


--- trunk/LayoutTests/inspector/dom-debugger/dom-breakpoint-subtree-modified-remove-expected.txt	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/LayoutTests/inspector/dom-debugger/dom-breakpoint-subtree-modified-remove-expected.txt	2020-10-27 06:39:08 UTC (rev 269023)
@@ -59,6 +59,27 @@
 Triggering breakpoint...
 PASS: Should pause.
 
+-- Running test case: DOMBreakpoint.SubtreeModified.Remove.Options.Condition.ConsoleCommandLineAPI
+Adding saved console value 'false'...
+Adding "subtree-modified:1,HTML,1,BODY,1,DIV,0,DIV" DOM Breakpoint...
+
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Adding saved console value 'true'...
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should pause.
+
+Triggering breakpoint...
+PASS: Should pause.
+
 -- Running test case: DOMBreakpoint.SubtreeModified.Remove.Options.IgnoreCount
 Adding "subtree-modified:1,HTML,1,BODY,1,DIV,0,DIV" DOM Breakpoint...
 
@@ -132,3 +153,35 @@
 PASS: Should execute breakpoint action.
 PASS: Should not pause.
 
+-- Running test case: DOMBreakpoint.SubtreeModified.Remove.Options.Actions.Evaluate.ConsoleCommandLineAPI
+Adding saved console value '1'...
+Adding "subtree-modified:1,HTML,1,BODY,1,DIV,0,DIV" DOM Breakpoint...
+
+Adding evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '2'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '3'...
+Editing evaluate action using saved console value...
+Enabling auto-continue...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+
+Adding saved console value '4'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+

Modified: trunk/LayoutTests/inspector/dom-debugger/event-animation-frame-breakpoints-expected.txt (269022 => 269023)


--- trunk/LayoutTests/inspector/dom-debugger/event-animation-frame-breakpoints-expected.txt	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/LayoutTests/inspector/dom-debugger/event-animation-frame-breakpoints-expected.txt	2020-10-27 06:39:08 UTC (rev 269023)
@@ -64,6 +64,28 @@
 Triggering breakpoint...
 PASS: Should pause.
 
+-- Running test case: DOMDebugger.Event.AnimationFrame.Options.Condition.ConsoleCommandLineAPI
+Adding saved console value 'false'...
+Creating "animation-frame" Event Breakpoint...
+Adding "animation-frame" Event Breakpoint...
+
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Adding saved console value 'true'...
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should pause.
+
+Triggering breakpoint...
+PASS: Should pause.
+
 -- Running test case: DOMDebugger.Event.AnimationFrame.Options.IgnoreCount
 Creating "animation-frame" Event Breakpoint...
 Adding "animation-frame" Event Breakpoint...
@@ -140,3 +162,36 @@
 PASS: Should execute breakpoint action.
 PASS: Should not pause.
 
+-- Running test case: DOMDebugger.Event.AnimationFrame.Options.Actions.Evaluate.ConsoleCommandLineAPI
+Adding saved console value '1'...
+Creating "animation-frame" Event Breakpoint...
+Adding "animation-frame" Event Breakpoint...
+
+Adding evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '2'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '3'...
+Editing evaluate action using saved console value...
+Enabling auto-continue...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+
+Adding saved console value '4'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+

Modified: trunk/LayoutTests/inspector/dom-debugger/event-interval-breakpoints-expected.txt (269022 => 269023)


--- trunk/LayoutTests/inspector/dom-debugger/event-interval-breakpoints-expected.txt	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/LayoutTests/inspector/dom-debugger/event-interval-breakpoints-expected.txt	2020-10-27 06:39:08 UTC (rev 269023)
@@ -84,6 +84,28 @@
 Triggering breakpoint...
 PASS: Should pause.
 
+-- Running test case: DOMDebugger.Event.Interval.Options.Condition.ConsoleCommandLineAPI
+Adding saved console value 'false'...
+Creating "interval" Event Breakpoint...
+Adding "interval" Event Breakpoint...
+
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Adding saved console value 'true'...
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should pause.
+
+Triggering breakpoint...
+PASS: Should pause.
+
 -- Running test case: DOMDebugger.Event.Interval.Options.IgnoreCount
 Creating "interval" Event Breakpoint...
 Adding "interval" Event Breakpoint...
@@ -160,3 +182,36 @@
 PASS: Should execute breakpoint action.
 PASS: Should not pause.
 
+-- Running test case: DOMDebugger.Event.Interval.Options.Actions.Evaluate.ConsoleCommandLineAPI
+Adding saved console value '1'...
+Creating "interval" Event Breakpoint...
+Adding "interval" Event Breakpoint...
+
+Adding evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '2'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '3'...
+Editing evaluate action using saved console value...
+Enabling auto-continue...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+
+Adding saved console value '4'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+

Modified: trunk/LayoutTests/inspector/dom-debugger/event-listener-breakpoints-expected.txt (269022 => 269023)


--- trunk/LayoutTests/inspector/dom-debugger/event-listener-breakpoints-expected.txt	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/LayoutTests/inspector/dom-debugger/event-listener-breakpoints-expected.txt	2020-10-27 06:39:08 UTC (rev 269023)
@@ -146,6 +146,28 @@
 Triggering breakpoint...
 PASS: Should pause.
 
+-- Running test case: DOMDebugger.Event.Listener.Options.Condition.ConsoleCommandLineAPI
+Adding saved console value 'false'...
+Creating "click" Event Breakpoint...
+Adding "listener:click" Event Breakpoint...
+
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Adding saved console value 'true'...
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should pause.
+
+Triggering breakpoint...
+PASS: Should pause.
+
 -- Running test case: DOMDebugger.Event.Listener.Options.IgnoreCount
 Creating "click" Event Breakpoint...
 Adding "listener:click" Event Breakpoint...
@@ -222,3 +244,36 @@
 PASS: Should execute breakpoint action.
 PASS: Should not pause.
 
+-- Running test case: DOMDebugger.Event.Listener.Options.Actions.Evaluate.ConsoleCommandLineAPI
+Adding saved console value '1'...
+Creating "click" Event Breakpoint...
+Adding "listener:click" Event Breakpoint...
+
+Adding evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '2'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '3'...
+Editing evaluate action using saved console value...
+Enabling auto-continue...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+
+Adding saved console value '4'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+

Modified: trunk/LayoutTests/inspector/dom-debugger/event-timeout-breakpoints-expected.txt (269022 => 269023)


--- trunk/LayoutTests/inspector/dom-debugger/event-timeout-breakpoints-expected.txt	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/LayoutTests/inspector/dom-debugger/event-timeout-breakpoints-expected.txt	2020-10-27 06:39:08 UTC (rev 269023)
@@ -64,6 +64,28 @@
 Triggering breakpoint...
 PASS: Should pause.
 
+-- Running test case: DOMDebugger.Event.Timer.Options.Condition.ConsoleCommandLineAPI
+Adding saved console value 'false'...
+Creating "timeout" Event Breakpoint...
+Adding "timeout" Event Breakpoint...
+
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Triggering breakpoint...
+PASS: Should not pause.
+
+Adding saved console value 'true'...
+Setting condition to saved console value...
+
+Triggering breakpoint...
+PASS: Should pause.
+
+Triggering breakpoint...
+PASS: Should pause.
+
 -- Running test case: DOMDebugger.Event.Timer.Options.IgnoreCount
 Creating "timeout" Event Breakpoint...
 Adding "timeout" Event Breakpoint...
@@ -140,3 +162,36 @@
 PASS: Should execute breakpoint action.
 PASS: Should not pause.
 
+-- Running test case: DOMDebugger.Event.Timer.Options.Actions.Evaluate.ConsoleCommandLineAPI
+Adding saved console value '1'...
+Creating "timeout" Event Breakpoint...
+Adding "timeout" Event Breakpoint...
+
+Adding evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '2'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '3'...
+Editing evaluate action using saved console value...
+Enabling auto-continue...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+
+Adding saved console value '4'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+

Modified: trunk/LayoutTests/inspector/dom-debugger/url-breakpoints-all-requests-expected.txt (269022 => 269023)


--- trunk/LayoutTests/inspector/dom-debugger/url-breakpoints-all-requests-expected.txt	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/LayoutTests/inspector/dom-debugger/url-breakpoints-all-requests-expected.txt	2020-10-27 06:39:08 UTC (rev 269023)
@@ -44,6 +44,31 @@
 Request Fetch "resources/dataFetch.json"...
 PASS: Should pause.
 
+-- Running test case: URLBreakpoint.BreakOnAll.Fetch.Options.Condition.ConsoleCommandLineAPI
+Adding saved console value 'false'...
+Adding All Requests URL Breakpoint...
+
+Setting condition to saved console value...
+
+Triggering breakpoint...
+Request Fetch "resources/dataFetch.json"...
+PASS: Should not pause.
+
+Triggering breakpoint...
+Request Fetch "resources/dataFetch.json"...
+PASS: Should not pause.
+
+Adding saved console value 'true'...
+Setting condition to saved console value...
+
+Triggering breakpoint...
+Request Fetch "resources/dataFetch.json"...
+PASS: Should pause.
+
+Triggering breakpoint...
+Request Fetch "resources/dataFetch.json"...
+PASS: Should pause.
+
 -- Running test case: URLBreakpoint.BreakOnAll.Fetch.Options.IgnoreCount
 Adding All Requests URL Breakpoint...
 
@@ -129,6 +154,42 @@
 PASS: Should execute breakpoint action.
 PASS: Should not pause.
 
+-- Running test case: URLBreakpoint.BreakOnAll.Fetch.Options.Actions.Evaluate.ConsoleCommandLineAPI
+Adding saved console value '1'...
+Adding All Requests URL Breakpoint...
+
+Adding evaluate action using saved console value...
+
+Triggering breakpoint...
+Request Fetch "resources/dataFetch.json"...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '2'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+Request Fetch "resources/dataFetch.json"...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '3'...
+Editing evaluate action using saved console value...
+Enabling auto-continue...
+
+Triggering breakpoint...
+Request Fetch "resources/dataFetch.json"...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+
+Adding saved console value '4'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+Request Fetch "resources/dataFetch.json"...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+
 -- Running test case: URLBreakpoint.BreakOnAll.XHR
 Adding All Requests URL Breakpoint...
 Request XHR "resources/dataXHR.json"...
@@ -163,6 +224,31 @@
 Request XHR "resources/dataXHR.json"...
 PASS: Should pause.
 
+-- Running test case: URLBreakpoint.BreakOnAll.XHR.Options.Condition.ConsoleCommandLineAPI
+Adding saved console value 'false'...
+Adding All Requests URL Breakpoint...
+
+Setting condition to saved console value...
+
+Triggering breakpoint...
+Request XHR "resources/dataXHR.json"...
+PASS: Should not pause.
+
+Triggering breakpoint...
+Request XHR "resources/dataXHR.json"...
+PASS: Should not pause.
+
+Adding saved console value 'true'...
+Setting condition to saved console value...
+
+Triggering breakpoint...
+Request XHR "resources/dataXHR.json"...
+PASS: Should pause.
+
+Triggering breakpoint...
+Request XHR "resources/dataXHR.json"...
+PASS: Should pause.
+
 -- Running test case: URLBreakpoint.BreakOnAll.XHR.Options.IgnoreCount
 Adding All Requests URL Breakpoint...
 
@@ -248,3 +334,39 @@
 PASS: Should execute breakpoint action.
 PASS: Should not pause.
 
+-- Running test case: URLBreakpoint.BreakOnAll.XHR.Options.Actions.Evaluate.ConsoleCommandLineAPI
+Adding saved console value '1'...
+Adding All Requests URL Breakpoint...
+
+Adding evaluate action using saved console value...
+
+Triggering breakpoint...
+Request XHR "resources/dataXHR.json"...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '2'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+Request XHR "resources/dataXHR.json"...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '3'...
+Editing evaluate action using saved console value...
+Enabling auto-continue...
+
+Triggering breakpoint...
+Request XHR "resources/dataXHR.json"...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+
+Adding saved console value '4'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+Request XHR "resources/dataXHR.json"...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+

Modified: trunk/LayoutTests/inspector/dom-debugger/url-breakpoints-containing-expected.txt (269022 => 269023)


--- trunk/LayoutTests/inspector/dom-debugger/url-breakpoints-containing-expected.txt	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/LayoutTests/inspector/dom-debugger/url-breakpoints-containing-expected.txt	2020-10-27 06:39:08 UTC (rev 269023)
@@ -44,6 +44,31 @@
 Request Fetch "resources/dataFetch.json"...
 PASS: Should pause.
 
+-- Running test case: URLBreakpoint.BreakOnContainingText.Fetch.Options.Condition.ConsoleCommandLineAPI
+Adding saved console value 'false'...
+Adding "text:data" URL Breakpoint...
+
+Setting condition to saved console value...
+
+Triggering breakpoint...
+Request Fetch "resources/dataFetch.json"...
+PASS: Should not pause.
+
+Triggering breakpoint...
+Request Fetch "resources/dataFetch.json"...
+PASS: Should not pause.
+
+Adding saved console value 'true'...
+Setting condition to saved console value...
+
+Triggering breakpoint...
+Request Fetch "resources/dataFetch.json"...
+PASS: Should pause.
+
+Triggering breakpoint...
+Request Fetch "resources/dataFetch.json"...
+PASS: Should pause.
+
 -- Running test case: URLBreakpoint.BreakOnContainingText.Fetch.Options.IgnoreCount
 Adding "text:data" URL Breakpoint...
 
@@ -129,6 +154,42 @@
 PASS: Should execute breakpoint action.
 PASS: Should not pause.
 
+-- Running test case: URLBreakpoint.BreakOnContainingText.Fetch.Options.Actions.Evaluate.ConsoleCommandLineAPI
+Adding saved console value '1'...
+Adding "text:data" URL Breakpoint...
+
+Adding evaluate action using saved console value...
+
+Triggering breakpoint...
+Request Fetch "resources/dataFetch.json"...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '2'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+Request Fetch "resources/dataFetch.json"...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '3'...
+Editing evaluate action using saved console value...
+Enabling auto-continue...
+
+Triggering breakpoint...
+Request Fetch "resources/dataFetch.json"...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+
+Adding saved console value '4'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+Request Fetch "resources/dataFetch.json"...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+
 -- Running test case: URLBreakpoint.BreakOnContainingText.XHR
 Adding "text:data" URL Breakpoint...
 Request XHR "resources/dataXHR.json"...
@@ -163,6 +224,31 @@
 Request XHR "resources/dataXHR.json"...
 PASS: Should pause.
 
+-- Running test case: URLBreakpoint.BreakOnContainingText.XHR.Options.Condition.ConsoleCommandLineAPI
+Adding saved console value 'false'...
+Adding "text:data" URL Breakpoint...
+
+Setting condition to saved console value...
+
+Triggering breakpoint...
+Request XHR "resources/dataXHR.json"...
+PASS: Should not pause.
+
+Triggering breakpoint...
+Request XHR "resources/dataXHR.json"...
+PASS: Should not pause.
+
+Adding saved console value 'true'...
+Setting condition to saved console value...
+
+Triggering breakpoint...
+Request XHR "resources/dataXHR.json"...
+PASS: Should pause.
+
+Triggering breakpoint...
+Request XHR "resources/dataXHR.json"...
+PASS: Should pause.
+
 -- Running test case: URLBreakpoint.BreakOnContainingText.XHR.Options.IgnoreCount
 Adding "text:data" URL Breakpoint...
 
@@ -248,3 +334,39 @@
 PASS: Should execute breakpoint action.
 PASS: Should not pause.
 
+-- Running test case: URLBreakpoint.BreakOnContainingText.XHR.Options.Actions.Evaluate.ConsoleCommandLineAPI
+Adding saved console value '1'...
+Adding "text:data" URL Breakpoint...
+
+Adding evaluate action using saved console value...
+
+Triggering breakpoint...
+Request XHR "resources/dataXHR.json"...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '2'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+Request XHR "resources/dataXHR.json"...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '3'...
+Editing evaluate action using saved console value...
+Enabling auto-continue...
+
+Triggering breakpoint...
+Request XHR "resources/dataXHR.json"...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+
+Adding saved console value '4'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+Request XHR "resources/dataXHR.json"...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+

Modified: trunk/LayoutTests/inspector/dom-debugger/url-breakpoints-matching-expected.txt (269022 => 269023)


--- trunk/LayoutTests/inspector/dom-debugger/url-breakpoints-matching-expected.txt	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/LayoutTests/inspector/dom-debugger/url-breakpoints-matching-expected.txt	2020-10-27 06:39:08 UTC (rev 269023)
@@ -44,6 +44,31 @@
 Request Fetch "resources/dataFetch.json"...
 PASS: Should pause.
 
+-- Running test case: URLBreakpoint.BreakOnMatchingRegularExpression.Fetch.Options.Condition.ConsoleCommandLineAPI
+Adding saved console value 'false'...
+Adding "regex:data[A-Z]*.(json|txt|png)" URL Breakpoint...
+
+Setting condition to saved console value...
+
+Triggering breakpoint...
+Request Fetch "resources/dataFetch.json"...
+PASS: Should not pause.
+
+Triggering breakpoint...
+Request Fetch "resources/dataFetch.json"...
+PASS: Should not pause.
+
+Adding saved console value 'true'...
+Setting condition to saved console value...
+
+Triggering breakpoint...
+Request Fetch "resources/dataFetch.json"...
+PASS: Should pause.
+
+Triggering breakpoint...
+Request Fetch "resources/dataFetch.json"...
+PASS: Should pause.
+
 -- Running test case: URLBreakpoint.BreakOnMatchingRegularExpression.Fetch.Options.IgnoreCount
 Adding "regex:data[A-Z]*.(json|txt|png)" URL Breakpoint...
 
@@ -129,6 +154,42 @@
 PASS: Should execute breakpoint action.
 PASS: Should not pause.
 
+-- Running test case: URLBreakpoint.BreakOnMatchingRegularExpression.Fetch.Options.Actions.Evaluate.ConsoleCommandLineAPI
+Adding saved console value '1'...
+Adding "regex:data[A-Z]*.(json|txt|png)" URL Breakpoint...
+
+Adding evaluate action using saved console value...
+
+Triggering breakpoint...
+Request Fetch "resources/dataFetch.json"...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '2'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+Request Fetch "resources/dataFetch.json"...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '3'...
+Editing evaluate action using saved console value...
+Enabling auto-continue...
+
+Triggering breakpoint...
+Request Fetch "resources/dataFetch.json"...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+
+Adding saved console value '4'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+Request Fetch "resources/dataFetch.json"...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+
 -- Running test case: URLBreakpoint.BreakOnMatchingRegularExpression.XHR
 Adding "regex:data[A-Z]*.(json|txt|png)" URL Breakpoint...
 Request XHR "resources/dataXHR.json"...
@@ -163,6 +224,31 @@
 Request XHR "resources/dataXHR.json"...
 PASS: Should pause.
 
+-- Running test case: URLBreakpoint.BreakOnMatchingRegularExpression.XHR.Options.Condition.ConsoleCommandLineAPI
+Adding saved console value 'false'...
+Adding "regex:data[A-Z]*.(json|txt|png)" URL Breakpoint...
+
+Setting condition to saved console value...
+
+Triggering breakpoint...
+Request XHR "resources/dataXHR.json"...
+PASS: Should not pause.
+
+Triggering breakpoint...
+Request XHR "resources/dataXHR.json"...
+PASS: Should not pause.
+
+Adding saved console value 'true'...
+Setting condition to saved console value...
+
+Triggering breakpoint...
+Request XHR "resources/dataXHR.json"...
+PASS: Should pause.
+
+Triggering breakpoint...
+Request XHR "resources/dataXHR.json"...
+PASS: Should pause.
+
 -- Running test case: URLBreakpoint.BreakOnMatchingRegularExpression.XHR.Options.IgnoreCount
 Adding "regex:data[A-Z]*.(json|txt|png)" URL Breakpoint...
 
@@ -248,3 +334,39 @@
 PASS: Should execute breakpoint action.
 PASS: Should not pause.
 
+-- Running test case: URLBreakpoint.BreakOnMatchingRegularExpression.XHR.Options.Actions.Evaluate.ConsoleCommandLineAPI
+Adding saved console value '1'...
+Adding "regex:data[A-Z]*.(json|txt|png)" URL Breakpoint...
+
+Adding evaluate action using saved console value...
+
+Triggering breakpoint...
+Request XHR "resources/dataXHR.json"...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '2'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+Request XHR "resources/dataXHR.json"...
+PASS: Should execute breakpoint action.
+PASS: Should pause.
+
+Adding saved console value '3'...
+Editing evaluate action using saved console value...
+Enabling auto-continue...
+
+Triggering breakpoint...
+Request XHR "resources/dataXHR.json"...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+
+Adding saved console value '4'...
+Editing evaluate action using saved console value...
+
+Triggering breakpoint...
+Request XHR "resources/dataXHR.json"...
+PASS: Should execute breakpoint action.
+PASS: Should not pause.
+

Modified: trunk/Source/_javascript_Core/ChangeLog (269022 => 269023)


--- trunk/Source/_javascript_Core/ChangeLog	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-10-27 06:39:08 UTC (rev 269023)
@@ -1,3 +1,36 @@
+2020-10-26  Devin Rousso  <[email protected]>
+
+        Web Inspector: console command line API should be exposed to breakpoint conditions/actions
+        https://bugs.webkit.org/show_bug.cgi?id=218141
+        <rdar://problem/70636727>
+
+        Reviewed by Brian Burg.
+
+        * debugger/Debugger.h:
+        (JSC::Debugger::Client::scopeExtensionObject): Added.
+        * debugger/Debugger.cpp:
+        (JSC::Debugger::setClient): Added.
+        (JSC::Debugger::evaluateBreakpointCondition):
+        (JSC::Debugger::evaluateBreakpointActions):
+        Introduce an optional `Debugger::Client` virtual class that can be used to adjust behavior
+        in various situations. Right now it is used when evaluating breakpoint conditions/actions
+        to get a scope extension object.
+
+        * inspector/agents/InspectorDebuggerAgent.h:
+        * inspector/agents/InspectorDebuggerAgent.cpp:
+        (Inspector::InspectorDebuggerAgent::internalEnable):
+        (Inspector::InspectorDebuggerAgent::internalDisable):
+        (Inspector::InspectorDebuggerAgent::scopeExtensionObject): Added.
+        Implement `Debugger::Client` and provide a newly created `CommandLineAPI` instance.
+
+        * inspector/InjectedScript.h:
+        * inspector/InjectedScript.cpp:
+        (Inspector::InjectedScript::createCommandLineAPIObject const): Added.
+        * inspector/InjectedScriptSource.js:
+        (let.InjectedScript.prototype.createCommandLineAPIObject): Added.
+        (let.InjectedScript.prototype._evaluateOn):
+        Expose a way for the C++ to create `CommandLineAPI` instances.
+
 2020-10-15  Tadeu Zagallo  <[email protected]>
 
         Sign MacroAssembler::jumpsToLink

Modified: trunk/Source/_javascript_Core/debugger/Debugger.cpp (269022 => 269023)


--- trunk/Source/_javascript_Core/debugger/Debugger.cpp	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/Source/_javascript_Core/debugger/Debugger.cpp	2020-10-27 06:39:08 UTC (rev 269023)
@@ -237,6 +237,12 @@
         codeBlock->setSteppingMode(CodeBlock::SteppingModeEnabled);
 }
 
+void Debugger::setClient(Client* client)
+{
+    ASSERT(!!m_client != !!client);
+    m_client = client;
+}
+
 void Debugger::addObserver(Observer& observer)
 {
     bool wasEmpty = m_observers.isEmpty();
@@ -609,7 +615,7 @@
 
     NakedPtr<Exception> exception;
     DebuggerCallFrame& debuggerCallFrame = currentDebuggerCallFrame();
-    JSObject* scopeExtensionObject = nullptr;
+    JSObject* scopeExtensionObject = m_client ? m_client->scopeExtensionObject(*this, globalObject, debuggerCallFrame) : nullptr;
     JSValue result = debuggerCallFrame.evaluateWithScopeExtension(condition, scopeExtensionObject, exception);
 
     // We can lose the debugger while executing _javascript_.
@@ -643,7 +649,7 @@
 
         case Breakpoint::Action::Type::Evaluate: {
             NakedPtr<Exception> exception;
-            JSObject* scopeExtensionObject = nullptr;
+            JSObject* scopeExtensionObject = m_client ? m_client->scopeExtensionObject(*this, globalObject, debuggerCallFrame) : nullptr;
             debuggerCallFrame.evaluateWithScopeExtension(action.data, scopeExtensionObject, exception);
             if (exception)
                 reportException(debuggerCallFrame.globalObject(), exception);
@@ -658,7 +664,7 @@
 
         case Breakpoint::Action::Type::Probe: {
             NakedPtr<Exception> exception;
-            JSObject* scopeExtensionObject = nullptr;
+            JSObject* scopeExtensionObject = m_client ? m_client->scopeExtensionObject(*this, globalObject, debuggerCallFrame) : nullptr;
             JSValue result = debuggerCallFrame.evaluateWithScopeExtension(action.data, scopeExtensionObject, exception);
             JSC::JSGlobalObject* debuggerGlobalObject = debuggerCallFrame.globalObject();
             if (exception)

Modified: trunk/Source/_javascript_Core/debugger/Debugger.h (269022 => 269023)


--- trunk/Source/_javascript_Core/debugger/Debugger.h	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/Source/_javascript_Core/debugger/Debugger.h	2020-10-27 06:39:08 UTC (rev 269023)
@@ -140,6 +140,15 @@
 
     void registerCodeBlock(CodeBlock*);
 
+    class Client {
+    public:
+        virtual ~Client() = default;
+
+        virtual JSObject* scopeExtensionObject(Debugger&, JSGlobalObject*, DebuggerCallFrame&) { return nullptr; }
+    };
+
+    void setClient(Client*);
+
     // FIXME: <https://webkit.org/b/162773> Web Inspector: Simplify Debugger::Script to use SourceProvider
     struct Script {
         String url;
@@ -325,6 +334,7 @@
     HashSet<Observer*> m_observers;
     bool m_dispatchingFunctionToObservers { false };
 
+    Client* m_client { nullptr };
     ProfilingClient* m_profilingClient { nullptr };
 
     bool m_doneProcessingDebuggerEvents { true };

Modified: trunk/Source/_javascript_Core/inspector/InjectedScript.cpp (269022 => 269023)


--- trunk/Source/_javascript_Core/inspector/InjectedScript.cpp	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/Source/_javascript_Core/inspector/InjectedScript.cpp	2020-10-27 06:39:08 UTC (rev 269023)
@@ -442,6 +442,17 @@
     ASSERT_UNUSED(callResult, callResult);
 }
 
+JSC::JSObject* InjectedScript::createCommandLineAPIObject(JSC::JSValue callFrame) const
+{
+    ASSERT(!hasNoValue());
+    Deprecated::ScriptFunctionCall function(injectedScriptObject(), "createCommandLineAPIObject"_s, inspectorEnvironment()->functionCallHandler());
+    function.appendArgument(callFrame);
+
+    auto callResult = callFunctionWithEvalEnabled(function);
+    ASSERT(callResult);
+    return callResult ? asObject(callResult.value()) : nullptr;
+}
+
 JSC::JSValue InjectedScript::arrayFromVector(Vector<JSC::JSValue>&& vector)
 {
     JSC::JSGlobalObject* globalObject = this->globalObject();

Modified: trunk/Source/_javascript_Core/inspector/InjectedScript.h (269022 => 269023)


--- trunk/Source/_javascript_Core/inspector/InjectedScript.h	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/Source/_javascript_Core/inspector/InjectedScript.h	2020-10-27 06:39:08 UTC (rev 269023)
@@ -91,6 +91,8 @@
     void releaseObject(const String& objectId);
     void releaseObjectGroup(const String& objectGroup);
 
+    JSC::JSObject* createCommandLineAPIObject(JSC::JSValue callFrame = { }) const;
+
 private:
     JSC::JSValue arrayFromVector(Vector<JSC::JSValue>&&);
 

Modified: trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js (269022 => 269023)


--- trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js	2020-10-27 06:39:08 UTC (rev 269023)
@@ -409,6 +409,11 @@
         delete this._objectGroups[objectGroupName];
     }
 
+    createCommandLineAPIObject(callFrame)
+    {
+        return new CommandLineAPI(callFrame || null);
+    }
+
     // CommandLineAPI
 
     inspectObject(object)
@@ -565,7 +570,7 @@
     {
         let commandLineAPI = null;
         if (includeCommandLineAPI)
-            commandLineAPI = new CommandLineAPI(isEvalOnCallFrame ? object : null);
+            commandLineAPI = this.createCommandLineAPIObject(isEvalOnCallFrame ? object : null);
         return evalFunction.call(object, _expression_, commandLineAPI);
     }
 

Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.cpp (269022 => 269023)


--- trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.cpp	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.cpp	2020-10-27 06:39:08 UTC (rev 269023)
@@ -240,6 +240,7 @@
 {
     m_enabled = true;
 
+    m_debugger.setClient(this);
     m_debugger.addObserver(*this);
 
     for (auto* listener : copyToVector(m_listeners))
@@ -261,6 +262,7 @@
     for (auto* listener : copyToVector(m_listeners))
         listener->debuggerWasDisabled();
 
+    m_debugger.setClient(nullptr);
     m_debugger.removeObserver(*this, isBeingDestroyed);
 
     clearInspectorBreakpointState();
@@ -1101,6 +1103,18 @@
     return { };
 }
 
+JSC::JSObject* InspectorDebuggerAgent::scopeExtensionObject(JSC::Debugger& debugger, JSC::JSGlobalObject* globalObject, JSC::DebuggerCallFrame& debuggerCallFrame)
+{
+    auto injectedScript = m_injectedScriptManager.injectedScriptFor(globalObject);
+    ASSERT(!injectedScript.hasNoValue());
+    if (injectedScript.hasNoValue())
+        return JSC::Debugger::Client::scopeExtensionObject(debugger, globalObject, debuggerCallFrame);
+
+    auto* debuggerGlobalObject = debuggerCallFrame.scope()->globalObject();
+    auto callFrame = toJS(debuggerGlobalObject, debuggerGlobalObject, _javascript_CallFrame::create(debuggerCallFrame).ptr());
+    return injectedScript.createCommandLineAPIObject(callFrame);
+}
+
 void InspectorDebuggerAgent::didParseSource(JSC::SourceID sourceID, const JSC::Debugger::Script& script)
 {
     String scriptIDStr = String::number(sourceID);

Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.h (269022 => 269023)


--- trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.h	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.h	2020-10-27 06:39:08 UTC (rev 269023)
@@ -49,7 +49,11 @@
 class InjectedScript;
 class InjectedScriptManager;
 
-class JS_EXPORT_PRIVATE InspectorDebuggerAgent : public InspectorAgentBase, public DebuggerBackendDispatcherHandler, public JSC::Debugger::Observer {
+class JS_EXPORT_PRIVATE InspectorDebuggerAgent
+    : public InspectorAgentBase
+    , public DebuggerBackendDispatcherHandler
+    , public JSC::Debugger::Client
+    , public JSC::Debugger::Observer {
     WTF_MAKE_NONCOPYABLE(InspectorDebuggerAgent);
     WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -91,6 +95,9 @@
     Protocol::ErrorStringOr<std::tuple<Ref<Protocol::Runtime::RemoteObject>, Optional<bool> /* wasThrown */, Optional<int> /* savedResultIndex */>> evaluateOnCallFrame(const Protocol::Debugger::CallFrameId&, const String& _expression_, const String& objectGroup, Optional<bool>&& includeCommandLineAPI, Optional<bool>&& doNotPauseOnExceptionsAndMuteConsole, Optional<bool>&& returnByValue, Optional<bool>&& generatePreview, Optional<bool>&& saveResult, Optional<bool>&& emulateUserGesture) override;
     Protocol::ErrorStringOr<void> setShouldBlackboxURL(const String& url, bool shouldBlackbox, Optional<bool>&& caseSensitive, Optional<bool>&& isRegex) final;
 
+    // JSC::Debugger::Client
+    JSC::JSObject* scopeExtensionObject(JSC::Debugger&, JSC::JSGlobalObject*, JSC::DebuggerCallFrame&) final;
+
     // JSC::Debugger::Observer
     void didParseSource(JSC::SourceID, const JSC::Debugger::Script&) final;
     void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage) final;

Modified: trunk/Source/WebInspectorUI/ChangeLog (269022 => 269023)


--- trunk/Source/WebInspectorUI/ChangeLog	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/Source/WebInspectorUI/ChangeLog	2020-10-27 06:39:08 UTC (rev 269023)
@@ -1,3 +1,46 @@
+2020-10-26  Devin Rousso  <[email protected]>
+
+        Web Inspector: console command line API should be exposed to breakpoint conditions/actions
+        https://bugs.webkit.org/show_bug.cgi?id=218141
+        <rdar://problem/70636727>
+
+        Reviewed by Brian Burg.
+
+        * UserInterface/Controllers/CodeMirrorCompletionController.js:
+        (WI.CodeMirrorCompletionController):
+        (WI.CodeMirrorCompletionController.prototype.get mode): Added.
+        (WI.CodeMirrorCompletionController.prototype.get delegate): Deleted.
+        * UserInterface/Controllers/_javascript_RuntimeCompletionProvider.js:
+        (WI._javascript_RuntimeCompletionProvider.prototype.completionControllerCompletionsNeeded):
+        (WI._javascript_RuntimeCompletionProvider.prototype.completionControllerCompletionsNeeded.shouldExposeEvent): Added.
+        (WI._javascript_RuntimeCompletionProvider.prototype.completionControllerCompletionsNeeded.shouldExposeException): Added.
+        (WI._javascript_RuntimeCompletionProvider.prototype.completionControllerCompletionsNeeded.receivedPropertyNames):
+        Introduce a `Mode` enum that can be fetched by completion providers to adjust functionality.
+
+        * UserInterface/Views/BreakpointPopover.js:
+        (WI.BreakpointPopover.appendContextMenuItems):
+        (WI.BreakpointPopover.prototype.show):
+        (WI.BreakpointPopover.prototype.breakpointActionViewCodeMirrorCompletionControllerMode): Added.
+        (WI.BreakpointPopover.prototype.get codeMirrorCompletionControllerMode): Added.
+        * UserInterface/Views/EventBreakpointPopover.js:
+        (WI.EventBreakpointPopover.prototype.get codeMirrorCompletionControllerMode): Added.
+        * UserInterface/Views/BreakpointActionView.js:
+        (WI.BreakpointActionView.prototype._updateBody):
+        Use a `Mode` that always exposes `$event`/`$exception` depending on the breakpoint type.
+
+        * UserInterface/Views/ConsolePrompt.js:
+        (WI.ConsolePrompt):
+        Use a `Mode` that only exposes `$event`/`$exception` when paused for an event/exeption.
+
+        * UserInterface/Views/ScopeChainDetailsSidebarPanel.js:
+        (WI.ScopeChainDetailsSidebarPanel.prototype._addWatchExpressionButtonClicked):
+        Use a `Mode` that always exposes `$event`/`$exception` since watch expressions track values
+        over time, and may therefore not always have an `$event`/`$exception` set.
+
+        * UserInterface/Views/TextEditor.js:
+        (WI.TextEditor):
+        Use the default `Mode` that never exposes `$event`/`$exception`.
+
 2020-10-26  Patrick Angle  <[email protected]>
 
         Web Inspector: Uncaught Exception: TypeError: undefined is not an object (evaluating 'this._boxModelDiagramRow.minimumWidth')

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js (269022 => 269023)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js	2020-10-27 06:39:08 UTC (rev 269023)
@@ -25,12 +25,14 @@
 
 WI.CodeMirrorCompletionController = class CodeMirrorCompletionController extends WI.Object
 {
-    constructor(codeMirror, delegate, stopCharactersRegex)
+    constructor(mode, codeMirror, delegate, stopCharactersRegex)
     {
+        console.assert(Object.values(WI.CodeMirrorCompletionController.Mode).includes(mode), mode);
+        console.assert(codeMirror instanceof CodeMirror, codeMirror);
+
         super();
 
-        console.assert(codeMirror);
-
+        this._mode = mode;
         this._codeMirror = codeMirror;
         this._stopCharactersRegex = stopCharactersRegex || null;
         this._delegate = delegate || null;
@@ -74,10 +76,7 @@
 
     // Public
 
-    get delegate()
-    {
-        return this._delegate;
-    }
+    get mode() { return this._mode; }
 
     addExtendedCompletionProvider(modeName, provider)
     {
@@ -898,6 +897,14 @@
     }
 };
 
+WI.CodeMirrorCompletionController.Mode = {
+    Basic: "basic",
+    EventBreakpoint: "event-breakpoint",
+    ExceptionBreakpoint: "exception-breakpoint",
+    FullConsoleCommandLineAPI: "full-console-command-line-api",
+    PausedConsoleCommandLineAPI: "paused-console-command-line-api",
+};
+
 WI.CodeMirrorCompletionController.UpdatePromise = {
     Canceled: "code-mirror-completion-controller-canceled",
     CompletionsFound: "code-mirror-completion-controller-completions-found",

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/_javascript_RuntimeCompletionProvider.js (269022 => 269023)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/_javascript_RuntimeCompletionProvider.js	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/_javascript_RuntimeCompletionProvider.js	2020-10-27 06:39:08 UTC (rev 269023)
@@ -140,11 +140,12 @@
         // and functions once instead of repetitively. Sure, there can be difference each time the base is evaluated,
         // but this optimization gives us more of a win. We clear the cache after 30 seconds or when stepping in the
         // debugger to make sure we don't use stale properties in most cases.
-        if (this._lastBase === base && this._lastPropertyNames) {
+        if (this._lastMode === completionController.mode && this._lastBase === base && this._lastPropertyNames) {
             receivedPropertyNames.call(this, this._lastPropertyNames);
             return;
         }
 
+        this._lastMode = completionController.mode;
         this._lastBase = base;
         this._lastPropertyNames = null;
 
@@ -278,20 +279,40 @@
                     propertyNames.push(savedResultAlias + "_");
 
                 let target = WI.runtimeManager.activeExecutionContext.target;
+                let targetData = WI.debuggerManager.paused ? WI.debuggerManager.dataForTarget(target) : {};
 
-                if (WI.debuggerManager.paused) {
-                    let targetData = WI.debuggerManager.dataForTarget(target);
-                    if (targetData.pauseReason === WI.DebuggerManager.PauseReason.Listener || targetData.pauseReason === WI.DebuggerManager.PauseReason.EventListener) {
-                        propertyNames.push("$event");
-                        if (savedResultAlias)
-                            propertyNames.push(savedResultAlias + "event");
-                    } else if (targetData.pauseReason === WI.DebuggerManager.PauseReason.Exception) {
-                        propertyNames.push("$exception");
-                        if (savedResultAlias)
-                            propertyNames.push(savedResultAlias + "exception");
+                function shouldExposeEvent() {
+                    switch (completionController.mode) {
+                    case WI.CodeMirrorCompletionController.Mode.FullConsoleCommandLineAPI:
+                    case WI.CodeMirrorCompletionController.Mode.EventBreakpoint:
+                        return true;
+                    case WI.CodeMirrorCompletionController.Mode.PausedConsoleCommandLineAPI:
+                        return targetData.pauseReason === WI.DebuggerManager.PauseReason.Listener || targetData.pauseReason === WI.DebuggerManager.PauseReason.EventListener;
                     }
+                    return false;
                 }
+                if (shouldExposeEvent()) {
+                    propertyNames.push("$event");
+                    if (savedResultAlias)
+                        propertyNames.push(savedResultAlias + "event");
+                }
 
+                function shouldExposeException() {
+                    switch (completionController.mode) {
+                    case WI.CodeMirrorCompletionController.Mode.FullConsoleCommandLineAPI:
+                    case WI.CodeMirrorCompletionController.Mode.ExceptionBreakpoint:
+                        return true;
+                    case WI.CodeMirrorCompletionController.Mode.PausedConsoleCommandLineAPI:
+                        return targetData.pauseReason === WI.DebuggerManager.PauseReason.Exception;
+                    }
+                    return false;
+                }
+                if (shouldExposeException()) {
+                    propertyNames.push("$exception");
+                    if (savedResultAlias)
+                        propertyNames.push(savedResultAlias + "exception");
+                }
+
                 switch (target.type) {
                 case WI.TargetType.Page:
                     propertyNames.push("$");

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointActionView.js (269022 => 269023)


--- trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointActionView.js	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointActionView.js	2020-10-27 06:39:08 UTC (rev 269023)
@@ -164,7 +164,7 @@
 
             this._codeMirrorViewport = {from: null, to: null};
 
-            var completionController = new WI.CodeMirrorCompletionController(this._codeMirror);
+            var completionController = new WI.CodeMirrorCompletionController(this._delegate.breakpointActionViewCodeMirrorCompletionControllerMode(this, this._codeMirror), this._codeMirror);
             completionController.addExtendedCompletionProvider("_javascript_", WI._javascript_RuntimeCompletionProvider);
 
             // CodeMirror needs a refresh after the popover displays to layout otherwise it doesn't appear.

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointPopover.js (269022 => 269023)


--- trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointPopover.js	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointPopover.js	2020-10-27 06:39:08 UTC (rev 269023)
@@ -55,7 +55,13 @@
         if (breakpoint.editable) {
             contextMenu.appendItem(WI.UIString("Edit Breakpoint\u2026"), () => {
                 const delegate = null;
-                let popover = new WI.BreakpointPopover(delegate, breakpoint);
+                let popover;
+                if (breakpoint instanceof WI.EventBreakpoint)
+                    popover = new WI.EventBreakpointPopover(delegate, breakpoint);
+                else if (breakpoint instanceof WI.URLBreakpoint)
+                    popover = new WI.URLBreakpointPopover(delegate, breakpoint);
+                else
+                    popover = new WI.BreakpointPopover(delegate, breakpoint);
                 popover.show(targetElement);
             });
         }
@@ -164,7 +170,7 @@
             if (this._breakpoint)
                 this._conditionCodeMirror.on("change", this._handleConditionCodeMirrorChange.bind(this));
 
-            let completionController = new WI.CodeMirrorCompletionController(this._conditionCodeMirror, this);
+            let completionController = new WI.CodeMirrorCompletionController(this.codeMirrorCompletionControllerMode, this._conditionCodeMirror, this);
             completionController.addExtendedCompletionProvider("_javascript_", WI._javascript_RuntimeCompletionProvider);
 
             let ignoreCountLabelElement = document.createElement("label");
@@ -273,6 +279,11 @@
 
     // BreakpointActionView delegate
 
+    breakpointActionViewCodeMirrorCompletionControllerMode(breakpointActionView, codeMirror)
+    {
+        return this.codeMirrorCompletionControllerMode;
+    }
+
     breakpointActionViewAppendActionView(breakpointActionView, newBreakpointAction)
     {
         this._breakpoint?.addAction(newBreakpointAction, {precedingAction: breakpointActionView.action});
@@ -309,6 +320,16 @@
 
     // Protected
 
+    get codeMirrorCompletionControllerMode()
+    {
+        // Overridden by subclasses if needed.
+
+        if (this._breakpoint === WI.debuggerManager.allExceptionsBreakpoint || this._breakpoint === WI.debuggerManager.uncaughtExceptionsBreakpoint)
+            return WI.CodeMirrorCompletionController.Mode.ExceptionBreakpoint;
+
+        return WI.CodeMirrorCompletionController.Mode.Basic;
+    }
+
     populateContent()
     {
         throw WI.NotImplementedError.subclassMustOverride();

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ConsolePrompt.js (269022 => 269023)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ConsolePrompt.js	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ConsolePrompt.js	2020-10-27 06:39:08 UTC (rev 269023)
@@ -56,7 +56,7 @@
 
         this._codeMirror.addKeyMap(keyMap);
 
-        this._completionController = new WI.CodeMirrorCompletionController(this._codeMirror, this);
+        this._completionController = new WI.CodeMirrorCompletionController(WI.CodeMirrorCompletionController.Mode.PausedConsoleCommandLineAPI, this._codeMirror, this);
         this._completionController.addExtendedCompletionProvider("_javascript_", WI._javascript_RuntimeCompletionProvider);
 
         let textarea = this._codeMirror.getInputField();

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/EventBreakpointPopover.js (269022 => 269023)


--- trunk/Source/WebInspectorUI/UserInterface/Views/EventBreakpointPopover.js	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/EventBreakpointPopover.js	2020-10-27 06:39:08 UTC (rev 269023)
@@ -62,6 +62,11 @@
 
     // Protected
 
+    get codeMirrorCompletionControllerMode()
+    {
+        return WI.CodeMirrorCompletionController.Mode.EventBreakpoint;
+    }
+
     populateContent()
     {
         let eventLabelElement = document.createElement("label");

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ScopeChainDetailsSidebarPanel.js (269022 => 269023)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ScopeChainDetailsSidebarPanel.js	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ScopeChainDetailsSidebarPanel.js	2020-10-27 06:39:08 UTC (rev 269023)
@@ -379,7 +379,7 @@
             "Enter": () => { this._popoverCommitted = true; popover.dismiss(); },
         });
 
-        let completionController = new WI.CodeMirrorCompletionController(this._codeMirror);
+        let completionController = new WI.CodeMirrorCompletionController(WI.CodeMirrorCompletionController.Mode.FullConsoleCommandLineAPI, this._codeMirror);
         completionController.addExtendedCompletionProvider("_javascript_", WI._javascript_RuntimeCompletionProvider);
 
         // Resize the popover as best we can when the CodeMirror editor changes size.

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js (269022 => 269023)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js	2020-10-27 04:39:55 UTC (rev 269022)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js	2020-10-27 06:39:08 UTC (rev 269023)
@@ -45,7 +45,7 @@
         this._codeMirror.on("gutterContextMenu", this._gutterContextMenu.bind(this));
         this._codeMirror.getScrollerElement().addEventListener("click", this._openClickedLinks.bind(this), true);
 
-        this._completionController = new WI.CodeMirrorCompletionController(this._codeMirror, this);
+        this._completionController = new WI.CodeMirrorCompletionController(WI.CodeMirrorCompletionController.Mode.Basic, this._codeMirror, this);
         this._tokenTrackingController = new WI.CodeMirrorTokenTrackingController(this._codeMirror, this);
 
         this._initialStringNotSet = true;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to