Closed Bug 1664444 Opened 4 years ago Closed 3 years ago

Switch Screenshots from using drawWindow to captureTab, to work with Fission iframes

Categories

(Firefox :: Screenshots, defect, P1)

defect

Tracking

()

RESOLVED FIXED
86 Branch
Fission Milestone M6c
Tracking Status
firefox86 --- fixed

People

(Reporter: zombie, Assigned: emmamalysz)

References

(Blocks 1 open bug, Regressed 1 open bug)

Details

Attachments

(1 file)

The canvas drawWindow method is sync, and thus can't be Fission-compatible for OOP iframes.

In bug 1636508, I introduced additional arguments to the tabs.captureTab method to specify an area of the document, and the scale (devicePixelRatio). They're not documented yet on MDN, but you should be able to understand them from the schema or tests in the second patch.

Emma or Sam, can you please check if the API addition is enough and appropriate for the Screenshots usecase, ideally in the next week, so that we could document and announce changes to addon devs?

Flags: needinfo?(sfoster)
Flags: needinfo?(emalysz)
Fission Milestone: --- → M7

The only issue I see is the lack of a bgColor option. Screenshots currently calls drawWindow(window, left, top, width, height, "#fff");. See shooter.js.

Is a background-color implicit in captureTab or might we get transparent screenshots without? Otherwise it looks like this should work.

The canvas context we use to call drawWindow is pretty much just used to get a data-uri from. In some cases we also use it to re-encode as JPEG if some capture size threshold is exceeded. We would have to either re-work that or (my preference) remove that step - see https://bugzilla.mozilla.org/show_bug.cgi?id=1649915#c6. - but I don't think that is relevant from the point of view of the extension api.

Flags: needinfo?(tomica)
Flags: needinfo?(sfoster)
Flags: needinfo?(emalysz)

(In reply to Sam Foster [:sfoster] (he/him) from comment #1)

The only issue I see is the lack of a bgColor option. Screenshots currently calls drawWindow(window, left, top, width, height, "#fff");. See shooter.js.

Is a background-color implicit in captureTab or might we get transparent screenshots without? Otherwise it looks like this should work.

Yeah, we have a hard-coded opaque white background, don't think there's need to enable changing that for now:
https://searchfox.org/mozilla-central/rev/f4b4008f5e/toolkit/components/extensions/parent/ext-tabs-base.js#136

The canvas context we use to call drawWindow is pretty much just used to get a data-uri from. In some cases we also use it to re-encode as JPEG if some capture size threshold is exceeded. We would have to either re-work that or (my preference) remove that step - see https://bugzilla.mozilla.org/show_bug.cgi?id=1649915#c6. - but I don't think that is relevant from the point of view of the extension api.

Right, you should be able avoid using a canvas from inside the page at all.

Flags: needinfo?(tomica)

Hi Emma, this is a Screenshots extension bug that will need to be fixed soon to be compatible with Fission. You can enabled Fission (Site Isolation) in Firefox Nightly's "Nightly Experiments" preferences: about:preferences#experimental

btw, the Module Owner wiki lists you as the triage owner of the "Firefox :: Screenshots" component, but Bugzilla still lists Ian Bicking as the triage owner.

Fission Milestone: M7 → M6c
Flags: needinfo?(emalysz)
Severity: -- → S2
Flags: needinfo?(emalysz)
Priority: -- → P1
Assignee: nobody → emalysz
Blocks: 1649915
Pushed by emalysz@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/90fd0f5a6bb2
make screenshots fission compatible and remove unused code r=sfoster
Flags: needinfo?(emalysz)
Pushed by abutkovits@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1bc4bc380261
make screenshots fission compatible and remove unused code r=sfoster
Flags: needinfo?(emalysz)
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 86 Branch
Regressions: 1683194
Regressions: 1696758
Regressions: 1696637
Regressions: 1643719
Regressions: 1700736
Regressions: 1699410
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: