Skip to main content
Sign in
Snippets Groups Projects

Only allow "about:" pages to have access to contentaccessible branding assets

  • View options
  • Closed created by henry
    Closed Only allow "about:" pages to have access to contentaccessible branding assets
    • View options
  • Marking this as confidential, since I'm not sure how critical it is to keep nightly, alpha and release looking the same. But this was the aim of #42319 (closed), but there is a work-around.

    Just add to a webpage

    <link rel="stylesheet" href="chrome://branding/content/aboutDialog.css">
    <div id="rightBox"></div>
    <div id="trademark"></div>

    and use computed style on #rightBox and #trademark to determine the difference. This works because the CSS is contentaccessible, which means it can be used for anything that isn't a document, including as a stylesheet.

    Note this only distinguishes between the stable release and nightly/alpha, because they have different rules for only these two elements.

    Technically, alpha has another rule for #rightBox:-moz-locale-dir(rtl) that nightly does not. However, I don't know of a way to access this rule. I think -moz-locale-dir never matches for HTML (rather than XUL), and I don't think it is possible to read the cross-origin CSSStyleSheet.cssRules. But maybe there is some other way.

    I guess the solution would be to either:

    1. Use the same CSS for each platform.
    2. Make this CSS identical/empty on all platforms, but add the differences in some other non contentaccessible package. I.e. somewhere other than chrome://branding/content/. We can then do a similar thing with about-wordmark.svg to avoid the padding and right-to-left corrections.
    3. Make all of chrome://branding/content/ non contentaccessible. I asked in the firefox developer chat if there is a good reason not to do this.

    And do the same for mullvad in mullvad-browser#312 (closed).

    /cc @pierov @thorin

    Attributes

    Assignees

    Labels

    Milestone

    None

    Dates

    Start: None

    Due: None

    Time tracking

    No estimate or time spent
    To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information

    Activity

    • All activity
    • Comments only
    • History only
    • Newest first
    • Oldest first