Unfortunately the implementation for this needs to live in SessionManager as long as it keeps
references to EngineSession instances and thumbnails. Therefore we determine what to trim in
SessionManager and notify BrowserStore to perform the same changes.
Hopefully in a not to distant future we can move that to BrowserStore.
4773: Closes https://github.com/mozilla-mobile/android-components/issues/4749: Fix for bug 1522829 r=pocmo a=csadilek
We basically already have the parent session everywhere we need it, we now just forward the corresponding engine session so we can pass it along to GeckoView e.g. when opening a new (regular or private) tab, and when reacting to window requests.
@pocmo one discussion point is whether or not we have to create an engine session for the parent if it's no longer there (e.g. when re-loading a child tab after a restart). I decided **not** to do that as we'd be loading all parent sessions on startup and the child session should already have the right state.
Also, I didn't want to overload the method as named args with default values make this easy enough to read in Kotlin.
Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com>
4609: Fix find in page not working with fresh install r=csadilek a=VMadalin
### Description
Fixed issue: https://github.com/mozilla-mobile/reference-browser/issues/915
The `engineSession` is null on `FindInPageInteractor` because the `bind()` method set it as null via `session.engineState.engineSession`.
<img width="752" alt="Screenshot 2019-10-02 at 08 25 39" src="https://user-images.githubusercontent.com/18151158/66025739-799e8e00-e4f7-11e9-944d-73ab86d45485.png">
Finally and after deep research I discover the problem is related with the tabs, when `EngineStateReducer.reduce()` is called for the first time no one has add the new tab created and without it it's imposible to propagate the `GeckoEngineSession` to the `BrowserState`
```
2019-10-02 17:50:58.885 8585-9964/org.mozilla.samples.browser: UnlinkEngineSessionAction
2019-10-02 17:50:58.891 8585-9964/org.mozilla.samples.browser: LinkEngineSessionAction
2019-10-02 17:50:58.919 8585-9964/org.mozilla.samples.browser: AddTabAction // after link
```
### Pull Request checklist
<!-- Before submitting the PR, please address each item -->
- [x] **Quality**: This PR builds and passes detekt/ktlint checks (A pre-push hook is recommended)
- [x] **Tests**: This PR includes thorough tests or an explanation of why it does not
- [ ] **Changelog**: This PR includes [a changelog entry](https://github.com/mozilla-mobile/android-components/blob/master/docs/changelog.md) or does not need one
- [x] **Accessibility**: The code in this PR follows [accessibility best practices](https://github.com/mozilla-mobile/shared-docs/blob/master/android/accessibility_guide.md) or does not include any user facing features
### After merge
- [ ] **Milestone**: Make sure issues closed by this pull request are added to the [milestone](https://github.com/mozilla-mobile/android-components/milestones) of the version currently in development.
- [ ] **Breaking Changes**: If this is a breaking change, please push a draft PR on [Reference Browser](https://github.com/mozilla-mobile/reference-browser) to address the breaking issues.
Co-authored-by: Madalin Valceleanu <devmobile@vmadalin.com>
Earlier, session icon was cleared whenever URL chagned. But, that resulted in no icon in the scenario of same-host URL redirects. Now, we are clearing session icon only if the scheme and host part of the URL changes.