Closed Bug 1678347 Opened 4 years ago Closed 3 years ago

Implement support for page ranges in print endpoint

Categories

(Remote Protocol :: Marionette, enhancement)

Default
enhancement

Tracking

(firefox96 fixed)

RESOLVED FIXED
96 Branch
Tracking Status
firefox96 --- fixed

People

(Reporter: jgraham, Assigned: jgraham)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

This allows printing only specified page ranges.

We take them in the form ["1-2", 4, "5-"] and convert to a flat array
of the form [1,2,4,4,5,2147483647], which is appropriate for
nsIPrintSettings.

Testing relies on the fact that wpt vendored pdf.js for print
reftests; using the same mechaism we can ensure the correct pages were
printed.

Assignee: nobody → james
Status: NEW → ASSIGNED

James, I assume you missed to continue on your patch. Will you have the time to do so?

Flags: needinfo?(james)

Done.

Flags: needinfo?(james)

Any updates on this?

Submitting page ranges is now giving me:

1633029152691	Marionette	DEBUG	0 -> [0,3,"WebDriver:Print",{"background":false,"margin":{"bottom":1,"left":1,"right":1,"top":1},"orientation":"portrait","page":{"height":27.94,"width":21.59},"pageRanges":[],"scale":1,"shrinkToFit":true}]
1633029154472	Marionette	DEBUG	PDF output written to /var/folders/fx/nlx77ccs72g808pr1994_xtw0000gn/T/Temp-c96daea6-1e2f-1144-8b0a-27ba61adc7d9/marionette.pdf
1633029154483	Marionette	DEBUG	0 <- [1,3,{"error":"unknown error","message":"RangeError: too many arguments provided for a function call","stacktrace":"GeckoDriver.prototype.print@chrome://remote/content/marionette/driver.js:2917:37\n"},null]

note that it isn't an issue when there is only one page, but more than one page throws this error. This is showing an empty array (which should work according to spec), but if there is more than one page, it will always return this error.

Full logs for 1 page vs > 1 page:
https://gist.github.com/titusfortner/03fa958b885f0a92cab01525f12b3f5d

Titus, which version of Firefox did you use? I assume it's a 92 release? Can you please try with Firefox 93 beta? I'm fairly sure that your issue is just bug 1719124.

James, it looks like the work on this patch has been stalled. Are you going to finish it up, or won't you have the time for it?

Flags: needinfo?(james)
Flags: needinfo?(titus.fortner)

Wow, yes, updating to v93 no longer gives me the error, and it looks like I can get the full page screenshot even when not headless, which is great. Thanks!

Flags: needinfo?(titus.fortner)

I've updated the patch.

Flags: needinfo?(james)
Attachment #9188873 - Attachment description: Bug 1678347 - Implement pageRanges support for marionette, → Bug 1678347 - [marionette] Implement pageRanges support.
Pushed by james@hoppipolla.co.uk: https://hg.mozilla.org/integration/autoland/rev/b709a9d0378a [marionette] Implement pageRanges support. r=webdriver-reviewers,whimboo
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/31541 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 96 Branch
Upstream PR merged by moz-wptsync-bot
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: