[Pkg-mozext-commits] [tabmixplus] 23/107: Follow up bug 1204983 - Deprecate NewTabURL and forward calls to AboutNewTabService
David Prévot
taffit at moszumanska.debian.org
Tue Dec 29 19:02:46 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 e00726dbb2337caaccd514ec95ad16ae452995fc
Author: onemen <tabmix.onemen at gmail.com>
Date: Thu Oct 22 23:54:20 2015 +0300
Follow up bug 1204983 - Deprecate NewTabURL and forward calls to AboutNewTabService
---
modules/NewTabURL.jsm | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/modules/NewTabURL.jsm b/modules/NewTabURL.jsm
index 0fab237..d4ac1b6 100644
--- a/modules/NewTabURL.jsm
+++ b/modules/NewTabURL.jsm
@@ -7,9 +7,16 @@ const {interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
+XPCOMUtils.defineLazyServiceGetter(this, "aboutNewTabService",
+ "@mozilla.org/browser/aboutnewtab-service;1",
+ "nsIAboutNewTabService");
+
XPCOMUtils.defineLazyModuleGetter(this, "NewTabURL",
"resource:///modules/NewTabURL.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "TabmixSvc",
+ "resource://tabmixplus/Services.jsm");
+
const FIREFOX_PREF = "browser" + ".newtab.url";
const ABOUT_NEW_TAB = "about:newtab";
@@ -21,6 +28,10 @@ this.Tabmix_NewTabURL = {
]),
init: function() {
+ if (!TabmixSvc.version(440)) {
+ this.updateNewTabURL = this._updateNewTabURL;
+ }
+
if (Services.prefs.prefHasUserValue(FIREFOX_PREF))
this.updateNewTabURL();
@@ -36,12 +47,23 @@ this.Tabmix_NewTabURL = {
}
},
- updateNewTabURL: function() {
+ // for Firefox 41 - 43
+ _updateNewTabURL: function() {
let value = Services.prefs.getComplexValue(FIREFOX_PREF, Ci.nsISupportsString).data;
if (value == ABOUT_NEW_TAB)
NewTabURL.reset();
else
NewTabURL.override(value);
+ },
+
+ // for Firefox 44+
+ updateNewTabURL: function() {
+ let value = Services.prefs.getComplexValue(FIREFOX_PREF, Ci.nsISupportsString).data;
+ if (value == ABOUT_NEW_TAB) {
+ aboutNewTabService.resetNewTabURL();
+ } else {
+ aboutNewTabService.newTabURL = value;
+ }
}
};
--
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