Bug 69358

Summary: Allow creating new pages with a existing back forward list
Product: WebKit Reporter: Carlos Garcia Campos <cgarcia>
Component: WebKit2Assignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: andersca, ap, beidson, lantw44, mcatanzaro, nekohayo, sam
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
See Also: https://bugzilla.gnome.org/show_bug.cgi?id=756820
https://bugzilla.gnome.org/show_bug.cgi?id=706731

Description Carlos Garcia Campos 2011-10-04 11:28:15 PDT
Tabbed browsers typically copy the bf list of the current tab for the new view when creating a new tab. Epiphany and midori do that by using WebCore::BackForwardList::addItem() to add items of current tab bf list to the bf list of the newly created tab. In WebKit2 the C API doesn't expose addItem() method to keep the API simple, so it would be better to be able to create a page with a existing bf list.
Comment 1 Alexey Proskuryakov 2011-10-04 22:05:25 PDT
Safari restores b/f list after a Web process crash, so there is apparently some way to do that. Not sure if it's using bundle API or not.
Comment 2 Carlos Garcia Campos 2011-10-04 23:33:55 PDT
WebPageProxy::initializeWebPage() uses its own bf list, so that when web process crashes, initializeWebPage is called again for the existing page that register current bf list items in the new web process.
Comment 3 Brady Eidson 2011-10-06 09:44:20 PDT
Safari on Lion also restores back/forward list from disk when you relaunch it, so there's definitely a way to do it outside of WebProcess crash recovery.
Comment 4 Carlos Garcia Campos 2011-10-19 03:19:10 PDT
(In reply to comment #3)
> Safari on Lion also restores back/forward list from disk when you relaunch it, so there's definitely a way to do it outside of WebProcess crash recovery.

Yes, there's WebPageProxy::restoreFromSessionStateData(), but it's still different from creating a page with a given bf list object, so that when WebPageProxy::initializeWebPage() is called, the page already has the bf list we want.
Comment 5 Brady Eidson 2011-10-19 07:44:00 PDT
(In reply to comment #4)
> (In reply to comment #3)
> > Safari on Lion also restores back/forward list from disk when you relaunch it, so there's definitely a way to do it outside of WebProcess crash recovery.
> 
> Yes, there's WebPageProxy::restoreFromSessionStateData(), but it's still different from creating a page with a given bf list object, so that when WebPageProxy::initializeWebPage() is called, the page already has the bf list we want.

SessionStateData contains the back/forward list, amongst other things.  The number of things it contains in the future might grow.  Most of these things will likely be desirable for people who think they actually just want the list of URLs in the back/forward list.

And if there's anything you don't want in there (I'd love to hear why you don't if there is anything), we could add filtering functions.

Having a freely mutable back/forward list in the WebKit 1 API turned out to be a mistake, and we're not interested in replicating that mistake in WebKit 2.  Treating a "session" as an opaque object that you can extract from a page and restore in to another page should be the only way to do this.

Note that the use case you gave in your initial report is entirely and cleaning fulfilled by this!
Comment 6 Michael Catanzaro 2015-10-24 19:31:05 PDT
(In reply to comment #5)
> SessionStateData contains the back/forward list, amongst other things.  The
> number of things it contains in the future might grow.  Most of these things
> will likely be desirable for people who think they actually just want the
> list of URLs in the back/forward list.

Sounds like we should investigating exposing this API in the GTK+ port.
Comment 7 Michael Catanzaro 2016-01-03 11:12:13 PST

*** This bug has been marked as a duplicate of bug 115600 ***