Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc-browser.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvarjolintu <sami.vanttinen@gmail.com>2017-09-30 16:49:25 +0300
committervarjolintu <sami.vanttinen@gmail.com>2017-09-30 16:49:25 +0300
commit51b9259fca7ee1f32d67d784ea0be3f0053791be (patch)
treeff51ac6a2045dbabce0558b8e4f6ff9a0a97f0f9
parentac4a57b36da06506d52b8e87bb49e462da66d24e (diff)
Improved timeout handling
-rw-r--r--CHANGELOG4
-rw-r--r--keepassxc-browser/background/event.js2
-rw-r--r--keepassxc-browser/background/keepass.js47
-rw-r--r--keepassxc-browser/keepassxc-browser.js1
-rw-r--r--keepassxc-browser/manifest.json2
5 files changed, 35 insertions, 21 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 6b5742a..9096398 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,7 @@
+0.3.2 (2017-09-30)
+=========================
+- Improved timeout handling
+
0.3.1 (2017-09-29)
=========================
- Added timeout handling for postMessage(). Allows proxy application to be reloaded.
diff --git a/keepassxc-browser/background/event.js b/keepassxc-browser/background/event.js
index 0052b20..cf2df09 100644
--- a/keepassxc-browser/background/event.js
+++ b/keepassxc-browser/background/event.js
@@ -128,7 +128,7 @@ event.onGetStatus = function(callback, tab) {
keepass.isConfigured((configured) => {
event.showStatus(configured, tab, callback);
});
- }, tab);
+ }, tab, true);
};
event.onReconnect = function(callback, tab) {
diff --git a/keepassxc-browser/background/keepass.js b/keepassxc-browser/background/keepass.js
index 4deb641..e5b2d4c 100644
--- a/keepassxc-browser/background/keepass.js
+++ b/keepassxc-browser/background/keepass.js
@@ -127,7 +127,7 @@ keepass.updateCredentials = function(callback, tab, entryId, username, password,
});
};
-keepass.retrieveCredentials = function(callback, tab, url, submiturl, forceCallback, triggerUnlock) {
+keepass.retrieveCredentials = function(callback, tab, url, submiturl, forceCallback) {
page.debug('keepass.retrieveCredentials(callback, {1}, {2}, {3}, {4})', tab.id, url, submiturl, forceCallback);
keepass.testAssociation((response) => {
@@ -204,12 +204,15 @@ keepass.retrieveCredentials = function(callback, tab, url, submiturl, forceCallb
};
// Redirects the callback to a listener (handleReply())
-keepass.callbackOnId = function(ev, action, tab, callback) {
+keepass.callbackOnId = function(ev, action, tab, callback, enableTimeout = false) {
+ let timeout;
let listener = ((port, action) => {
let handler = (msg) => {
if (msg && msg.action === action) {
ev.removeListener(handler);
- clearTimeout(timeout);
+ if (enableTimeout) {
+ clearTimeout(timeout);
+ }
callback(msg);
}
};
@@ -218,16 +221,18 @@ keepass.callbackOnId = function(ev, action, tab, callback) {
ev.addListener(listener);
// Handle timeouts
- let timeout = setTimeout(() => {
- const errorMessage = {
- action: action,
- error: kpErrors.getError(5),
- errorCode: 5
- };
- keepass.isKeePassXCAvailable = false;
- callback(errorMessage);
- ev.removeListener(listener.handler);
- }, keepass.messageTimeout);
+ if (enableTimeout) {
+ timeout = setTimeout(() => {
+ const errorMessage = {
+ action: action,
+ error: kpErrors.getError(5),
+ errorCode: 5
+ };
+ keepass.isKeePassXCAvailable = false;
+ callback(errorMessage);
+ ev.removeListener(listener.handler);
+ }, keepass.messageTimeout);
+ }
};
keepass.generatePassword = function(callback, tab, forceCallback) {
@@ -351,7 +356,7 @@ keepass.associate = function(callback, tab) {
}, tab);
};
-keepass.testAssociation = function(callback, tab, triggerUnlock) {
+keepass.testAssociation = function(callback, tab, enableTimeout = false) {
if (tab && page.tabs[tab.id]) {
page.tabs[tab.id].errorMessage = null;
}
@@ -438,10 +443,10 @@ keepass.testAssociation = function(callback, tab, triggerUnlock) {
callback(keepass.isAssociated());
});
keepass.nativePort.postMessage(request);
- }, tab, triggerUnlock);
+ }, tab, enableTimeout);
};
-keepass.getDatabaseHash = function(callback, tab, triggerUnlock) {
+keepass.getDatabaseHash = function(callback, tab, enableTimeout = false) {
if (!keepass.isConnected) {
keepass.handleError(tab, kpErrors.TIMEOUT_OR_NOT_CONNECTED);
callback([]);
@@ -505,10 +510,16 @@ keepass.getDatabaseHash = function(callback, tab, triggerUnlock) {
else {
keepass.databaseHash = 'no-hash';
keepass.isDatabaseClosed = true;
- keepass.handleError(tab, response.errorCode, response.error);
+ if (response.message === "") {
+ keepass.handleError(tab, kpErrors.TIMEOUT_OR_NOT_CONNECTED);
+ }
+ else {
+ keepass.handleError(tab, response.errorCode, response.error);
+ }
+ //keepass.handleError(tab, response.errorCode, response.error);
callback(keepass.databaseHash);
}
- });
+ }, enableTimeout);
keepass.nativePort.postMessage(request);
};
diff --git a/keepassxc-browser/keepassxc-browser.js b/keepassxc-browser/keepassxc-browser.js
index 52a5338..7de7bea 100644
--- a/keepassxc-browser/keepassxc-browser.js
+++ b/keepassxc-browser/keepassxc-browser.js
@@ -1120,7 +1120,6 @@ cip.detectNewActiveFields = function() {
//if (hiddenFields > 0) {
const divDetect = setInterval(function() {
const fields = cipFields.getAllFields();
- console.log(fields.length);
if (fields.length > 1) {
cip.initCredentialFields(true);
clearInterval(divDetect);
diff --git a/keepassxc-browser/manifest.json b/keepassxc-browser/manifest.json
index 7973a95..11c52bd 100644
--- a/keepassxc-browser/manifest.json
+++ b/keepassxc-browser/manifest.json
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "keepassxc-browser",
- "version": "0.3.1",
+ "version": "0.3.2",
"description": "KeePassXC integration for modern web browsers",
"author": "Sami Vänttinen",
"icons": {