Closed Bug 1654476 Opened 5 years ago Closed 5 years ago

[Linux/Gtk] Firefox fails to paste text/html mime if content="text/html; is missing

Categories

(Core :: Widget: Gtk, defect, P2)

defect

Tracking

()

RESOLVED FIXED
81 Branch
Tracking Status
firefox81 --- fixed

People

(Reporter: stransky, Assigned: stransky)

References

()

Details

Attachments

(3 files)

Firefox fails to paste text/html mime if there are text/plain formats in clipboard on Linux/Gtk.

echo '<b>Bold</b><i>Italics</i>Plain' | wl-copy --type text/html

puts those targets at clipboard:

$xclip -o -t TARGETS

text/x-moz-url-priv
text/plain
text/plain;charset=utf-8
STRING
TEXT
COMPOUND_TEXT
UTF8_STRING
text/_moz_htmlinfo
text/_moz_htmlcontext
text/html
TARGETS
TIMESTAMP

echo '<b>Bold</b><i>Italics</i>Plain' | wl-copy

puts those targets at clipboard:

[komat@localhost ~]$ xclip -o -t TARGETS
text/plain
text/plain;charset=utf-8
STRING
TEXT
COMPOUND_TEXT
UTF8_STRING
TARGETS
TIMESTAMP

so the clipboard contains plain text along the html and other formats.

It does not work because there's missing content="text/html; field so we failed to convert it at ConvertHTMLtoUCS2(). Maybe other applications (Chrome, OpenOffice) are not so strict and don't request the metadata.

Summary: [Linux/Gtk] Firefox fails to paste text/html mime if there are text/plain formats in clipboard → [Linux/Gtk] Firefox fails to paste text/html mime if content="text/html; is missing
  • Fallback to utf-8 when charset is not set for text/html.
  • Move GetHTMLCharset() call out of ConvertHTMLtoUCS2() and use charset param there.
  • Make GetHTMLCharset()/ConvertHTMLtoUCS2() return bool.

Depends on D84492

Pushed by ncsoregi@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/af66e1ce7d9d [Linux/Gtk] Provide more logging to clipboard code, r=jhorak https://hg.mozilla.org/integration/autoland/rev/a32f54d0690c [Linux/Gtk] Fallback to utf-8 when charset is not set for text/html, r=jhorak https://hg.mozilla.org/integration/autoland/rev/955f20019d71 [Linux/Gtk] GetHTMLCharset() logging fixes, r=jhorak
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: