Remove block_url feature to increase websites compatibility
This commit is contained in:
parent
630a3f9cb9
commit
90e9862982
|
@ -216,47 +216,6 @@ async function ask_server(logins, domain, wdomain, mkey, sendResponse, options)
|
|||
return true;
|
||||
}
|
||||
|
||||
function url_block_callback(details)
|
||||
{
|
||||
// debug(JSON.stringify(details));
|
||||
if (details.requestBody)
|
||||
{
|
||||
if (details.requestBody.formData)
|
||||
{
|
||||
for (var key in details.requestBody.formData)
|
||||
{
|
||||
for(var idx in details.requestBody.formData[key])
|
||||
{
|
||||
value = details.requestBody.formData[key][idx];
|
||||
if (value.startsWith("@@") ||
|
||||
value.startsWith("@_"))
|
||||
return {cancel: true};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
// Analyse POST parameters
|
||||
if (details.method == "POST" && details.requestBody.raw)
|
||||
{
|
||||
alert(details.requestBody.raw);
|
||||
var postedString = decodeURIComponent(String.fromCharCode.apply(null,
|
||||
new Uint8Array(details.requestBody.raw[0].bytes)));
|
||||
if (postedString.indexOf("=@@") != -1 ||
|
||||
postedString.indexOf("=@_") != -1)
|
||||
return {cancel: true};
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
return {cancel: false};
|
||||
}
|
||||
|
||||
function url_unblock_callback(details)
|
||||
{
|
||||
return {cancel: false};
|
||||
}
|
||||
|
||||
function update_gpass_icon(iconId, tabId)
|
||||
{
|
||||
debug("update_gpass_icon");
|
||||
|
@ -312,38 +271,6 @@ function save_gpass_enable_config(uri, enable)
|
|||
}
|
||||
}
|
||||
|
||||
function _block_url(tabs, callback)
|
||||
{
|
||||
options = {
|
||||
urls:[tabs[0].url],
|
||||
"types":["main_frame"]
|
||||
};
|
||||
|
||||
if (tabs.length)
|
||||
{
|
||||
options["tabId"] = tabs[0].id;
|
||||
options["windowId"] = tabs[0].windowId;
|
||||
}
|
||||
|
||||
browser.webRequest.onBeforeRequest.addListener(
|
||||
url_block_callback,
|
||||
options,
|
||||
["blocking", "requestBody"]);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
function _query_tabs_block_url(tabs)
|
||||
{
|
||||
return _block_url(tabs, url_block_callback);
|
||||
}
|
||||
|
||||
function _query_tabs_unblock_url(tabs)
|
||||
{
|
||||
return _block_url(tabs, url_unblock_callback);
|
||||
}
|
||||
|
||||
function _query_tabs_is_gpass_enabled(tabs, sendResponse)
|
||||
{
|
||||
if (tabs.length)
|
||||
|
@ -426,14 +353,6 @@ function extension_load()
|
|||
});
|
||||
return true;
|
||||
}
|
||||
else if (request.type == "block_url")
|
||||
{
|
||||
browser.tabs.query({active:true, currentWindow:true}, _query_tabs_block_url);
|
||||
}
|
||||
else if (request.type == "unblock_url")
|
||||
{
|
||||
browser.tabs.query({active:true, currentWindow:true}, _query_tabs_unblock_url);
|
||||
}
|
||||
else if (request.type == "is_gpass_enabled")
|
||||
{
|
||||
browser.tabs.query({active:true, currentWindow:true},
|
||||
|
|
|
@ -236,7 +236,6 @@ function block_all_forms(doc, do_block)
|
|||
{
|
||||
if (do_block)
|
||||
{
|
||||
block_url(form.action);
|
||||
old_cb = form.onsubmit;
|
||||
if (old_cb)
|
||||
form.removeEventListener("submit", old_cb);
|
||||
|
@ -254,10 +253,6 @@ function block_all_forms(doc, do_block)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Request can be sent to another URL... */
|
||||
if (managed_forms.length && do_block)
|
||||
block_url("<all_urls>");
|
||||
}
|
||||
|
||||
function unblock_all_forms()
|
||||
|
@ -271,7 +266,6 @@ function unblock_all_forms()
|
|||
var form = managed_forms[i];
|
||||
|
||||
form.removeEventListener("submit", on_sumbit);
|
||||
unblock_url(form.action);
|
||||
|
||||
var fields = form.getElementsByTagName("input");
|
||||
for (var a=0; a<fields.length; a++)
|
||||
|
@ -286,9 +280,6 @@ function unblock_all_forms()
|
|||
}
|
||||
}
|
||||
|
||||
if (managed_forms.length)
|
||||
unblock_url("<all_urls>");
|
||||
|
||||
gpass_enabled = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,18 +34,6 @@ function notify(text, data)
|
|||
browser.runtime.sendMessage({type: "notification", options:{"message":text, "data":data}});
|
||||
}
|
||||
|
||||
function block_url(url)
|
||||
{
|
||||
debug("Block URL " + url);
|
||||
browser.runtime.sendMessage({type: "block_url", options:{"url":url}});
|
||||
}
|
||||
|
||||
function unblock_url(url)
|
||||
{
|
||||
debug("Unblock URL " + url);
|
||||
browser.runtime.sendMessage({type: "unblock_url", options:{"url":url}});
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/questions/6965107/converting-between-strings-and-arraybuffers
|
||||
function ab2str(buf) {
|
||||
return String.fromCharCode.apply(null, new Uint8Array(buf));
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
"name": "gPass",
|
||||
"short_name": "gPass",
|
||||
"version": "0.9",
|
||||
"version": "1.0",
|
||||
"description": "gPass : global password manager",
|
||||
"icons" : {"16":"icons/gpass_icon_16.png", "32":"icons/gpass_icon_32.png", "64":"icons/gpass_icon_64.png", "128":"icons/gpass_icon_128.png"},
|
||||
"author" : "Grégory Soutadé",
|
||||
|
|
|
@ -216,47 +216,6 @@ async function ask_server(logins, domain, wdomain, mkey, sendResponse, options)
|
|||
return true;
|
||||
}
|
||||
|
||||
function url_block_callback(details)
|
||||
{
|
||||
// debug(JSON.stringify(details));
|
||||
if (details.requestBody)
|
||||
{
|
||||
if (details.requestBody.formData)
|
||||
{
|
||||
for (var key in details.requestBody.formData)
|
||||
{
|
||||
for(var idx in details.requestBody.formData[key])
|
||||
{
|
||||
value = details.requestBody.formData[key][idx];
|
||||
if (value.startsWith("@@") ||
|
||||
value.startsWith("@_"))
|
||||
return {cancel: true};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
// Analyse POST parameters
|
||||
if (details.method == "POST" && details.requestBody.raw)
|
||||
{
|
||||
alert(details.requestBody.raw);
|
||||
var postedString = decodeURIComponent(String.fromCharCode.apply(null,
|
||||
new Uint8Array(details.requestBody.raw[0].bytes)));
|
||||
if (postedString.indexOf("=@@") != -1 ||
|
||||
postedString.indexOf("=@_") != -1)
|
||||
return {cancel: true};
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
return {cancel: false};
|
||||
}
|
||||
|
||||
function url_unblock_callback(details)
|
||||
{
|
||||
return {cancel: false};
|
||||
}
|
||||
|
||||
function update_gpass_icon(iconId, tabId)
|
||||
{
|
||||
debug("update_gpass_icon");
|
||||
|
@ -312,38 +271,6 @@ function save_gpass_enable_config(uri, enable)
|
|||
}
|
||||
}
|
||||
|
||||
function _block_url(tabs, callback)
|
||||
{
|
||||
options = {
|
||||
urls:[tabs[0].url],
|
||||
"types":["main_frame"]
|
||||
};
|
||||
|
||||
if (tabs.length)
|
||||
{
|
||||
options["tabId"] = tabs[0].id;
|
||||
options["windowId"] = tabs[0].windowId;
|
||||
}
|
||||
|
||||
browser.webRequest.onBeforeRequest.addListener(
|
||||
url_block_callback,
|
||||
options,
|
||||
["blocking", "requestBody"]);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
function _query_tabs_block_url(tabs)
|
||||
{
|
||||
return _block_url(tabs, url_block_callback);
|
||||
}
|
||||
|
||||
function _query_tabs_unblock_url(tabs)
|
||||
{
|
||||
return _block_url(tabs, url_unblock_callback);
|
||||
}
|
||||
|
||||
function _query_tabs_is_gpass_enabled(tabs, sendResponse)
|
||||
{
|
||||
if (tabs.length)
|
||||
|
@ -426,14 +353,6 @@ function extension_load()
|
|||
});
|
||||
return true;
|
||||
}
|
||||
else if (request.type == "block_url")
|
||||
{
|
||||
browser.tabs.query({active:true, currentWindow:true}, _query_tabs_block_url);
|
||||
}
|
||||
else if (request.type == "unblock_url")
|
||||
{
|
||||
browser.tabs.query({active:true, currentWindow:true}, _query_tabs_unblock_url);
|
||||
}
|
||||
else if (request.type == "is_gpass_enabled")
|
||||
{
|
||||
browser.tabs.query({active:true, currentWindow:true},
|
||||
|
|
|
@ -236,7 +236,6 @@ function block_all_forms(doc, do_block)
|
|||
{
|
||||
if (do_block)
|
||||
{
|
||||
block_url(form.action);
|
||||
old_cb = form.onsubmit;
|
||||
if (old_cb)
|
||||
form.removeEventListener("submit", old_cb);
|
||||
|
@ -254,10 +253,6 @@ function block_all_forms(doc, do_block)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Request can be sent to another URL... */
|
||||
if (managed_forms.length && do_block)
|
||||
block_url("<all_urls>");
|
||||
}
|
||||
|
||||
function unblock_all_forms()
|
||||
|
@ -271,7 +266,6 @@ function unblock_all_forms()
|
|||
var form = managed_forms[i];
|
||||
|
||||
form.removeEventListener("submit", on_sumbit);
|
||||
unblock_url(form.action);
|
||||
|
||||
var fields = form.getElementsByTagName("input");
|
||||
for (var a=0; a<fields.length; a++)
|
||||
|
@ -286,9 +280,6 @@ function unblock_all_forms()
|
|||
}
|
||||
}
|
||||
|
||||
if (managed_forms.length)
|
||||
unblock_url("<all_urls>");
|
||||
|
||||
gpass_enabled = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,18 +34,6 @@ function notify(text, data)
|
|||
browser.runtime.sendMessage({type: "notification", options:{"message":text, "data":data}});
|
||||
}
|
||||
|
||||
function block_url(url)
|
||||
{
|
||||
debug("Block URL " + url);
|
||||
browser.runtime.sendMessage({type: "block_url", options:{"url":url}});
|
||||
}
|
||||
|
||||
function unblock_url(url)
|
||||
{
|
||||
debug("Unblock URL " + url);
|
||||
browser.runtime.sendMessage({type: "unblock_url", options:{"url":url}});
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/questions/6965107/converting-between-strings-and-arraybuffers
|
||||
function ab2str(buf) {
|
||||
return String.fromCharCode.apply(null, new Uint8Array(buf));
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
"name": "gPass",
|
||||
"short_name": "gPass",
|
||||
"version": "0.9",
|
||||
"version": "1.0",
|
||||
"description": "gPass : global password manager",
|
||||
"icons" : {"16":"icons/gpass_icon_16.png", "32":"icons/gpass_icon_32.png", "64":"icons/gpass_icon_64.png", "128":"icons/gpass_icon_128.png"},
|
||||
"author" : "Grégory Soutadé",
|
||||
|
|
Loading…
Reference in New Issue
Block a user