Closed Bug 1585284 Opened 5 years ago Closed 5 years ago

Resolving the dataTransfer.files[n].text promise when triggered from a drag and drop event causes a NS_ERROR_FAILURE error

Categories

(Core :: DOM: File, defect, P2)

69 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla71
Tracking Status
firefox71 --- fixed

People

(Reporter: bluebottel, Assigned: baku)

References

Details

Attachments

(3 files)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:69.0) Gecko/20100101 Firefox/69.0

Steps to reproduce:

Demo here: http://jsfiddle.net/0q5k6m9d/

Set up a drop zone and add a ondrop handler. In the ondrop handler function attempt to resolve the promise to get the file content like so

event.dataTransfer.files[0].text(fileContent => { ... }

I tested this on Ubuntu 18.04 and Windows 10 with Firefox 69.01

Actual results:

"NS_ERROR_FAILURE" is written to the console and the execution of the script is halted.

Expected results:

The file's content should be accessible after the promise resolves.

Component: Untriaged → DOM: Events
Product: Firefox → Core

Looks the NS_ERROR_FAILURE may be thrown from Blob implementation... moving this bug to DOM:File ...

Component: DOM: Events → DOM: File

Looks like baku (somewhat recently) implemented this in bug 1557121 so he may have the most informed opinion.

Flags: needinfo?(amarchesini)
Priority: -- → P2
Assignee: nobody → amarchesini
Flags: needinfo?(amarchesini)
Pushed by amarchesini@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/30100f2c6128
Use nsIGlobalObject in any Blob/File CTOR, r=smaug
https://hg.mozilla.org/integration/autoland/rev/bee7aebbca69
Use BlobImpl in MutableBlobStorage instead of Blob, r=smaug
https://hg.mozilla.org/integration/autoland/rev/87469bcb7a13
Force global in Blob CTOR, r=smaug
Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla71
Regressions: CVE-2021-38504
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: