Open Bug 1755852 Opened 3 years ago Updated 5 months ago

[meta] Tracking regressions on deactivated dom.netinfo.enabled pref on mobile (navigator.connection undefined)

Categories

(Core :: DOM: Navigation, defect, P2)

Firefox 99
Unspecified
All
defect

Tracking

()

Webcompat Priority P3
Tracking Status
firefox-esr91 --- unaffected
firefox97 --- unaffected
firefox98 - unaffected
firefox99 + wontfix

People

(Reporter: karlcow, Unassigned)

References

(Depends on 1 open bug, Regression)

Details

(Keywords: meta, regression)

[Tracking Requested - why for this release]: This will reach release when 99 and has the potential of breaking sites. We can mitigate with site interventions. Let's make it ride the train to beta at least, so we have more chances to catch regressions.

In Bug 1637922, we disabled navigator.connection through the preference dom.netinfo.enabled. This bug is to track these regression and understand if we need to create site interventions or if we have to re-enable it.

The first case of regression is because of this pattern.

    if (isAndroid) {
      navigator.connection.addEventListener('typechange', () => {
        // connectionType = navigator.connection.type
        const connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
        const effectiveType = connection.effectiveType;
        const type = connection.type;

// … more code …

})}

it fails with:

Uncaught (in promise) TypeError: can't access property "addEventListener", navigator.connection is undefined

Checking online for the same pattern:
https://github.com/search?l=JavaScript&q=navigator.connection.addEventListener&type=Code

Set release status flags based on info from the regressing bug 1637922

FWIW: Brave recently did the same thing: https://github.com/brave/brave-browser/issues/20122

Has Regression Range: --- → yes

Would it be possible to re-enable this for Add-ons so an Add-on can do decisions based on which network type currently is available?

I'm developing a pretty simple Add-on which does this:
https://github.com/M-Reimer/mobilemediablocker
https://addons.mozilla.org/firefox/addon/mobilemediablocker/

The idea of this Add-on is to block all media requests if the connection is of cellular type. This is very useful for most data plans in Germany as we pay a fortune for just a few 100 megabytes of data. If the wifi connection dies for whatever reason and the phone reconnects using the cellular network, then it regularly happened to me that I kept surfing using cellular data without really noticing and ending with no data volume left for the month.

Depends on: 1756692
Depends on: 1757307

Moving this bug to DOM component because it's about the navigator.connection Web API. This isn't a GeckoView bug.

Severity: S1 → --
Component: General → DOM: Networking
Priority: P1 → --
Product: GeckoView → Core
Summary: Tracking regressions on deactivated dom.netinfo.enabled on mobile (navigator.connection undefined) → Tracking regressions on deactivated dom.netinfo.enabled pref on mobile (navigator.connection undefined)
Component: DOM: Networking → DOM: Navigation

Karl, from what I read comment 0, my understanding is that there's no action my team should take at this moment, and your team has been monitoring the situation. Let me know if I miss anything.

Severity: -- → S3
Flags: needinfo?(kdubost)
Priority: -- → P2
Summary: Tracking regressions on deactivated dom.netinfo.enabled pref on mobile (navigator.connection undefined) → [meta] Tracking regressions on deactivated dom.netinfo.enabled pref on mobile (navigator.connection undefined)

that's correct. We have been using site interventions for the eventual detected breakage.
Also it seems that it solves also issues on websites which were not working before.

Flags: needinfo?(kdubost)
You need to log in before you can comment on or make changes to this bug.