Search code examples
javascriptgoogle-chrome-extensionbrowser-history

History not fully deleted using chrome.history.deleteRange


I have written a small extension that uses deleteRange from chrome.history API in order to delete parts of the browser history between a start and an end time stamp.

chrome.history.deleteRange({
   startTime : startTime,
   endTime : endTime
}, function() {
   console.log("Recent history deleted successfully");
});

I get both startTime and endTime using (new Date()).getTime().

It "kind of works". If I open a page in Chrome for the very first time after starting the extension, I will be able to use its URL in the omnibox without fully typing it (a sign for me that Chrome remembers the URL through its history). After calling deleteRange, I am no longer able to do so. I also see the text Recent history deleted successfully on the console. This is a sign for me that the page has been wiped from history.

But it hasn't. If I go to Chrome/Settings/History, I can still see when I accessed the page. I expected that this would have been wiped ... how can I wipe a page (that I never ever opened before) from the recent history using start and end time stamp?

EDIT: I added the line

console.log("Right before calling deleteRange. startTime=" + startTime + " / endTime=" + endTime);

to my code which resulted in

Right before calling deleteRange. startTime=1416931451880 / endTime=1416931463988

EDIT2: I opened a Chromium bug. Let's see what I can get from there


Solution

  • Chromium developers have confirmed the bug. It depends on History Sync being enabled.

    See Chromium bug report