[Pkg-mozext-commits] [requestpolicy] 41/100: fix #479
David Prévot
taffit at moszumanska.debian.org
Fri Dec 12 22:56:54 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository requestpolicy.
commit dd7a70741aadb23bb030ad9d5bb02071d8f0493c
Author: myrdd <myrdd at users.noreply.github.com>
Date: Wed Oct 1 18:06:32 2014 +0200
fix #479
---
src/components/requestpolicyService.js | 26 ++++++++++++++++++++++++++
src/content/overlay.js | 12 ------------
2 files changed, 26 insertions(+), 12 deletions(-)
diff --git a/src/components/requestpolicyService.js b/src/components/requestpolicyService.js
index b7ebc51..0bc490f 100644
--- a/src/components/requestpolicyService.js
+++ b/src/components/requestpolicyService.js
@@ -512,6 +512,7 @@ RequestPolicyService.prototype = {
os.addObserver(this, "http-on-modify-request", false);
os.addObserver(this, "xpcom-shutdown", false);
os.addObserver(this, "profile-after-change", false);
+ os.addObserver(this, "sessionstore-windows-restored", false);
os.addObserver(this, "quit-application", false);
os.addObserver(this, "private-browsing", false);
os.addObserver(this, HTTPS_EVERYWHERE_REWRITE_TOPIC, false);
@@ -536,6 +537,7 @@ RequestPolicyService.prototype = {
os.removeObserver(this, "http-on-modify-request");
os.removeObserver(this, "xpcom-shutdown");
os.removeObserver(this, "profile-after-change");
+ os.removeObserver(this, "sessionstore-windows-restored");
os.removeObserver(this, "quit-application");
os.removeObserver(this, requestpolicy.mod.SUBSCRIPTION_UPDATED_TOPIC);
os.removeObserver(this, requestpolicy.mod.SUBSCRIPTION_ADDED_TOPIC);
@@ -687,6 +689,27 @@ RequestPolicyService.prototype = {
}
},
+ _showWelcomeWindow : function() {
+ if (!this.prefs.getBoolPref("welcomeWindowShown")) {
+ var url = "chrome://requestpolicy/content/settings/setup.html";
+
+ var wm = CC['@mozilla.org/appshell/window-mediator;1'].
+ getService(CI.nsIWindowMediator);
+ var windowtype = 'navigator:browser';
+ var mostRecentWindow = wm.getMostRecentWindow(windowtype);
+
+ // the gBrowser object of the firefox window
+ var _gBrowser = mostRecentWindow.getBrowser();
+
+ if (typeof(_gBrowser.addTab) != "function") return;
+
+ _gBrowser.selectedTab = _gBrowser.addTab(url);
+
+ this.prefs.setBoolPref("welcomeWindowShown", true);
+ this._prefService.savePrefFile(null);
+ }
+ },
+
// /////////////////////////////////////////////////////////////////////////
// nsIRequestPolicy interface
// /////////////////////////////////////////////////////////////////////////
@@ -1009,6 +1032,9 @@ RequestPolicyService.prototype = {
this._initializeExtensionCompatibility();
this._initializeApplicationCompatibility();
break;
+ case "sessionstore-windows-restored":
+ this._showWelcomeWindow();
+ break;
case "private-browsing" :
if (data == "enter") {
this._privateBrowsingEnabled = true;
diff --git a/src/content/overlay.js b/src/content/overlay.js
index 17134f9..0c53a62 100644
--- a/src/content/overlay.js
+++ b/src/content/overlay.js
@@ -330,7 +330,6 @@ requestpolicy.overlay = {
this._addLocationObserver();
this._addHistoryObserver();
}
- this._showWelcomeWindow();
} catch (e) {
requestpolicy.mod.Logger.severe(requestpolicy.mod.Logger.TYPE_ERROR,
@@ -1571,17 +1570,6 @@ requestpolicy.overlay = {
// this._openInNewTab(this._prefetchDisablingInstructionsUri);
// },
- _showWelcomeWindow : function() {
- if (!this._rpService.prefs.getBoolPref("welcomeWindowShown")) {
- this._rpService.prefs.setBoolPref("welcomeWindowShown", true);
- this._rpService._prefService.savePrefFile(null);
- window.setTimeout(function() {
- var tab = gBrowser.addTab("chrome://requestpolicy/content/settings/setup.html");
- gBrowser.selectedTab = tab;
- }, 0);
- }
- },
-
openToolbarPopup : function(anchor) {
// requestpolicy.overlay._toolbox.insertBefore(requestpolicy.overlay._menu,
// null);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/requestpolicy.git
More information about the Pkg-mozext-commits
mailing list