devnull69
devnull69

Reputation: 16564

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

Upvotes: 2

Views: 543

Answers (2)

devnull69
devnull69

Reputation: 16564

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

See Chromium bug report

Upvotes: 1

nikolay.tenev
nikolay.tenev

Reputation: 1

Check out the documentation: API

It states, that:

Pages will not be removed from the history unless ALL visits fall within the range.

So my guess is, that those pages you get suggestions for, have visits from before startTime. So their URLs aren't removed, because not all visits fall within the range you specify.

Upvotes: 0

Related Questions