mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-10 05:08:36 +02:00
MozReview-Commit-ID: 6rcQfPajmfw --HG-- extra : transplant_source : %7C%9B%E9%AD%F0K%8Ds%960%D0J%B8%3B%B5%B1r%C2%2A%03
33 lines
1 KiB
JavaScript
33 lines
1 KiB
JavaScript
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
|
/* vim: set sts=2 sw=2 et tw=80: */
|
|
"use strict";
|
|
|
|
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
|
|
|
XPCOMUtils.defineLazyGetter(this, "History", () => {
|
|
Cu.import("resource://gre/modules/PlacesUtils.jsm");
|
|
return PlacesUtils.history;
|
|
});
|
|
|
|
extensions.registerSchemaAPI("history", "history", (extension, context) => {
|
|
return {
|
|
history: {
|
|
deleteAll: function() {
|
|
return History.clear();
|
|
},
|
|
deleteRange: function(filter) {
|
|
let newFilter = {
|
|
beginDate: new Date(filter.startTime),
|
|
endDate: new Date(filter.endTime),
|
|
};
|
|
// History.removeVisitsByFilter returns a boolean, but our API should return nothing
|
|
return History.removeVisitsByFilter(newFilter).then(() => undefined);
|
|
},
|
|
deleteUrl: function(details) {
|
|
let url = details.url;
|
|
// History.remove returns a boolean, but our API should return nothing
|
|
return History.remove(url).then(() => undefined);
|
|
},
|
|
},
|
|
};
|
|
});
|