Closed Bug 1307931 Opened 9 years ago Closed 8 years ago

Make urls in output clickable

Categories

(DevTools :: Console, enhancement, P1)

enhancement

Tracking

(firefox57 verified)

VERIFIED FIXED
Firefox 57
Iteration:
57.1 - Aug 15
Tracking Status
firefox57 --- verified

People

(Reporter: linclark, Assigned: nchevobbe)

References

Details

(Whiteboard: [reserve-console-html])

Attachments

(2 files, 1 obsolete file)

Originally posted by:linclark see https://github.com/devtools-html/gecko-dev/issues/348 In the current web console, clicking on URLs will open the link. Tests: - [ ] browser_webconsole_clickable_urls.js
Priority: -- → P2
Whiteboard: new-console
Honza, do you think this is something that should happen at the Reps level? For example, if there's a URL in JSON Viewer or debugger, should it also be clickable? If so, what do you think would be the best course? Maybe do a similar thing as we have with Variables View, were if you pass in a handler function then it will be used as an onClick handler for a URL?
Flags: needinfo?(odvarko)
(In reply to Lin Clark [:linclark] from comment #2) > Honza, do you think this is something that should happen at the Reps level? > For example, if there's a URL in JSON Viewer or debugger, should it also be > clickable? Yes > If so, what do you think would be the best course? Maybe do a similar thing > as we have with Variables View, were if you pass in a handler function then > it will be used as an onClick handler for a URL? Passing a handler function in as a prop sounds good to me. I am seeing two options: 1) Pass in a new prop e.g. 'urlLink' that opens a new tab. 2) Reuse the existing 'objectLink' prop and make it smart in a way the it knows what the user clicked on and whether the variables view (object inspector) or a new tab should be opened. I tend to think that #2 is better, but the implementation should be nice & clean. Also note that there is an existing report - bug 1245303, that has also a suggested patch that modifies the StringRep. Honza
Flags: needinfo?(odvarko)
Just realizing that this will potentially break given the console perf enhancement that we discussed on Monday. If we cache the results of reps as HTML, then we can't easily use click handlers on anything inside of reps.
It looks like gamakichi on IRC started working on this and has a patch ready for review (https://pastebin.mozilla.org/8929855), but they are not there anymore and I can't find its bugzilla account (I don't know if they have one). Consider that this bug is assigned for now.
Flags: qe-verify+
Priority: P2 → P3
Whiteboard: new-console → [reserve-new-console]
QA Contact: iulia.cristescu
Whiteboard: [reserve-new-console] → [reserve-console-html]
Depends on: 1383797
Assignee: nobody → nchevobbe
Depends on: 1386525
No longer depends on: 1383797
Priority: P3 → P1
Status: NEW → ASSIGNED
Iteration: --- → 57.1 - Aug 15
Brian, I copied devtools/client/webconsole/test/browser_webconsole_clickable_urls.js over the new console directory for this, but I ended up simplifying the tests quite a bit. Does it still make sense to have it "copied" in the repo, or should I just create a new file ?
(In reply to Nicolas Chevobbe [:nchevobbe] from comment #8) > Brian, I copied > devtools/client/webconsole/test/browser_webconsole_clickable_urls.js over > the new console directory for this, but I ended up simplifying the tests > quite a bit. Does it still make sense to have it "copied" in the repo, or > should I just create a new file ? I think copying is fine
Comment on attachment 8893408 [details] Bug 1307931 - Make urls in output clickable; . https://reviewboard.mozilla.org/r/164522/#review170076 Looks good to me
Attachment #8893408 - Flags: review?(bgrinstead) → review+
Attachment #8893407 - Attachment is obsolete: true
Comment on attachment 8893408 [details] Bug 1307931 - Make urls in output clickable; . https://reviewboard.mozilla.org/r/164522/#review172304 ::: devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_clickable_urls.js:24 (Diff revision 3) > - > - // 1: URL opens page using https when clicked. > - { > - input: "'https://example.com'", > - output: "https://example.com", > - expectedTab: "https://example.com/", > + }); > + > + let node = await waitFor(() => findMessage(hud, url)); > + const link = node.querySelector("a.url"); > + > + const onTabLoaded = new Promise(resolve => { Looks like there's a `BrowserTestUtils.waitForNewTab(gBrowser, url, true)` that wraps up this boilerplate around the tabContainer and browserLoaded.
Comment on attachment 8895846 [details] Bug 1307931 - devtools reps: update bundle to v0.12.1. https://reviewboard.mozilla.org/r/167136/#review172306 Looks like there are some try failures but r=me with those addressed
Attachment #8895846 - Flags: review?(bgrinstead) → review+
Comment on attachment 8893408 [details] Bug 1307931 - Make urls in output clickable; . https://reviewboard.mozilla.org/r/164522/#review172304 > Looks like there's a `BrowserTestUtils.waitForNewTab(gBrowser, url, true)` that wraps up this boilerplate around the tabContainer and browserLoaded. Thanks for the tip, test looks cleaner with it.
> Looks like there are some try failures but r=me with those addressed I fixed the issues and pushed to TRY again
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/87afcda8a0ff devtools reps: update bundle to v0.12.1. r=bgrins https://hg.mozilla.org/integration/autoland/rev/dc8e54688912 Make urls in output clickable; r=bgrins.
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 57
(In reply to Jan Honza Odvarko [:Honza] from comment #3) > > I am seeing two options: > > 1) Pass in a new prop e.g. 'urlLink' that opens a new tab. > 2) Reuse the existing 'objectLink' prop and make it smart in a way the it > knows what the user clicked on and whether the variables view (object > inspector) or a new tab should be opened. > > I tend to think that #2 is better, but the implementation should be nice & > clean. > I understand that the second option was chosen. In that case, can you please detail what is the expected behaviour? In what cases the variable view and a new tab are opened?
Flags: needinfo?(odvarko)
Hello Iulia, We don't have the concept of the variable view anymore in the console, so I thin comment 3 is obsolete. This bug is only about being able to click on a URL when one is logged (e.g. with `console.log("http://www.google.com")`). Clicking on the link should always open a new tab.
Flags: needinfo?(odvarko)
Thanks Nicolas for your quick answer! Managed to reproduce the initial issue on 52.0a1 (2016-10-22). I can confirm the bug is verified fixed on 57.0a1 (2017-08-22), using Windows 10 x64, Ubuntu 16.04 x64 and Mac OS X 10.11.6.
Status: RESOLVED → VERIFIED
Flags: qe-verify+
See Also: → 1394094
Depends on: 1399460
No longer depends on: 1399460
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: