Closed Bug 1167508 Opened 9 years ago Closed 9 years ago

Use async flushing for LoadInOtherProcess() and remove TabState.flush()

Categories

(Firefox :: Session Restore, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 41
Tracking Status
firefox41 --- fixed

People

(Reporter: ttaubert, Assigned: ttaubert)

References

Details

Attachments

(7 files, 5 obsolete files)

2.00 KB, patch
billm
: review+
Details | Diff | Splinter Review
3.47 KB, patch
billm
: review+
Details | Diff | Splinter Review
2.42 KB, patch
billm
: review+
Details | Diff | Splinter Review
2.72 KB, patch
billm
: review+
Details | Diff | Splinter Review
6.59 KB, patch
billm
: review+
Details | Diff | Splinter Review
13.78 KB, patch
billm
: review+
Details | Diff | Splinter Review
2.39 KB, patch
billm
: review+
Details | Diff | Splinter Review
LoadInOtherProcess() is the only place still using TabState.flush() outside of tests.
We can remove TabState.flush() with that already but not sync flushing quite yet as we're still using .flushWindow().
I found that we need to reset the epoch when a new frameLoader is created in a <browser>. This mostly works fine currently because when we do that (remoteness switching) we at the same time restore data into the tab, which also restores the old epoch. This doesn't happen when the browser crashes though, so I think the correct way to handle this is to actually reset the epoch and not carry it forward.
Assignee: nobody → ttaubert
Status: NEW → ASSIGNED
Attachment #8609824 - Flags: review?(wmccloskey)
TabStateFlusher.flush() currently doesn't support crashed browsers and does never resolve in that case. We shouldn't punish the caller for not checking whether the tab is crashed as the tab state is basically frozen and should simply be accessible.
Attachment #8609826 - Flags: review?(wmccloskey)
This moves the remoteness switching code from LoadInOtherProcess() to SessionStore and makes it a regular API. Calling browser.loadURI() does now first flush asynchronously to receive all the necessary data and then start navigation. Remoteness switching happens asynchronously now.
Attachment #8609828 - Flags: review?(wmccloskey)
Let's get rid of TabState.flush(). We still have .flushWindow() though, the last that needs to be removed.
Attachment #8609829 - Flags: review?(wmccloskey)
This makes SessionStore's promiseBrowserLoaded() simply use BrowserTestUtils.browserLoaded() and fixes that latter to support being called for a browser that may switch its remoteness asynchronously while waiting for the load to happen.
Attachment #8609830 - Flags: review?(wmccloskey)
All the necessary test fixes.
Attachment #8609831 - Flags: review?(wmccloskey)
Small fix.
Attachment #8609828 - Attachment is obsolete: true
Attachment #8609828 - Flags: review?(wmccloskey)
Attachment #8609889 - Flags: review?(wmccloskey)
Small fix.
Attachment #8609831 - Attachment is obsolete: true
Attachment #8609831 - Flags: review?(wmccloskey)
Attachment #8609890 - Flags: review?(wmccloskey)
One more test fix.
Attachment #8610217 - Flags: review?(wmccloskey)
Attachment #8609890 - Attachment is obsolete: true
Attachment #8609890 - Flags: review?(wmccloskey)
Gah, these customizableui tests are hard, need to do some more work on those.
Attachment #8609824 - Flags: review?(wmccloskey) → review+
Comment on attachment 8609826 [details] [diff] [review]
0002-Bug-1167508-Support-flushing-crashed-browsers.patch

Review of attachment 8609826 [details] [diff] [review]:
-----------------------------------------------------------------

This handles the case where the browser crashed before the TabStateFlusher.flush. Even with this patch, we still won't handle a crash after a flush is sent and before the reply is received, right? Should we maybe do resolveAll in that case? We have all the data we're going to get at that time.
Attachment #8609826 - Flags: review?(wmccloskey) → review+
I'm a little scared looking at the rest of the patches. There's nothing wrong with the patches here. It's just the whole concept of remoteness switching is so broken. I'd like to think a little more about how to make it better. I'll get back to this tomorrow or Friday. Sorry for the delay.
(In reply to Bill McCloskey (:billm) from comment #16)
> I'm a little scared looking at the rest of the patches. There's nothing
> wrong with the patches here. It's just the whole concept of remoteness
> switching is so broken. I'd like to think a little more about how to make it
> better. I'll get back to this tomorrow or Friday. Sorry for the delay.

No worries, I'm all open to better ideas here :)
(In reply to Bill McCloskey (:billm) from comment #15)
> This handles the case where the browser crashed before the
> TabStateFlusher.flush. Even with this patch, we still won't handle a crash
> after a flush is sent and before the reply is received, right? Should we
> maybe do resolveAll in that case? We have all the data we're going to get at
> that time.

SessionStore.onBrowserCrashed() calls TabStateFlusher.resolveAll() passing the browser that crashed. Added that case in bug 1162871 already :)
Comment on attachment 8609889 [details] [diff] [review]
0003-Bug-1167508-Use-async-flushing-for-LoadInOtherProces.patch, v2

Review of attachment 8609889 [details] [diff] [review]:
-----------------------------------------------------------------

OK, let's just do this. I don't see any alternative.
Attachment #8609889 - Flags: review?(wmccloskey) → review+
Attachment #8609829 - Flags: review?(wmccloskey) → review+
Attachment #8609830 - Flags: review?(wmccloskey) → review+
Comment on attachment 8610217 [details] [diff] [review]
0006-Bug-1167508-Fix-tests-that-expect-a-sync-remoteness-.patch, v3

Review of attachment 8610217 [details] [diff] [review]:
-----------------------------------------------------------------

::: browser/base/content/test/general/browser_e10s_chrome_process.js
@@ +24,5 @@
>      let asyncTask = Task.async(transitionTask);
> +    yield asyncTask(browser, endURL);
> +
> +    if (startProcessIsRemote != endProcessIsRemote) {
> +      yield BrowserTestUtils.waitForEvent(browser, "XULFrameLoaderCreated");

Rather than encoding this specific event into a bunch of tests, can we add a function to BTU that does it? That way, if we change how this stuff works, we won't have to change a bunch of tests.
Attachment #8610217 - Flags: review?(wmccloskey)
Attachment #8610217 - Attachment is obsolete: true
Attachment #8614565 - Flags: review?(wmccloskey)
Aha, about:newtab was causing issues when it was preloaded. Shouldn't use that in tests if we're not actually testing about:newtab itself.
Attachment #8614565 - Attachment is obsolete: true
Attachment #8614565 - Flags: review?(wmccloskey)
Attachment #8614635 - Flags: review?(wmccloskey)
Fixing a few more failures on try that weren't there before. Turns out that some tests cause the window to be closed just before flushing completes. We need to check if the window is gone before continuing.

https://treeherder.mozilla.org/#/jobs?repo=try&revision=1a4353961665
Attachment #8614739 - Flags: review?(wmccloskey)
Attachment #8614635 - Flags: review?(wmccloskey) → review+
Attachment #8614739 - Flags: review?(wmccloskey) → review+
Depends on: 1172137
Was luck enough to hit an existing leak in bug 1172137 with my patches. Pushed to try again with the fixes, hope that's the last try push.

https://treeherder.mozilla.org/#/jobs?repo=try&revision=af54e489c668
(Well, I didn't hit it *in* bug 1172137 but I filed that bug to fix the leak.)
Backed out because bug 1172137 had to be backed out.
Depends on: 1173267
Depends on: 1174030
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: