Commit 152d67f0 authored by Sascha's avatar Sascha

Merge branch 'develop' into 'master'

Preparing v1.11.4 (v2)

See merge request !116
parents dc08ea23 9a7305f6
......@@ -12,6 +12,20 @@
}
});
/**
* @ngdoc
* @name psonocli.browserClient#register_auth_required_listener
* @methodOf psonocli.browserClient
*
* @description
* Registers a listener with chrome.webRequest.onAuthRequired.addListener
*/
var register_auth_required_listener = function(callback) {
if (typeof chrome.webRequest !== 'undefined') {
chrome.webRequest.onAuthRequired.addListener(callback, {urls: ["<all_urls>"]}, ["asyncBlocking"]);
}
};
/**
* Returns the client type
*/
......@@ -349,6 +363,7 @@
}
return {
register_auth_required_listener: register_auth_required_listener,
get_client_type: get_client_type,
open_tab: open_tab,
open_tab_bg: open_tab_bg,
......
......@@ -224,7 +224,6 @@
* @param {object} item The item to open
*/
function on_item_click(item) {
console.log(item);
managerSecret.on_item_click(item)
}
......
......@@ -22,6 +22,18 @@
'logout'
];
/**
* @ngdoc
* @name psonocli.browserClient#register_auth_required_listener
* @methodOf psonocli.browserClient
*
* @description
* Registers a listener with browser.webRequest.onAuthRequired.addListener
*/
var register_auth_required_listener = function(callback) {
// pass don't do anything
};
/**
* Returns the client type
*/
......@@ -371,6 +383,7 @@
}
return {
register_auth_required_listener: register_auth_required_listener,
get_client_type: get_client_type,
open_tab: open_tab,
open_tab_bg: open_tab_bg,
......
......@@ -61,9 +61,7 @@
if (typeof browser.runtime.onMessage !== 'undefined') {
browser.runtime.onMessage.addListener(on_message);
}
if (typeof browser.webRequest !== 'undefined') {
browser.webRequest.onAuthRequired.addListener(on_auth_required, {urls: ["<all_urls>"]}, ["asyncBlocking"]);
}
browserClient.register_auth_required_listener(on_auth_required);
// browser.webRequest.onBeforeRequest.addListener(on_before_request, {urls: ["<all_urls>"]}, ["blocking", "requestBody"]);
// browser.webRequest.onBeforeSendHeaders.addListener(on_before_send_headers, {urls: ["<all_urls>"]}, ["blocking", "requestHeaders"]);
......
......@@ -12,6 +12,24 @@
}
});
/**
* @ngdoc
* @name psonocli.browserClient#register_auth_required_listener
* @methodOf psonocli.browserClient
*
* @description
* Registers a listener with chrome.webRequest.onAuthRequired.addListener
*/
var register_auth_required_listener = function(callback) {
if (typeof browser.webRequest !== 'undefined') {
browser.webRequest.onAuthRequired.addListener(function(details) {
return new Promise(function(resolve, reject) {
return callback(details, resolve)
})
}, {urls: ["<all_urls>"]}, ["blocking"]);
}
};
/**
* Returns the client type
*/
......@@ -124,7 +142,11 @@
return deferred.resolve(new_config);
};
browser.storage.managed.get('ConfigJson', onStorageRetrieve);
var storageItem = browser.storage.managed.get('ConfigJson');
storageItem.then(onStorageRetrieve, function(reason) {
return deferred.resolve(new_config);
});
return deferred.promise;
};
......@@ -337,6 +359,7 @@
}
return {
register_auth_required_listener: register_auth_required_listener,
get_client_type: get_client_type,
open_tab: open_tab,
open_tab_bg: open_tab_bg,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment