1. cd ../mozilla/dist/WIN32_D.OBJ/bin 2. launch testembed.exe (you can interchange steps 3 & 4: same result) 3. Select Tests > Add History Listener 4. Enter a url. 5. Select Tools > Test Your Method; or Interfaces > nsIWebNav and run through nsIWebNavitation::GotoIndex() test. 6. Check TestOutput.txt logfile in C:/Temp folder. Also display prompt. Result: Indicates that nsISHistoryListener::OnHistoryGoBack(). If index for GotoIndex()test is greater than current index, we get nsISHistoryListener::OnHistoryGoForward(). Expected: History listener should call nsISHistoryListener::OnHistoryGotoIndex(). Note: GotoIndex() navigation is working OK. Logfile contents: TestEmbed started up. nsIWebBrowserChrome::SetWebBrowser(). AddWebBrowserListener(). Add History Lstnr test passed. nsIHistoryListener::OnHistoryNewEntry() nsIURI::GetSpec() test passed. the uri = http://www.nokia.com/main.html nsIHistoryListener::OnHistoryGoBack() nsIURI::GetSpec() test passed. the uri = http://www.netscape.com/ OnHistoryGoBack() notification = 1 GotoIndex() test passed. TestEmbed shut down.
onHistoryGotoIndex() is working. Please see the JS testcase that is up in http://bubblegum. I do get callbacks in onHistorygotoIndex().
Change qa contact to depstein. Reopening this bug after changing the summary to more accurately reflect the problem. nsISHistoryListener::OnHistoryGotoIndex() is called when the difference between the current and the navigated index is greater than 1. So if 3 urls have been loaded, and index = 0 inside goToIndex(), then the listener method will be called; but not when index = 2 or 4. In testEmbed, the goToIndex() is set to 0, so after running the nsIWebNav goForward() test, it will call nsISHistoryListener::OnHistoryGoBack().
Comment on attachment 49235 [details] [diff] [review] patch to nsSHistory.cpp sr=alecf
Fix checked in.
nsISHistoryListener::OnHistoryGotoIndex()is called, but the index of the last url is always passed to it, not the true value from GoToIndex(). So if we load 3 urls, and the index is set to 0, it still passes 2 to OnHistoryGotoIndex(). I'll verify this one as fixed and will investigate this other one.