Comparing version 0.0.8 to 0.0.9
@@ -128,2 +128,12 @@ // Copyright 2014 Google Inc. All rights reserved | ||
/** | ||
* Call MessagePort disconnect | ||
*/ | ||
u2f.disconnect = function() { | ||
if (u2f.port_ && u2f.port_.port_) { | ||
u2f.port_.port_.disconnect(); | ||
u2f.port_ = null; | ||
} | ||
}; | ||
/** | ||
* Sets up a MessagePort to the U2F extension using the | ||
@@ -130,0 +140,0 @@ * available mechanisms. |
@@ -57,10 +57,18 @@ 'use strict'; | ||
} ); | ||
ret.promise.cancel = function( msg ) | ||
/** | ||
* Reject request promise and disconnect port if 'disconnect' flag is true | ||
* @param {string} msg | ||
* @param {boolean} disconnect | ||
*/ | ||
ret.promise.cancel = function( msg, disconnect ) | ||
{ | ||
ret.reject( makeError( msg, { errorCode: -1 } ) ) | ||
} | ||
if ( disconnect ) | ||
coreApi.disconnect( ); | ||
ret.reject( makeError( msg, { errorCode: -1 } ) ); | ||
}; | ||
return ret; | ||
} | ||
function isSupported( ) | ||
function isSupported( ignorePreconditions /* = false */ ) | ||
{ | ||
@@ -77,2 +85,9 @@ var Promise = this; | ||
if ( !ignorePreconditions ) | ||
{ | ||
if ( location.protocol === 'http:' ) | ||
// U2F isn't supported over http, only https | ||
return Promise.resolve( false ); | ||
} | ||
return defer( Promise, coreApi.isSupported ).promise; | ||
@@ -88,3 +103,7 @@ } | ||
if ( !value ) | ||
{ | ||
if ( location.protocol === 'http:' ) | ||
throw new Error( "U2F isn't supported over http, only https" ); | ||
throw new Error( "U2F not supported" ); | ||
} | ||
} ); | ||
@@ -91,0 +110,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"author": "Gustaf Räntilä <g.rantila@gmail.com>", | ||
@@ -8,0 +8,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20056
514