Web Inspector: Breakpoint Log action should support template literals
authormattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Dec 2016 11:11:59 +0000 (11:11 +0000)
committermattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Dec 2016 11:11:59 +0000 (11:11 +0000)
commitc7307c05e4c25e84e3aac91b9edf94a81254cd3d
treeadbdf7b191fca608d4c252988e2fd562b24cfae7
parent2946c794e857da8663300a340807cb9d8acebf52
Web Inspector: Breakpoint Log action should support template literals
https://bugs.webkit.org/show_bug.cgi?id=165116
<rdar://problem/29464765>

Reviewed by Joseph Pecoraro.

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js:
New string "${expr} = expression" for breakpoint popover.

* UserInterface/Controllers/BreakpointLogMessageLexer.js: Added.
To support template literal placeholders in message text, it is necessary
to distinguish plain text parts of the message from placeholders, since
plain text must be escaped.

(WebInspector.BreakpointLogMessageLexer):
(WebInspector.BreakpointLogMessageLexer.prototype.tokenize):
(WebInspector.BreakpointLogMessageLexer.prototype.reset):
(WebInspector.BreakpointLogMessageLexer.prototype._finishPlainText):
(WebInspector.BreakpointLogMessageLexer.prototype._finishExpression):
(WebInspector.BreakpointLogMessageLexer.prototype._appendToken):
(WebInspector.BreakpointLogMessageLexer.prototype._consume):
(WebInspector.BreakpointLogMessageLexer.prototype._peek):
(WebInspector.BreakpointLogMessageLexer.prototype._expression):
(WebInspector.BreakpointLogMessageLexer.prototype._plainText):
(WebInspector.BreakpointLogMessageLexer.prototype._possiblePlaceholder):
(WebInspector.BreakpointLogMessageLexer.prototype._regExpOrStringLiteral):

* UserInterface/Controllers/DebuggerManager.js:
(WebInspector.DebuggerManager.prototype._debuggerBreakpointOptions):
Build breakpoint "options" object for DebuggerAgent. If a Log action
contains template literal placeholders it is changed to an Evaluate
action, which calls console.log with a template literal.

(WebInspector.DebuggerManager.prototype._setBreakpoint):
Use converted breakpoint options.

* UserInterface/Main.html:
* UserInterface/Test.html:
New file.

* UserInterface/Views/BreakpointActionView.css:
(.breakpoint-action-block-body > .description):
Styles for breakpoint Log action hint text.

* UserInterface/Views/BreakpointActionView.js:
(WebInspector.BreakpointActionView.prototype._updateBody):
Add Log action hint text element.

LayoutTests:

* inspector/debugger/breakpoint-action-log-expected.txt: Added.
* inspector/debugger/breakpoint-action-log.html: Added.
Check that breakpoint log actions support template literal placeholders.

* inspector/unit-tests/breakpoint-log-message-lexer-expected.txt: Added.
* inspector/unit-tests/breakpoint-log-message-lexer.html: Added.
Check that the lexer correctly scans breakpoint log action text.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209706 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/debugger/breakpoint-action-log-expected.txt [new file with mode: 0644]
LayoutTests/inspector/debugger/breakpoint-action-log.html [new file with mode: 0644]
LayoutTests/inspector/unit-tests/breakpoint-log-message-lexer-expected.txt [new file with mode: 0644]
LayoutTests/inspector/unit-tests/breakpoint-log-message-lexer.html [new file with mode: 0644]
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
Source/WebInspectorUI/UserInterface/Controllers/BreakpointLogMessageLexer.js [new file with mode: 0644]
Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js
Source/WebInspectorUI/UserInterface/Main.html
Source/WebInspectorUI/UserInterface/Test.html
Source/WebInspectorUI/UserInterface/Views/BreakpointActionView.css
Source/WebInspectorUI/UserInterface/Views/BreakpointActionView.js