Hi, and thanks. I would like to be able to prepend items to the history list (i.e. put items in the browser's history list before the first one). The reason is that I am using WebKit as a plug-in. I want to shut down and restart WebKit, re-loading it with the history that I've kept track of. To keep it simple, I propose adding a simple "prependItem" to QWebHistory, so that I can do this.

From an IRC chat with Kenneth:
- change prpItem to newItem in both addItem() and prependItem()
- He also asked if ASSERT(newItem) was okay. It looks like it is
- Also, in qwebhistory.cpp, he asked if WebCore should be namespaced in the file.

I am ok with the API except for one thing I'd like to see addressed first:
1) What is wrong with storing the history like other clients do? Arora also has need to shut down and re-open from time to time with an intact history list. What is different about your situation as compared to Arora or other Qt clients that already do this with the existing API?

Ok, scratch my last question. Arora and other clients *do not* restore history in this sense. There is the QWebHistoryInterface::historyContains method, but that is only for visited links. You are looking to make the back/forward list persistent across restarts.
However, I have another question... Can't you achieve the same thing with simple 'addItem'? Why do you need to add 'prependItem' to WebCore?

The problem is that addItem() *appends* history items, so if there are already URLs in the history, they come after the current URL.
Even if this weren't so: in the case of re-initializing the history, if you call addItem(URL1), addItem(URL2), ... addItem(URLn), the problem is that the "current URL" is wrong (it will be URL1). There isn't API for "make this history item the current item" (there is a "goto this history item", but that's not the same.
Admittedly there are probably alternatives to prependItem, but this seemed simplest.

It seems to me your specific use case is to restore the history on restarting the plugin. Given this, there should be no prior URLS in the back/forward list, right?
If true, then it seems you could simply append your items in reverse order, no?

Comment on attachment 31721[details]
minor cleanups + changelog
Take this out of the review queue as it seems things will need to be changed. For instance, s/addItem/prependItem/ to QWebHistory and also s/const QString &urlString/const QUrl &url/ etc, etc.