Bug 790026 - [gcli] screenshot command could use a 'chrome' option, r=jwalker

This commit is contained in:
Girish Sharma 2012-09-14 02:28:56 +05:30
parent f45eec4632
commit f42551714d
3 changed files with 31 additions and 1 deletions

View File

@ -41,6 +41,12 @@ gcli.addCommand({
description: gcli.lookup("screenshotClipboardDesc"),
manual: gcli.lookup("screenshotClipboardManual")
},
{
name: "chrome",
type: "boolean",
description: gcli.lookup("screenshotChromeDesc"),
manual: gcli.lookup("screenshotChromeManual")
},
{
name: "delay",
type: { name: "number", min: 0 },
@ -65,7 +71,14 @@ gcli.addCommand({
}
],
exec: function Command_screenshot(args, context) {
var document = context.environment.contentDocument;
if (args.chrome && args.selector) {
// Node screenshot with chrome option does not work as inteded
// Refer https://bugzilla.mozilla.org/show_bug.cgi?id=659268#c7
// throwing for now.
throw new Error(gcli.lookup("screenshotSelectorChromeConflict"));
}
var document = args.chrome? context.environment.chromeDocument
: context.environment.contentDocument;
if (args.delay > 0) {
var promise = context.createPromise();
document.defaultView.setTimeout(function Command_screenshotDelay() {

View File

@ -121,6 +121,7 @@ function testCapture() {
fullpage: false,
clipboard: false,
node: null,
chrome: false,
},
outputMatch: new RegExp("^Saved to "),
});
@ -137,6 +138,7 @@ function testCapture() {
fullpage: true,
clipboard: true,
node: null,
chrome: false,
},
outputMatch: new RegExp("^Copied to clipboard.$"),
});

View File

@ -70,6 +70,16 @@ screenshotClipboardDesc=Copy screenshot to clipboard? (true/false)
# asks for help on what it does.
screenshotClipboardManual=True if you want to copy the screenshot instead of saving it to a file.
# LOCALIZATION NOTE (screenshotChromeDesc) A very short string to describe
# the 'chrome' parameter to the 'screenshot' command, which is displayed in
# a dialog when the user is using this command.
screenshotChromeDesc=Capture Firefox chrome window? (true/false)
# LOCALIZATION NOTE (screenshotChromeManual) A fuller description of the
# 'chrome' parameter to the 'screenshot' command, displayed when the user
# asks for help on what it does.
screenshotChromeManual=True if you want to take the screenshot of the Firefox window rather than the web page's content window.
# LOCALIZATION NOTE (screenshotGroupOptions) A label for the optional options of
# the screenshot command.
screenshotGroupOptions=Options
@ -94,6 +104,11 @@ screenshotFullPageDesc=Entire webpage? (true/false)
# asks for help on what it does.
screenshotFullPageManual=True if the screenshot should also include parts of the webpage which are outside the current scrolled bounds.
# LOCALIZATION NOTE (screenshotSelectorChromeConflict) Exception thwon when user
# tries to use 'selector' option along with 'chrome' option of the screenshot
# command. Refer: https://bugzilla.mozilla.org/show_bug.cgi?id=659268#c7
screenshotSelectorChromeConflict=selector option is not supported when chrome option is true
# LOCALIZATION NOTE (screenshotGeneratedFilename) The auto generated filename
# when no file name is provided. the first argument (%1$S) is the date string
# in yyyy-mm-dd format and the second argument (%2$S) is the time string