[Pkg-mozext-commits] [tabmixplus] 80/107: Incompatibility with Google Redirects Fixer & Tracking Remover, when google tab is locked link open two tabs - one blank tab and the other with the linked page
David Prévot
taffit at moszumanska.debian.org
Tue Dec 29 19:02:53 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository tabmixplus.
commit 17af54f3bd9e2197dc880baacedd03bae0d5dc23
Author: onemen <tabmix.onemen at gmail.com>
Date: Sun Nov 15 20:56:23 2015 +0200
Incompatibility with Google Redirects Fixer & Tracking Remover, when google tab is locked link open two tabs - one blank tab and the other with the linked page
---
chrome/content/minit/tablib.js | 7 ++++++
modules/Services.jsm | 2 ++
modules/extensions/AddonManager.jsm | 50 +++++++++++++++++++++++++++++++------
3 files changed, 51 insertions(+), 8 deletions(-)
diff --git a/chrome/content/minit/tablib.js b/chrome/content/minit/tablib.js
index 3810cf2..cb7b488 100644
--- a/chrome/content/minit/tablib.js
+++ b/chrome/content/minit/tablib.js
@@ -71,7 +71,14 @@ var tablib = { // eslint-disable-line
}
var allowLoad = tablib.isException(browser.tabmix_allowLoad !== false ||
uri.match(/^javascript:/));
+
if (!allowLoad) {
+ // we allow Google Redirects Fixer & Tracking Remover to load fixed url
+ // to the same tab
+ if (TabmixSvc.isFixedGoogleUrl(uri)) {
+ browser.tabmix_allowLoad = true;
+ return null;
+ }
try {
let newURI = Services.io.newURI(uri, null, null);
allowLoad = browser.currentURI.equalsExceptRef(newURI);
diff --git a/modules/Services.jsm b/modules/Services.jsm
index 308152e..dc8b848 100644
--- a/modules/Services.jsm
+++ b/modules/Services.jsm
@@ -260,6 +260,8 @@ this.TabmixSvc = {
!this.prefBranch.getBoolPref("squaredTabsStyle");
},
+ isFixedGoogleUrl: () => false,
+
blockedClickingOptions: []
};
diff --git a/modules/extensions/AddonManager.jsm b/modules/extensions/AddonManager.jsm
index b67fbc9..02f9d2e 100644
--- a/modules/extensions/AddonManager.jsm
+++ b/modules/extensions/AddonManager.jsm
@@ -11,6 +11,31 @@ const Cu = Components.utils;
Cu.import("resource://gre/modules/AddonManager.jsm");
Cu.import("resource://tabmixplus/Services.jsm");
+const GOOGLE_REGEXP = /http(s)?:\/\/((www|encrypted|news|images)\.)?google\.(.*?)\/url\?/;
+const GOOGLE_IMGRES_REGEXP = /http(s)?:\/\/(.*?\.)?google\.(.*?)\/imgres\?/;
+const GOOGLE_PLUS_REGEXP = /http(s)?:\/\/plus.url.google.com\/url\?/;
+
+// https://addons.mozilla.org/en-US/firefox/addon/google-no-tracking-url/
+var GoogleNoTrackingUrl = {
+ id: "jid1-zUrvDCat3xoDSQ at jetpack",
+ pref: "extensions." + this.id + "aggresiveGoogleImagesCleanup",
+ onEnabled: function() {
+ const pref = this.pref;
+ TabmixSvc.isFixedGoogleUrl = function(url) {
+ const aggresiveWithImageUrls = TabmixSvc.prefs.get(pref, false);
+ const isSearchResult = GOOGLE_REGEXP.test(url);
+ const isImageSearchResult = GOOGLE_IMGRES_REGEXP.test(url);
+ const isGooglePlusRedirect = GOOGLE_PLUS_REGEXP.test(url);
+
+ return isSearchResult || isGooglePlusRedirect ||
+ isImageSearchResult && aggresiveWithImageUrls;
+ };
+ },
+ onDisabled: function() {
+ TabmixSvc.isFixedGoogleUrl = () => false;
+ },
+};
+
// https://addons.mozilla.org/en-US/firefox/addon/private-tab
var PrivateTab = {
id: "privateTab at infocatcher",
@@ -31,13 +56,7 @@ var SessionManager = {
id: "{1280606b-2510-4fe0-97ef-9b5a22eafe30}",
init: function() {
this._saveTabmixPrefs();
- try {
- let tmp = {};
- Cu.import("chrome://sessionmanager/content/modules/session_manager.jsm", tmp);
- TabmixSvc.sessionManagerAddonInstalled = true;
- } catch (ex) {
- TabmixSvc.sessionManagerAddonInstalled = false;
- }
+ TabmixSvc.sessionManagerAddonInstalled = true;
},
_saveTabmixPrefs: function() {
this.manager_enabled = TabmixSvc.prefBranch.getBoolPref("sessions.manager");
@@ -71,12 +90,21 @@ var SessionManager = {
};
var TabmixListener = {
+ init: function(id) {
+ if (id == SessionManager.id) {
+ SessionManager.init();
+ } else if (id == GoogleNoTrackingUrl.id) {
+ GoogleNoTrackingUrl.onEnabled();
+ }
+ },
onChange: function(aAddon, aAction) {
let id = aAddon.id;
if (id == SessionManager.id)
SessionManager[aAction]();
else if (id == PrivateTab.id) {
PrivateTab[aAction]();
+ } else if (id == GoogleNoTrackingUrl.id) {
+ GoogleNoTrackingUrl[aAction]();
}
},
onEnabled: function(aAddon) {
@@ -99,8 +127,14 @@ var TabmixAddonManager = {
return;
this.initialized = true;
- SessionManager.init();
AddonManager.addAddonListener(TabmixListener);
+ AddonManager.getAddonsByTypes(["extension"], function(addons) {
+ addons.forEach(addon => {
+ if (addon.isActive) {
+ TabmixListener.init(addon.id);
+ }
+ });
+ });
}
};
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tabmixplus.git
More information about the Pkg-mozext-commits
mailing list