Closed
Bug 1315242
Opened 8 years ago
Closed 8 years ago
Web Console doesn't show line/column for error thrown from console input.
Categories
(DevTools :: Console, defect, P3)
DevTools
Console
Tracking
(firefox52 fixed)
RESOLVED
FIXED
Firefox 52
Tracking | Status | |
---|---|---|
firefox52 | --- | fixed |
People
(Reporter: arai, Assigned: arai)
References
Details
Attachments
(8 files, 5 obsolete files)
13.64 KB,
patch
|
jimb
:
review+
|
Details | Diff | Splinter Review |
1.15 KB,
patch
|
bgrins
:
review+
|
Details | Diff | Splinter Review |
30.45 KB,
image/png
|
Details | |
10.25 KB,
patch
|
Details | Diff | Splinter Review | |
6.10 KB,
patch
|
bgrins
:
review+
|
Details | Diff | Splinter Review |
5.75 KB,
patch
|
Details | Diff | Splinter Review | |
1.37 KB,
patch
|
bgrins
:
review+
|
Details | Diff | Splinter Review |
2.39 KB,
patch
|
bgrins
:
review+
|
Details | Diff | Splinter Review |
Steps to reproduce:
1. open web console
2. evaluate the following code
foo()
Actual result:
get the following error message
ReferenceError: foo is not defined [Learn More]
Expected result:
get error message with location information like following
ReferenceError: foo is not defined [Learn More] typein:1:1
filename part isn't necessary, but line/column should be there.
Assignee | ||
Comment 1•8 years ago
|
||
sometimes column information is important for JavaScript error, like bug 1315242's case.
will work on this, this will help bug 1283712 too, as location information is important for note too.
let me know if there's already a bug for this.
Assignee: nobody → arai.unmht
See Also: → 1283712
Comment 2•8 years ago
|
||
The location would be coming from the evalled debugger code in this case. We wouldn't have anywhere to link to with the source, but the location info might be handy. I'm not sure if the debugger API exposes this currently though.
Priority: -- → P3
Assignee | ||
Comment 3•8 years ago
|
||
(In reply to Brian Grinstead [:bgrins] from comment #2)
> I'm not sure if the debugger API exposes this currently though.
there wasn't, so I've added :)
will attach patch after I added some testcases.
Updated•8 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 4•8 years ago
|
||
To get line/column number from devtools, added lineNumber/columnNumber getters, just like errorMessageName getter that extracts JSErrorReport information.
now we have 3 accessors for JSErrorReport, so separated the part that extracts JSErrorReport from `referent` object, to GetErrorReport function.
and used it from DebuggerObject::getErrorMessageName, DebuggerObject::getLineNumber, and DebuggerObject::getColumnNumber.
lineNumber and columnNumber getters return number value if there's JSErrorReport, otherwise returns undefined.
so that we can check if it has lineNumber/columnNumber by checking type.
will post other parts after this part, since they depends on interface.
Attachment #8807787 -
Flags: review?(jimb)
Comment 5•8 years ago
|
||
Comment on attachment 8807787 [details] [diff] [review]
Part 1: Add lineNumber and columnNumber property to debugger object to get line/column from JSErrorReport.
Review of attachment 8807787 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks very much for doing this!
Thank you for cleaning up DebuggerObject::getErrorMessageName. The new code better fits the SpiderMonkey coding style.
Changes to Debugger.cpp require corresponding changes to the documentation in js/src/doc/Debugger, and they require full unit tests in js/src/jit-test/tests/debug.
Please flag for review again when these changes have been made; I will try to respond as quickly as possible.
::: js/src/vm/Debugger.cpp
@@ +8683,5 @@
> +/* static */ bool
> +DebuggerObject::lineNumberGetter(JSContext *cx, unsigned argc, Value* vp)
> +{
> + THIS_DEBUGOBJECT(cx, argc, vp, "get lineNumber", args, object)
> +fprintf(stderr, "lineNumberGetter\n");
These debugging printfs need to come out.
@@ +9300,5 @@
> JS_PSG("isProxy", DebuggerObject::isProxyGetter, 0),
> JS_PSG("proxyTarget", DebuggerObject::proxyTargetGetter, 0),
> JS_PSG("proxyHandler", DebuggerObject::proxyHandlerGetter, 0),
> + JS_PSG("lineNumber", DebuggerObject::lineNumberGetter, 0),
> + JS_PSG("columnNumber", DebuggerObject::columnNumberGetter, 0),
I would rather see these called `errorLineNumber` and `errorColumnNumber`. (Debugger.Object needs to carry accessors for many kinds of referents.)
@@ +9618,5 @@
> return true;
> }
>
> +static bool
> +GetErrorReport(JSContext* cx, HandleObject maybeError, JSErrorReport** report)
This should be a private static method of DebuggerObject, like `checkThis`.
It's SpiderMonkey style to use `&` for pointers that can't be null, even when they are non-const. The pointer to the JSErrorReport may be null, but the pointer to that pointer must not be. So `report` should be `JSObject*&`.
Attachment #8807787 -
Flags: review?(jimb) → review-
Assignee | ||
Comment 6•8 years ago
|
||
(In reply to Tooru Fujisawa [:arai] from comment #1)
> sometimes column information is important for JavaScript error, like bug
> 1315242's case.
bug 1310045's case, I meant :P
Assignee | ||
Comment 7•8 years ago
|
||
Thank you for reviewing :)
renamed to errorLineNumber and errorColumnNumber, and added documents and testcases.
Attachment #8807787 -
Attachment is obsolete: true
Attachment #8808412 -
Flags: review?(jimb)
Comment 8•8 years ago
|
||
Comment on attachment 8808412 [details] [diff] [review]
Part 1: Add errorLineNumber and errorColumnNumber property to debugger object to get line/column from JSErrorReport.
Review of attachment 8808412 [details] [diff] [review]:
-----------------------------------------------------------------
Thank you for the revisions! The tests look really good.
::: js/src/doc/Debugger/Debugger.Object.md
@@ +157,5 @@
> : If the referent is an error created with an engine internal message template
> this is a string which is the name of the template; `undefined` otherwise.
>
> +`errorLineNumber`
> +: If the referent is an error this is a line number of the error;
I'd prefer:
"If the referent is an Error object, this is the line number at which the referent was created; ..."
and similarly for column number.
Attachment #8808412 -
Flags: review?(jimb) → review+
Assignee | ||
Comment 9•8 years ago
|
||
Added code to get error's line number and column number from evaluation result,
and when they're available, set frame to "typein:{line}:{column}"
then when formatting it, if frame's url is "typein", it shows location even if it's not linkable.
Attachment #8808691 -
Flags: review?(bgrinstead)
Assignee | ||
Comment 10•8 years ago
|
||
Added testcase for syntax error that will set column number to specific value. (column 4)
Attachment #8808693 -
Flags: review?(bgrinstead)
Assignee | ||
Comment 11•8 years ago
|
||
Updated stub with
./mach test devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/browser_webconsole_update_stubs_evaluation_result.js
Attachment #8808695 -
Flags: review?(bgrinstead)
Assignee | ||
Comment 12•8 years ago
|
||
and added a testcase for location
Attachment #8808697 -
Flags: review?(bgrinstead)
Comment 13•8 years ago
|
||
Hi, I have this series applied but am not seeing the typein location. Should I be seeing the frame here?
Flags: needinfo?(arai.unmht)
Assignee | ||
Comment 14•8 years ago
|
||
yeah, the location should be there.
let me check again.
maybe I broke the patch just before attaching
Comment 15•8 years ago
|
||
Comment on attachment 8808691 [details] [diff] [review]
Part 2: Display line number and column number in error message for console input.
Review of attachment 8808691 [details] [diff] [review]:
-----------------------------------------------------------------
I'm still having issues applying locally, waiting for a clobber but here's initial feedback. This looks good though
::: devtools/client/shared/components/frame.js
@@ +37,5 @@
> showFullSourceUrl: PropTypes.bool,
> // Service to enable the source map feature for console.
> sourceMapService: PropTypes.object,
> + // Frame is typein
> + isTypein: PropTypes.bool,
Nit: I prefer a name like isConsoleInput throughout this patch
::: devtools/server/actors/webconsole.js
@@ +933,5 @@
> + try {
> + let line = error.errorLineNumber;
> + let column = error.errorColumnNumber;
> +
> + if (typeof line === "number" &&typeof column === "number") {
Nit: space after &&
@@ +936,5 @@
> +
> + if (typeof line === "number" &&typeof column === "number") {
> + // Set frame only if we have line/column numbers.
> + frame = {
> + source: "typein",
Instead of "typein" here, can we try "console-input"?
Attachment #8808691 -
Flags: review?(bgrinstead)
Comment 16•8 years ago
|
||
(In reply to Brian Grinstead [:bgrins] from comment #13)
> Created attachment 8808705 [details]
> input.png
>
> Hi, I have this series applied but am not seeing the typein location.
> Should I be seeing the frame here?
I think this was an issue in my build, clearing needinfo
Flags: needinfo?(arai.unmht)
Assignee | ||
Comment 17•8 years ago
|
||
reused "debugger eval code" as frame.source.
and changed "typein" to "console-input" when displaying the frame.
also, fixed the comment for evalWithDebugger, that "url" is the property of |aOptions| parameter, not return object.
Attachment #8808691 -
Attachment is obsolete: true
Attachment #8808754 -
Flags: review?(bgrinstead)
Comment 18•8 years ago
|
||
Comment on attachment 8808695 [details] [diff] [review]
Part 4: Update stub.
Review of attachment 8808695 [details] [diff] [review]:
-----------------------------------------------------------------
Hi, now that Bug 1307905 has landed can you re-run the stub generation for this patch? It should ignore properties like 'timestamp'
Attachment #8808695 -
Flags: review?(bgrinstead)
Updated•8 years ago
|
Attachment #8808693 -
Flags: review?(bgrinstead) → review+
Assignee | ||
Comment 19•8 years ago
|
||
to make things easier, I'll land Part 1 first.
so that we can use artifact build.
Keywords: leave-open
Assignee | ||
Comment 20•8 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/f28db33d51f15a0f1ee7b9916b1c3ae59641cd6e
Bug 1315242 - Part 1: Add errorLineNumber and errorColumnNumber property to debugger object to get line/column from JSErrorReport. r=jimb
Assignee | ||
Comment 21•8 years ago
|
||
regenerated
Attachment #8808695 -
Attachment is obsolete: true
Attachment #8809082 -
Flags: review?(bgrinstead)
Assignee | ||
Comment 22•8 years ago
|
||
and updated to follow part 2
Attachment #8808697 -
Attachment is obsolete: true
Attachment #8808697 -
Flags: review?(bgrinstead)
Attachment #8809083 -
Flags: review?(bgrinstead)
Comment 23•8 years ago
|
||
Started doing a review on part 2 which led me to making local changes, which I'll just upload instead commenting on splinter. This is meant to be squashed in with your patch but basically here's what it does:
* Set don't set "console-input" as the visible source but just allow "debugger eval input" to go through. This has a benefit of showing the same source in both the stack trace and the console.trace() header when running this in console: `setTimeout(() => { console.trace() })`. This will require another change on Part 5 to match (sorry about that)
* Remove isConsoleInput special case in frame component and instead display source information and line number even when it's not linkable. AFAIK there aren't other cases of this - if it ends up being a problem we can reintroduce an option to force the location info to be shown, but let's do this for now since it's simpler
Updated•8 years ago
|
Attachment #8809082 -
Flags: review?(bgrinstead) → review+
Comment 24•8 years ago
|
||
Comment on attachment 8808754 [details] [diff] [review]
Part 2: Display line number and column number in error message for console input.
See comment 23 - can you please fold the review comments into this one and confirm they look right to you? r=me on that patch if you are happy with the changes as well
Attachment #8808754 -
Flags: review?(bgrinstead)
Comment 25•8 years ago
|
||
Comment on attachment 8809083 [details] [diff] [review]
Part 5: Add a testcase for location in Evaluation Result.
Review of attachment 8809083 [details] [diff] [review]:
-----------------------------------------------------------------
::: devtools/client/webconsole/new-console-output/test/components/evaluation-result.test.js
@@ +78,5 @@
> + const wrapper = render(EvaluationResult({ message }));
> +
> + const locationLink = wrapper.find(`.message-location`);
> + expect(locationLink.length).toBe(1);
> + expect(locationLink.text()).toBe("console-input:1:4");
Will need to switch this back to "debugger eval code" after Comment 23
Attachment #8809083 -
Flags: review?(bgrinstead)
Assignee | ||
Comment 26•8 years ago
|
||
Thanks :)
We could use "console-input" as filename in debugger, so that trace shows that filename.
I think "console-input" is more intuitive than "debugger eval code", since it's a code entered in console, not debugger.
Will try changing that part.
Assignee | ||
Comment 27•8 years ago
|
||
looks like we should change many more code in devtools to change "debugger eval code" to "console-input", for console input filename.
https://treeherder.mozilla.org/#/jobs?repo=try&revision=047ff6417fca977c25e66cba73a64c8ccf9bea78&selectedJob=30795366
it should be left to another dedicated bug if we go that way.
will use "debugger eval code" for now.
Assignee | ||
Comment 28•8 years ago
|
||
Updated the test to use "debugger eval code".
will file a bug to change internal and exposed filename to more intuitive one.
Attachment #8809083 -
Attachment is obsolete: true
Attachment #8809280 -
Flags: review?(bgrinstead)
Updated•8 years ago
|
Attachment #8809280 -
Flags: review?(bgrinstead) → review+
Assignee | ||
Comment 30•8 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/fd1505a03d78c38a05fac455c28539ef05686bfe
Bug 1315242 - Part 2: Display line number and column number in error message for console input. r=bgrins
https://hg.mozilla.org/integration/mozilla-inbound/rev/07585bbe0c8fb528e6103ca46b0b243019bf61c0
Bug 1315242 - Part 3: Add a test input for syntax error in Evaluation Result. r=bgrins
https://hg.mozilla.org/integration/mozilla-inbound/rev/5778f05e78db4dfaaaba4a4c50c61e2e8969b83f
Bug 1315242 - Part 4: Update stub. r=bgrins
https://hg.mozilla.org/integration/mozilla-inbound/rev/ce34d3f8a3b728d60a7ecd35b70e096bf87b85f9
Bug 1315242 - Part 5: Add a testcase for location in Evaluation Result. r=bgrins
Comment 31•8 years ago
|
||
bugherder |
Assignee | ||
Updated•8 years ago
|
Keywords: leave-open
Assignee | ||
Comment 32•8 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/debae3394553dde5b5edcdf1e2afbed5d282db1d
Backed out changeset ce34d3f8a3b7 (bug 1315242)
https://hg.mozilla.org/integration/mozilla-inbound/rev/f35567f72f1127cee6e6dda78b1ce38f74186a4c
Backed out changeset 5778f05e78db (bug 1315242)
https://hg.mozilla.org/integration/mozilla-inbound/rev/7b1fd4bf3ac16abd6e718260050046f4dbe1db11
Backed out changeset 07585bbe0c8f (bug 1315242)
https://hg.mozilla.org/integration/mozilla-inbound/rev/6f3b378f627f6fe3288bd0c4b193bec23badba2b
Backed out changeset fd1505a03d78 for mochitest chrome bustage (bug 1315242)
Assignee | ||
Comment 33•8 years ago
|
||
Assignee | ||
Comment 34•8 years ago
|
||
As we changed line/column to be shown for not-linkable location, the test for it should be updated.
Changed the expected value for not-linkable test to expect line/column, also added the case that it has column.
Attachment #8809494 -
Flags: review?(bgrinstead)
Updated•8 years ago
|
Attachment #8809494 -
Flags: review?(bgrinstead) → review+
Assignee | ||
Comment 35•8 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/66f8ba508c9851a48944894a3040738a8cbcd4b0
Bug 1315242 - Part 2: Display line number and column number in error message for console input. r=bgrins
https://hg.mozilla.org/integration/mozilla-inbound/rev/48214b1297023ed37de76d1421426c58af935532
Bug 1315242 - Part 3: Add a test input for syntax error in Evaluation Result. r=bgrins
https://hg.mozilla.org/integration/mozilla-inbound/rev/ad6fa81a22987ecd04e0652c2241ed0aa3c5e1b0
Bug 1315242 - Part 4: Update stub. r=bgrins
https://hg.mozilla.org/integration/mozilla-inbound/rev/fa67f98c5ffd878b667226c589e819d3c1c91fea
Bug 1315242 - Part 5: Add a testcase for location in Evaluation Result. r=bgrins
https://hg.mozilla.org/integration/mozilla-inbound/rev/4e1adcac2cfd09116a522c79a4baafc02d26fee3
Bug 1315242 - Part 6: Update test_frame_01.html to follow new behavior of location. r=bgrins
Comment 36•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/66f8ba508c98
https://hg.mozilla.org/mozilla-central/rev/48214b129702
https://hg.mozilla.org/mozilla-central/rev/ad6fa81a2298
https://hg.mozilla.org/mozilla-central/rev/fa67f98c5ffd
https://hg.mozilla.org/mozilla-central/rev/4e1adcac2cfd
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox52:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 52
Comment 37•8 years ago
|
||
I have reproduced this bug with Firefox nightly 52.0a1(build id:20161104030212)on
windows 7(64 bit)
I have verified this bug as fixed with Firefox beta 52.0b5(build id:20170209120619)
User agent:Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0
[bugday-20170208]
Comment 38•7 years ago
|
||
problem is back in 55.0.1. I am doing a function call I made which has a bug in it and it's a large function.
TypeError: undefined has no properties [Learn More]
is the error message, without line:col on right hand side, in pink.
what this error is, is the index of a string accessed with [] is out of bounds. message should say that (that's a different bug), but mainly the biggest problem I have is that when running from an HTML file it shows line:col, but from console prompt no.
Comment 39•7 years ago
|
||
same with 55.
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•