Ignore did-fail-load event when trying to use U2F devices

This commit is contained in:
Yuya Ochiai
2018-03-16 22:00:21 +09:00
parent 3cfc75604b
commit d5ff7c7a98

View File

@@ -16,6 +16,9 @@ const ErrorView = require('./ErrorView.jsx');
const preloadJS = `file://${remote.app.getAppPath()}/browser/webview/mattermost_bundle.js`;
const ERR_NOT_IMPLEMENTED = -11;
const U2F_EXTENSION_URL = 'chrome-extension://kmendfapggjehodndflmmgagdbamhnfd/u2f-comms.html';
function extractFileURL(message) {
const matched = message.match(/Not allowed to load local resource:\s*(.+)/);
if (matched) {
@@ -72,6 +75,11 @@ const MattermostView = createReactClass({
if (e.errorCode === -3) { // An operation was aborted (due to user action).
return;
}
if (e.errorCode === ERR_NOT_IMPLEMENTED && e.validatedURL === U2F_EXTENSION_URL) {
// U2F device is not supported, but the guest page should fall back to PIN code in 2FA.
// https://github.com/mattermost/desktop/issues/708
return;
}
self.setState({
errorInfo: e,