Closed Bug 1421655 Opened 7 years ago Closed 7 years ago

browser.clipboard.setImageData Only Works with a Small Amount of Data

Categories

(WebExtensions :: Untriaged, defect)

defect
Not set
normal

Tracking

(firefox59 verified)

VERIFIED FIXED
mozilla59
Tracking Status
firefox59 --- verified

People

(Reporter: bchen, Assigned: baku)

Details

Attachments

(4 files)

Bug 1356543 introduced browser.clipboard.setImageData, which is now used in Screenshots.  However, there's a regression starting with the 2017-11-27-22-04-46 build of Nightly.  I think it came from bug 1420223.  More specifically: https://hg.mozilla.org/mozilla-central/diff/e60f002f07d0/toolkit/components/extensions/ext-clipboard.js#l1.32  That `apply` call will hit the function argument length limit.

STR

1. Google image search something with latest Nightly.  Page down to the bottom.
2. Start Screenshots and select save full page.
3. Click the copy button.

Expected

Image successfully copied to system clipboard.

Actual

Error notification.

The error message itself is also incorrect and misleading because the catch block did not make use of the exception.
Note this is causing a critical bug in the Screenshots' copy feature: https://github.com/mozilla-services/screenshots/issues/3850
Based on comment 0, pinging :baku.
Flags: needinfo?(amarchesini)
Assignee: nobody → amarchesini
Flags: needinfo?(amarchesini)
The problem here is that we are copy the buffer too much and we end up reaching the limit of the string size. Let's use arrayBuffer instead.
Attachment #8933249 - Flags: review?(aosmond)
To be consistent with the other method.
Attachment #8933251 - Flags: review?(aosmond)
Attachment #8933249 - Flags: review?(aosmond) → review+
Attachment #8933250 - Flags: review?(aosmond) → review+
Attachment #8933251 - Flags: review?(aosmond) → review+
Pushed by amarchesini@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/d2dff894a6dd
Using imgITools::decodeImageFromArrayBuffer instead coping data into a string, r=aosmond
https://hg.mozilla.org/integration/mozilla-inbound/rev/807297ac2445
Implementation of imgITools::decodeImageFromArrayBuffer, r=aosmond
https://hg.mozilla.org/integration/mozilla-inbound/rev/75d2ae4d07c4
Renaming imgITools::decodeImageBuffer to imgITools::decodeImageFromBuffer, r=aosmond
Attached image not blurred.PNG
I can reproduce this issue on Firefox 59.0a1 (20171128220048) under Wind 10 64-bit. 

This issue is verified as fixed on Firefox 59.0a1 (20171205100345) under Wind 10 64-bit and Mac OS X 10.13.
Status: RESOLVED → VERIFIED
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: