Closed Bug 1743783 Opened 2 years ago Closed 2 years ago

Taking a screenshot from the command line doesn't work on Windows

Categories

(Firefox :: Headless, defect)

x86_64
Windows
defect

Tracking

()

RESOLVED FIXED
97 Branch
Tracking Status
firefox97 --- fixed

People

(Reporter: Dexter, Assigned: toshi)

Details

Attachments

(1 file)

This problem is present in both Nightly (96.0a1 (2021-11-30) (64-bit)) and Release (94.0.2 (64 bit)).

STR

  • Open a Windows command prompt.
  • Execute firefox.exe -P test -no-remote -screenshot "https://www.example.com"

Expected Outcome

The screenshot of the page gets saved as screenshot.png in the current working directory.

Current Outcome
Nothing is saved, the process lives forever.

Other info
I tried to build locally, and I'm seeing a different problem as well. Whenever I try to take a screenshot:

 ./mach run --screenshot "https://www.example.com"
 0:01.05 d:/mozilla-unified/obj-x86_64-pc-mingw32\dist\bin\firefox.exe --screenshot https://www.example.com -no-remote -wait-for-browser -profile d:\mozilla-unified\obj-x86_64-pc-mingw32\tmp\profile-default -attach-console
Failure taking screenshot: Error: Invalid URL passed to loadContentWindow(): -attach-console
*** UTM:SVC TimerManager:registerTimer called after profile-before-change notification. Ignoring timer registration for id: recipe-client-addon-run

This seems to happen because of this line and its interaction with how parsing happens when taking a screenshot.

Manually adding -attach-console to the previous ./mach run command works around this and allows to reproduce the problem consistently.

HeadlessShell.handleCmdLineArgs needs to skip arguments starting with a hyphen
to search for a URL.

Assignee: nobody → tkikuchi
Status: NEW → ASSIGNED

The severity field is not set for this bug.
:bdahl, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(bdahl)
Pushed by tkikuchi@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a69b68be11e1
Ignore extra command options when taking a screenshot.  r=mossop
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 97 Branch
Severity: -- → S3
Flags: needinfo?(bdahl)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: