Skip to content

Commit a4f5c71

Browse files
authored
Revert "Bugfix FXIOS-14135 ⁃ Website showing as not secure while it i…s loading (#30746)" (#31037)
1 parent 5828572 commit a4f5c71

File tree

5 files changed

+6
-46
lines changed

5 files changed

+6
-46
lines changed

firefox-ios/Client/Frontend/Browser/BrowserViewController/Extensions/BrowserViewController+WebViewDelegates.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,10 +1181,6 @@ extension BrowserViewController: WKNavigationDelegate {
11811181
}
11821182
}
11831183
}
1184-
1185-
if tabManager.selectedTab === tab {
1186-
updateURLBarDisplayURL(tab, true)
1187-
}
11881184
}
11891185
}
11901186
}

firefox-ios/Client/Frontend/Browser/BrowserViewController/Views/BrowserViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2586,7 +2586,7 @@ class BrowserViewController: UIViewController,
25862586

25872587
/// Updates the URL bar text and button states.
25882588
/// Call this whenever the page URL changes.
2589-
func updateURLBarDisplayURL(_ tab: Tab, _ navigationFinished: Bool = false) {
2589+
fileprivate func updateURLBarDisplayURL(_ tab: Tab) {
25902590
var safeListedURLImageName: String? {
25912591
return (tab.contentBlocker?.status == .safelisted) ?
25922592
StandardImageIdentifiers.Small.notificationDotFill : nil
@@ -2601,7 +2601,7 @@ class BrowserViewController: UIViewController,
26012601
StandardImageIdentifiers.Small.shieldSlashFillMulticolor
26022602
lockIconNeedsTheming = hasSecureContent
26032603
let isWebsiteMode = tab.url?.isReaderModeURL == false
2604-
lockIconImageName = isWebsiteMode && navigationFinished ? lockIconImageName : nil
2604+
lockIconImageName = isWebsiteMode ? lockIconImageName : nil
26052605
}
26062606

26072607
let action = ToolbarAction(
@@ -4620,7 +4620,7 @@ extension BrowserViewController: TabManagerDelegate {
46204620
selectedTab.webView?.applyTheme(theme: currentTheme())
46214621
}
46224622

4623-
updateURLBarDisplayURL(selectedTab, selectedTab.isLoading == false)
4623+
updateURLBarDisplayURL(selectedTab)
46244624
if addressToolbarContainer.inOverlayMode, selectedTab.url?.displayURL != nil {
46254625
addressToolbarContainer.leaveOverlayMode(reason: .finished, shouldCancelLoading: false)
46264626
}

firefox-ios/Client/Frontend/Browser/Toolbars/Redux/AddressBarState.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ struct AddressBarState: StateType, Sendable, Equatable {
403403
borderPosition: state.borderPosition,
404404
url: toolbarAction.url,
405405
searchTerm: nil,
406-
lockIconImageName: toolbarAction.lockIconImageName,
406+
lockIconImageName: toolbarAction.lockIconImageName ?? state.lockIconImageName,
407407
lockIconNeedsTheming: toolbarAction.lockIconNeedsTheming ?? state.lockIconNeedsTheming,
408408
safeListedURLImageName: toolbarAction.safeListedURLImageName,
409409
isEditing: state.isEditing,

firefox-ios/firefox-ios-tests/Tests/ClientTests/BrowserViewControllerTests.swift

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -185,42 +185,6 @@ class BrowserViewControllerTests: XCTestCase, StoreTestUtility {
185185
// XCTAssertEqual(action.readerModeState, .active)
186186
// }
187187

188-
func testUpdateURLBarDisplayURL_whenNavigationNotFinished_shouldHideLockIcon() throws {
189-
let expectation = XCTestExpectation(description: "expect mock store to dispatch an action")
190-
let subject = createSubject()
191-
let tab = MockTab(profile: profile, windowUUID: .XCTestDefaultUUID)
192-
tab.url = URL(string: "https://google.com")
193-
let mockTabWebView = MockTabWebView(tab: tab)
194-
tab.webView = mockTabWebView
195-
196-
mockStore.dispatchCalled = {
197-
expectation.fulfill()
198-
}
199-
subject.updateURLBarDisplayURL(tab, false)
200-
wait(for: [expectation])
201-
202-
let action = try XCTUnwrap(mockStore.dispatchedActions.first as? ToolbarAction)
203-
XCTAssertEqual(action.lockIconImageName, nil)
204-
}
205-
206-
func testUpdateURLBarDisplayURL_whenNavigationIsFinished_shouldShowLockIcon() throws {
207-
let expectation = XCTestExpectation(description: "expect mock store to dispatch an action")
208-
let subject = createSubject()
209-
let tab = MockTab(profile: profile, windowUUID: .XCTestDefaultUUID)
210-
tab.url = URL(string: "https://google.com")
211-
let mockTabWebView = MockTabWebView(tab: tab)
212-
tab.webView = mockTabWebView
213-
214-
mockStore.dispatchCalled = {
215-
expectation.fulfill()
216-
}
217-
subject.updateURLBarDisplayURL(tab, true)
218-
wait(for: [expectation])
219-
220-
let action = try XCTUnwrap(mockStore.dispatchedActions.first as? ToolbarAction)
221-
XCTAssertEqual(action.lockIconImageName, StandardImageIdentifiers.Small.shieldSlashFillMulticolor)
222-
}
223-
224188
// MARK: - Handle PDF
225189

226190
func testHandlePDFDownloadRequest_doesntDocumentLoadingView_whenTabNotSelected() {

firefox-ios/firefox-ios-tests/Tests/XCUITests/TabsTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ class TabsTests: BaseTestCase {
346346

347347
// Open New Tab
348348
app.cells.buttons[StandardImageIdentifiers.Large.plus].waitAndTap()
349-
app.buttons[AccessibilityIdentifiers.Browser.UrlBar.cancelButton].tapWithRetry()
349+
navigator.performAction(Action.CloseURLBarOpen)
350350

351351
waitForTabsButton()
352352
checkNumberOfTabsExpectedToBeOpen(expectedNumberOfTabsOpen: 2)
@@ -377,7 +377,7 @@ class TabsTests: BaseTestCase {
377377
mozWaitForElementToExist(app.buttons[AccessibilityIdentifiers.Toolbar.tabsButton])
378378
app.buttons[AccessibilityIdentifiers.Toolbar.tabsButton].press(forDuration: 1)
379379
app.tables.cells.buttons["New Private Tab"].waitAndTap()
380-
app.buttons[AccessibilityIdentifiers.Browser.UrlBar.cancelButton].tapWithRetry()
380+
app.buttons[AccessibilityIdentifiers.Browser.UrlBar.cancelButton].waitAndTap()
381381
let tabsButton = app.buttons[AccessibilityIdentifiers.Toolbar.tabsButton]
382382
mozWaitForElementToExist(tabsButton)
383383
navigator.nowAt(NewTabScreen)

0 commit comments

Comments
 (0)