From faa8ee63b035354cbe3a85ef5e7d2333f05136f6 Mon Sep 17 00:00:00 2001 From: Jordan Bates Date: Thu, 15 Aug 2013 20:44:06 -0700 Subject: [PATCH] Lets not use try, catch --- builds/4chan-X.user.js | 14 ++------------ builds/crx/script.js | 14 ++------------ src/Posting/QuickReply.coffee | 8 +------- 3 files changed, 5 insertions(+), 31 deletions(-) diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index d63bbf8c7..c0cad046a 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -5436,19 +5436,9 @@ return QR.nodes.fileInput.click(); }, fileInput: function(files) { - var check, err, file, length, max, post, _i, _len; + var file, length, max, post, _i, _len; - try { - if (files instanceof Event) { - check = true; - } - } catch (_error) { - err = _error; - if (this instanceof Element) { - check = true; - } - } - if (check) { + if (this instanceof Element) { files = __slice.call(this.files); QR.nodes.fileInput.value = null; } diff --git a/builds/crx/script.js b/builds/crx/script.js index ab26be75f..dbd30b602 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -5446,19 +5446,9 @@ return QR.nodes.fileInput.click(); }, fileInput: function(files) { - var check, err, file, length, max, post, _i, _len; + var file, length, max, post, _i, _len; - try { - if (files instanceof Event) { - check = true; - } - } catch (_error) { - err = _error; - if (this instanceof Element) { - check = true; - } - } - if (check) { + if (this instanceof Element) { files = __slice.call(this.files); QR.nodes.fileInput.value = null; } diff --git a/src/Posting/QuickReply.coffee b/src/Posting/QuickReply.coffee index be71207b9..46d13641c 100755 --- a/src/Posting/QuickReply.coffee +++ b/src/Posting/QuickReply.coffee @@ -443,13 +443,7 @@ QR = QR.nodes.fileInput.click() fileInput: (files) -> - try - if files instanceof Event # file input - check = true - catch err - if @ instanceof Element # file input - check = true - if check + if @ instanceof Element # file input, revert to "files instanceof Event" after a Pale Moon update files = [@files...] QR.nodes.fileInput.value = null # Don't hold the files from being modified on windows {length} = files