Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marius-wieschollek/passwords-webextension.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius David Wieschollek <passwords.public@mdns.eu>2021-12-11 17:51:02 +0300
committerMarius David Wieschollek <passwords.public@mdns.eu>2021-12-11 17:51:02 +0300
commit04bb5029db2c6bd2e0b427f8a86ced30bbf09c04 (patch)
tree4e337f81098f83726077751de2e021f7c92a49c5
parent610c6774c582c94cf1e7ed4a8ca0097ef98d661a (diff)
[#200] Prevent errors in field collection from causing site errors
Signed-off-by: Marius David Wieschollek <passwords.public@mdns.eu>
-rw-r--r--src/js/Services/FormService.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/js/Services/FormService.js b/src/js/Services/FormService.js
index 4c14580..a66c616 100644
--- a/src/js/Services/FormService.js
+++ b/src/js/Services/FormService.js
@@ -1,9 +1,16 @@
export default class FormService {
getPasswordFields(rootNode = document) {
- if(!rootNode || rootNode.querySelectorAll) rootNode = document;
- let fields = rootNode.querySelectorAll('input[type="password"]'),
- excludes = ['fake', 'hidden'],
+ let fields;
+ try {
+ if(!rootNode || rootNode.querySelectorAll) rootNode = document;
+ fields = rootNode.querySelectorAll('input[type="password"]');
+ } catch(e) {
+ console.error(e);
+ return [];
+ }
+
+ let excludes = ['fake', 'hidden'],
passwordFields = [];
loop: for(let field of fields) {