Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function(oldDomain, newDomain) {
- let { PlacesQuery } = ChromeUtils.importESModule("resource://gre/modules/PlacesQuery.sys.mjs");
- let query = new PlacesQuery();
- query.getHistory({ sortBy: "site", daysOld: 3650 }).then(hists => {
- let newVisits = [];
- for (let visit of hists.get(oldDomain) || []) {
- let url = new URL(visit.url);
- url.host = newDomain;
- newVisits.push({
- url: url.href,
- title: visit.title,
- visits: [{ date: visit.date }]
- });
- }
- if (newVisits.length) PlacesUtils.history.insertMany(newVisits);
- console.log(`${newVisits.length} urls have been migrated to the new domain`);
- });
- })("aaa.sa", "aaa.fn");
Advertisement
Add Comment
Please, Sign In to add comment