Closed Bug 318653 Opened 19 years ago Closed 19 years ago

Fill out history API


(Firefox :: Bookmarks & History, defect, P5)






(Reporter: brettw, Assigned: brettw)



(Keywords: fixed1.8.1)


(1 file)

Many functions are missing that allow more direct access to the history service, such as adding history items or changing some variables such as visit counts.
Priority: -- → P2
This patch adds the ability to set all information for any history entry, and to create new visits. The referrer ID in AddVisit is not hooked up pending many changes to the way this is handled from docshell.
Attachment #207202 - Flags: review?(annie.sullivan)
Comment on attachment 207202 [details] [diff] [review]
Add ability to manually set more info

>+nsNavHistory::SetPageDetails(nsIURI* aURI, const nsAString& aTitle,
>+                             const nsAString& aUserTitle, PRUint32 aVisitCount,
>+                             PRBool aHidden, PRBool aTyped)
>+  // look up the page ID, creating a new one if necessary
>+  PRInt64 pageID;
>+  nsresult rv = GetUrlIdFor(aURI, &pageID, PR_TRUE);
>+  NS_ENSURE_SUCCESS(rv, rv);
>+  nsCOMPtr<mozIStorageStatement> statement;
>+  rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING(
>+      "UPDATE moz_history "
>+      "SET title = ?2, "
>+          "user_title = ?3, "
>+          "visit_count = ?4, "
>+          "hidden = ?5, "
>+          "typed = ?6 "
>+       "WHERE id = ?1"),
>+    getter_AddRefs(statement));

I noticed some database statements are created as member variables in the InitDB() function (mDBGetURLPageInfo, mDBGetURLPageInfoFull, etc).  Is this for speed?  If so, should we do the same thing here?  If this is going to be used for backups, I can imagine this function getting called sequentially for each url in recent history, so if CreateStatement() is slow, maybe we'd want to make the statement a member variable?

Otherwise, looks fine.
Attachment #207202 - Flags: review?(annie.sullivan) → review+
Using precompiled statements right now is kind of a mess. I've been trying to use precompiled ones when I know that the statement will be used a lot, and not in all other cases. There are some cases where this needs to be changed (bug 320183). We really don't have a good idea how long statement compilation takes right now. Later we'll go through them all and figure out what are the critical paths.
Patch is on trunk for the add functions, there may be a few more.
Depends on: 320831, 320832, 320833, 320885
No longer depends on: 320885
Additional API changes are very low priority
Priority: P2 → P5
Additional API changes should be their own bugs
Closed: 19 years ago
Keywords: fixed1.8.1
Resolution: --- → FIXED
Bug 451915 - move Firefox/Places bugs to Firefox/Bookmarks and History. Remove all bugspam from this move by filtering for the string "places-to-b-and-h".

In Thunderbird 3.0b, you do that as follows:
Tools | Message Filters
Make sure the correct account is selected. Click "New"
Conditions: Body   contains   places-to-b-and-h
Change the action to "Delete Message".
Select "Manually Run" from the dropdown at the top.
Click OK.

Select the filter in the list, make sure "Inbox" is selected at the bottom, and click "Run Now". This should delete all the bugspam. You can then delete the filter.

Component: Places → Bookmarks & History
QA Contact: places → bookmarks
You need to log in before you can comment on or make changes to this bug.