Bug 1646457 Comment 6 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Current working hypothesis: [`TextEditor::Copy`](https://searchfox.org/mozilla-central/rev/c2e3ac11be4837718c2604e58085fbc8252b69dd/editor/libeditor/TextEditor.cpp#1221) (called from [`EditorEventListener::KeyPress`](https://searchfox.org/mozilla-central/rev/c2e3ac11be4837718c2604e58085fbc8252b69dd/editor/libeditor/EditorEventListener.cpp#610)) fails somewhere.

[`DataTransfer::SetData`](https://searchfox.org/mozilla-central/rev/d25eb00ab4e90cc0130cd18f303a04cc2a2f8409/dom/events/DataTransfer.cpp#391) is one of the inner stack frames of `TextEditor::Copy`, and for the flavor "text/html" it's called with the string of the first selected table cell.
It seems it's called via some JS from`TextEditor::Copy`, so the next step is to determine from where exactly.
Current working hypothesis: [`TextEditor::Copy`](https://searchfox.org/mozilla-central/rev/c2e3ac11be4837718c2604e58085fbc8252b69dd/editor/libeditor/TextEditor.cpp#1221) (called from [`EditorEventListener::KeyPress`](https://searchfox.org/mozilla-central/rev/c2e3ac11be4837718c2604e58085fbc8252b69dd/editor/libeditor/EditorEventListener.cpp#610)) fails somewhere.

[`DataTransfer::SetData`](https://searchfox.org/mozilla-central/rev/d25eb00ab4e90cc0130cd18f303a04cc2a2f8409/dom/events/DataTransfer.cpp#391) is one of the inner stack frames of `TextEditor::Copy`, and for the flavor "text/html" it's called with the string of the first selected table cell.
It seems it's called via some JS from`TextEditor::Copy`, so the next step is to determine from where exactly.

It seems filling the clipboard is done by some JS of the website. At least it calls [`Selection::Stringify`](https://searchfox.org/mozilla-central/rev/803b368879fa332e8e2c1840bf1ec164f7ed2c32/dom/base/Selection.cpp#275,290) for the "text/plain" flavor.
Still need to figure out how the clipboard content for "text/html" is generated. Presumably, it's generated from the first range of the Selection, because that corresponds to the exported content.

Back to Bug 1646457 Comment 6