Closed Bug 635576 Opened 14 years ago Closed 14 years ago

There is no API to set visitCount in the History Service

Categories

(Toolkit :: Places, enhancement)

enhancement
Not set
normal

Tracking

()

VERIFIED WONTFIX

People

(Reporter: jerry, Unassigned)

References

()

Details

User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-us) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4 Build Identifier: Gecko 2.0 In bookmarks synchronization applications, it is necessary to *set* the visit count of a URI. There is no function in the nsINavHistoryService API to do this. If you want to increase the visit count from N1 to N2, you can work around this by calling addVisit(), N2-N1 times. But there are issues with this (https://bugzilla.mozilla.org/show_bug.cgi?id=624944), and there is no way to decrease the visit count. Reproducible: Always
Oh, I forgot to say that I get the same exception, both on Firefox 3.6.13 in 32-bit mode and on Firefox 4.0b11 in 64-bit mode.
Also, one might try to set visit count by using the History Service's setPageDetails(), like this: historyService.setPageDetails( uri, historyService.getPageTitle(uri), change.visitCount, aHidden, aTyped ) ; However, this function also sets (overwrites) the pageTitle, 'hidden', and 'typed'. Thus, I need to re-set these to their current values. But I can't see any way to get the current values for 'hidden' and 'typed'. Currently, I am working around the problem by accessing the database directly: querying moz_bookmarks to get the fk and then updating moz_places. Hence, the need for a function in the API to set the visitCount.
Version: unspecified → Trunk
Component: Extension Compatibility → Places
Product: Firefox → Toolkit
QA Contact: extension.compatibility → places
This won't ever happen, we need visit_count to be reliable for a lot of good reasons, allowing anyone to artificially set the value means breaking stuff and making users cry. NEVER EVER try to do direct database changes. Anything that writes values to our database IS bad. you can do whatever selects you want, attach whatever additional databases you want to the connection and join, but writing to places.sqlite is not what you want, even if you think you want to do that. Also consider that any change to visit_count will most likely be nullified in future by our internal maintenance code that check coherence of the data.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → WONTFIX
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.