Closed Bug 1670200 Opened 5 years ago Closed 12 days ago

Drag image to other app from blob url doesn't work

Categories

(Core :: DOM: Copy & Paste and Drag & Drop, defect)

Firefox 82
defect

Tracking

()

RESOLVED FIXED
142 Branch
Webcompat Score 1
Tracking Status
relnote-firefox --- 142+
firefox142 --- fixed

People

(Reporter: descent-tact0m, Assigned: edgar)

References

()

Details

(Keywords: webcompat:platform-bug)

Attachments

(3 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.11 Safari/537.36

Steps to reproduce:

Steps to reproduce the problem:

  1. Open https://mdn.mozillademos.org/en-US/docs/Web/API/File/Using_files_from_web_applications$samples/Example_Using_object_URLs_to_display_images?revision=1644987
  2. Select an image
  3. Drag the image displayed on the page to another app, e.g. Word

Actual results:

The image is copied to Word

Expected results:

"blob:https://mdn.mozillademos.org/90909672-2cac-4398-9f43-6dfecc8aa987" is copied to Word

oh wait I accidently reversed the actual results and expected results

Correct my typo:

Expected results: The image is copied to Word

Actual results: "blob:https://mdn.mozillademos.org/90909672-2cac-4398-9f43-6dfecc8aa987" is copied to Word

Component: Untriaged → DOM: Drag & Drop
Product: Firefox → Core
Severity: -- → S2

(In reply to jackworks from comment #1)

oh wait I accidently reversed the actual results and expected results

Correct my typo:

Expected results: The image is copied to Word

Actual results: "blob:https://mdn.mozillademos.org/90909672-2cac-4398-9f43-6dfecc8aa987" is copied to Word

The link on comment 0 was no longer valid. I tried dragging images from other web pages to Word. I didn't encounter the issue mentioned.
It'd be great to share a link if this issue is still reproducible.

Severity: S2 → S3
Webcompat Score: --- → 1

It's this example on MDN.

The bug here is that when dragging and dropping an image from a blob URL, we treat the content "as a link to a blob", not as an image. Given that this is a core bug with a testcase, and not about "a real site", we'll remove the site-report flag here.

The data difference in nsITransferable is due to https://searchfox.org/mozilla-central/rev/058836008f131ae5591d04952a1500c9f94bedbc/dom/base/nsContentAreaDragDrop.cpp#382-386, where BlobURL is not a nsIURL, so the image data isn't set properly for blob.

Assignee: nobody → echen
Attachment #9497250 - Attachment description: WIP: Bug 1670200 - Part 1: Add log to dump flavors in nsITransferable for Drag session; → Bug 1670200 - Part 1: Add log to dump flavors in nsITransferable for drag session; r?handyman
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

Make it easier to add subtests. And also add tests for dom.events.dataTransfer.imageAsFile.enabled=false.

Depends on D255281

Attachment #9497251 - Attachment description: WIP: Bug 1670200 - Part 2: Fix support for dragging image that use blob URL; → Bug 1670200 - Part 3: Fix support for dragging image that use blob URL; r?tschuster,nika
Attachment #9497415 - Attachment description: iBug 1670200 - Part 2: Refactor test_drag_image_file.html test; r?tschuster,nika → Bug 1670200 - Part 2: Refactor test_drag_image_file.html test; r?tschuster,nika
Attachment #9497415 - Attachment description: Bug 1670200 - Part 2: Refactor test_drag_image_file.html test; r?tschuster,nika → Bug 1670200 - Part 2: Refactor test_drag_image_file.html test; r?tschuster
Attachment #9497250 - Attachment description: Bug 1670200 - Part 1: Add log to dump flavors in nsITransferable for drag session; r?handyman → Bug 1670200 - Part 3: Fix support for dragging image that use blob URL; r?tschuster
Attachment #9497250 - Attachment description: Bug 1670200 - Part 3: Fix support for dragging image that use blob URL; r?tschuster → Bug 1670200 - Part 1: Add log to dump flavors in nsITransferable for drag session; r?handyman
Attachment #9497251 - Attachment description: Bug 1670200 - Part 3: Fix support for dragging image that use blob URL; r?tschuster,nika → Bug 1670200 - Part 3: Fix support for dragging image that use blob URL; r?tschuster
Pushed by imoraru@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/7e9c51b1e125 https://hg.mozilla.org/integration/autoland/rev/1d95c28e65c4 Revert "Bug 1670200 - Part 3: Fix support for dragging image that use blob URL; r=tschuster" for causing mochitest-plain failures test_dragstart.html.

Revert for causing mochitest-plain failures test_dragstart.html.

[task 2025-07-03T21:18:28.052+00:00] 21:18:28     INFO -  TEST-PASS | dom/events/test/test_dragstart.html | link text/plain
[task 2025-07-03T21:18:28.052+00:00] 21:18:28     INFO -  Sending events for image
[task 2025-07-03T21:18:28.053+00:00] 21:18:28     INFO -  Buffered messages finished
[task 2025-07-03T21:18:28.053+00:00] 21:18:28  WARNING -  TEST-UNEXPECTED-FAIL | dom/events/test/test_dragstart.html | initial image types length - got 12, expected 8
[task 2025-07-03T21:18:28.053+00:00] 21:18:28     INFO -      SimpleTest.is@SimpleTest/SimpleTest.js:509:14
[task 2025-07-03T21:18:28.053+00:00] 21:18:28     INFO -      checkTypes@dom/events/test/test_dragstart.html:606:7
[task 2025-07-03T21:18:28.053+00:00] 21:18:28     INFO -      doDragStartImage@dom/events/test/test_dragstart.html:478:13
[task 2025-07-03T21:18:28.053+00:00] 21:18:28     INFO -      ondragstart@dom/events/test/test_dragstart.html:1:17
[task 2025-07-03T21:18:28.053+00:00] 21:18:28     INFO -      synthesizeMouseAtPoint@SimpleTest/EventUtils.js:794:32
[task 2025-07-03T21:18:28.053+00:00] 21:18:28     INFO -      synthesizeMouse@SimpleTest/EventUtils.js:557:10
[task 2025-07-03T21:18:28.053+00:00] 21:18:28     INFO -      sendMouseEventsForDrag@dom/events/test/test_dragstart.html:126:18
[task 2025-07-03T21:18:28.053+00:00] 21:18:28     INFO -      afterDragTests@dom/events/test/test_dragstart.html:62:25
[task 2025-07-03T21:18:28.053+00:00] 21:18:28     INFO -      setTimeout handler*SimpleTest_setTimeoutShim@SimpleTest/SimpleTest.js:922:41
[task 2025-07-03T21:18:28.053+00:00] 21:18:28     INFO -      doDragStartSelection@dom/events/test/test_dragstart.html:181:13
[task 2025-07-03T21:18:28.054+00:00] 21:18:28     INFO -      ondragstart@dom/events/test/test_dragstart.html:1:21
[task 2025-07-03T21:18:28.054+00:00] 21:18:28     INFO -      synthesizeMouseAtPoint@SimpleTest/EventUtils.js:794:32
[task 2025-07-03T21:18:28.054+00:00] 21:18:28     INFO -      synthesizeMouse@SimpleTest/EventUtils.js:557:10
[task 2025-07-03T21:18:28.054+00:00] 21:18:28     INFO -      runTests@dom/events/test/test_dragstart.html:26:18
[task 2025-07-03T21:18:28.054+00:00] 21:18:28     INFO -      setTimeout handler*SimpleTest_setTimeoutShim@SimpleTest/SimpleTest.js:922:41
[task 2025-07-03T21:18:28.054+00:00] 21:18:28     INFO -      onload@dom/events/test/test_dragstart.html:1:11
[task 2025-07-03T21:18:28.054+00:00] 21:18:28     INFO -  TEST-PASS | dom/events/test/test_dragstart.html | initial image text/x-moz-url check
Flags: needinfo?(echen)
Status: ASSIGNED → RESOLVED
Closed: 12 days ago
Resolution: --- → FIXED
Target Milestone: --- → 142 Branch
Flags: needinfo?(echen)
Duplicate of this bug: 1967706

:edgar did you want to mention this in the fx142 release notes? Feel free to nominate if so.

Flags: needinfo?(echen)

Release Note Request (optional, but appreciated)
[Why is this notable]: Improve how Firefox handles blob images in drag-and-drop operations.
[Affects Firefox for Android]: Yes, but Firefox doesn't support drag-and-drop with touch input.
[Suggested wording]: Drag-and-drop support for blob images has been improved.
[Links (documentation, blog post, etc)]: None.

relnote-firefox: --- → ?
Flags: needinfo?(echen)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: