Closed Bug 1522989 Opened 6 years ago Closed 6 years ago

Headless mode doesn't work with screenshot

Categories

(Firefox :: Headless, defect)

65 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 66
Tracking Status
firefox-esr60 --- unaffected
firefox64 --- wontfix
firefox65 --- wontfix
firefox66 + fixed

People

(Reporter: thomasmo, Assigned: thomasmo)

References

Details

(Keywords: regression)

Attachments

(1 file)

Looks like the fix to Bug 1507352 breaks capturing a screenshot in headless mode, at least with the command in the repro steps below. Removing the fix enables the fix again.

Repro Steps:

In a build that contains https://phabricator.services.mozilla.com/D11969 (Fx 65+), execute the following command:
firefox.exe -headless -no-remote -profile c:\path\to\profile -screenshot c:\path\to\screenshot.jpg https://eggtimer.org

  • Expected: screenshot written to disk at c:\path\to\screenshot.jpg, firefox.exe (all of them) terminate
  • Actual: no screenshot written to disk, firefox.exe stays open with cpu idle
Assignee: nobody → thomasmo

I wonder if we'd be better off using this to avoid the about:blank load: https://searchfox.org/mozilla-central/source/docshell/base/nsIDocShell.idl#944

Can you add a debugging statement here: https://searchfox.org/mozilla-central/rev/465dbfe030dfec7756b9b523029e90d48dd5ecce/browser/components/shell/HeadlessShell.jsm#36 to print out what uri and location are? For example, something like:

  dump(`uri is: ${uri.spec} and location is ${location.spec}\n`);
Flags: needinfo?(thomasmo)

(In reply to Dave Townsend [:mossop] (he/him) from comment #1)

I wonder if we'd be better off using this to avoid the about:blank load: https://searchfox.org/mozilla-central/source/docshell/base/nsIDocShell.idl#944

We probably can, but it would be hard to code that since the docshell would live in the content process...

Here is the debug output where that code is:
uri is: undefined and location is https://eggtimer.org/

Flags: needinfo?(thomasmo)

Oh, I'm sorry. I had a typo in my previous debug code. What I should have said was:

 dump(`uri is: ${uri} and location is ${location.spec}\n`);

My mistake caused the first result to come out as undefined. Any chance you could try this please?

My guess is that uri would be "https://eggtimer.org" (without the trailing slash)!

If my guess is correct, https://phabricator.services.mozilla.com/D17710 should fix the bug.

D'oh! I didn't catch that either. Here's the update:
uri is: https://eggtimer.org and location is https://eggtimer.org/

Yes--the trailing slash makes the difference

Great, I'd appreciate if you can try out the patch above. It should fix the problem, I'm pretty sure.

Yes--I can confirm that the patch fixes this bug

Thanks very much!

Pushed by eakhgari@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/34e24b0fb7b7 Only compare URI specs against parsed URI specs; r=mossop
Pushed by eakhgari@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/29da27d7e834 Only compare URI specs against parsed URI specs; r=mossop
Flags: needinfo?(ehsan)
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 66
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: