Closed
Bug 1342526
Opened 8 years ago
Closed 8 years ago
string-valued evaluation results should be quoted
Categories
(DevTools :: Console, defect)
DevTools
Console
Tracking
(firefox55 fixed)
RESOLVED
FIXED
Firefox 55
Tracking | Status | |
---|---|---|
firefox55 | --- | fixed |
People
(Reporter: tromey, Assigned: tromey)
References
Details
Attachments
(1 file)
STR:
Open the console.
Evaluate a string-valued expression, like:
>> "x"
Right now the console prints:
<- x
But I think the result in this case should be in JS syntax, so:
<- "x"
I think this amounts to just setting the proper flag on the rep.
Assignee | ||
Comment 1•8 years ago
|
||
We discussed this a bit in light of bug 1302873.
I think the answer here is that console.log should not quote its output,
but evaluation should. That is, console.log is like "print something for a human"
where's evaluation should print things in JS syntax.
Comment hidden (mozreview-request) |
Comment 3•8 years ago
|
||
mozreview-review |
Comment on attachment 8847023 [details]
Bug 1342526 - quote string expression results in console;
https://reviewboard.mozilla.org/r/120058/#review121884
Looks good, thanks Tom.
Can you check that mocha tests are not impacted ?
You can run them by going to devtools/client/webconsole , and then run `npm test`
::: devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_string.js:16
(Diff revision 1)
> + let hud = yield openNewTabAndConsole(TEST_URI);
> +
> + let receievedMessages = waitForMessages({
> + hud,
> + messages: [{
> + // Test that the output does not include quotes.
we could specify that this is for console.logged messages
Attachment #8847023 -
Flags: review?(chevobbe.nicolas) → review+
Assignee | ||
Comment 4•8 years ago
|
||
(In reply to Nicolas Chevobbe [:nchevobbe] from comment #3)
> Can you check that mocha tests are not impacted ?
> You can run them by going to devtools/client/webconsole , and then run `npm
> test`
This seems fine.
Is there a bug for running mocha tests in try?
> > + let receievedMessages = waitForMessages({
> > + hud,
> > + messages: [{
> > + // Test that the output does not include quotes.
>
> we could specify that this is for console.logged messages
I couldn't see a way to do this. waitForMessages says:
* - messages: Array[Object]. An array of messages to match.
Current supported options:
* - text: Exact text match in .message-body
so I don't think there's an existing way?
Assignee: nobody → ttromey
Flags: needinfo?(chevobbe.nicolas)
Comment 5•8 years ago
|
||
> Is there a bug for running mocha tests in try?
here it is https://bugzilla.mozilla.org/show_bug.cgi?id=1312823
> I couldn't see a way to do this.
Oh sorry, I think I wasn't clear enough. I meant adding an info to say we're checking console.log message, like we do a couple line below for evaluation (`info("evaluating a string constant");`, so maybe `info("logging a string");`). At first I was a bit confused by this, adding the info (or a plain comment) would help seeing that this is a two-part test (console.log and evaluation)
Flags: needinfo?(chevobbe.nicolas)
Comment hidden (mozreview-request) |
Comment 7•8 years ago
|
||
mozreview-review |
Comment on attachment 8847023 [details]
Bug 1342526 - quote string expression results in console;
https://reviewboard.mozilla.org/r/120058/#review122896
Still good, thanks for adding the log :)
Comment 8•8 years ago
|
||
mozreview-review |
Comment on attachment 8847023 [details]
Bug 1342526 - quote string expression results in console;
https://reviewboard.mozilla.org/r/120056/#review122898
::: devtools/client/webconsole/new-console-output/test/mochitest/test-console.html:10
(Diff revision 2)
> <title>Simple webconsole test page</title>
> </head>
> <body>
> <p>Simple webconsole test page</p>
> <script>
> /* exported doLogs */
we should export stringLog as well or eslint throws a no-unused-vars error
Comment hidden (mozreview-request) |
Comment 10•8 years ago
|
||
Pushed by ttromey@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/495238244147
quote string expression results in console; r=nchevobbe
Comment 11•8 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 55
Comment 12•8 years ago
|
||
I have reproduced this bug with Nightly 54.0a1 (2017-02-24) (64-bit) on WIndows 7,64 Bit!
This bug's fix is verified with latest Nightly!
Build ID : 20170331030216
User Agent : Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0
[bugday-20170329]
Comment 13•8 years ago
|
||
But having to type console.log() to display a string nicely is annoying.
What about having print() behave like console.log()? It's much shorter.
And quoting pprint makes it so useless:
> pprint([1,2,3,4,5])
" 0: 1\n 1: 2\n 2: 3\n 3: 4\n 4: 5"
Previously it was better:
> pprint([1,2,3,4,5])
0: 1
1: 2
2: 3
3: 4
4: 5
Assignee | ||
Comment 14•8 years ago
|
||
(In reply to Oriol from comment #13)
> But having to type console.log() to display a string nicely is annoying.
>
> What about having print() behave like console.log()? It's much shorter.
>
> And quoting pprint makes it so useless:
Could you please file a new bug for this?
Updated•8 years ago
|
status-firefox54:
affected → ---
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•