mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-12 22:28:59 +02:00
MozReview-Commit-ID: ljq4KPzUqu --HG-- extra : rebase_source : 71de8b56d523568a940cb1d12a4f773c991c3294
38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
/* Any copyright is dedicated to the Public Domain.
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
function doUpdate(update) {
|
|
const { classes: Cc, interfaces: Ci, results: Cr } = Components;
|
|
|
|
let listener = {
|
|
QueryInterface: function(iid)
|
|
{
|
|
if (iid.equals(Ci.nsISupports) ||
|
|
iid.equals(Ci.nsIUrlClassifierUpdateObserver))
|
|
return this;
|
|
|
|
throw Cr.NS_ERROR_NO_INTERFACE;
|
|
},
|
|
updateUrlRequested: function(url) { },
|
|
streamFinished: function(status) { },
|
|
updateError: function(errorCode) {
|
|
sendAsyncMessage("updateError", errorCode);
|
|
},
|
|
updateSuccess: function(requestedTimeout) {
|
|
sendAsyncMessage("updateSuccess");
|
|
}
|
|
};
|
|
|
|
let dbService = Cc["@mozilla.org/url-classifier/dbservice;1"]
|
|
.getService(Ci.nsIUrlClassifierDBService);
|
|
|
|
dbService.beginUpdate(listener, "test-malware-simple,test-unwanted-simple", "");
|
|
dbService.beginStream("", "");
|
|
dbService.updateStream(update);
|
|
dbService.finishStream();
|
|
dbService.finishUpdate();
|
|
}
|
|
|
|
addMessageListener("doUpdate", ({ testUpdate }) => {
|
|
doUpdate(testUpdate);
|
|
});
|