Index: lib/contentPolicy.js |
=================================================================== |
--- a/lib/contentPolicy.js |
+++ b/lib/contentPolicy.js |
@@ -96,17 +96,17 @@ var Policy = exports.Policy = |
let offset = "a".charCodeAt(0); |
for (let i = 0; i < 20; i++) |
collapsedClass += String.fromCharCode(offset + Math.random() * 26); |
let collapseStyle = Services.io.newURI("data:text/css," + |
encodeURIComponent("." + collapsedClass + |
"{-moz-binding: url(chrome://global/content/bindings/general.xml#foobarbazdummy) !important;}"), null, null); |
Utils.styleService.loadAndRegisterSheet(collapseStyle, Ci.nsIStyleSheetService.USER_SHEET); |
- onShutdown.add(function() |
+ onShutdown.add(() => |
{ |
Utils.styleService.unregisterSheet(collapseStyle, Ci.nsIStyleSheetService.USER_SHEET); |
}); |
}, |
/** |
* Checks whether a node should be blocked, hides it if necessary |
* @param wnd {nsIDOMWindow} |
@@ -255,34 +255,34 @@ var Policy = exports.Policy = |
/** |
* Checks whether the location's scheme is blockable. |
* @param location {nsIURI} |
* @return {Boolean} |
*/ |
isBlockableScheme: function(location) |
{ |
- return !Policy.whitelistSchemes.has(location.scheme); |
+ return !this.whitelistSchemes.has(location.scheme); |
}, |
/** |
* Checks whether a page is whitelisted. |
* @param {String} url |
* @param {String} [parentUrl] location of the parent page |
* @param {String} [sitekey] public key provided on the page |
* @return {Filter} filter that matched the URL or null if not whitelisted |
*/ |
isWhitelisted: function(url, parentUrl, sitekey) |
{ |
if (!url) |
return null; |
// Do not apply exception rules to schemes on our whitelistschemes list. |
let match = /^([\w\-]+):/.exec(url); |
- if (match && Policy.whitelistSchemes.has(match[1])) |
+ if (match && this.whitelistSchemes.has(match[1])) |
return null; |
if (!parentUrl) |
parentUrl = url; |
// Ignore fragment identifier |
let index = url.indexOf("#"); |
if (index >= 0) |
@@ -294,17 +294,17 @@ var Policy = exports.Policy = |
/** |
* Checks whether the page loaded in a window is whitelisted for indication in the UI. |
* @param wnd {nsIDOMWindow} |
* @return {Filter} matching exception rule or null if not whitelisted |
*/ |
isWindowWhitelisted: function(wnd) |
{ |
- return Policy.isWhitelisted(getWindowLocation(wnd)); |
+ return this.isWhitelisted(getWindowLocation(wnd)); |
}, |
/** |
* Asynchronously re-checks filters for given nodes. |
* @param {Node[]} nodes |
* @param {RequestEntry} entry |
*/ |
refilterNodes: function(nodes, entry) |
@@ -339,25 +339,25 @@ var PolicyImplementation = |
registrar.registerFactory(this.classID, this.classDescription, this.contractID, this); |
let catMan = Utils.categoryManager; |
for (let category of this.xpcom_categories) |
catMan.addCategoryEntry(category, this.contractID, this.contractID, false, true); |
Services.obs.addObserver(this, "content-document-global-created", true); |
- onShutdown.add(function() |
+ onShutdown.add(() => |
{ |
Services.obs.removeObserver(this, "content-document-global-created"); |
for (let category of this.xpcom_categories) |
catMan.deleteCategoryEntry(category, this.contractID, false); |
registrar.unregisterFactory(this.classID, this); |
- }.bind(this)); |
+ }); |
}, |
// |
// nsISupports interface implementation |
// |
QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPolicy, Ci.nsIObserver, |
Ci.nsIChannelEventSink, Ci.nsIFactory, Ci.nsISupportsWeakReference]), |