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

Side by Side Diff: lib/filterListener.js

Issue 5450822905233408: Issue 417 - Reinitializing removed filter lists (Core/Firefox) (Closed)
Patch Set: Created May 26, 2014, 10:22 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 else if (match && match[1] == "subscription") 113 else if (match && match[1] == "subscription")
114 onSubscriptionChange(match[2], item, newValue, oldValue); 114 onSubscriptionChange(match[2], item, newValue, oldValue);
115 else 115 else
116 onGenericChange(action, item); 116 onGenericChange(action, item);
117 }); 117 });
118 118
119 if ("nsIStyleSheetService" in Ci) 119 if ("nsIStyleSheetService" in Ci)
120 ElemHide.init(); 120 ElemHide.init();
121 else 121 else
122 flushElemHide = function() {}; // No global stylesheet in Chrome & Co. 122 flushElemHide = function() {}; // No global stylesheet in Chrome & Co.
123 FilterStorage.loadFromDisk(); 123 FilterStorage.loadFromDisk(null, function()
124 {
125 // All attempts to restore filter settings have failed
126 // so we need to reinitialize them
127 if (addSubscription)
128 {
129 addSubscription(null);
130 filterlistsReinitialized = true;
131 }
132 else
133 {
134 let {UI} = require("ui");
135 UI.addSubscription(UI.currentWindow, null);
136 UI.filterlistsReinitialized = true;
137 }
138 });
Wladimir Palant 2014/05/26 15:08:46 This is really the wrong place to do it. We are al
Thomas Greiner 2014/05/26 17:45:38 Done.
124 139
125 TimeLine.log("done initializing data structures"); 140 TimeLine.log("done initializing data structures");
126 141
127 Services.obs.addObserver(HistoryPurgeObserver, "browser:purge-session-history" , true); 142 Services.obs.addObserver(HistoryPurgeObserver, "browser:purge-session-history" , true);
128 onShutdown.add(function() 143 onShutdown.add(function()
129 { 144 {
130 Services.obs.removeObserver(HistoryPurgeObserver, "browser:purge-session-his tory"); 145 Services.obs.removeObserver(HistoryPurgeObserver, "browser:purge-session-his tory");
131 }); 146 });
132 TimeLine.log("done adding observers"); 147 TimeLine.log("done adding observers");
133 148
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 defaultMatcher.clear(); 283 defaultMatcher.clear();
269 ElemHide.clear(); 284 ElemHide.clear();
270 for (let subscription of FilterStorage.subscriptions) 285 for (let subscription of FilterStorage.subscriptions)
271 if (!subscription.disabled) 286 if (!subscription.disabled)
272 subscription.filters.forEach(addFilter); 287 subscription.filters.forEach(addFilter);
273 flushElemHide(); 288 flushElemHide();
274 } 289 }
275 else if (action == "save") 290 else if (action == "save")
276 isDirty = 0; 291 isDirty = 0;
277 } 292 }
OLDNEW

Powered by Google App Engine
This is Rietveld