[Pkg-mozext-commits] [flashblock] 01/05: Imported Upstream version 1.5.19
David Prévot
taffit at moszumanska.debian.org
Wed Nov 25 19:43:21 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 1b3570574245b2faccba3e1ded784779c7c78e5d
Author: David Prévot <david at tilapin.org>
Date: Wed Nov 25 15:25:32 2015 -0400
Imported Upstream version 1.5.19
---
.../content/flashblock/Flashblock.jsm | 73 +++
.../{flashblock.js => flashblock-globals.js} | 76 ++-
.../content/flashblock/flashblock.css | 9 +
.../content/flashblock/flashblock.js | 605 +++++----------------
.../content/flashblock/flashblock.xml | 33 +-
.../content/flashblock/flashblock.xul | 7 +-
chrome/flashblock.jar!/content/flashblock/frame.js | 94 ++++
.../content/flashblock/videoblock.xml | 11 +-
install.rdf | 21 +-
9 files changed, 394 insertions(+), 535 deletions(-)
diff --git a/chrome/flashblock.jar!/content/flashblock/Flashblock.jsm b/chrome/flashblock.jar!/content/flashblock/Flashblock.jsm
new file mode 100644
index 0000000..43cae76
--- /dev/null
+++ b/chrome/flashblock.jar!/content/flashblock/Flashblock.jsm
@@ -0,0 +1,73 @@
+var EXPORTED_SYMBOLS = ["FBlockUtils", "FBlockState"];
+
+const { interfaces: Ci, classes: Cc, utils: Cu } = Components;
+
+Cu.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);
+}
+
+var prefObserver = {
+ observe: function(subject, topic, data) {
+ switch(data) {
+ case "flashblock.whitelist":
+ Whitelist.load();
+ break;
+
+ case "flashblock.enabled":
+ FBlockState.enabled = FBlockUtils.isEnabled();
+ break;
+
+ case "flashblock.html5video.blocked":
+ FBlockState.videoblockEnabled = FBlockUtils.isVideoEnabled();
+ break;
+
+ case "flashblock.silverlight.blocked":
+ FBlockState.silverblockEnabled = FBlockUtils.isSilverlightEnabled();
+ break;
+
+ case "flashblock.whitelist.includeTarget":
+ FBlockState.targetEnabled = FBlockUtils.isTargetEnabled();
+ break;
+ }
+ },
+
+ QueryInterface : function (aIID) {
+ if (aIID.equals(Components.interfaces.nsIObserver) ||
+ aIID.equals(Components.interfaces.nsISupports) ||
+ aIID.equals(Components.interfaces.nsISupportsWeakReference))
+ return this;
+ throw Components.results.NS_NOINTERFACE;
+ }
+};
+
+Services.prefs.addObserver("flashblock.", prefObserver, true);
+
+const Whitelist = {
+ rx: null,
+
+ load: function () {
+ const wl = FBlockUtils.getWhitelist();
+ this.rx = wl && new RegExp(
+ "^(?:" + wl.split(",").map(function(s) s.replace(/[.?+-]/g, "\\$&").replace(/\*/g, '.*')).join("|") + ")"
+ );
+ },
+
+ checkHost: function (host) host && this.rx && this.rx.test(host),
+
+ check: function (url) !FBlockUtils.isLocalBlocked() && url.protocol == "file:" || this.checkHost(url.host) || this.checkHost(url.spec)
+}
+Whitelist.load();
+
+const FBlockState = {
+ enabled: FBlockUtils.isEnabled(),
+ videoblockEnabled: FBlockUtils.isVideoEnabled(),
+ silverblockEnabled: FBlockUtils.isSilverlightEnabled(),
+ targetEnabled: FBlockUtils.isTargetEnabled(),
+ checkWhitelist: function (url) Whitelist.check(url),
+ checkHostInWhitelist: function (host) Whitelist.checkHost(host),
+ whitelist: Whitelist,
+};
+
diff --git a/chrome/flashblock.jar!/content/flashblock/flashblock.js b/chrome/flashblock.jar!/content/flashblock/flashblock-globals.js
similarity index 88%
copy from chrome/flashblock.jar!/content/flashblock/flashblock.js
copy to chrome/flashblock.jar!/content/flashblock/flashblock-globals.js
index 7ed5cc9..3b27735 100644
--- a/chrome/flashblock.jar!/content/flashblock/flashblock.js
+++ b/chrome/flashblock.jar!/content/flashblock/flashblock-globals.js
@@ -1,5 +1,12 @@
var Flashblock = {
+ // Pseudo Globals
+
+ gFlashblockWhitelist: [],
+ gFlashblockEnabled : true,
+ gSilverblockEnabled : true,
+ gVideoblockEnabled : true,
+
// File mode flags
MODE_RDONLY : 0x01,
@@ -97,20 +104,6 @@ var Flashblock = {
return (ret == fileContents.length);
},
- // Removes the CSS import statement for the flashblock stylesheet
- removeImportFromUserStylesheet : function (fileName) {
- var fileContents = Flashblock.readUserChromeFile(fileName);
- var re = new RegExp("^[ \t]*@import.*chrome://flashblock/content/flashblock.css.*(\n)?$", "mg");
-
- if(re.test(fileContents)) {
- fileContents = fileContents.replace(re, '');
- var ret = Flashblock.writeUserChromeFile(fileName, fileContents);
- return (ret == fileContents.length)
- } else {
- return true;
- }
- },
-
_whitelistTargetEnabled: true,
/// PREF FUNCTIONS
@@ -120,17 +113,17 @@ var Flashblock = {
if(data == "flashblock.whitelist")
Flashblock.loadWhitelist();
else if(data == "flashblock.enabled") {
- gFlashblockEnabled = Flashblock.isEnabled();
- Flashblock.setButtonState(gFlashblockEnabled);
+ Flashblock.gFlashblockEnabled = Flashblock.isEnabled();
+ Flashblock.setButtonState(Flashblock.gFlashblockEnabled);
}
else if(data == "javascript.enabled") {
- Flashblock.setButtonState(gFlashblockEnabled);
+ Flashblock.setButtonState(this.gFlashblockEnabled);
}
else if(data == "flashblock.html5video.blocked") {
- gVideoblockEnabled = Flashblock.isVideoEnabled();
+ Flashblock.gVideoblockEnabled = Flashblock.isVideoEnabled();
}
else if(data == "flashblock.silverlight.blocked") {
- gSilverblockEnabled = Flashblock.isSilverlightEnabled();
+ Flashblock.gSilverblockEnabled = Flashblock.isSilverlightEnabled();
}
else if(data == "flashblock.whitelist.includeTarget") {
Flashblock._whitelistTargetEnabled = Flashblock.isTargetEnabled();
@@ -162,17 +155,17 @@ var Flashblock = {
// Loads the whitelist into the global array
loadWhitelist : function () {
var flashblockPref = FBlockUtils.getWhitelist();
- gFlashblockWhitelist = new Array();
+ Flashblock.gFlashblockWhitelist = [];
if (flashblockPref)
- gFlashblockWhitelist = flashblockPref.split(",");
+ Flashblock.gFlashblockWhitelist = flashblockPref.split(",");
},
checkHostInWhitelist : function (host) {
if (!host)
return false;
- for (var i = 0; i < gFlashblockWhitelist.length; i++) {
+ for (var i = 0; i < Flashblock.gFlashblockWhitelist.length; i++) {
// Handle *
- var expr = gFlashblockWhitelist[i];
+ var expr = Flashblock.gFlashblockWhitelist[i];
expr = expr.replace(/\./g, "\\.");
expr = expr.replace(/\-/g, "\\-");
expr = expr.replace(/\?/g, "\\?");
@@ -268,7 +261,7 @@ var Flashblock = {
},
checkLoadFlash : function (e) {
- if(!gFlashblockEnabled ||
+ if(!Flashblock.gFlashblockEnabled ||
(e.target &&
(e.target.ownerDocument && e.target.ownerDocument.location && (Flashblock.checkWhitelist(e.target.ownerDocument.location)) ||
(Flashblock._whitelistTargetEnabled && Flashblock.checkWhitelist(Flashblock.getTargetURI(e.target))) ||
@@ -280,8 +273,8 @@ var Flashblock = {
},
checkLoadVideo : function (e) {
- if (!gFlashblockEnabled ||
- !gVideoblockEnabled ||
+ if (!Flashblock.gFlashblockEnabled ||
+ !Flashblock.gVideoblockEnabled ||
(e.target &&
(e.target.ownerDocument && e.target.ownerDocument.location && (Flashblock.checkWhitelist(e.target.ownerDocument.location)) ||
(Flashblock._whitelistTargetEnabled && Flashblock.checkWhitelist(Flashblock.getTargetURI(e.target))) ||
@@ -293,8 +286,8 @@ var Flashblock = {
},
checkLoadSilver : function (e) {
- if (!gFlashblockEnabled ||
- !gSilverblockEnabled ||
+ if (!Flashblock.gFlashblockEnabled ||
+ !Flashblock.gSilverblockEnabled ||
(e.target &&
(e.target.ownerDocument && e.target.ownerDocument.location && (Flashblock.checkWhitelist(e.target.ownerDocument.location)) ||
(Flashblock._whitelistTargetEnabled && Flashblock.checkWhitelist(Flashblock.getTargetURI(e.target))) ||
@@ -458,10 +451,6 @@ var Flashblock = {
onInstall : function() {
window.removeEventListener("load", Flashblock.onInstall, true);
- // Remove the old-style userContent.css import
- Flashblock.removeImportFromUserStylesheet('userContent.css');
-
- // Only use the new stylesheet api
var sss = Components.classes["@mozilla.org/content/style-sheet-service;1"]
.getService(Components.interfaces.nsIStyleSheetService);
var ios = Components.classes["@mozilla.org/network/io-service;1"]
@@ -475,9 +464,9 @@ var Flashblock = {
browserInit: function() {
Flashblock.addPrefObserver();
Flashblock.loadWhitelist();
- gFlashblockEnabled = Flashblock.isEnabled();
- gVideoblockEnabled = Flashblock.isVideoEnabled();
- gSilverblockEnabled = Flashblock.isSilverlightEnabled();
+ Flashblock.gFlashblockEnabled = Flashblock.isEnabled();
+ Flashblock.gVideoblockEnabled = Flashblock.isVideoEnabled();
+ Flashblock.gSilverblockEnabled = Flashblock.isSilverlightEnabled();
Flashblock._whitelistTargetEnabled = Flashblock.isTargetEnabled();
window.addEventListener("load", Flashblock.onInstall, true);
@@ -491,7 +480,7 @@ var Flashblock = {
//was flashblockToggleButton()
toggleButton : function(event) {
- var state = !gFlashblockEnabled;
+ var state = !Flashblock.gFlashblockEnabled;
FBlockUtils.setEnabled(state);
Flashblock.setButtonState(state);
if (event.metaKey || event.ctrlKey || event.shiftKey) {
@@ -560,13 +549,15 @@ var Flashblock = {
toolbarWhitelistItem.setAttribute("checked", whitelisted)
}
+ var thisURI = Components.classes['@mozilla.org/network/standard-url;1']
+ .createInstance(Components.interfaces.nsIURI);
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 {
+ thisURI.spec = content.location;
}
+ whitelisted = this.checkHostInWhitelist(thisURI.host);
+ contextmenuWhitelistItem.setAttribute("checked", whitelisted);
} else {
contextmenuWhitelistItem.setAttribute("disabled", true);
if(toolbarWhitelistItem)
@@ -623,8 +614,3 @@ var Flashblock = {
return true;
}
}
-
-var gFlashblockWhitelist;
-var gFlashblockEnabled;
-var gSilverblockEnabled;
-var gVideoblockEnabled;
diff --git a/chrome/flashblock.jar!/content/flashblock/flashblock.css b/chrome/flashblock.jar!/content/flashblock/flashblock.css
index c547543..fd5cc4f 100644
--- a/chrome/flashblock.jar!/content/flashblock/flashblock.css
+++ b/chrome/flashblock.jar!/content/flashblock/flashblock.css
@@ -9,6 +9,15 @@
/*
* Flash identifiers.
*/
+/*
+embed[type="application/x-shockwave-flash"]:-moz-handler-disabled,
+embed[type="application/x-shockwave-flash"]:-moz-handler-blocked,
+embed[type="application/x-shockwave-flash"]:-moz-handler-crashed,
+embed[type="application/x-shockwave-flash"]:-moz-handler-clicktoplay,
+embed[type="application/x-shockwave-flash"]:-moz-handler-playpreview,
+embed[type="application/x-shockwave-flash"]:-moz-handler-vulnerable-updatable,
+embed[type="application/x-shockwave-flash"]:-moz-handler-vulnerable-no-update,
+*/
object[classid*=":D27CDB6E-AE6D-11cf-96B8-444553540000"],
object[codebase*="swflash.cab"],
object[data*=".swf"],
diff --git a/chrome/flashblock.jar!/content/flashblock/flashblock.js b/chrome/flashblock.jar!/content/flashblock/flashblock.js
index 7ed5cc9..4bbcb92 100644
--- a/chrome/flashblock.jar!/content/flashblock/flashblock.js
+++ b/chrome/flashblock.jar!/content/flashblock/flashblock.js
@@ -1,373 +1,99 @@
-var Flashblock = {
-
- // File mode flags
-
- MODE_RDONLY : 0x01,
- MODE_WRONLY : 0x02,
- MODE_RDWR : 0x04,
- MODE_CREATE : 0x08,
- MODE_APPEND : 0x10,
- MODE_TRUNCATE : 0x20,
- MODE_SYNC : 0x40,
- MODE_EXCL : 0x80,
-
- /// USER STYLESHEET FUNCTIONS
-
- // Returns a nsIFile for the specified file in the profile chrome directory
- getUserChromeFile : function(fileName) {
- var NSIFILE = Components.interfaces.nsIFile;
- var dirLocator = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties);
- var userChromePath = dirLocator.get("UChrm", NSIFILE).path;
-
- var file = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsILocalFile);
-
- file.initWithPath(userChromePath);
- file.append(fileName);
-
- return file;
- },
-
- // Returns the contents of the specified file in the profile chrome directory
- readUserChromeFile : function (fileName) {
- var fileContents = "";
- var file = Flashblock.getUserChromeFile(fileName);
-
- if(file.exists()) {
- var ioFlags = this.MODE_RDONLY;
-
- // Get an input stream
- var is = Components.classes["@mozilla.org/network/file-input-stream;1"]
- .createInstance( Components.interfaces.nsIFileInputStream);
- is.init(file, ioFlags, 0, is.CLOSE_ON_EOF);
- var sis = Components.classes["@mozilla.org/scriptableinputstream;1"]
- .createInstance( Components.interfaces.nsIScriptableInputStream);
- sis.init(is);
-
- // Read the file in
- while(sis.available() > 0)
- fileContents += sis.read(sis.available());
-
- // Close streams
- is.close();
- sis.close();
- }
-
- return fileContents;
- },
-
- // Writes the specified contents into the specified file in the profile chrome directory
- writeUserChromeFile : function (fileName, fileContents) {
- var file = Flashblock.getUserChromeFile(fileName);
- var ioFlags = this.MODE_WRONLY | this.MODE_CREATE | this.MODE_TRUNCATE;
- var perm = 0644;
+Cu.import("chrome://flashblock/content/Flashblock.jsm"); // FBlockUtils, FBlockState
- var os = Components.classes["@mozilla.org/network/file-output-stream;1"]
- .createInstance( Components.interfaces.nsIFileOutputStream);
- os.init(file, ioFlags, perm, 0);
-
- var result = os.write(fileContents, fileContents.length);
- os.close();
-
- return result;
- },
-
- // Checks the if the user stylesheet already contains the import statement
- userStyleSheetHasImport : function () {
- var fileContents = Flashblock.readUserChromeFile('userContent.css');
- var re = new RegExp("^[ \t]*@import.*chrome://flashblock/content/flashblock.css", "m");
+var Flashblock = {
- return re.test(fileContents);
+ prefObserver : {
+ observe: function(subject, topic, data) {
+ switch(data) {
+ case "flashblock.enabled":
+ case "javascript.enabled":
+ Flashblock.setButtonState(FBlockState.enabled && FBlockState.isJavascriptEnabled());
+ break;
+ }
},
- // Adds a CSS import statement for the flashblock stylesheet
- addImportToUserStylesheet : function (fileName) {
- var importStr = "@import url(chrome://flashblock/content/flashblock.css);"
-
- var fileContents = Flashblock.readUserChromeFile('userContent.css');
- var re = new RegExp("^[ \t]*@import.*chrome://flashblock/content/flashblock.css", "m");
-
- if(re.test(fileContents))
- return true;
+ QueryInterface : function (aIID) {
+ if (aIID.equals(Components.interfaces.nsIObserver) ||
+ aIID.equals(Components.interfaces.nsISupports) ||
+ aIID.equals(Components.interfaces.nsISupportsWeakReference))
+ return this;
+ throw Components.results.NS_NOINTERFACE;
+ }
+ },
+
+ // was addFlashblockPrefObserver
+ addPrefObserver : function () {
+ var prefs = Components.classes["@mozilla.org/preferences-service;1"]
+ .getService(Components.interfaces.nsIPrefBranch);
+
+ var pbi = prefs.QueryInterface(Components.interfaces.nsIPrefBranchInternal);
+ pbi.addObserver("flashblock.", Flashblock.prefObserver, true);
+ pbi.addObserver("javascript.enabled", Flashblock.prefObserver, true);
+ },
+
+ // Gets the hostname from the URI of the current page
+ getHost : function () {
+ var pageURI;
+ if (gContextMenu)
+ pageURI = gContextMenu.target.baseURI;
+ else
+ pageURI = content.location;
+
+ // Work around about: and file:// URIs.
+ // If we do uri.spec = "about:blank", the URI ends up as about://blank/
+ if(/about:|file:|news:|snews:/i.test(pageURI.protocol))
+ return null;
+
+ var uri = Components.classes['@mozilla.org/network/standard-url;1']
+ .createInstance(Components.interfaces.nsIURI);
+ uri.spec = pageURI;
+
+ // Phil: use asciiHost until we change the pref from char to complex
+ var host = uri.asciiHost;
+ if (uri.port > 0)
+ host += ":" + uri.port;
+
+ return host;
+ },
+
+ // Adds the host of the current URI to the whitelist
+ addSiteToWhitelist : function (site) {
+ var host = site || this.getHost();
+ if( (!host) || (host == "") )
+ return;
+
+ var prefStr = FBlockUtils.getWhitelist();
+ var re = new RegExp("(^|,)" + host + "(,|$)");
+ if(! re.test(prefStr)) {
+ if(prefStr && prefStr.length > 0)
+ prefStr += "," + host;
+ else
+ prefStr = host;
+ FBlockUtils.setWhitelist(prefStr);
+ }
+ },
- fileContents = importStr + "\n" + fileContents;
+ // Removes the host of the current URI from the whitelist
+ removeSiteFromWhitelist : function () {
+ var host = this.getHost();
+ if( (!host) || (host == "") )
+ return;
- var ret = Flashblock.writeUserChromeFile(fileName, fileContents);
- return (ret == fileContents.length);
- },
+ var prefStr = FBlockUtils.getWhitelist();
+ var regex = new RegExp("(^|,)(" + host + ")(,|$)", "g");
- // Removes the CSS import statement for the flashblock stylesheet
- removeImportFromUserStylesheet : function (fileName) {
- var fileContents = Flashblock.readUserChromeFile(fileName);
- var re = new RegExp("^[ \t]*@import.*chrome://flashblock/content/flashblock.css.*(\n)?$", "mg");
-
- if(re.test(fileContents)) {
- fileContents = fileContents.replace(re, '');
- var ret = Flashblock.writeUserChromeFile(fileName, fileContents);
- return (ret == fileContents.length)
- } else {
- return true;
- }
- },
+ prefStr = prefStr.replace(regex, "$3");
+ FBlockUtils.setWhitelist(prefStr);
+ },
- _whitelistTargetEnabled: true,
-
-/// PREF FUNCTIONS
- // was flashblockPrefObserver
- prefObserver : {
- observe: function(subject, topic, data) {
- if(data == "flashblock.whitelist")
- Flashblock.loadWhitelist();
- else if(data == "flashblock.enabled") {
- gFlashblockEnabled = Flashblock.isEnabled();
- Flashblock.setButtonState(gFlashblockEnabled);
- }
- 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();
- }
- else if(data == "flashblock.whitelist.includeTarget") {
- Flashblock._whitelistTargetEnabled = Flashblock.isTargetEnabled();
- }
- },
-
- QueryInterface : function (aIID) {
- if (aIID.equals(Components.interfaces.nsIObserver) ||
- aIID.equals(Components.interfaces.nsISupports) ||
- aIID.equals(Components.interfaces.nsISupportsWeakReference))
- return this;
- throw Components.results.NS_NOINTERFACE;
- }
- },
-
- // was addFlashblockPrefObserver
- addPrefObserver : function () {
- var prefs = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
-
- var pbi = prefs.QueryInterface(Components.interfaces.nsIPrefBranchInternal);
- pbi.addObserver("flashblock.", Flashblock.prefObserver, true);
- pbi.addObserver("javascript.enabled", Flashblock.prefObserver, true);
- },
-
-
-/// WHITELIST FUNCTIONS
-
- // Loads the whitelist into the global array
- loadWhitelist : function () {
- var flashblockPref = FBlockUtils.getWhitelist();
- gFlashblockWhitelist = new Array();
- if (flashblockPref)
- gFlashblockWhitelist = flashblockPref.split(",");
- },
-
- checkHostInWhitelist : function (host) {
- if (!host)
- return false;
- for (var i = 0; i < gFlashblockWhitelist.length; i++) {
- // Handle *
- var expr = gFlashblockWhitelist[i];
- expr = expr.replace(/\./g, "\\.");
- expr = expr.replace(/\-/g, "\\-");
- expr = expr.replace(/\?/g, "\\?");
- expr = expr.replace(/\+/g, "\\+");
- //expr = expr.replace(/\*/g, "[A-Za-z0-9_\\-\\.]*")
- //expr = expr.replace(/\*/g, "[^ \t\v\n\r\f]*")
- expr = expr.replace(/\*/g, ".*")
- if (expr.slice(-2) != ".*")
- expr = expr + ".*"
- expr = expr + "$"; // "^" +
-
- var re = new RegExp(expr);
- if(re.test(host))
- return true;
- }
- return false;
- },
-
- checkWhitelist : function (url) {
- if(!FBlockUtils.isLocalBlocked()) {
- if(url.protocol == "file:")
- return true;
- }
-
- return this.checkHostInWhitelist(url.host) || this.checkHostInWhitelist(url.spec);
- },
-
- getTargetURI : function(node) {
- var targetURI;
- try {
- // Get object URI in the same way as nsObjectLoadingContent::LoadObject()
- var relativeURI;
- switch (node.localName.toLowerCase()) {
- case "object":
- relativeURI = node.getAttribute("data") || node.getAttribute("src") || "";
- if (!relativeURI) {
- var params = node.getElementsByTagName("param");
-
- for (var ii = 0; ii < params.length; ii++) {
- var name = params[ii].getAttribute("name");
- switch (name) {
- case "movie":
- case "src":
- relativeURI = params[ii].getAttribute("value");
- break;
- }
- }
- }
- break;
- case "embed":
- relativeURI = node.getAttribute("src") || "";
- break;
- }
-
- var ios = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
- var baseURI = ios.newURI(node.baseURI, null, null);
- var codeBase = node.getAttribute("codebase");
- if (codeBase) {
- try {
- baseURI = ios.newURI(codeBase, node.ownerDocument.characterSet, baseURI);
- } catch (e) {} // Ignore invalid codebase attribute
- }
- if (node.ownerDocument)
- targetURI = ios.newURI(relativeURI, node.ownerDocument.characterSet, baseURI);
- else
- targetURI = ios.newURI(relativeURI, null, baseURI);
- }
- catch (e) {
- Components.utils.reportError(e);
- }
- return targetURI;
- },
-
- blockedByContentPolicy : function(node) {
- try {
- var uri = this.getTargetURI(node);
- // Ask content policy whether this object is already blocked
- var ios = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
- var requestOrigin = ios.newURI(node.ownerDocument.location, null, null);
- var contentPolicy = Components.classes["@mozilla.org/layout/content-policy;1"]
- .getService(Components.interfaces.nsIContentPolicy);
- var blockType = contentPolicy.shouldLoad(Components.interfaces.nsIContentPolicy.TYPE_OBJECT,
- uri, requestOrigin, node,
- node.getAttribute("type"), null);
- return blockType != Components.interfaces.nsIContentPolicy.ACCEPT;
- }
- catch (e) {
- Components.utils.reportError(e);
- return false;
- }
- },
-
- checkLoadFlash : function (e) {
- 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))) ||
- Flashblock.blockedByContentPolicy(e.target)))
- ) {
- e.preventDefault();
- }
- 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();
- }
- e.stopPropagation();
- },
-
- checkLoadSilver : function (e) {
- if (!gFlashblockEnabled ||
- !gSilverblockEnabled ||
- (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();
- }
- e.stopPropagation();
- },
-
- // Gets the hostname from the URI of the current page
- getHost : function () {
- var pageURI;
- if (gContextMenu)
- pageURI = gContextMenu.target.baseURI;
- else
- pageURI = content.location;
-
- // Work around about: and file:// URIs.
- // If we do uri.spec = "about:blank", the URI ends up as about://blank/
- if(/about:|file:|news:|snews:/i.test(pageURI.protocol))
- return null;
-
- var uri = Components.classes['@mozilla.org/network/standard-url;1']
- .createInstance(Components.interfaces.nsIURI);
- uri.spec = pageURI;
-
- // Phil: use asciiHost until we change the pref from char to complex
- var host = uri.asciiHost;
- if (uri.port > 0)
- host += ":" + uri.port;
-
- return host;
- },
-
- // Adds the host of the current URI to the whitelist
- addSiteToWhitelist : function (site) {
- var host = site || this.getHost();
- if( (!host) || (host == "") )
- return;
-
- var prefStr = FBlockUtils.getWhitelist();
- var re = new RegExp("(^|,)" + host + "(,|$)");
- if(! re.test(prefStr)) {
- if(prefStr && prefStr.length > 0)
- prefStr += "," + host;
- else
- prefStr = host;
- FBlockUtils.setWhitelist(prefStr);
- }
- },
-
- // Removes the host of the current URI from the whitelist
- removeSiteFromWhitelist : function () {
- var host = this.getHost();
- if( (!host) || (host == "") )
- return;
-
- var prefStr = FBlockUtils.getWhitelist();
- var regex = new RegExp("(^|,)(" + host + ")(,|$)", "g");
-
- prefStr = prefStr.replace(regex, "$3");
- FBlockUtils.setWhitelist(prefStr);
- },
-
- // Toggles the whitelist status of the host of the current URI
- toggleSiteWhitelisted : function () {
- host = this.getHost();
- if(this.checkHostInWhitelist(host))
- this.removeSiteFromWhitelist();
- else
- this.addSiteToWhitelist();
- },
+ // Toggles the whitelist status of the host of the current URI
+ toggleSiteWhitelisted : function () {
+ host = this.getHost();
+ if(FBlockState.checkHostInWhitelist(host))
+ this.removeSiteFromWhitelist();
+ else
+ this.addSiteToWhitelist();
+ },
/// CONTEXT MENU FUNCTIONS
@@ -377,9 +103,9 @@ var Flashblock = {
for (var i = 0; i < items.length; i++) {
var cm = document.getElementById(items[i]);
if (cm)
- cm.addEventListener("popupshowing",Flashblock.contextMenu,false);
+ cm.addEventListener("popupshowing", Flashblock.contextMenu, false);
}
- Flashblock.setButtonState(Flashblock.isEnabled());
+ Flashblock.setButtonState(FBlockState.enabled && FBlockUtils.isJavascriptEnabled());
},
// was flashblockContextMenu()
@@ -403,11 +129,10 @@ var Flashblock = {
cm.showItem("context-flashRemove", onFlash && !nukeItem);
if (onFlash) {
-
var itemsToHide = ["context-back", "context-forward", "context-reload",
"context-stop", "context-sep-stop",
"context-bookmarkpage", "context-savepage", "context-sendpage",
- "context-viewbgimage", "context-viewbgimage-menu", "context-sep-viewbgimage",
+ "context-viewbgimage", "context-viewbgimage-menu", "context-sep-viewbgimage",
"context-selectall", "context-viewsource", "context-viewinfo",
"context-metadata", "context-sep-properties",
"switchToTrident", "context-print" ];
@@ -416,10 +141,10 @@ var Flashblock = {
}
var thisURI = Components.classes['@mozilla.org/network/standard-url;1']
- .createInstance(Components.interfaces.nsIURI);
+ .createInstance(Components.interfaces.nsIURI);
thisURI.spec = gContextMenu.target.baseURI;
document.getElementById("context-flashAllow")
- .setAttribute("tooltiptext", thisURI.prePath);
+ .setAttribute("tooltiptext", thisURI.prePath);
var cmLocationItem = document.getElementById("context-flashLocation");
if (cmLocationItem && gContextMenu.target.title) {
@@ -445,12 +170,13 @@ var Flashblock = {
// was flashblockOptions()
showOptions : function() {
window.openDialog("chrome://flashblock/content/options.xul",
- "FlashblockOptions", "chrome,titlebar,toolbar,centerscreen,resizable");
+ "FlashblockOptions",
+ "chrome,titlebar,toolbar,centerscreen,resizable");
},
copyLocation : function() {
var clipboard = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
- .getService(Components.interfaces.nsIClipboardHelper);
+ .getService(Components.interfaces.nsIClipboardHelper);
clipboard.copyString(Flashblock.getAbsoluteURL(gContextMenu.target));
},
@@ -458,14 +184,10 @@ var Flashblock = {
onInstall : function() {
window.removeEventListener("load", Flashblock.onInstall, true);
- // Remove the old-style userContent.css import
- Flashblock.removeImportFromUserStylesheet('userContent.css');
-
- // Only use the new stylesheet api
var sss = Components.classes["@mozilla.org/content/style-sheet-service;1"]
- .getService(Components.interfaces.nsIStyleSheetService);
+ .getService(Components.interfaces.nsIStyleSheetService);
var ios = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
+ .getService(Components.interfaces.nsIIOService);
var u = ios.newURI("chrome://flashblock/content/flashblock.css", null, null);
if(!sss.sheetRegistered(u, sss.USER_SHEET)) {
sss.loadAndRegisterSheet(u, sss.USER_SHEET);
@@ -474,29 +196,20 @@ var Flashblock = {
browserInit: function() {
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)
},
/// TOOLBARBUTTON CODE
//was flashblockToggleButton()
toggleButton : function(event) {
- var state = !gFlashblockEnabled;
- FBlockUtils.setEnabled(state);
- Flashblock.setButtonState(state);
- if (event.metaKey || event.ctrlKey || event.shiftKey) {
- BrowserReload();
- }
+ var state = !gFlashblockEnabled;
+ FBlockUtils.setEnabled(state);
+ Flashblock.setButtonState(state);
+ if (event.metaKey || event.ctrlKey || event.shiftKey) {
+ BrowserReload();
+ }
},
//was flashblockSetButtonState(state)
@@ -523,7 +236,7 @@ var Flashblock = {
.createInstance(Components.interfaces.nsIURI);
thisURI.spec = content.location;
var menu = document.getElementById("buttonmenu-flashblockAllow");
- if (menu) {
+ if (menu) {
menu.setAttribute("tooltiptext", thisURI.prePath)
};
},
@@ -547,84 +260,46 @@ var Flashblock = {
}
},
- checkWhitelistToggle : function () {
- var host = this.getHost();
- var toolbarWhitelistItem = document.getElementById("buttonmenu-flashblockAllow");
- var contextmenuWhitelistItem = document.getElementById("context-flashAllow");
-
- if(host) {
- var whitelisted = this.checkHostInWhitelist(host);
- contextmenuWhitelistItem.setAttribute("disabled", false);
- 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)
- toolbarWhitelistItem.setAttribute("disabled", true);
- }
- },
-
-/// MISC
-
- //was flashblockHideObject()
- hideObject : function() {
- if(gContextMenu) {
- var obj = gContextMenu.target;
- if(obj) {
- obj.style.display = "none";
- }
- }
- },
-
- // the isEnabled() function in flashblock-prefs.js seems to go out of scope
- isEnabled : function() {
- var prefs = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
-
- if(prefs.getPrefType("flashblock.enabled") == prefs.PREF_BOOL)
- return prefs.getBoolPref("flashblock.enabled");
- 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);
+ checkWhitelistToggle : function () {
+ var host = this.getHost();
+ var toolbarWhitelistItem = document.getElementById("buttonmenu-flashblockAllow");
+ var contextmenuWhitelistItem = document.getElementById("context-flashAllow");
+
+ if(host) {
+ var whitelisted = FBlockState.checkHostInWhitelist(host);
+ contextmenuWhitelistItem.setAttribute("disabled", false);
+ if(toolbarWhitelistItem) {
+ toolbarWhitelistItem.setAttribute("disabled", false);
+ toolbarWhitelistItem.setAttribute("checked", whitelisted)
+ }
- if(prefs.getPrefType("flashblock.silverlight.blocked") == prefs.PREF_BOOL)
- return prefs.getBoolPref("flashblock.silverlight.blocked");
- return false;
- },
+ if (gContextMenu) {
+ var thisURI = Components.classes['@mozilla.org/network/standard-url;1']
+ .createInstance(Components.interfaces.nsIURI);
+ thisURI.spec = gContextMenu.target.baseURI;
+ whitelisted = FBlockState.checkHostInWhitelist(thisURI.host);
+ contextmenuWhitelistItem.setAttribute("checked", whitelisted);
+ }
+ } else {
+ contextmenuWhitelistItem.setAttribute("disabled", true);
+ if(toolbarWhitelistItem)
+ toolbarWhitelistItem.setAttribute("disabled", true);
+ }
+ },
- isTargetEnabled : function() {
- var prefs = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
+/// MISC
- if(prefs.getPrefType("flashblock.silverlight.blocked") == prefs.PREF_BOOL)
- return prefs.getBoolPref("flashblock.whitelist.includeTarget");
- return true;
- }
+ //was flashblockHideObject()
+ hideObject : function() {
+ if(gContextMenu) {
+ var obj = gContextMenu.target;
+ if(obj) {
+ obj.style.display = "none";
+ }
+ }
+ }
}
-var gFlashblockWhitelist;
var gFlashblockEnabled;
var gSilverblockEnabled;
var gVideoblockEnabled;
diff --git a/chrome/flashblock.jar!/content/flashblock/flashblock.xml b/chrome/flashblock.jar!/content/flashblock/flashblock.xml
index d9ef11e..379bf45 100644
--- a/chrome/flashblock.jar!/content/flashblock/flashblock.xml
+++ b/chrome/flashblock.jar!/content/flashblock/flashblock.xml
@@ -111,13 +111,14 @@ function flashblockIsWhitelisted(node, type) {
// thought of it on my own. :-)
// Lor 20041215: Use "UIEvents" to make it work in post-1.0 FF
// (thanks to Neil again)
+ // bz says QI is a no-op.
document.QueryInterface(Components.interfaces.nsIDOMDocument);
var flashblockEvent = document.createEvent("UIEvents");
if(flashblockEvent) {
var evt = type == "silverlight" ? "silverblockCheckLoad" : "flashblockCheckLoad";
flashblockEvent.initEvent(evt, true, true);
node.dispatchEvent(flashblockEvent);
- if(flashblockEvent.getPreventDefault() == true) {
+ if(flashblockEvent.defaultPrevented || node.hasAttribute("data-flashblockWhitelisted")) {
// Whitelisted
return true;
}
@@ -331,25 +332,29 @@ placeholder.addEventListener("keypress", flashblockShowFlash, "false");
</implementation>
</binding>
-<binding id="director" extends="#flash">
+<binding id="director" extends="#flash"
+ bindToUntrustedContent="true">
<implementation>
<field name="flashblockType">"director"</field>
</implementation>
</binding>
-<binding id="authorware" extends="#flash">
+<binding id="authorware" extends="#flash"
+ bindToUntrustedContent="true">
<implementation>
<field name="flashblockType">"authorware"</field>
</implementation>
</binding>
-<binding id="silverlight" extends="#flash">
+<binding id="silverlight" extends="#flash"
+ bindToUntrustedContent="true">
<implementation>
<field name="flashblockType">"silverlight"</field>
</implementation>
</binding>
-<binding id="brokenobject">
+<binding id="brokenobject"
+ bindToUntrustedContent="true">
<implementation>
<field name="brokenObject">"yes"</field>
@@ -384,7 +389,7 @@ function flashblockCreatePlaceholder(isStandalone) {
}
// Substitute the animation with a placeholder
-function flashblockShowPlaceholder() {
+function flashblockShowPlaceholder(placeholder, current, parent) {
// Just in case the object has been moved away from under our feet during
// the timeout, re-assign the parent node. See bug 13680
// parent = current.parentNode;
@@ -457,13 +462,15 @@ function flashblockIsWhitelisted(node, type) {
// thought of it on my own. :-)
// Lor 20041215: Use "UIEvents" to make it work in post-1.0 FF
// (thanks to Neil again)
+ // bz says QI is a no-op.
document.QueryInterface(Components.interfaces.nsIDOMDocument);
var flashblockEvent = document.createEvent("UIEvents");
if(flashblockEvent) {
var evt = type == "silverlight" ? "silverblockCheckLoad" : "flashblockCheckLoad";
flashblockEvent.initEvent(evt, true, true);
node.dispatchEvent(flashblockEvent);
- if(flashblockEvent.getPreventDefault() == true) {
+ node.ownerDocument.defaultView.console.log(node.ownerDocument.URL + " ==> " + flashblockEvent.defaultPrevented);
+ if(flashblockEvent.defaultPrevented || node.hasAttribute("data-flashblockWhitelisted")) {
// Whitelisted
return true;
}
@@ -702,18 +709,20 @@ placeholder.addEventListener("keypress", flashblockShowFlash, "false");
</implementation>
</binding>
-<binding id="sifr-replaced">
+<binding id="sifr-replaced"
+ bindToUntrustedContent="true">
<implementation>
<constructor>
<![CDATA[
+// bz says QI is a no-op.
document.QueryInterface(Components.interfaces.nsIDOMDocument);
event = document.createEvent("UIEvents");
if(event) {
event.initEvent("flashblockCheckLoad", true, true);
this.dispatchEvent(event);
- if(event.getPreventDefault() == true) {
+ if(event.defaultPrevented || this.hasAttribute("data-flashblockWhitelisted")) {
// Whitelisted
return;
}
@@ -729,18 +738,20 @@ this.style.overflow ="hidden";
</implementation>
</binding>
-<binding id="sifr-alternate">
+<binding id="sifr-alternate"
+ bindToUntrustedContent="true">
<implementation>
<constructor>
<![CDATA[
+// bz says QI is a no-op.
document.QueryInterface(Components.interfaces.nsIDOMDocument);
var event = document.createEvent("UIEvents");
if(event) {
event.initEvent("flashblockCheckLoad", true, true);
this.dispatchEvent(event);
- if(event.getPreventDefault() == true) {
+ if(event.defaultPrevented || this.hasAttribute("data-flashblockWhitelisted")) {
// Whitelisted
return;
}
diff --git a/chrome/flashblock.jar!/content/flashblock/flashblock.xul b/chrome/flashblock.jar!/content/flashblock/flashblock.xul
index 0973576..c7eb1cc 100644
--- a/chrome/flashblock.jar!/content/flashblock/flashblock.xul
+++ b/chrome/flashblock.jar!/content/flashblock/flashblock.xul
@@ -11,7 +11,6 @@
<overlay id="flashblockOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <script type="application/x-javascript" src="flashblock-prefs.js"/>
<script type="application/x-javascript" src="flashblock.js"/>
<script><![CDATA[
Flashblock.browserInit();
@@ -48,17 +47,19 @@
</popup>
<!-- Firefox toolbar button overlay -->
+ <!-- toolgroup is for Netscape 8 -->
<toolbarpalette id="BrowserToolbarPalette">
<toolbarbutton
id="flashblockToggle-button"
class="toolbarbutton-1 chromeclass-toolbar-additional"
type="menu-button"
- label="&general.label;"
+ label="&btnToggle.label;"
labelon="&btnToggle.labelon;"
labeloff="&btnToggle.labeloff;"
tooltiptext="&btnToggle.tooltip;"
oncommand="Flashblock.toggleButton(event);event.stopPropagation();"
- state="enabled">
+ state="enabled"
+ toolgroup="functional">
<menupopup id="flashblockPopupMenu"/>
</toolbarbutton>
</toolbarpalette>
diff --git a/chrome/flashblock.jar!/content/flashblock/frame.js b/chrome/flashblock.jar!/content/flashblock/frame.js
new file mode 100644
index 0000000..301c084
--- /dev/null
+++ b/chrome/flashblock.jar!/content/flashblock/frame.js
@@ -0,0 +1,94 @@
+Components.utils.import("chrome://flashblock/content/Flashblock.jsm"); // FBlockUtils, FBlockState
+
+const ios = Components.classes["@mozilla.org/network/io-service;1"]
+ .getService(Components.interfaces.nsIIOService);
+
+function getTargetURI(node) {
+ var targetURI;
+ try {
+ // Get object URI in the same way as nsObjectLoadingContent::LoadObject()
+ var relativeURI;
+ switch (node.localName.toLowerCase()) {
+ case "object":
+ relativeURI = node.getAttribute("data") || node.getAttribute("src") || "";
+ if (!relativeURI) {
+ var params = node.getElementsByTagName("param");
+
+ for (var ii = 0; ii < params.length; ii++) {
+ var name = params[ii].getAttribute("name");
+ switch (name) {
+ case "movie":
+ case "src":
+ relativeURI = params[ii].getAttribute("value");
+ break;
+ }
+ }
+ }
+ break;
+ case "embed":
+ relativeURI = node.getAttribute("src") || "";
+ break;
+ }
+
+
+ var baseURI = ios.newURI(node.baseURI, null, null);
+ var codeBase = node.getAttribute("codebase");
+ if (codeBase) {
+ try {
+ baseURI = ios.newURI(codeBase, node.ownerDocument.characterSet, baseURI);
+ } catch (e) {} // Ignore invalid codebase attribute
+ }
+ if (node.ownerDocument)
+ targetURI = ios.newURI(relativeURI, node.ownerDocument.characterSet, baseURI);
+ else
+ targetURI = ios.newURI(relativeURI, null, baseURI);
+ }
+ catch (e) {
+ Components.utils.reportError(e);
+ }
+ return targetURI;
+}
+
+function blockedByContentPolicy(node) {
+ try {
+ var uri = getTargetURI(node);
+ // Ask content policy whether this object is already blocked
+ var requestOrigin = ios.newURI(node.ownerDocument.location, null, null);
+ var contentPolicy = Components.classes["@mozilla.org/layout/content-policy;1"]
+ .getService(Components.interfaces.nsIContentPolicy);
+ var blockType = contentPolicy.shouldLoad(Components.interfaces.nsIContentPolicy.TYPE_OBJECT,
+ uri, requestOrigin, node,
+ node.getAttribute("type"), null);
+ return blockType != Components.interfaces.nsIContentPolicy.ACCEPT;
+ }
+ catch (e) {
+ Components.utils.reportError(e);
+ return false;
+ }
+}
+
+
+function check(e, featureEnabled) {
+ console.log(e.type + ", " + FBlockState.enabled + ", " + featureEnabled + ", " + FBlockState.checkWhitelist(e.target.ownerDocument.location));
+ const attrName = "data-flashblockWhitelisted";
+
+ let node = e.target;
+ node.removeAttribute(attrName);
+ if (!FBlockState.enabled ||
+ !featureEnabled ||
+ (e.target &&
+ (e.target.ownerDocument && e.target.ownerDocument.location && (FBlockState.checkWhitelist(e.target.ownerDocument.location)) ||
+ (FBlockState.targetEnabled && FBlockState.checkWhitelist(getTargetURI(e.target))) ||
+ blockedByContentPolicy(e.target)))
+ ) {
+ console.log(e.type + ": preventing");
+ node.setAttribute(attrName, "true");
+ e.preventDefault();
+ console.log(e.type + ": prevented " + e.defaultPrevented + ", " + e.cancelable + ", " + e.timeStamp);
+ }
+ e.stopPropagation();
+}
+
+addEventListener("flashblockCheckLoad", function(e) { check(e, FBlockState.enabled) }, true, true)
+addEventListener("HTML5VideoCheckLoad", function(e) { check(e, FBlockState.videoblockEnabled) }, true, true)
+addEventListener("silverblockCheckLoad", function(e) { check(e, FBlockState.silverblockEnabled) }, true, true)
diff --git a/chrome/flashblock.jar!/content/flashblock/videoblock.xml b/chrome/flashblock.jar!/content/flashblock/videoblock.xml
index 23cdf8b..a03318d 100644
--- a/chrome/flashblock.jar!/content/flashblock/videoblock.xml
+++ b/chrome/flashblock.jar!/content/flashblock/videoblock.xml
@@ -16,7 +16,7 @@ function nativeMethod(untrustedObject, methodName)
{
// happier stack traces and faster multiple calls
var fun = Components.lookupMethod(untrustedObject, methodName);
-
+
return function()
{
return fun.apply(untrustedObject, arguments);
@@ -31,7 +31,7 @@ function flashblockCreatePlaceholder() {
flashblockCreateElement = nativeMethod(document, "createElementNS");
placeholder = flashblockCreateElement("http://www.w3.org/1999/xhtml", "div");
} catch (e) {
- placeholder = document.createElementNS( "http://www.w3.org/1999/xhtml", "div");
+ placeholder = document.createElementNS( "http://www.w3.org/1999/xhtml", "div");
}
return placeholder;
}
@@ -54,7 +54,7 @@ function flashblockShowPlaceholder() {
// if ("LoadMovie" in current)
// current.LoadMovie(0, "");
parent.insertBefore(placeholder, current);
- parent.removeChild(current);
+ parent.removeChild(current);
}
// Show the original animation
@@ -83,6 +83,7 @@ function flashblockShowFlash(event) {
function flashblockIsWhitelisted(node) {
// Check if the page that loaded the Flash site is whitelisted
+ // bz says QI is a no-op.
document.QueryInterface(Components.interfaces.nsIDOMDocument);
var flashblockEvent = document.createEvent("UIEvents");
@@ -90,7 +91,7 @@ function flashblockIsWhitelisted(node) {
var evt = "HTML5VideoCheckLoad";
flashblockEvent.initEvent(evt, true, true);
node.dispatchEvent(flashblockEvent);
- if(flashblockEvent.getPreventDefault())
+ if(flashblockEvent.defaultPrevented || node.hasAttribute("data-flashblockWhitelisted"))
return true; // Whitelisted
}
return false;
@@ -143,7 +144,7 @@ function flashblockStylePlaceholder(flash, placeholder) {
// height = flash.height;
else if (height)
height = Math.max(height,32) + "px";
- else
+ else
height = "32px"
placeholder.style.width = width;
diff --git a/install.rdf b/install.rdf
index 307e881..b54280f 100644
--- a/install.rdf
+++ b/install.rdf
@@ -1,13 +1,12 @@
-<?xml version="1.0"?>
-<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+<?xml version='1.0' encoding='utf-8'?>
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>{3d7eb24f-2740-49df-8937-200b1cc08f8a}</em:id>
<em:type>2</em:type>
<em:unpack>true</em:unpack>
<em:name>Flashblock</em:name>
- <em:version>1.5.18</em:version>
+ <em:version>1.5.19</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>
@@ -18,6 +17,7 @@
<em:contributor>Special thanks to:</em:contributor>
<em:contributor> - Jesse Ruderman (initial idea)</em:contributor>
<em:contributor> - Neil Rashbrook (whitelist wizardry)</em:contributor>
+ <em:contributor>Giorgio Maone (e10s hacks)</em:contributor>
<em:homepageURL>http://flashblock.mozdev.org/</em:homepageURL>
<em:iconURL>chrome://flashblock/content/flashblock-32.png</em:iconURL>
<em:optionsURL>chrome://flashblock/content/options.xul</em:optionsURL>
@@ -26,8 +26,17 @@
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
- <em:minVersion>2.0</em:minVersion>
- <em:maxVersion>50.*</em:maxVersion>
+ <em:minVersion>17.0</em:minVersion>
+ <em:maxVersion>46.0</em:maxVersion>
+ </Description>
+ </em:targetApplication>
+
+ <!-- Pale Moon -->
+ <em:targetApplication>
+ <Description>
+ <em:id>{8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4}</em:id>
+ <em:minVersion>25.0</em:minVersion>
+ <em:maxVersion>25.*</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
--
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