hterm: workaround FF bug with selectAllChildren
In some situations, it looks like FF throws NS_ERROR_FAILURE when we
call Selection.selectAllChildren(). Add a try/catch block to prevent
the temporary node being stuck in the DOM.
Going by the upstream report, there doesn't seem to be a way for us
to workaround the bug.
Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1178676
Bug: 836939
Change-Id: Id0f484f5b7e1e2f3370895cbc94074690a4aad03
Reviewed-on: https://chromium-review.googlesource.com/c/1252412
Reviewed-by: Vitaliy Shipitsyn <vsh@google.com>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/hterm/js/hterm_terminal.js b/hterm/js/hterm_terminal.js
index 0ed6b86..6180e05 100644
--- a/hterm/js/hterm_terminal.js
+++ b/hterm/js/hterm_terminal.js
@@ -3081,7 +3081,12 @@
var focusNode = selection.focusNode;
var focusOffset = selection.focusOffset;
- selection.selectAllChildren(copySource);
+ // FF sometimes throws NS_ERROR_FAILURE exceptions when we make this call.
+ // Catch it because a failure here leaks the copySource node.
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1178676
+ try {
+ selection.selectAllChildren(copySource);
+ } catch (ex) {}
hterm.copySelectionToClipboard(this.document_);