[Pkg-mozext-commits] [requestpolicy] 10/14: show Notice when both RP and RPC are installed

David Prévot taffit at moszumanska.debian.org
Sun Jul 5 15:42:37 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v0.5.29
in repository requestpolicy.

commit 20ad13be85f346c32dd35790a34f08e96d94ad63
Author: Martin Kimmerle <dev at 256k.de>
Date:   Thu May 21 04:09:04 2015 +0200

    show Notice when both RP and RPC are installed
---
 src/chrome.manifest                    |  3 ++
 src/chrome.manifest.devel              |  3 ++
 src/chrome.manifest.packaging          |  3 ++
 src/components/requestpolicyService.js | 34 +++++++++++++++++++++++
 src/content/rp-and-rpc.html            | 51 ++++++++++++++++++++++++++++++++++
 5 files changed, 94 insertions(+)

diff --git a/src/chrome.manifest b/src/chrome.manifest
index 59cc271..4a4e495 100644
--- a/src/chrome.manifest
+++ b/src/chrome.manifest
@@ -2,6 +2,9 @@ content    requestpolicy    content/
 resource   requestpolicy    modules/
 skin       requestpolicy    classic/1.0    skin/
 
+content    rpcontinued      content/
+skin       rpcontinued      classic/1.0    skin/
+
 locale     requestpolicy    en-US          locale/en-US/
 locale     requestpolicy    de             locale/de/
 locale     requestpolicy    eo             locale/eo/
diff --git a/src/chrome.manifest.devel b/src/chrome.manifest.devel
index 59cc271..4a4e495 100644
--- a/src/chrome.manifest.devel
+++ b/src/chrome.manifest.devel
@@ -2,6 +2,9 @@ content    requestpolicy    content/
 resource   requestpolicy    modules/
 skin       requestpolicy    classic/1.0    skin/
 
+content    rpcontinued      content/
+skin       rpcontinued      classic/1.0    skin/
+
 locale     requestpolicy    en-US          locale/en-US/
 locale     requestpolicy    de             locale/de/
 locale     requestpolicy    eo             locale/eo/
diff --git a/src/chrome.manifest.packaging b/src/chrome.manifest.packaging
index 813ddf6..23f390d 100644
--- a/src/chrome.manifest.packaging
+++ b/src/chrome.manifest.packaging
@@ -2,6 +2,9 @@ content    requestpolicy    jar:chrome/requestpolicy.jar!/content/
 resource   requestpolicy    modules/
 skin       requestpolicy    classic/1.0    jar:chrome/requestpolicy.jar!/skin/
 
+content    rpcontinued      jar:chrome/requestpolicy.jar!/content/
+skin       rpcontinued      classic/1.0    jar:chrome/requestpolicy.jar!/skin/
+
 locale     requestpolicy    en-US          jar:chrome/requestpolicy.jar!/locale/en-US/
 locale     requestpolicy    de             jar:chrome/requestpolicy.jar!/locale/de/
 locale     requestpolicy    eo             jar:chrome/requestpolicy.jar!/locale/eo/
diff --git a/src/components/requestpolicyService.js b/src/components/requestpolicyService.js
index 9f6c413..8dd8986 100644
--- a/src/components/requestpolicyService.js
+++ b/src/components/requestpolicyService.js
@@ -179,6 +179,35 @@ RequestPolicyService.prototype = {
     // default preferences.
   },
 
+
+  _checkForLegacyRP : function () {
+
+    function addonCallback(addon) {
+      if (addon === null) {
+        // RP is not installed
+        return;
+      }
+
+      const url = "chrome://rpcontinued/content/rp-and-rpc.html";
+
+      var wm = CC["@mozilla.org/appshell/window-mediator;1"]
+          .getService(CI.nsIWindowMediator);
+      var mostRecentWindow = wm.getMostRecentWindow("navigator:browser");
+
+      // the gBrowser object of the firefox window
+      var _gBrowser = mostRecentWindow.getBrowser();
+
+      if (typeof(_gBrowser.addTab) !== "function") {
+        return;
+      }
+
+      _gBrowser.selectedTab = _gBrowser.addTab(url);
+    }
+
+    AddonManager.getAddonByID("requestpolicy at requestpolicy.com",
+                              addonCallback);
+  },
+
   _initializeExtensionCompatibility : function() {
     if (this._compatibilityRules.length != 0) {
       return;
@@ -516,6 +545,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);
@@ -537,6 +567,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");
       if (!AddonManager) {
         os.removeObserver(this, "em-action-requested");
@@ -1670,6 +1701,9 @@ RequestPolicyService.prototype = {
         this._initializeApplicationCompatibility();
 
         break;
+      case "sessionstore-windows-restored":
+        this._checkForLegacyRP();
+        break;
       case "private-browsing" :
         if (data == "enter") {
           this._privateBrowsingEnabled = true;
diff --git a/src/content/rp-and-rpc.html b/src/content/rp-and-rpc.html
new file mode 100644
index 0000000..eab7168
--- /dev/null
+++ b/src/content/rp-and-rpc.html
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+  <head>
+    <title>RequestPolicy Continued - Notice about legacy RP</title>
+    <style>
+      body {
+        background: #fec;
+        font-family: sans-serif;
+      }
+
+      #content {
+        background-image: url(chrome://rpcontinued/skin/requestpolicy-icon-32.png);
+        background-position: 16px 3.3em;
+        background-repeat: no-repeat;
+        max-width: 45em;
+        padding: 3em 3em 3em 72px;
+      }
+
+      h1 {
+        margin-top: 0;
+      }
+
+      h1 span {
+        color: #c32;
+        font-size: 0.7em;
+      }
+    </style>
+  </head>
+  <body>
+    <div id="content">
+      <h1>Important Notice! <span>regarding RequestPolicy</span></h1>
+
+      <p>
+        You've successfully installed <i>RequestPolicy Continued</i>!
+      </p>
+
+      <p>
+        However, currently both <i>“RequestPolicy”</i> and
+        <i>“RequestPolicy Continued”</i> are installed in your browser.
+        <b>This will lead to conflicts!</b>
+      </p>
+
+      <p>
+        Therefore, please disable or uninstall the old version. To do
+        that, visit the <a href ="about:addons">Add-ons Manager</a>.
+      </p>
+    </div>
+  </body>
+</html>

-- 
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