From b51e30b0b823230b473661145ea0b0114d879b48 Mon Sep 17 00:00:00 2001 From: Jason Barnabe Date: Tue, 4 Feb 2014 13:40:25 -0600 Subject: [PATCH] Fix breakage up to Firefox 28 with autocomplete --- content/edit.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/content/edit.js b/content/edit.js index 5e30ce5..a570d42 100644 --- a/content/edit.js +++ b/content/edit.js @@ -164,9 +164,13 @@ function init2() { wrapLinesE.checked = wrapLines; wrapLinesE.style.display = ""; } - if (sourceEditorType == "sourceeditor" && autocompleter != null) { - sourceEditor.extend(autocompleter); - sourceEditor.setupAutoCompletion(null); + if (sourceEditorType == "sourceeditor") { + // Up to Firefox 28, sometimes "require" will return an object when something is not available instead of throwing. + // Rather than trying to detect if autocompleter is available, let's just try to use it. + try { + sourceEditor.extend(autocompleter); + sourceEditor.setupAutoCompletion(null); + } catch (ex) { } } initStyle();