| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 31 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | (function () { | 
            ||
| 11 |     angular.module('passmanExtension').factory('HttpsTest', ['$http', '$q', function ($http, $q) { | 
            ||
| 12 |         var tester = {}; | 
            ||
| 13 |         tester.test = function (url) { | 
            ||
| 14 | var deferred = $q.defer();  | 
            ||
| 15 |             if(url.match(/https?/)){ | 
            ||
| 16 | deferred.resolve(url);  | 
            ||
| 17 | return deferred.promise;  | 
            ||
| 18 | }  | 
            ||
| 19 | // first test with https  | 
            ||
| 20 | var protocol = 'https://';  | 
            ||
| 21 | |||
| 22 |             var req = { | 
            ||
| 23 | method: 'GET',  | 
            ||
| 24 | url: protocol+url,  | 
            ||
| 25 | timeout: 500  | 
            ||
| 26 | };  | 
            ||
| 27 | |||
| 28 |             $http(req).then(function () { | 
            ||
| 29 | // we have https  | 
            ||
| 30 | deferred.resolve(protocol + url)  | 
            ||
| 31 | },  | 
            ||
| 32 |                 function () { | 
            ||
| 33 | protocol = 'http://';  | 
            ||
| 34 | // we don't have https  | 
            ||
| 35 | deferred.reject(protocol + url);  | 
            ||
| 36 | });  | 
            ||
| 37 | return deferred.promise;  | 
            ||
| 38 | };  | 
            ||
| 39 | |||
| 40 | return tester;  | 
            ||
| 41 | }]);  | 
            ||
| 42 | }());  | 
            ||
| 43 |