From 1fbd9f5418b7ec9c31a541e2095cd5b2e3734628 Mon Sep 17 00:00:00 2001 From: uno_tasuku Date: Thu, 2 Jul 2015 15:36:36 +0900 Subject: [PATCH] Fixed type error in chrome content_script #124 --- browser-ext/login/chrome/helpers.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/browser-ext/login/chrome/helpers.js b/browser-ext/login/chrome/helpers.js index 42afa1cd..7fbbd973 100644 --- a/browser-ext/login/chrome/helpers.js +++ b/browser-ext/login/chrome/helpers.js @@ -24,7 +24,8 @@ * ***************************************************************************** */ -var _CHROME_VERSION = parseInt(navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)[2], 10); +var _CHROME_VERSION = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./); +_CHROME_VERSION = _CHROME_VERSION && parseInt(_CHROME_VERSION[2], 10); var LAST_AUTOCOMPLETE_COMPLIANT_CHROME_VERSION = 33; @@ -99,7 +100,7 @@ function ContentHelper() { this.preventAutoFill = function($passwordField, $form) { $form.attr('autocomplete', 'off'); - if (_CHROME_VERSION > LAST_AUTOCOMPLETE_COMPLIANT_CHROME_VERSION) { + if (_CHROME_VERSION && _CHROME_VERSION > LAST_AUTOCOMPLETE_COMPLIANT_CHROME_VERSION) { console.log('using extreme measures to prevent browser form saving'); var newInput = document.createElement('input'); newInput.setAttribute('type', 'password');