From 90e9862982e565f1f735e7d86b1d04a89eaeb7f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 29 Aug 2020 17:57:39 +0200 Subject: [PATCH] Remove block_url feature to increase websites compatibility --- chrome_addon/background.js | 81 ------------------------------ chrome_addon/lib/main.js | 9 ---- chrome_addon/lib/misc.js | 12 ----- chrome_addon/manifest.json | 2 +- firefox_webextension/background.js | 81 ------------------------------ firefox_webextension/lib/main.js | 9 ---- firefox_webextension/lib/misc.js | 12 ----- firefox_webextension/manifest.json | 2 +- 8 files changed, 2 insertions(+), 206 deletions(-) diff --git a/chrome_addon/background.js b/chrome_addon/background.js index 14a3438..5b185ec 100644 --- a/chrome_addon/background.js +++ b/chrome_addon/background.js @@ -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}, diff --git a/chrome_addon/lib/main.js b/chrome_addon/lib/main.js index 5da14e7..ea39299 100644 --- a/chrome_addon/lib/main.js +++ b/chrome_addon/lib/main.js @@ -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(""); } 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"); - gpass_enabled = false; } diff --git a/chrome_addon/lib/misc.js b/chrome_addon/lib/misc.js index df4645e..aa891d7 100644 --- a/chrome_addon/lib/misc.js +++ b/chrome_addon/lib/misc.js @@ -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)); diff --git a/chrome_addon/manifest.json b/chrome_addon/manifest.json index d2b3489..7cc3462 100644 --- a/chrome_addon/manifest.json +++ b/chrome_addon/manifest.json @@ -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é", diff --git a/firefox_webextension/background.js b/firefox_webextension/background.js index 14a3438..5b185ec 100644 --- a/firefox_webextension/background.js +++ b/firefox_webextension/background.js @@ -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}, diff --git a/firefox_webextension/lib/main.js b/firefox_webextension/lib/main.js index 5da14e7..ea39299 100644 --- a/firefox_webextension/lib/main.js +++ b/firefox_webextension/lib/main.js @@ -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(""); } 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"); - gpass_enabled = false; } diff --git a/firefox_webextension/lib/misc.js b/firefox_webextension/lib/misc.js index df4645e..aa891d7 100644 --- a/firefox_webextension/lib/misc.js +++ b/firefox_webextension/lib/misc.js @@ -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)); diff --git a/firefox_webextension/manifest.json b/firefox_webextension/manifest.json index 20b1260..d16973e 100644 --- a/firefox_webextension/manifest.json +++ b/firefox_webextension/manifest.json @@ -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é",