Opened 4 years ago

Last modified 3 years ago

#3704 closed change

Consider Edge a seperate platform in the generated "info" module — at Version 16

Reported by: sebastian Assignee:
Priority: P2 Milestone:
Module: Automation Keywords:
Cc: trev, kzar, oleksandr, sergz, scottlow Blocked By:
Blocking: Platform: Edge
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29337867

Description (last modified by sebastian)

Background

The info module provides metadata such as the platform, application and their respective versions. For Chrome, Opera and Edge that module is generated from chromeInfo.js.tmpl and the platform is currently hard-coded to "chromium". However, with Edge, this is no longer accurrate.

Also the version given by the Edge/ token in the user agent string, parsed there, refers to the platform (EdgeHTML), not to the application (Edge), unlike for other browsers.

What to change

Change the logic in chromeInfo.js.tmpl so that following info.* properties are initialized like below if the user agent string is indicating Edge:

platform "edgehtml"
platformVersion the version given by the Edge/ token in the UA
application "edge"
applicationVersion "0"

Change History (16)

comment:1 Changed 4 years ago by sebastian

  • Component changed from Sitescripts to Build-and-Release-Tools
  • Description modified (diff)

comment:2 Changed 4 years ago by sebastian

  • Cc trev kzar added
  • Ready unset

The assumptions in the issue description turned out to be wrong; Edge is already using a UA string similar to Chrome. So with the existing code, the current version of Edge will be recognized like that:

{
  application: "edge",
  applicationVersion: "25.10586.0.0",
  platform: "chromium",
  platformVersion: "42.0.2311.135"
}

But one question remains: Do we want to have info.platform set to "chromium" and info.platformVersion to the fake Chrome version given in Edge's user agent string, or should we rather consider Edge a separate platform? Technically, it is a different platform but as far as extension code is concerned not so much. The same holds true for Web Extensions for Firefox. Any thoughts?

comment:3 Changed 4 years ago by oleksandr

  • Cc oleksandr added

comment:4 Changed 4 years ago by trev

The engine is called EdgeHTML, that's the platform in this case IMHO (I'd agree to "edge" as well however). The user agent string is irrelevant in that case, the important part is the real technological basis of the browser. Aiming for full Chromium compatibility is great but Edge isn't Chrome. In theory, another browser embedding EdgeHTML should be possible.

comment:5 Changed 4 years ago by sebastian

Sounds reasonable to me. But how would you (reliably) detect EdgeHTML other than by relying on the user agent string? The builds for Chrome, Opera and Edge will be compatible with all of these browsers. And we might have only one unified build in the future, anyway. Checking for the chrome namespace would allow to identify Chromium as of now. But since both, Edge and Firefox (Web Extensions), and who knows who else is following, expose the Chrome-like extension API with the browser namespace instead, this doesn't seem to be a good/reliable approach to detect the platform. Neither is there an extension API to detect the actual platform. So it seems the UA string is all we got.

Last edited 4 years ago by sebastian (previous) (diff)

comment:6 Changed 4 years ago by trev

I sincerely doubt that, that would be the first browser where the engine cannot be reliably identified by means of JavaScript. Worst-case scenario: window.external && typeof window.external.msTrackingProtectionEnabled == "function".

Last edited 4 years ago by trev (previous) (diff)

comment:7 Changed 4 years ago by oleksandr

FYI: https://dev.windows.com/en-us/microsoft-edge/platform/faq/what-is-the-microsoft-edge-user-agent-st/

For some non-interoperable/app-related scenarios, such as extensions, analytics, links to app stores, and pinned sites, you should use the “Edge” token to detect Microsoft Edge

So Microsoft actually recommends using UA.

Last edited 4 years ago by oleksandr (previous) (diff)

comment:8 Changed 4 years ago by sebastian

It of course depends on what you consider reliable. If checking for non-standard DOM APIs is any better than relying on the user agent string, sure that would be an option. However, as we have to rely on the UA anyway, for the application, applicationVersion and platformVersion, I guess it would be reasonable to rely on it for the platform itself as well, besides that seems to be what Microsoft recommends.

Last edited 4 years ago by sebastian (previous) (diff)

comment:9 Changed 4 years ago by trev

This will mostly depend on whether other application embedding EdgeHTML (apps?) will load extensions/use the same user agent string.

comment:10 Changed 4 years ago by oleksandr

The EdgeHTML engine that is used in WebView in Universal Windows Platform applications uses the same EdgeHTML version that the Microsoft Edge browser uses. I have checked like described here? Those have the same user agent.

comment:11 Changed 4 years ago by sebastian

Also we wouldn't be able to correctly detect platformVersion (and potentially application and applicationVersion) anyway if the user agent string is incompatible. Moreover, if we rely on non-standard DOM APIs, it will break if they get removed in the future. So I still think the user agent string is the best we got here.

comment:12 Changed 4 years ago by sebastian

  • Description modified (diff)
  • Ready set

comment:13 Changed 4 years ago by sebastian

  • Description modified (diff)

comment:14 Changed 4 years ago by sergz

  • Cc sergz added

comment:15 Changed 4 years ago by sebastian

  • Summary changed from Support Edge's user agent string in the generated "info" module to Consider Edge a seperate platform in the generated "info" module

comment:16 Changed 4 years ago by sebastian

  • Description modified (diff)
Note: See TracTickets for help on using tickets.