diff --git a/android-components/components/feature/session/src/main/java/mozilla/components/feature/session/SessionUseCases.kt b/android-components/components/feature/session/src/main/java/mozilla/components/feature/session/SessionUseCases.kt index 4c53f0d22f75..565ba3463218 100644 --- a/android-components/components/feature/session/src/main/java/mozilla/components/feature/session/SessionUseCases.kt +++ b/android-components/components/feature/session/src/main/java/mozilla/components/feature/session/SessionUseCases.kt @@ -4,6 +4,7 @@ package mozilla.components.feature.session +import mozilla.components.browser.state.action.ContentAction import mozilla.components.browser.state.action.CrashAction import mozilla.components.browser.state.action.EngineAction import mozilla.components.browser.state.action.LastAccessAction @@ -99,6 +100,13 @@ class SessionUseCases( flags = flags, additionalHeaders = additionalHeaders, ) + // Update the url in content immediately until the engine updates with any new changes to the state. + store.dispatch( + ContentAction.UpdateUrlAction( + loadSessionId, + url, + ), + ) store.dispatch( EngineAction.OptimizedLoadUrlTriggeredAction( loadSessionId, diff --git a/android-components/components/feature/session/src/test/java/mozilla/components/feature/session/SessionUseCasesTest.kt b/android-components/components/feature/session/src/test/java/mozilla/components/feature/session/SessionUseCasesTest.kt index 16a5fd3d626f..4461577d2595 100644 --- a/android-components/components/feature/session/src/test/java/mozilla/components/feature/session/SessionUseCasesTest.kt +++ b/android-components/components/feature/session/src/test/java/mozilla/components/feature/session/SessionUseCasesTest.kt @@ -11,6 +11,7 @@ import mozilla.components.browser.state.action.EngineAction import mozilla.components.browser.state.action.TabListAction import mozilla.components.browser.state.engine.EngineMiddleware import mozilla.components.browser.state.selector.findTab +import mozilla.components.browser.state.selector.selectedTab import mozilla.components.browser.state.state.BrowserState import mozilla.components.browser.state.state.TabSessionState import mozilla.components.browser.state.state.createCustomTab @@ -80,6 +81,7 @@ class SessionUseCasesTest { assertEquals("mozilla", action.tabId) assertEquals("https://getpocket.com", action.url) } + assertEquals("https://getpocket.com", store.state.selectedTab?.content?.url) useCases.loadUrl("https://www.mozilla.org", LoadUrlFlags.select(LoadUrlFlags.EXTERNAL)) store.waitUntilIdle() @@ -93,6 +95,7 @@ class SessionUseCasesTest { assertEquals("https://www.mozilla.org", action.url) assertEquals(LoadUrlFlags.select(LoadUrlFlags.EXTERNAL), action.flags) } + assertEquals("https://www.mozilla.org", store.state.selectedTab?.content?.url) useCases.loadUrl("https://firefox.com", store.state.selectedTabId) store.waitUntilIdle() @@ -102,6 +105,7 @@ class SessionUseCasesTest { assertEquals("mozilla", action.tabId) assertEquals("https://firefox.com", action.url) } + assertEquals("https://firefox.com", store.state.selectedTab?.content?.url) useCases.loadUrl.invoke( "https://developer.mozilla.org", diff --git a/docs/changelog.md b/docs/changelog.md index 06a453a17cc4..c3de6235c869 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -19,7 +19,7 @@ permalink: /changelog/ * **all components** * All new usages of the `concept-fetch` component to make fetch requests now have conservative-mode off by default. Current features will continue to use conservative mode until individually updated. - + * **browser-toolbar** * Add `showMenuButton` and `hideMenuButton` API to `BrowserToolbar` and `DisplayToolbar` to allow hiding and showing of the menu button in the `BrowserToolbar` [Bug 1864760](https://bugzilla.mozilla.org/show_bug.cgi?id=1864760) @@ -27,6 +27,9 @@ permalink: /changelog/ * **feature-customtabs** * Fallback behaviour when failing to open a new window in custom tab will now be loading the URL directly in the same custom tab. [Bug 1832357](https://bugzilla.mozilla.org/show_bug.cgi?id=1832357) +* **feature-session** + * Update URL in the store immediately when using the optimized load URL code path. + # 123.0 * [Commits](https://github.com/mozilla-mobile/firefox-android/compare/releases_v122..releases_v123) * [Dependencies](https://github.com/mozilla-mobile/firefox-android/blob/releases_v123/android-components/plugins/dependencies/src/main/java/DependenciesPlugin.kt) diff --git a/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/CrashReportingTest.kt b/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/CrashReportingTest.kt index 84083e014ddf..be99ebe8af54 100644 --- a/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/CrashReportingTest.kt +++ b/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/CrashReportingTest.kt @@ -85,7 +85,7 @@ class CrashReportingTest : TestSetup() { verifyPageContent(tabCrashMessage) }.openTabDrawer { verifyExistingOpenTabs(firstWebPage.title) - verifyExistingOpenTabs(secondWebPage.title) + verifyExistingOpenTabs("about:crashcontent") }.closeTabDrawer { }.goToHomescreen { verifyExistingTopSitesList()