Skip to content

Zen doesn't identify itself in the extensions API #12198

@ToyKeeper

Description

@ToyKeeper

Preliminary Checks

  • I have read and understood the important section above.
  • I have searched existing issues and avoided creating duplicates.
  • I am not filing an enhancement request.
  • I have checked that this issue cannot be reproduced on Mozilla Firefox.
  • I have checked that this issue can be reproduced once I removed all my Mods and Custom CSS.

What happened?

Extensions need to be able to detect the type of browser they are running in, because different browsers work in different ways and need per-browser code to implement some features or work around quirks. Zen Browser is more quirky than most, which makes this extra important... but it does not seem to identify itself. This means extensions will break and won't be able to apply browser-specific fixes.

Almost anything would work, as long as it is consistent, relatively easy to discover, and provides sufficient info. For example...

  • Brave creates an object called navigator.brave, so detection is as easy as isBrave = (typeof navigator.brave !== 'undefined');.

  • Maxthon creates a top-level object called maxthon.

  • MS Edge registers itself as a brand in navigator.userAgentData and identifies itself in the user agent:

let isEdge = / Edg\//.test(navigator.userAgent);
if (navigator.userAgentData?.brands) {
  isEdge = navigator.userAgentData.brands
    .some(b => b.brand === "Microsoft Edge");
}
  • Firefox (and derivatives) are trivial to detect because they define browser instead of using chrome as the top-level API object... but if a derivative doesn't distinguish itself further, it may be mistaken for Firefox.

Simply setting navigator.zenBrowser = true in the API would help quite a bit, though to make it more robust, it should ideally provide more info than that... like navigator.zenBrowser.version = [1, 18, 3, 2]; or navigator.zenBrowser.version = '1.18.3b';, to allow extensions to apply version-specific fixes in addition to browser-specific fixes. Or perhaps something like browser.zen.version, and expose user config options so extensions can check on config settings they might need to support... if (browser.zen.getConfig('zen.window-sync.enabled')) { // handle "window sync" mode quirks }.

Zen's quirks break extensions, but that's not a bug... it's just a side effect of being different. The bug is that Zen doesn't provide the info extensions need to be able to function correctly.

Expected behavior

Browser identifies itself in the extension API.

Actual behavior

Zen seems to be indistinguishable from Firefox, so extensions can't apply Zen-specific fixes.

Version

1.18.3b

What platform are you seeing the problem on?

Linux (AppImage)

What component is this issue related to?

Extensions

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions