Closed Bug 1259279 Opened 8 years ago Closed 8 years ago

Cut/Paste uses cached image.

Categories

(Core :: DOM: Serializers, defect)

45 Branch
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: 209software, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0
Build ID: 20160315153207

Steps to reproduce:

I am writing a web script that generates a status bar image in code.  The image always has the same name.  
- Load the page.
- Right Click image and "Copy Image"
- Paste into a new email in Outlook.
- modify the source code so that the image is different (it may be possible to use code that displays the time as a graphic)
- reload the page and not that the image is different
- right click the image and "Copy Image"
- paste it into the same email on Outlook


Actual results:

Copying the updated image (right click, Copy Image) and pasting it to Outlook always pastes in the first version of the image, even when the updated image is shown in the browser.


Expected results:

the copy command should have overwritten the old image data with the updated image data.
Component: Untriaged → Serializers
Product: Firefox → Core
reporter, any chance for a testcase?
Flags: needinfo?(209software)
Try this.

- open Outlook (or Thunderbird) and create a new email
- open FF and browse to http://www.209software.com/timeimage.aspx
- right click the image and COPY IMAGE
- Paste it into the empty email
- Go back to FF and REFRESH, updating the image to a new time.
- right click the image and COPY IMAGE
- Paste it into the empty email after the first pasted image.

It will paste the OLD time again, even though the image has a new time.

(This may not be a FF issue, as I just realized that IE does the same thing)
Flags: needinfo?(209software)
here is a youtube of this.
https://youtu.be/AD1Bkecux9A
I see this behaviour with Chrome, too.
I just tested this on my Ubuntu Linux Laptop, and got the same behavior, the refetching on the first paste, then never fetching again, using the cache for al subsequent pastes.  So It's not Windows.
Neil knows more about what's going on here (it depends into what application you're pasting). He may also know if there's a better component for this bug.
Flags: needinfo?(enndeakin)
When we do Copy Image, we put both an image in the OS native format and an html string for the image (such as <img src="hello.jpg">) on the clipboard. I confirmed here that the expected image is being copied properly. On Mac, for example, you can open the clipboard viewer (Finder -> Edit -> Show Clipboard) or paste into Preview and get the image with the expected time. On Windows, you can paste into Paint.

The destination application, in this case I used Thunderbird, is using the html string instead. Our editor code prefers html over image data (see nsHTMLEditor::PrepareHTMLTransferable) when pasting, likely so that style and attributes from the <img> tag are retained. So Thunderbird is doing that and I suppose Outlook does that too which would make sense as they both allow html editing.

So I think this is working as designed. This is an unusual case but I think we want to retain the existing preference of using html over the image when pasting.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Flags: needinfo?(enndeakin)
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.