[Pkg-mozext-commits] [flashblock] 01/03: Imported Upstream version 1.5.20

David Prévot taffit at moszumanska.debian.org
Sun Dec 6 17:08:08 UTC 2015


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

taffit pushed a commit to branch master
in repository flashblock.

commit 784314f19e74528df0d1a4b86b342e73d6e9fc11
Author: David Prévot <david at tilapin.org>
Date:   Sun Dec 6 12:17:14 2015 -0400

    Imported Upstream version 1.5.20
---
 .../content/flashblock/Flashblock.jsm              |  6 +-
 .../content/flashblock/flashblock.js               | 21 +++---
 .../content/flashblock/flashblock.xul              |  2 +-
 .../flashblock/{flashblock-1.js => flashblock1.js} | 80 ++++++++--------------
 chrome/flashblock.jar!/content/flashblock/frame.js | 10 ++-
 .../flashblock.jar!/content/flashblock/version.dtd |  2 +-
 install.rdf                                        |  2 +-
 7 files changed, 52 insertions(+), 71 deletions(-)

diff --git a/chrome/flashblock.jar!/content/flashblock/Flashblock.jsm b/chrome/flashblock.jar!/content/flashblock/Flashblock.jsm
index 43cae76..21c4544 100644
--- a/chrome/flashblock.jar!/content/flashblock/Flashblock.jsm
+++ b/chrome/flashblock.jar!/content/flashblock/Flashblock.jsm
@@ -2,11 +2,13 @@ var EXPORTED_SYMBOLS = ["FBlockUtils", "FBlockState"];
 
 const { interfaces: Ci, classes: Cc, utils: Cu } = Components;
 
-Cu.import("resource://gre/modules/Services.jsm");
+Components.utils.import("resource://gre/modules/Services.jsm");
 Services.scriptloader.loadSubScript("chrome://flashblock/content/flashblock-prefs.js"); // FBlockUtils
 
 if (Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_DEFAULT) {
-  Services.mm.loadFrameScript("chrome://flashblock/content/frame.js", true);
+  Components.classes["@mozilla.org/globalmessagemanager;1"]
+            .getService(Components.interfaces.nsIMessageListenerManager)
+            .loadFrameScript("chrome://flashblock/content/frame.js", true);
 }
 
 var prefObserver = {
diff --git a/chrome/flashblock.jar!/content/flashblock/flashblock.js b/chrome/flashblock.jar!/content/flashblock/flashblock.js
index 4bbcb92..cbe7546 100644
--- a/chrome/flashblock.jar!/content/flashblock/flashblock.js
+++ b/chrome/flashblock.jar!/content/flashblock/flashblock.js
@@ -1,4 +1,4 @@
-Cu.import("chrome://flashblock/content/Flashblock.jsm"); // FBlockUtils, FBlockState
+Components.utils.import("chrome://flashblock/content/Flashblock.jsm"); // FBlockUtils, FBlockState
 
 var Flashblock = {
 
@@ -7,7 +7,7 @@ var Flashblock = {
       switch(data) {
         case "flashblock.enabled":
         case "javascript.enabled":
-        Flashblock.setButtonState(FBlockState.enabled && FBlockState.isJavascriptEnabled());
+        Flashblock.setButtonState(FBlockState.enabled && FBlockUtils.isJavascriptEnabled());
         break;
       }
     },
@@ -95,7 +95,6 @@ var Flashblock = {
       this.addSiteToWhitelist();
   },
 
-
 /// CONTEXT MENU FUNCTIONS
 
     contextMenuInit : function () {
@@ -204,7 +203,7 @@ var Flashblock = {
 
   //was flashblockToggleButton()
     toggleButton : function(event) {
-      var state = !gFlashblockEnabled;
+      var state = !FBlockState.enabled;
       FBlockUtils.setEnabled(state);
       Flashblock.setButtonState(state);
       if (event.metaKey || event.ctrlKey || event.shiftKey) {
@@ -291,15 +290,11 @@ var Flashblock = {
 
   //was flashblockHideObject()
   hideObject : function() {
-      if(gContextMenu) {
-          var obj = gContextMenu.target;
-          if(obj) {
-              obj.style.display = "none";
-          }
+    if(gContextMenu) {
+      var obj = gContextMenu.target;
+      if(obj) {
+        obj.style.display = "none";
       }
+    }
   }
 }
-
-var gFlashblockEnabled;
-var gSilverblockEnabled;
-var gVideoblockEnabled;
diff --git a/chrome/flashblock.jar!/content/flashblock/flashblock.xul b/chrome/flashblock.jar!/content/flashblock/flashblock.xul
index c7eb1cc..be811d4 100644
--- a/chrome/flashblock.jar!/content/flashblock/flashblock.xul
+++ b/chrome/flashblock.jar!/content/flashblock/flashblock.xul
@@ -11,7 +11,7 @@
 <overlay id="flashblockOverlay" 
          xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
-  <script type="application/x-javascript" src="flashblock.js"/>
+  <script type="application/x-javascript" src="chrome://flashblock/content/flashblock.js"/>
   <script><![CDATA[
     Flashblock.browserInit();
   ]]></script>
diff --git a/chrome/flashblock.jar!/content/flashblock/flashblock-1.js b/chrome/flashblock.jar!/content/flashblock/flashblock1.js
similarity index 88%
rename from chrome/flashblock.jar!/content/flashblock/flashblock-1.js
rename to chrome/flashblock.jar!/content/flashblock/flashblock1.js
index 9a4ccbd..e0461a5 100644
--- a/chrome/flashblock.jar!/content/flashblock/flashblock-1.js
+++ b/chrome/flashblock.jar!/content/flashblock/flashblock1.js
@@ -126,6 +126,9 @@ var Flashblock = {
 			else if(data == "javascript.enabled") {
 				Flashblock.setButtonState(gFlashblockEnabled);
 			}
+			else if(data == "flashblock.html5video.blocked") {
+				gVideoblockEnabled = Flashblock.isVideoEnabled();
+			}
 			else if(data == "flashblock.silverlight.blocked") {
 				gSilverblockEnabled = Flashblock.isSilverlightEnabled();
 			}
@@ -183,9 +186,8 @@ var Flashblock = {
 			expr = expr + "$"; // "^" + 
 
 			var re = new RegExp(expr);
-			if(re.test(host)) {
+			if(re.test(host))
 				return true;
-			}
 		}
 		return false;
 	},
@@ -269,7 +271,7 @@ var Flashblock = {
 	},
 
 	checkLoadFlash : function (e) {
-/*		if(!gFlashblockEnabled ||
+		if(!gFlashblockEnabled ||
 			(e.target &&
 				(e.target.ownerDocument && e.target.ownerDocument.location && (Flashblock.checkWhitelist(e.target.ownerDocument.location)) ||
 				(Flashblock._whitelistTargetEnabled && Flashblock.checkWhitelist(Flashblock.getTargetURI(e.target))) ||
@@ -277,32 +279,24 @@ var Flashblock = {
 			) {
 			e.preventDefault();
 		}
-*/
-		if (!gFlashblockEnabled) {
-			e.preventDefault();
-		}
-		else if (e.target && e.target.ownerDocument && e.target.ownerDocument.location &&
-				Flashblock.checkWhitelist(e.target.ownerDocument.location)) {
-			e.preventDefault();
-		}
-		else if (e.originalTarget && e.originalTarget.ownerDocument && e.originalTarget.ownerDocument.location &&
-				Flashblock.checkWhitelist(e.originalTarget.ownerDocument.location)) {
+		e.stopPropagation();
+	},
+
+	checkLoadVideo : function (e) {
+		if (!gFlashblockEnabled ||
+			!gVideoblockEnabled ||
+			(e.target &&
+				(e.target.ownerDocument && e.target.ownerDocument.location && (Flashblock.checkWhitelist(e.target.ownerDocument.location)) ||
+				(Flashblock._whitelistTargetEnabled && Flashblock.checkWhitelist(Flashblock.getTargetURI(e.target))) ||
+				Flashblock.blockedByContentPolicy(e.target)))
+			) {
 			e.preventDefault();
 		}
-		else if (e.target && Flashblock._whitelistTargetEnabled &&
-				Flashblock.checkWhitelist(Flashblock.getTargetURI(e.target)))
-			e.preventDefault();
-		else if (e.originalTarget && Flashblock._whitelistTargetEnabled &&
-				Flashblock.checkWhitelist(Flashblock.getTargetURI(e.originalTarget)))
-			e.preventDefault();
-		//else if (Flashblock.blockedByContentPolicy(e.target))
-		//	e.preventDefault();
-
 		e.stopPropagation();
 	},
 
 	checkLoadSilver : function (e) {
-/*		if (!gFlashblockEnabled ||
+		if (!gFlashblockEnabled ||
 			!gSilverblockEnabled ||
 			(e.target &&
 				(e.target.ownerDocument && e.target.ownerDocument.location && (Flashblock.checkWhitelist(e.target.ownerDocument.location)) ||
@@ -311,26 +305,6 @@ var Flashblock = {
 			) {
 			e.preventDefault();
 		}
-*/
-		if (!gFlashblockEnabled)
-			e.preventDefault();
-		else if (!gSilverblockEnabled)
-			e.preventDefault();
-		else if (e.target && e.target.ownerDocument && e.target.ownerDocument.location &&
-				Flashblock.checkWhitelist(e.target.ownerDocument.location))
-			e.preventDefault();
-		else if (e.originalTarget && e.originalTarget.ownerDocument && e.originalTarget.ownerDocument.location &&
-				Flashblock.checkWhitelist(e.originalTarget.ownerDocument.location))
-			e.preventDefault();
-		else if (e.target && Flashblock._whitelistTargetEnabled &&
-				Flashblock.checkWhitelist(Flashblock.getTargetURI(e.target)))
-			e.preventDefault();
-		else if (e.originalTarget && Flashblock._whitelistTargetEnabled &&
-				Flashblock.checkWhitelist(Flashblock.getTargetURI(e.originalTarget)))
-			e.preventDefault();
-		//else if (Flashblock.blockedByContentPolicy(e.target))
-		//	e.preventDefault();
-
 		e.stopPropagation();
 	},
 
@@ -505,12 +479,14 @@ var Flashblock = {
       Flashblock.addPrefObserver();
       Flashblock.loadWhitelist();
       gFlashblockEnabled = Flashblock.isEnabled();
+      gVideoblockEnabled = Flashblock.isVideoEnabled();
       gSilverblockEnabled = Flashblock.isSilverlightEnabled();
       Flashblock._whitelistTargetEnabled = Flashblock.isTargetEnabled();
 
       window.addEventListener("load", Flashblock.onInstall, true);
       window.addEventListener("load", Flashblock.contextMenuInit, true);
       window.addEventListener("flashblockCheckLoad", Flashblock.checkLoadFlash, true, true)
+      window.addEventListener("HTML5VideoCheckLoad", Flashblock.checkLoadVideo, true, true)
       window.addEventListener("silverblockCheckLoad", Flashblock.checkLoadSilver, true, true)
     },
 
@@ -582,18 +558,12 @@ var Flashblock = {
 		if(host) {
 			var whitelisted = this.checkHostInWhitelist(host);
 			contextmenuWhitelistItem.setAttribute("disabled", false);
+			contextmenuWhitelistItem.setAttribute("checked", whitelisted);
 			if(toolbarWhitelistItem) {
 				toolbarWhitelistItem.setAttribute("disabled", false);
 				toolbarWhitelistItem.setAttribute("checked", whitelisted)
 			}
 
-			if (gContextMenu) {
-				var thisURI = Components.classes['@mozilla.org/network/standard-url;1']
-					.createInstance(Components.interfaces.nsIURI);
-				thisURI.spec = gContextMenu.target.baseURI;
-				whitelisted = this.checkHostInWhitelist(thisURI.host);
-				contextmenuWhitelistItem.setAttribute("checked", whitelisted);
-			}
 		} else {
 			contextmenuWhitelistItem.setAttribute("disabled", true);
 			if(toolbarWhitelistItem)
@@ -623,6 +593,15 @@ var Flashblock = {
         return true;
     },
 
+    isVideoEnabled : function() {
+        var prefs = Components.classes["@mozilla.org/preferences-service;1"]
+                              .getService(Components.interfaces.nsIPrefBranch);
+
+        if(prefs.getPrefType("flashblock.html5video.blocked") == prefs.PREF_BOOL)
+            return prefs.getBoolPref("flashblock.html5video.blocked");
+        return false;
+    },
+
     isSilverlightEnabled : function() {
         var prefs = Components.classes["@mozilla.org/preferences-service;1"]
                               .getService(Components.interfaces.nsIPrefBranch);
@@ -645,3 +624,4 @@ var Flashblock = {
 var gFlashblockWhitelist;
 var gFlashblockEnabled;
 var gSilverblockEnabled;
+var gVideoblockEnabled;
diff --git a/chrome/flashblock.jar!/content/flashblock/frame.js b/chrome/flashblock.jar!/content/flashblock/frame.js
index 301c084..2ebc29f 100644
--- a/chrome/flashblock.jar!/content/flashblock/frame.js
+++ b/chrome/flashblock.jar!/content/flashblock/frame.js
@@ -3,6 +3,10 @@ Components.utils.import("chrome://flashblock/content/Flashblock.jsm"); // FBlock
 const ios = Components.classes["@mozilla.org/network/io-service;1"]
       .getService(Components.interfaces.nsIIOService);
 
+function log(s) {
+  content.console.log(s);
+}
+
 function getTargetURI(node) {
   var targetURI;
   try {
@@ -69,7 +73,7 @@ function blockedByContentPolicy(node) {
 
 
 function check(e, featureEnabled) {
-  console.log(e.type + ", " + FBlockState.enabled + ", " + featureEnabled + ", " + FBlockState.checkWhitelist(e.target.ownerDocument.location));
+  log(e.type + ", " + FBlockState.enabled + ", " + featureEnabled + ", " + FBlockState.checkWhitelist(e.target.ownerDocument.location));
   const attrName = "data-flashblockWhitelisted";
 
   let node = e.target;
@@ -81,10 +85,10 @@ function check(e, featureEnabled) {
         (FBlockState.targetEnabled && FBlockState.checkWhitelist(getTargetURI(e.target))) ||
         blockedByContentPolicy(e.target)))
       ) {
-      console.log(e.type + ": preventing");
+      log(e.type + ": preventing");
       node.setAttribute(attrName, "true");
       e.preventDefault();
-      console.log(e.type + ": prevented " + e.defaultPrevented  + ", " + e.cancelable + ", " + e.timeStamp);
+      log(e.type + ": prevented " + e.defaultPrevented  + ", " + e.cancelable + ", " + e.timeStamp);
     }
     e.stopPropagation();
 }
diff --git a/chrome/flashblock.jar!/content/flashblock/version.dtd b/chrome/flashblock.jar!/content/flashblock/version.dtd
index dfa1cad..a0e773d 100644
--- a/chrome/flashblock.jar!/content/flashblock/version.dtd
+++ b/chrome/flashblock.jar!/content/flashblock/version.dtd
@@ -1 +1 @@
-<!ENTITY extension.version "1.5.18">
+<!ENTITY extension.version "1.5.20">
diff --git a/install.rdf b/install.rdf
index b54280f..8294c48 100644
--- a/install.rdf
+++ b/install.rdf
@@ -6,7 +6,7 @@
         <em:type>2</em:type>
         <em:unpack>true</em:unpack>
         <em:name>Flashblock</em:name>
-        <em:version>1.5.19</em:version>
+        <em:version>1.5.20</em:version>
         <em:description>Replaces Flash objects with a button you can click to view them.</em:description>
         <em:creator>The Flashblock Team</em:creator>
         <em:contributor>Ted Drake</em:contributor>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/flashblock.git



More information about the Pkg-mozext-commits mailing list