Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Fix #3406, add logging of unexpected clipboard state #3430

Merged
merged 1 commit into from
Aug 31, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions addon/webextension/clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,19 @@ this.clipboard = (function() {
let el = doc.createElement("textarea");
doc.body.appendChild(el);
el.value = text;
if (!text) {
let exc = new Error("Clipboard copy given empty text");
exc.noPopup = true;
catcher.unhandled(exc);
}
el.select();
if (doc.activeElement !== el) {
let unhandledTag = doc.activeElement ? doc.activeElement.tagName : "No active element";
let exc = new Error("Clipboard el.select failed");
exc.activeElement = unhandledTag;
exc.noPopup = true;
catcher.unhandled(exc);
}
const copied = doc.execCommand("copy");
if (!copied) {
catcher.unhandled(new Error("Clipboard copy failed"));
Expand Down