Bug 1257565 - add remote settings support for plugin and addon blocklist, r=aswan

MozReview-Commit-ID: AiGycyhGUta

Differential Revision: https://phabricator.services.mozilla.com/D29834
This commit is contained in:
Gijs Kruitbosch
2019-05-07 00:55:53 +00:00
parent 7252b0ba55
commit b05b726973
61 changed files with 5075 additions and 101 deletions

View File

@@ -192,36 +192,19 @@ function clearAllPluginPermissions() {
}
}
function updateBlocklist(aCallback) {
let blocklistNotifier = Cc["@mozilla.org/extensions/blocklist;1"]
.getService(Ci.nsITimerCallback);
let observer = function() {
Services.obs.removeObserver(observer, "blocklist-updated");
SimpleTest.executeSoon(aCallback);
};
Services.obs.addObserver(observer, "blocklist-updated");
blocklistNotifier.notify(null);
}
var _originalTestBlocklistURL = null;
function setAndUpdateBlocklist(aURL, aCallback) {
if (!_originalTestBlocklistURL) {
_originalTestBlocklistURL = Services.prefs.getCharPref("extensions.blocklist.url");
}
Services.prefs.setCharPref("extensions.blocklist.url", aURL);
updateBlocklist(aCallback);
}
// A generator that insures a new blocklist is loaded (in both
// An async helper that insures a new blocklist is loaded (in both
// processes if applicable).
var _originalTestBlocklistURL = null;
async function asyncSetAndUpdateBlocklist(aURL, aBrowser) {
// FIXME: this needs to also work with the remote settings blocklist,
// https://bugzilla.mozilla.org/show_bug.cgi?id=1549548
info("*** loading new blocklist: " + aURL);
let doTestRemote = aBrowser ? aBrowser.isRemoteBrowser : false;
if (!_originalTestBlocklistURL) {
_originalTestBlocklistURL = Services.prefs.getCharPref("extensions.blocklist.url");
}
Services.prefs.setCharPref("extensions.blocklist.url", aURL);
let localPromise = TestUtils.topicObserved("blocklist-updated");
let localPromise = TestUtils.topicObserved("plugin-blocklist-updated");
let blocklistNotifier = Cc["@mozilla.org/extensions/blocklist;1"]
.getService(Ci.nsITimerCallback);
blocklistNotifier.notify(null);