Closed Bug 1164160 Opened 9 years ago Closed 9 years ago

Local server pages don't restore properly on resume

Categories

(Firefox for iOS :: General, defect)

Other
iOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
fennec + ---

People

(Reporter: st3fan, Assigned: st3fan)

References

Details

Attachments

(1 file)

Right now the web server picks a random port every time it starts. This causes trouble when tabs are restored or when the app comes back after being killed. SPecially when you had error or reading view pages open.

Either run the server on a fixed port or discover the port at runtime and update the port in the URL every time. THe latter would be nicer but maybe a fixed port is ok too?
tracking-fennec: ? → +
Assignee: nobody → sarentz
This patch actually does the reverse. It leaves the internal web server on a random port. But it does a couple of things to support this:

* We now set the `GCDWebServerOption_AutomaticallySuspendInBackground` option to keep server alive and thus keep the port that was chosen upon application start.
* We do no longer store reader mode URLs in the application state. Instead we write a `SavedTab` object and mark it with `readerMode` and `selected` properties together with the original url. When the tab is restored we turn the original URL into the reader mode url.

This patch also contains two fixes for `ReaderModeUtils` to better recognize and parse reader mode URLs.

I understand the last part of this was not really part of this bug description but that was actually the reason why I wanted to run the web server on a fixed port.
Attachment #8608983 - Flags: review?(bnicholson)
Status: NEW → ASSIGNED
Summary: Run our internal web server on a fixed port → Local server pages can't be restored after the app is killed
Comment on attachment 8608983 [details] [review]
PR: https://github.com/mozilla/firefox-ios/pull/491

Sounds like you plan to update this, so clearing r? flag for now.
Attachment #8608983 - Flags: review?(bnicholson) → feedback+
Summary: Local server pages can't be restored after the app is killed → Local server pages don't restore properly on resume
Comment on attachment 8608983 [details] [review]
PR: https://github.com/mozilla/firefox-ios/pull/491

Although this is a relatively small patch, it fixes the following bugs:

* 1164160 - Local server pages don't restore properly on resume
* 1168687 - Screenshots do not restore on resume
* 1167310 - Do not store tab state at startup
* 1166491 - Session encoding unsafely unwraps web view's URL

These are combined in a rewrite of the code that implements the `UIStateRestoration` functions. That code may seem a bit overly verbose and pedantic. This is on purpose because this code must be very robust to not fail on startup.
Comment on attachment 8608983 [details] [review]
PR: https://github.com/mozilla/firefox-ios/pull/491

I'd like to land this early wednesday so that we can include these fixes in the new build. (At least some of these contribute to the startup crashes that people have reported).
Attachment #8608983 - Flags: review?(sleroux)
Attachment #8608983 - Flags: review?(bnicholson)
Comment on attachment 8608983 [details] [review]
PR: https://github.com/mozilla/firefox-ios/pull/491

Nice, this looks great to me.
Attachment #8608983 - Flags: review?(bnicholson)
Attachment #8608983 - Flags: review+
Attachment #8608983 - Flags: feedback+
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: