Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/filterStorage.js

Issue 29329336: Issue 3208 - Inject content policy implementation into all processes (Closed)
Patch Set: Created Oct. 22, 2015, 9:03 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« lib/contentPolicy.js ('K') | « lib/elemHide.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/filterStorage.js
===================================================================
--- a/lib/filterStorage.js
+++ b/lib/filterStorage.js
@@ -318,26 +318,21 @@ let FilterStorage = exports.FilterStorag
subscription.filters.splice(oldPosition, 1);
subscription.filters.splice(newPosition, 0, filter);
FilterNotifier.triggerListeners("filter.moved", filter, subscription, oldPosition, newPosition);
},
/**
* Increases the hit count for a filter by one
* @param {Filter} filter
- * @param {Window} window Window that the match originated in (required
- * to recognize private browsing mode)
*/
- increaseHitCount: function(filter, wnd)
+ increaseHitCount: function(filter)
{
- if (!Prefs.savestats || PrivateBrowsing.enabledForWindow(wnd) ||
- PrivateBrowsing.enabled || !(filter instanceof ActiveFilter))
- {
+ if (!Prefs.savestats || !(filter instanceof ActiveFilter))
Wladimir Palant 2015/10/22 21:51:14 Having private browsing considered in filterStorag
return;
- }
filter.hitCount++;
filter.lastHit = Date.now();
},
/**
* Resets hit count for some filters
* @param {Filter[]} filters filters to be reset, if null all filters will be reset
@@ -690,83 +685,16 @@ function removeSubscriptionFilters(subsc
{
let i = filter.subscriptions.indexOf(subscription);
if (i >= 0)
filter.subscriptions.splice(i, 1);
}
}
/**
- * Observer listening to private browsing mode changes.
- * @class
- */
-let PrivateBrowsing = exports.PrivateBrowsing =
-{
- /**
- * Will be set to true when the private browsing mode is switched on globally.
- * @type Boolean
- */
- enabled: false,
-
- /**
- * Checks whether private browsing is enabled for a particular window.
- */
- enabledForWindow: function(/**Window*/ wnd) /**Boolean*/
- {
- try
- {
- return wnd.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsILoadContext)
- .usePrivateBrowsing;
- }
- catch (e)
- {
- // Gecko 19 and below will throw NS_NOINTERFACE, this is expected
- if (e.result != Cr.NS_NOINTERFACE)
- Cu.reportError(e);
- return false;
- }
- },
-
- init: function()
- {
- if ("@mozilla.org/privatebrowsing;1" in Cc)
- {
- try
- {
- this.enabled = Cc["@mozilla.org/privatebrowsing;1"].getService(Ci.nsIPrivateBrowsingService).privateBrowsingEnabled;
- Services.obs.addObserver(this, "private-browsing", true);
- onShutdown.add(function()
- {
- Services.obs.removeObserver(this, "private-browsing");
- }.bind(this));
- }
- catch(e)
- {
- Cu.reportError(e);
- }
- }
- },
-
- observe: function(subject, topic, data)
- {
- if (topic == "private-browsing")
- {
- if (data == "enter")
- this.enabled = true;
- else if (data == "exit")
- this.enabled = false;
- }
- },
-
- QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIObserver])
-};
-PrivateBrowsing.init();
-
-/**
* IO.readFromFile() listener to parse filter data.
* @constructor
*/
function INIParser()
{
this.fileProperties = this.curObj = {};
this.subscriptions = [];
this.knownFilters = Object.create(null);
« lib/contentPolicy.js ('K') | « lib/elemHide.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld