Last Comment Bug 709460 - GCLI needs a screenshot command
: GCLI needs a screenshot command
Status: RESOLVED FIXED
[fixed-in-fx-team]
:
Product: Firefox
Classification: Client Software
Component: Developer Tools: Console (show other bugs)
: unspecified
: All All
: P2 normal (vote)
: Firefox 15
Assigned To: Victor Porof [:vporof][:vp]
:
: Brian Grinstead [:bgrins]
Mentors:
Depends on:
Blocks: GCLICMD
  Show dependency treegraph
 
Reported: 2011-12-10 02:27 PST by Joe Walker [:jwalker] (needinfo me or ping on irc)
Modified: 2012-06-27 11:34 PDT (History)
4 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
upload 1 (7.28 KB, patch)
2012-01-23 05:27 PST, Joe Walker [:jwalker] (needinfo me or ping on irc)
no flags Details | Diff | Splinter Review
upload 2 (7.45 KB, patch)
2012-01-31 10:04 PST, Joe Walker [:jwalker] (needinfo me or ping on irc)
no flags Details | Diff | Splinter Review
v3 (8.53 KB, patch)
2012-05-24 07:52 PDT, Victor Porof [:vporof][:vp]
jwalker: review+
Details | Diff | Splinter Review

Description Joe Walker [:jwalker] (needinfo me or ping on irc) 2011-12-10 02:27:04 PST
i.e.

  > screenshot foo.png
  Saved screenshot of current page to 'downloads/foo.png'
Comment 1 Joe Walker [:jwalker] (needinfo me or ping on irc) 2011-12-10 02:28:03 PST
This needs to take into account bug 664693 comment 10 (and the few comments prior to that).
Comment 2 barryvan 2011-12-13 20:21:04 PST
Would it be possible to also add support for:

* screenshots copied directly to clipboard, rather than saved on disk;
* screenshots of the viewport/entire window; and
* screenshots of a particular area/element.

The last one could encapsulate the second (screenshot --elem body). I'm not sure of the syntax for it, though. Perhaps "screenshot --elem <selector>".
Comment 3 Joe Walker [:jwalker] (needinfo me or ping on irc) 2012-01-11 10:16:35 PST
Bug triage, filter on PEGASUS.
Comment 4 Joe Walker [:jwalker] (needinfo me or ping on irc) 2012-01-11 10:18:24 PST
Bug triage, filter on PEGASUS.
Comment 5 Joe Walker [:jwalker] (needinfo me or ping on irc) 2012-01-23 05:27:04 PST
Created attachment 590679 [details] [diff] [review]
upload 1

Basic implementation.
No tests, l10n incomplete, errors in getting default download directory.
Comment 6 Joe Walker [:jwalker] (needinfo me or ping on irc) 2012-01-31 08:33:48 PST
https://tbpl.mozilla.org/?tree=Try&rev=b447debd6053
Comment 7 Joe Walker [:jwalker] (needinfo me or ping on irc) 2012-01-31 10:04:11 PST
Created attachment 593142 [details] [diff] [review]
upload 2

Basically working.
Just does current window, and only to a file right now. Enhancements welcome.
Comment 8 Joe Walker [:jwalker] (needinfo me or ping on irc) 2012-02-15 00:15:41 PST
https://tbpl.mozilla.org/?tree=Try&rev=9dbf9f91493c
Comment 9 Joe Walker [:jwalker] (needinfo me or ping on irc) 2012-02-15 00:16:02 PST
https://bugzilla.mozilla.org/show_bug.cgi?id=723431
Comment 10 Victor Porof [:vporof][:vp] 2012-03-27 03:37:19 PDT
Can I take this?
Comment 11 Joe Walker [:jwalker] (needinfo me or ping on irc) 2012-03-28 11:07:11 PDT
(In reply to Victor Porof from comment #10)
> Can I take this?

You're welcome to
Comment 12 Joe Walker [:jwalker] (needinfo me or ping on irc) 2012-03-28 11:07:48 PDT
Just checked and that's the latest version.
It works OK, but can only screenshot the visible screen
Comment 13 Victor Porof [:vporof][:vp] 2012-03-28 11:15:45 PDT
Cool, I'll play with it a bit.
Comment 14 Joe Walker [:jwalker] (needinfo me or ping on irc) 2012-04-29 11:26:04 PDT
GCLI Triage.
Comment 15 Victor Porof [:vporof][:vp] 2012-05-24 07:52:19 PDT
Created attachment 626805 [details] [diff] [review]
v3

Now able to screenshot the entire webpage view bounds or just a single node identified by a css selector.
Comment 16 Joe Walker [:jwalker] (needinfo me or ping on irc) 2012-05-25 10:12:02 PDT
Comment on attachment 626805 [details] [diff] [review]
v3

Review of attachment 626805 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks!

::: browser/devtools/commandline/GcliCommands.jsm
@@ +195,5 @@
> +
> +    let source = ioService.newURI(data, "UTF8", null);
> +    persist.saveURI(source, null, null, null, null, file);
> +
> +    return "Saved to " + filename;

We're planning on adding a green tick-mark to indicate that the command executed correctly, and I'm expecting that the user will know the filename, so I think we can just return here.

In the future, I've been mulling over the idea that we should have an implicit --verbose flag for all commands which we could turn on/off globally or on a case by case basis.
Comment 17 Victor Porof [:vporof][:vp] 2012-05-25 23:05:01 PDT
(In reply to Joe Walker from comment #16)
> Comment on attachment 626805 [details] [diff] [review]
> v3
> 
> Review of attachment 626805 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> Thanks!
> 
> ::: browser/devtools/commandline/GcliCommands.jsm
> @@ +195,5 @@
> > +
> > +    let source = ioService.newURI(data, "UTF8", null);
> > +    persist.saveURI(source, null, null, null, null, file);
> > +
> > +    return "Saved to " + filename;
> 
> We're planning on adding a green tick-mark to indicate that the command
> executed correctly, and I'm expecting that the user will know the filename,
> so I think we can just return here.
> 

I'm not entirely sure that the user will know the filename right from the start. First time I tried a screenshot and didn't enter a fullpath, I almost got confused on whether the image will be saved in my downloads folder, or on my desktop (like os x does).

Maybe we should keep it?
Comment 18 Joe Walker [:jwalker] (needinfo me or ping on irc) 2012-05-30 02:11:14 PDT
(In reply to Victor Porof from comment #17)
> ...
> > We're planning on adding a green tick-mark to indicate that the command
> > executed correctly, and I'm expecting that the user will know the filename,
> > so I think we can just return here.
> > 
> 
> I'm not entirely sure that the user will know the filename right from the
> start. First time I tried a screenshot and didn't enter a fullpath, I almost
> got confused on whether the image will be saved in my downloads folder, or
> on my desktop (like os x does).
> 
> Maybe we should keep it?

Ok, you sold me.
Thanks.
Comment 19 Joe Walker [:jwalker] (needinfo me or ping on irc) 2012-06-01 01:01:56 PDT
https://tbpl.mozilla.org/?tree=Fx-Team&rev=a24414165cd4
Comment 20 Rob Campbell [:rc] (:robcee) 2012-06-01 06:00:27 PDT
https://hg.mozilla.org/mozilla-central/rev/68600a8af079

Note You need to log in before you can comment on or make changes to this bug.