From dcb6f68826bd64d6cb41d2d7a0d5da1a58da9a1b Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Thu, 24 Oct 2019 20:01:04 -0400 Subject: Don't pass null textSource into searchSource --- ext/bg/js/settings-popup-preview.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'ext/bg/js') diff --git a/ext/bg/js/settings-popup-preview.js b/ext/bg/js/settings-popup-preview.js index b12fb726..ce6da4c0 100644 --- a/ext/bg/js/settings-popup-preview.js +++ b/ext/bg/js/settings-popup-preview.js @@ -158,9 +158,14 @@ class SettingsPopupPreview { const range = document.createRange(); range.selectNode(textNode); const source = new TextSourceRange(range, range.toString(), null); + if (source === null) { return; } this.frontend.textSourceLast = null; - await this.frontend.searchSource(source, 'script'); + try { + await this.frontend.searchSource(source, 'script'); + } finally { + source.cleanup(); + } await this.frontend.lastShowPromise; if (this.frontend.popup.isVisible()) { -- cgit v1.2.3