Closed Bug 1783086 Opened 2 years ago Closed 1 year ago

`WebDriver:Print` implementation missing `background` argument

Categories

(Remote Protocol :: Marionette, defect, P1)

Default
defect
Points:
2

Tracking

(firefox113 fixed)

RESOLVED FIXED
113 Branch
Tracking Status
firefox113 --- fixed

People

(Reporter: kaylafire, Assigned: Sasha)

References

(Blocks 2 open bugs)

Details

(Whiteboard: [webdriver:m6], [wptsync upstream] [webdriver:relnote])

Attachments

(8 files)

When using WebDriver:Print though the WebDriver crate and geckodriver, marionette's current implementation ignores the parameter named background, and instead looks for a parameter named printBackground (https://searchfox.org/mozilla-central/source/remote/shared/PDF.jsm#45), therefore rendering it impossible to specify background rendering behavior for PDFs' in webdriver.

an example of this behavior in geckodriver with irreverent JSON parameters removed.

webdriver::server DEBUG -> POST /session/<SESSION_ID>/print {"background":true, <removed>, "printBackground":true, <removed>}
Marionette DEBUG 0 -> [0,5,"WebDriver:Print",{"background":true, <removed> }]
RemoteAgent DEBUG PDF output written to /build/Temp-<UUID>/marionette.pdf

when this returns, even though background is specified to be true, there are no backgrounds rendered in the resulting PDF.

See Also: → 1604506

I've fixed this in my local checkout of mozilla-central, I'm hoping to have a patch ready for review soon.

Assignee: nobody → dev
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Severity: -- → S3
Priority: -- → P3

Thank you for finding this incompatibility with the WebDriver spec and even working on a fix! This is great to see. I'll be able to have a look at the patch soon.

Blocks: webdriver
Attachment #9288744 - Attachment description: Bug 1783086 - Fix `WebDriver:Print` interface function to accept named parameter `background` from the webdriver spec. r=whimboo → Bug 1783086 - Fix `print.addDefaultSettings` function to accept named parameter `background` from the webdriver spec. r=whimboo

This attempts to assert the functionality of the background parameter by testing and assuming WebDriver:Print
will attempt to be somewhat deterministic.

pdf_options.py attempts to test for the functionality of the background parameter indirectly though equivalence using the following steps.

  • First, let identity be the result of WebDriver:Print({})

  • Second, let background be the result of WebDriver:Print({ background: True })

  • Third, let identity_check be the result of WebDriver:Print({})

  • Fourth, assert that identity != background

  • Fifth, assert that identity == identity_check

Depends on D153903

Attachment #9288744 - Attachment description: Bug 1783086 - Fix `print.addDefaultSettings` function to accept named parameter `background` from the webdriver spec. r=whimboo → Bug 1783086 - Fix `WebDriver:Print` interface by renaming all `printBackground` instances to `background`. r=whimboo
Attachment #9288744 - Attachment description: Bug 1783086 - Fix `WebDriver:Print` interface by renaming all `printBackground` instances to `background`. r=whimboo → Bug 1783086 - Rename all `printBackground` instances to `background` as per `WebDriver` spec. r=whimboo
Attachment #9290173 - Attachment description: Bug 1783086 - Add identity test and background rendering test to assert webdriver spec and functionality. r=whimboo → Bug 1783086 - Add pdf background rendering test to assert webdriver spec and functionality. r=whimboo
Attachment #9288744 - Attachment description: Bug 1783086 - Rename all `printBackground` instances to `background` as per `WebDriver` spec. r=whimboo → Bug 1783086 - [marionette] Rename `printBackground` to `background` for WebDriver compatibility. r=whimboo
Attachment #9290173 - Attachment description: Bug 1783086 - Add pdf background rendering test to assert webdriver spec and functionality. r=whimboo → Bug 1783086 - Add pdf background rendering setting test to assert webdriver spec and functionality. r=whimboo

Hi there, I've added the results of running ./mach test with some extra code to dump the PDF output to files when testing.

I've run the tests multiple times, there's times where the equality test has run successfully up to 9 times in a row, but it seems to be inconsistent. These pdf's are an example of the changes the browser is making per PDF print operation.

also, I've found biodiff to be very useful in finding the specific changes between the two versions.

Hi Kayla, as you got a review from James a while ago I wonder if you are still interested to get his proposal with pdf.js implemented. Please let us know if not. Thanks!

Flags: needinfo?(dev)

Hi Henrik!

Yes I still intend to implement the test suggestions from the review.
I had/have gotten caught up in other pressing work, my apologies for the radio silence.

I'm hoping to have the time to implement it this week.

Flags: needinfo?(dev)

No worries. Thanks for letting us know!

(In reply to Kayla Firestack [:kaylafire] from comment #10)

Yes I still intend to implement the test suggestions from the review.
I had/have gotten caught up in other pressing work, my apologies for the radio silence.

I'm hoping to have the time to implement it this week.

Hi Kayla, we would kinda appreciate a fix here. So if you foresee that you won't have the time in the near future to continue please let us know and we might have to take over the remaining work. Thanks!

Flags: needinfo?(dev)

Hi Henrik, I was unable to continue working on this due to environment issues, If someone else has time to finish the test for this I welcome it.
I'm so sorry I didn't see this sooner, I've been out of free time starting and on-boarding new job I couldn't account for before.

Flags: needinfo?(dev)

Thanks for letting us know and your patch for the print command! We will have to see how to get this finished and landed.

Assignee: dev → nobody
Status: ASSIGNED → NEW

Setting to P2 given that we most likely want to work on that feature for BiDi in the next milestone.

Priority: P3 → P2
Whiteboard: [webdriver:backlog]
Product: Testing → Remote Protocol
Blocks: 1818733
Assignee: nobody → aborovova
Status: NEW → ASSIGNED
Points: --- → 2
Priority: P2 → P1
Whiteboard: [webdriver:backlog] → [webdriver:m6]
No longer blocks: 1806807
Attachment #9321316 - Attachment description: Bug 1783086 - [wdspec] Add fixture to render PDF to png for marionette. → Bug 1783086 - [wdspec] Add fixtures to render PDF to png and compare two pngs for marionette.
Pushed by aborovova@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a5f7eb5de08b
[marionette] Rename `printBackground` to `background` for WebDriver compatibility. r=webdriver-reviewers,whimboo
https://hg.mozilla.org/integration/autoland/rev/46736eb834cb
[wdspec] Add fixtures to render PDF to png and compare two pngs for marionette. r=webdriver-reviewers,whimboo
https://hg.mozilla.org/integration/autoland/rev/95635d61a8fa
[wdspec] Add tests for background argument of "Webdriver:Print" command. r=webdriver-reviewers,whimboo
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/38958 for changes under testing/web-platform/tests
Whiteboard: [webdriver:m6] → [webdriver:m6], [wptsync upstream]
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 113 Branch
Upstream PR merged by jgraham
Whiteboard: [webdriver:m6], [wptsync upstream] → [webdriver:m6], [wptsync upstream] [webdriver:relnote]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: