1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-12 22:33:35 +00:00

lint fixes

This commit is contained in:
Kyle Spearrin
2017-07-14 15:34:05 -04:00
parent cf850838b5
commit e4baa19232
24 changed files with 94 additions and 83 deletions

View File

@@ -23,7 +23,16 @@ paths.cssDir = paths.popupDir + 'css/';
paths.webfontsDir = './src/webfonts/'; paths.webfontsDir = './src/webfonts/';
gulp.task('lint', function () { gulp.task('lint', function () {
return gulp.src(paths.popupDir + 'app/**/*.js') return gulp.src([
paths.popupDir + '**/*.js',
'./src/services/**/*.js',
'./src/notification/**/*.js',
'./src/models/**/*.js',
'./src/scripts/**/*.js',
//'./src/content/**/*.js',
'./src/overlay/**/*.js',
'./src/background.js'
])
.pipe(jshint()) .pipe(jshint())
.pipe(jshint.reporter('default')); .pipe(jshint.reporter('default'));
}); });

View File

@@ -386,7 +386,7 @@ function messageTab(tabId, command, data, callback) {
}; };
if (data) { if (data) {
obj['data'] = data; obj.data = data;
} }
chrome.tabs.sendMessage(tabId, obj, function () { chrome.tabs.sendMessage(tabId, obj, function () {

View File

@@ -5,13 +5,13 @@
if (window.location.hostname.indexOf('bitwarden.com') === -1) { if (window.location.hostname.indexOf('bitwarden.com') === -1) {
chrome.storage.local.get('neverDomains', function (obj) { chrome.storage.local.get('neverDomains', function (obj) {
var domains = obj['neverDomains']; var domains = obj.neverDomains;
if (domains && domains.hasOwnProperty(window.location.hostname)) { if (domains && domains.hasOwnProperty(window.location.hostname)) {
return; return;
} }
chrome.storage.local.get('disableAddLoginNotification', function (obj) { chrome.storage.local.get('disableAddLoginNotification', function (obj) {
if (!obj || !obj['disableAddLoginNotification']) { if (!obj || !obj.disableAddLoginNotification) {
chrome.runtime.sendMessage({ chrome.runtime.sendMessage({
command: 'bgCollectPageDetails' command: 'bgCollectPageDetails'
}); });

View File

@@ -1,7 +1,7 @@
// THIS FILE IS NOT CURRENTLY IN USE // THIS FILE IS NOT CURRENTLY IN USE
// IT IS NOT LOADED IN THE MANIFEST // IT IS NOT LOADED IN THE MANIFEST
!(function () { (function () {
chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) { chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {
if (msg.command === 'openOverlayPopup') { if (msg.command === 'openOverlayPopup') {
closePopup(); closePopup();

View File

@@ -41,7 +41,7 @@ var TokenRequest = function (email, masterPasswordHash, provider, token, remembe
obj.devicePushToken = this.device.pushToken; obj.devicePushToken = this.device.pushToken;
} }
if (this.token && this.provider != null && (typeof this.provider !== 'undefined')) { if (this.token && this.provider !== null && (typeof this.provider !== 'undefined')) {
obj.twoFactorToken = this.token; obj.twoFactorToken = this.token;
obj.twoFactorProvider = this.provider; obj.twoFactorProvider = this.provider;
obj.twoFactorRemember = this.remember ? '1' : '0'; obj.twoFactorRemember = this.remember ? '1' : '0';

View File

@@ -149,7 +149,7 @@ var Folder = function (obj, alreadyEncrypted) {
} }
}; };
!function () { (function () {
CipherString.prototype.decrypt = function (orgId) { CipherString.prototype.decrypt = function (orgId) {
if (this.decryptedValue) { if (this.decryptedValue) {
var deferred = Q.defer(); var deferred = Q.defer();
@@ -274,4 +274,4 @@ var Folder = function (obj, alreadyEncrypted) {
return deferred.promise; return deferred.promise;
}; };
}(); })();

View File

@@ -10,7 +10,7 @@ window[window.GoogleAnalyticsObject] = function (action, param1, param2, param3,
chrome.storage.local.get('disableGa', function (obj) { chrome.storage.local.get('disableGa', function (obj) {
// Default for Firefox is disabled. // Default for Firefox is disabled.
if ((isFirefox && obj['disableGa'] === undefined) || obj['disableGa']) { if ((isFirefox && obj.disableGa === undefined) || obj.disableGa) {
return; return;
} }

View File

@@ -4,7 +4,7 @@
this.info = infoCallback; this.info = infoCallback;
this.iframe = null; this.iframe = null;
this.connectorLink = document.createElement('a'); this.connectorLink = document.createElement('a');
}; }
U2f.prototype.init = function (data) { U2f.prototype.init = function (data) {
var self = this; var self = this;
@@ -44,7 +44,7 @@ U2f.prototype.validMessage = function (event) {
} }
return event.data.indexOf('success|') === 0 || event.data.indexOf('error|') === 0 || event.data.indexOf('info|') === 0; return event.data.indexOf('success|') === 0 || event.data.indexOf('error|') === 0 || event.data.indexOf('info|') === 0;
} };
U2f.prototype.stop = function () { U2f.prototype.stop = function () {
this.sendMessage('stop'); this.sendMessage('stop');
@@ -67,4 +67,4 @@ U2f.prototype.base64Encode = function (str) {
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) { return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) {
return String.fromCharCode('0x' + p1); return String.fromCharCode('0x' + p1);
})); }));
} };

View File

@@ -25,7 +25,7 @@ function ApiService(tokenService, appIdService, utilsService, logoutCallback) {
this.utilsService = utilsService; this.utilsService = utilsService;
initApiService(); initApiService();
}; }
function initApiService() { function initApiService() {
// Auth APIs // Auth APIs
@@ -482,7 +482,7 @@ function initApiService() {
console.log('Logging out from apiService at ' + new Date() + '. Reason: Status ' + jqXHR.status + '.'); console.log('Logging out from apiService at ' + new Date() + '. Reason: Status ' + jqXHR.status + '.');
console.log(jqXHR); console.log(jqXHR);
if (self && self.logoutCallback) { if (self && self.logoutCallback) {
self.logoutCallback(true, function () { }) self.logoutCallback(true, function () { });
} }
else { else {
chrome.runtime.sendMessage({ command: 'logout', expired: true }); chrome.runtime.sendMessage({ command: 'logout', expired: true });
@@ -539,7 +539,7 @@ function initApiService() {
}); });
}); });
return deferred.promise return deferred.promise;
} }
function refreshToken(self, success, error) { function refreshToken(self, success, error) {
@@ -588,4 +588,4 @@ function initApiService() {
} }
}); });
} }
}; }

View File

@@ -1,6 +1,6 @@
function AppIdService() { function AppIdService() {
initAppIdService(); initAppIdService();
}; }
function initAppIdService() { function initAppIdService() {
AppIdService.prototype.getAppId = function (callback) { AppIdService.prototype.getAppId = function (callback) {
@@ -41,4 +41,4 @@ function initAppIdService() {
return v.toString(16); return v.toString(16);
}); });
} }
}; }

View File

@@ -1,6 +1,6 @@
function AutofillService() { function AutofillService() {
initAutofill(); initAutofill();
}; }
function initAutofill() { function initAutofill() {
AutofillService.prototype.generateFillScript = function (pageDetails, fillUsername, fillPassword) { AutofillService.prototype.generateFillScript = function (pageDetails, fillUsername, fillPassword) {
@@ -29,9 +29,10 @@ function initAutofill() {
passwordFields = loadPasswordFields(pageDetails, true); passwordFields = loadPasswordFields(pageDetails, true);
} }
var i;
for (var formKey in pageDetails.forms) { for (var formKey in pageDetails.forms) {
var passwordFieldsForForm = []; var passwordFieldsForForm = [];
for (var i = 0; i < passwordFields.length; i++) { for (i = 0; i < passwordFields.length; i++) {
if (formKey === passwordFields[i].form) { if (formKey === passwordFields[i].form) {
passwordFieldsForForm.push(passwordFields[i]); passwordFieldsForForm.push(passwordFields[i]);
} }
@@ -156,4 +157,4 @@ function initAutofill() {
return usernameField; return usernameField;
} }
}; }

View File

@@ -67,4 +67,4 @@ function ConstantsService() {
} }
] ]
}; };
}; }

View File

@@ -1,7 +1,7 @@
function CryptoService(constantsService) { function CryptoService(constantsService) {
this.constantsService = constantsService; this.constantsService = constantsService;
initCryptoService(constantsService); initCryptoService(constantsService);
}; }
function initCryptoService(constantsService) { function initCryptoService(constantsService) {
var _key, var _key,
@@ -34,7 +34,7 @@ function initCryptoService(constantsService) {
callback(); callback();
}); });
}); });
} };
CryptoService.prototype.setKeyHash = function (keyHash, callback) { CryptoService.prototype.setKeyHash = function (keyHash, callback) {
if (!callback || typeof callback !== 'function') { if (!callback || typeof callback !== 'function') {
@@ -48,7 +48,7 @@ function initCryptoService(constantsService) {
}, function () { }, function () {
callback(); callback();
}); });
} };
CryptoService.prototype.setEncKey = function (encKey) { CryptoService.prototype.setEncKey = function (encKey) {
var deferred = Q.defer(); var deferred = Q.defer();
@@ -66,7 +66,7 @@ function initCryptoService(constantsService) {
}); });
return deferred.promise; return deferred.promise;
} };
CryptoService.prototype.setEncPrivateKey = function (encPrivateKey) { CryptoService.prototype.setEncPrivateKey = function (encPrivateKey) {
var deferred = Q.defer(); var deferred = Q.defer();
@@ -84,7 +84,7 @@ function initCryptoService(constantsService) {
}); });
return deferred.promise; return deferred.promise;
} };
CryptoService.prototype.setOrgKeys = function (orgs) { CryptoService.prototype.setOrgKeys = function (orgs) {
var deferred = Q.defer(); var deferred = Q.defer();
@@ -101,7 +101,7 @@ function initCryptoService(constantsService) {
}); });
return deferred.promise; return deferred.promise;
} };
CryptoService.prototype.getKey = function () { CryptoService.prototype.getKey = function () {
var deferred = Q.defer(); var deferred = Q.defer();
@@ -410,7 +410,7 @@ function initCryptoService(constantsService) {
}); });
} }
plainValueEncoding = plainValueEncoding || 'utf8' plainValueEncoding = plainValueEncoding || 'utf8';
if (plainValueEncoding === 'utf8') { if (plainValueEncoding === 'utf8') {
plainValue = fromUtf8ToArray(plainValue); plainValue = fromUtf8ToArray(plainValue);
} }
@@ -428,7 +428,7 @@ function initCryptoService(constantsService) {
return aesEncrypt(this, plainValue, key).then(function (encValue) { return aesEncrypt(this, plainValue, key).then(function (encValue) {
var macLen = 0; var macLen = 0;
if (encValue.mac) { if (encValue.mac) {
macLen = encValue.mac.length macLen = encValue.mac.length;
} }
var encBytes = new Uint8Array(1 + encValue.iv.length + macLen + encValue.ct.length); var encBytes = new Uint8Array(1 + encValue.iv.length + macLen + encValue.ct.length);
@@ -480,7 +480,7 @@ function initCryptoService(constantsService) {
} }
CryptoService.prototype.decrypt = function (cipherString, key, outputEncoding) { CryptoService.prototype.decrypt = function (cipherString, key, outputEncoding) {
outputEncoding = outputEncoding || 'utf8' outputEncoding = outputEncoding || 'utf8';
var ivBuf = fromB64ToArray(cipherString.initializationVector).buffer; var ivBuf = fromB64ToArray(cipherString.initializationVector).buffer;
var ctBuf = fromB64ToArray(cipherString.cipherText).buffer; var ctBuf = fromB64ToArray(cipherString.cipherText).buffer;
@@ -615,14 +615,14 @@ function initCryptoService(constantsService) {
padding = { padding = {
name: 'RSA-OAEP', name: 'RSA-OAEP',
hash: { name: 'SHA-256' } hash: { name: 'SHA-256' }
} };
break; break;
case constantsService.encType.Rsa2048_OaepSha1_B64: case constantsService.encType.Rsa2048_OaepSha1_B64:
case constantsService.encType.Rsa2048_OaepSha1_HmacSha256_B64: case constantsService.encType.Rsa2048_OaepSha1_HmacSha256_B64:
padding = { padding = {
name: 'RSA-OAEP', name: 'RSA-OAEP',
hash: { name: 'SHA-1' } hash: { name: 'SHA-1' }
} };
break; break;
default: default:
throw 'encType unavailable.'; throw 'encType unavailable.';
@@ -853,4 +853,4 @@ function initCryptoService(constantsService) {
} }
return arr; return arr;
} }
}; }

View File

@@ -6,11 +6,11 @@ function FolderService(cryptoService, userService, apiService, i18nService) {
this.decryptedFolderCache = null; this.decryptedFolderCache = null;
initFolderService(); initFolderService();
}; }
function initFolderService() { function initFolderService() {
FolderService.prototype.clearCache = function () { FolderService.prototype.clearCache = function () {
this.decryptedFolderCache = null this.decryptedFolderCache = null;
}; };
FolderService.prototype.encrypt = function (folder) { FolderService.prototype.encrypt = function (folder) {
@@ -112,12 +112,12 @@ function initFolderService() {
if (!folder.id) { if (!folder.id) {
self.apiService.postFolder(request, apiSuccess, function (response) { self.apiService.postFolder(request, apiSuccess, function (response) {
handleError(response, deferred) handleError(response, deferred);
}); });
} }
else { else {
self.apiService.putFolder(folder.id, request, apiSuccess, function (response) { self.apiService.putFolder(folder.id, request, apiSuccess, function (response) {
handleError(response, deferred) handleError(response, deferred);
}); });
} }
@@ -251,7 +251,7 @@ function initFolderService() {
deferred.resolve(); deferred.resolve();
}); });
}, function (response) { }, function (response) {
handleError(response, deferred) handleError(response, deferred);
}); });
return deferred.promise; return deferred.promise;
@@ -260,4 +260,4 @@ function initFolderService() {
function handleError(error, deferred) { function handleError(error, deferred) {
deferred.reject(error); deferred.reject(error);
} }
}; }

View File

@@ -7,4 +7,4 @@ function i18nService() {
throw 'set not allowed for i18n'; throw 'set not allowed for i18n';
} }
}); });
}; }

View File

@@ -8,7 +8,7 @@
this.refreshBadgeAndMenu = refreshBadgeAndMenu; this.refreshBadgeAndMenu = refreshBadgeAndMenu;
initLockService(this); initLockService(this);
}; }
function initLockService(self) { function initLockService(self) {
checkLock(); checkLock();
@@ -128,4 +128,4 @@ function initLockService(self) {
return deferred.promise; return deferred.promise;
} }
}; }

View File

@@ -6,11 +6,11 @@ function LoginService(cryptoService, userService, apiService, settingsService) {
this.decryptedLoginCache = null; this.decryptedLoginCache = null;
initLoginService(); initLoginService();
}; }
function initLoginService() { function initLoginService() {
LoginService.prototype.clearCache = function () { LoginService.prototype.clearCache = function () {
this.decryptedLoginCache = null this.decryptedLoginCache = null;
}; };
LoginService.prototype.encrypt = function (login) { LoginService.prototype.encrypt = function (login) {
@@ -185,12 +185,12 @@ function initLoginService() {
if (!login.id) { if (!login.id) {
self.apiService.postLogin(request, apiSuccess, function (response) { self.apiService.postLogin(request, apiSuccess, function (response) {
handleError(response, deferred) handleError(response, deferred);
}); });
} }
else { else {
self.apiService.putLogin(login.id, request, apiSuccess, function (response) { self.apiService.putLogin(login.id, request, apiSuccess, function (response) {
handleError(response, deferred) handleError(response, deferred);
}); });
} }
@@ -420,7 +420,7 @@ function initLoginService() {
}); });
} }
else { else {
callback() callback();
} }
}); });
}); });
@@ -460,4 +460,4 @@ function initLoginService() {
deferred.reject(error.message); deferred.reject(error.message);
return; return;
} }
}; }

View File

@@ -2,7 +2,7 @@
this.optionsCache = null; this.optionsCache = null;
initPasswordGenerationService(); initPasswordGenerationService();
}; }
function initPasswordGenerationService() { function initPasswordGenerationService() {
var optionsKey = 'passwordGenerationOptions'; var optionsKey = 'passwordGenerationOptions';
@@ -181,4 +181,4 @@ function initPasswordGenerationService() {
return deferred.promise; return deferred.promise;
}; };
}; }

View File

@@ -3,11 +3,11 @@ function SettingsService(userService) {
this.settingsCache = null; this.settingsCache = null;
initSettingsService(); initSettingsService();
}; }
function initSettingsService() { function initSettingsService() {
SettingsService.prototype.clearCache = function () { SettingsService.prototype.clearCache = function () {
this.settingsCache = null this.settingsCache = null;
}; };
SettingsService.prototype.getSettings = function (callback) { SettingsService.prototype.getSettings = function (callback) {
@@ -103,4 +103,4 @@ function initSettingsService() {
function handleError(error, deferred) { function handleError(error, deferred) {
deferred.reject(error); deferred.reject(error);
} }
}; }

View File

@@ -11,7 +11,7 @@
this.lastRevisionCheck = null; this.lastRevisionCheck = null;
initSyncService(); initSyncService();
}; }
function initSyncService() { function initSyncService() {
SyncService.prototype.fullSync = function (forceSync, callback) { SyncService.prototype.fullSync = function (forceSync, callback) {
@@ -133,7 +133,7 @@ function initSyncService() {
deferred.reject(); deferred.reject();
}); });
return deferred.promise return deferred.promise;
} }
function syncFolders(self, userId) { function syncFolders(self, userId) {
@@ -153,7 +153,7 @@ function initSyncService() {
deferred.reject(); deferred.reject();
}); });
return deferred.promise return deferred.promise;
} }
function syncCiphers(self, userId) { function syncCiphers(self, userId) {
@@ -176,7 +176,7 @@ function initSyncService() {
deferred.reject(); deferred.reject();
}); });
return deferred.promise return deferred.promise;
} }
function syncSettings(self, userId) { function syncSettings(self, userId) {
@@ -203,7 +203,7 @@ function initSyncService() {
}); });
return deferred.promise; return deferred.promise;
}; }
SyncService.prototype.getLastSync = function (callback) { SyncService.prototype.getLastSync = function (callback) {
if (!callback || typeof callback !== 'function') { if (!callback || typeof callback !== 'function') {
@@ -250,4 +250,4 @@ function initSyncService() {
this.syncInProgress = false; this.syncInProgress = false;
chrome.runtime.sendMessage({ command: 'syncCompleted', successfully: successfully }); chrome.runtime.sendMessage({ command: 'syncCompleted', successfully: successfully });
}; };
}; }

View File

@@ -1,6 +1,6 @@
function TokenService() { function TokenService() {
initTokenService(); initTokenService();
}; }
function initTokenService() { function initTokenService() {
var _token, var _token,
@@ -287,5 +287,5 @@ function initTokenService() {
//polyfill https://github.com/davidchambers/Base64.js //polyfill https://github.com/davidchambers/Base64.js
return window.decodeURIComponent(escape(window.atob(output))); return window.decodeURIComponent(escape(window.atob(output)));
}; }
}; }

View File

@@ -1,6 +1,6 @@
function TotpService() { function TotpService() {
initTotpService(); initTotpService();
}; }
function initTotpService() { function initTotpService() {
var b32Chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'; var b32Chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
@@ -41,7 +41,8 @@ function initTotpService() {
var b32tohex = function (s) { var b32tohex = function (s) {
s = s.toUpperCase(); s = s.toUpperCase();
var cleanedInput = ''; var cleanedInput = '';
for (var i = 0; i < s.length; i++) { var i;
for (i = 0; i < s.length; i++) {
if (b32Chars.indexOf(s[i]) < 0) { if (b32Chars.indexOf(s[i]) < 0) {
continue; continue;
} }
@@ -52,14 +53,14 @@ function initTotpService() {
var bits = ''; var bits = '';
var hex = ''; var hex = '';
for (var i = 0; i < s.length; i++) { for (i = 0; i < s.length; i++) {
var byteIndex = b32Chars.indexOf(s.charAt(i)); var byteIndex = b32Chars.indexOf(s.charAt(i));
if (byteIndex < 0) { if (byteIndex < 0) {
continue; continue;
} }
bits += leftpad(byteIndex.toString(2), 5, '0'); bits += leftpad(byteIndex.toString(2), 5, '0');
} }
for (var i = 0; i + 4 <= bits.length; i += 4) { for (i = 0; i + 4 <= bits.length; i += 4) {
var chunk = bits.substr(i, 4); var chunk = bits.substr(i, 4);
hex = hex + parseInt(chunk, 2).toString(16); hex = hex + parseInt(chunk, 2).toString(16);
} }
@@ -104,4 +105,4 @@ function initTotpService() {
return otp; return otp;
}); });
}; };
}; }

View File

@@ -4,7 +4,7 @@
this.cryptoService = cryptoService; this.cryptoService = cryptoService;
initUserService(); initUserService();
}; }
function initUserService() { function initUserService() {
var userIdKey = 'userId', var userIdKey = 'userId',
@@ -51,7 +51,7 @@ function initUserService() {
deferred.resolve(); deferred.resolve();
}); });
return deferred.promise return deferred.promise;
}; };
UserService.prototype.getUserId = function (callback) { UserService.prototype.getUserId = function (callback) {
@@ -105,7 +105,7 @@ function initUserService() {
deferred.resolve(_stamp); deferred.resolve(_stamp);
}); });
return deferred.promise return deferred.promise;
}; };
UserService.prototype.clear = function (callback) { UserService.prototype.clear = function (callback) {
@@ -142,4 +142,4 @@ function initUserService() {
}); });
}); });
}; };
}; }

View File

@@ -3,7 +3,7 @@ function UtilsService() {
this.browserCache = null; this.browserCache = null;
this.analyticsIdCache = null; this.analyticsIdCache = null;
}; }
function initUtilsService() { function initUtilsService() {
UtilsService.prototype.getBrowser = function () { UtilsService.prototype.getBrowser = function () {
@@ -29,19 +29,19 @@ function initUtilsService() {
UtilsService.prototype.isFirefox = function () { UtilsService.prototype.isFirefox = function () {
return this.getBrowser() === 'firefox'; return this.getBrowser() === 'firefox';
} };
UtilsService.prototype.isChrome = function () { UtilsService.prototype.isChrome = function () {
return this.getBrowser() === 'chrome'; return this.getBrowser() === 'chrome';
} };
UtilsService.prototype.isEdge = function () { UtilsService.prototype.isEdge = function () {
return this.getBrowser() === 'edge'; return this.getBrowser() === 'edge';
} };
UtilsService.prototype.isOpera = function () { UtilsService.prototype.isOpera = function () {
return this.getBrowser() === 'opera'; return this.getBrowser() === 'opera';
} };
UtilsService.prototype.analyticsId = function () { UtilsService.prototype.analyticsId = function () {
if (this.analyticsIdCache) { if (this.analyticsIdCache) {
@@ -62,7 +62,7 @@ function initUtilsService() {
} }
return this.analyticsIdCache; return this.analyticsIdCache;
} };
UtilsService.prototype.getDeviceType = function () { UtilsService.prototype.getDeviceType = function () {
if (this.isChrome()) { if (this.isChrome()) {
@@ -79,7 +79,7 @@ function initUtilsService() {
} }
return -1; return -1;
} };
UtilsService.prototype.initListSectionItemListeners = function (doc, angular) { UtilsService.prototype.initListSectionItemListeners = function (doc, angular) {
if (!doc) { if (!doc) {
@@ -127,7 +127,7 @@ function initUtilsService() {
doc.on('blur', '.list-section-item input, .list-section-item select, .list-section-item textarea', function (e) { doc.on('blur', '.list-section-item input, .list-section-item select, .list-section-item textarea', function (e) {
$(this).parent().removeClass('active'); $(this).parent().removeClass('active');
}); });
} };
UtilsService.prototype.getDomain = function (uriString) { UtilsService.prototype.getDomain = function (uriString) {
if (!uriString) { if (!uriString) {
@@ -171,7 +171,7 @@ function initUtilsService() {
} }
return null; return null;
} };
UtilsService.prototype.getHostname = function (uriString) { UtilsService.prototype.getHostname = function (uriString) {
if (!uriString) { if (!uriString) {
@@ -198,10 +198,10 @@ function initUtilsService() {
} }
return null; return null;
} };
function validIpAddress(ipString) { function validIpAddress(ipString) {
var ipRegex = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/; var ipRegex = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
return ipRegex.test(ipString); return ipRegex.test(ipString);
} }
}; }