Fix #702 -- Fix U2F support in Firefox 57

This commit is contained in:
Raphael Michel
2017-12-09 18:36:57 +01:00
parent 3ece911018
commit c50a8e7740

View File

@@ -1,5 +1,5 @@
//Copyright 2014-2015 Google Inc. All rights reserved. //Copyright 2014-2015 Google Inc. All rights reserved.
// Extended by Raphael Michel 2017 for compatibility with Firefox 57
//Use of this source code is governed by a BSD-style //Use of this source code is governed by a BSD-style
//license that can be found in the LICENSE file or at //license that can be found in the LICENSE file or at
//https://developers.google.com/open-source/licenses/bsd //https://developers.google.com/open-source/licenses/bsd
@@ -10,6 +10,7 @@
'use strict'; 'use strict';
var build_u2f_object = function () {
/** /**
* Namespace for the U2F api. * Namespace for the U2F api.
* @type {Object} * @type {Object}
@@ -47,7 +48,7 @@ u2f.MessageTypes = {
'U2F_SIGN_REQUEST': 'u2f_sign_request', 'U2F_SIGN_REQUEST': 'u2f_sign_request',
'U2F_SIGN_RESPONSE': 'u2f_sign_response', 'U2F_SIGN_RESPONSE': 'u2f_sign_response',
'U2F_GET_API_VERSION_REQUEST': 'u2f_get_api_version_request', 'U2F_GET_API_VERSION_REQUEST': 'u2f_get_api_version_request',
'U2F_GET_API_VERSION_RESPONSE': 'u2f_get_api_version_response' 'ndowsU2F_GET_API_VERSION_RESPONSE': 'u2f_get_api_version_response'
}; };
@@ -470,7 +471,8 @@ u2f.WrappedAuthenticatorPort_.INTENT_URL_BASE_ =
* @constructor * @constructor
* @private * @private
*/ */
u2f.WrappedIosPort_ = function() {}; u2f.WrappedIosPort_ = function () {
};
/** /**
* Launch the iOS client app request * Launch the iOS client app request
@@ -746,3 +748,13 @@ u2f.getApiVersion = function(callback, opt_timeoutSeconds) {
port.postMessage(req); port.postMessage(req);
}); });
}; };
return u2f;
};
try {
var u2f = build_u2f_object();
} catch (TypeError) {
// Firefox 57 sets the u2f object itself, we are not allowed to override it,
// so fail silently.
}