With the fix on bug 1704697 we got already some good improvements.
Nevertheless the example from comment 0 is still failing. Having a further look this seems to actually be a bug in the WebDriver HTTP spec.
So what happens here... The first two navigation commands load just a single page, while the third navigation loads a page with a frame. Switching to that frame and calling
Back will put the page into bfcache and a
pagehide event is received. But there is never coming in a
pageshow event for that frame, but only for the top-level browsing context, which we should not switch to given by the spec:
If the previous step completed results in a pageHide event firing, wait until pageShow event fires or for the session page load timeout milliseconds to pass, whichever occurs sooner.
As such in such conditions we always run into a page load timeout.
James, not sure if that's something we still want to fix in the HTTP spec or only make it work correctly in the BiDi spec.