Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fire pixels when showing the error screen #3462

Merged
merged 6 commits into from
Oct 28, 2024

Conversation

brindy
Copy link
Contributor

@brindy brindy commented Oct 25, 2024

Task/Issue URL: https://app.asana.com/0/392891325557410/1208511720659950/f
Tech Design URL:
CC:

Description:
Fires a pixel when the error screen is shown.

Steps to test this PR:

  1. Open a tab, and use activity monitor to kill that process. The "webpage has crashed" error screen should appear and the pixel should be fired.
  2. Open a nonsense url like https://nonsense.url - The 'unable to load' page should appear and the pixel should be displayed
  3. Switch between other tabs and the error pages and pixels should be fired when the user switches tabs.

Definition of Done:


Internal references:

Pull Request Review Checklist
Software Engineering Expectations
Technical Design Template
Pull Request Documentation

@@ -1251,6 +1251,8 @@ extension Tab/*: NavigationResponder*/ { // to be moved to Tab+Navigation.swift

@MainActor
func webContentProcessDidTerminate(with reason: WKProcessTerminationReason?) {
guard (error?.code.rawValue ?? WKError.Code.unknown.rawValue) != WKError.Code.webContentProcessTerminated.rawValue else { return }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try to avoid duplicate executions of this in case the app is stuck in some kind of loop

@@ -153,6 +154,32 @@ final class TabCollectionViewModel: NSObject {
burnerMode: burnerMode)
}

var selectedTabCancellable: AnyCancellable?
private func subscribeToSelectedTab() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, how come we send the pixel again when the user switch tabs? Won’t this generate noise in the pixels since it will send failures to load for the same webpage even tho it has not loaded multiple times?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Future suggestion: Perhaps we can inject the fire function and unit test the behaviour

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the requirement is to fire the pixel when the user sees the error screen and I checked this with Bobby as it would have been harder to have some state to only fire it the first time the error screen is seen and reset it, etc.

Copy link
Contributor

@alessandroboron alessandroboron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! The PR work as expected. I left a comment about sending the pixels when switching tabs.

@brindy brindy merged commit cb1122b into main Oct 28, 2024
19 checks passed
@brindy brindy deleted the brindy/wk_termination_validation branch October 28, 2024 10:58
samsymons added a commit that referenced this pull request Oct 29, 2024
# By Dax the Duck (5) and others
# Via GitHub (4) and Diego Rey Mendez (1)
* main: (26 commits)
  PIR broker configs: Add sub actions to ExpectationAction (#3452)
  Fix Neighbor Report Broker JSON and include optOutUrl for all brokers (#3463)
  Freemium DBP: Feature Branch to Main PR (#3426)
  Remove noisy PIR pixels (#3459)
  Bump version to 1.112.0 (290)
  Set marketing version to 1.112.0
  Update embedded files
  update fe onboarding (#3415)
  fire pixels when showing the error screen (#3462)
  Disable NTP animation when toggling Privacy Feed (#3460)
  Bump version to 1.111.0 (289)
  Check the config test pixel from the subscription monitor (#3455)
  Update OnboardingUserScript to use a weak script broker reference (#3456)
  fix flaky bookmark store tests (#3431)
  Workaround for stuck scans on Xcode 16 (#3453)
  Set autohidesScrollers in Bookmarks Manager; Fix scrollers positioning (#3451)
  fix Suggestions not reacting to clicks after being interacted with using keyboard (#3457)
  Fix testWhenChangingSortingInThePanelIsReflectedInTheManager UI Test (#3454)
  add contextual onboarding pixels  (#3447)
  Bump version to 1.111.0 (288)
  ...

# Conflicts:
#	DuckDuckGo/Preferences/View/PreferencesViewController.swift
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants