Guest User

Untitled

a guest
Aug 2nd, 2025
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function(oldDomain, newDomain) {
  2.     let { PlacesQuery } = ChromeUtils.importESModule("resource://gre/modules/PlacesQuery.sys.mjs");
  3.     let query = new PlacesQuery();
  4.     query.getHistory({ sortBy: "site", daysOld: 3650 }).then(hists => {
  5.         let newVisits = [];
  6.         for (let visit of hists.get(oldDomain) || []) {
  7.             let url = new URL(visit.url);
  8.             url.host = newDomain;
  9.             newVisits.push({
  10.                 url: url.href,
  11.                 title: visit.title,
  12.                 visits: [{ date: visit.date }]
  13.             });
  14.         }
  15.         if (newVisits.length) PlacesUtils.history.insertMany(newVisits);
  16.         console.log(`${newVisits.length} urls have been migrated to the new domain`);
  17.     });
  18. })("aaa.sa", "aaa.fn");
Advertisement
Add Comment
Please, Sign In to add comment