Verified Commit 0d3b0974 authored by henry's avatar henry Committed by Pier Angelo Vendrame
Browse files

fixup! MB 39: Add home page about:mullvad-browser

Bug 271: Show update in about:mullvad-browser
parent 1b1e94cd
Loading
Loading
Loading
Loading
+14 −0
Changes for browser/components/BrowserGlue.sys.mjs: 14 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -370,6 +370,20 @@ let JSWINDOWACTORS = {
    matches: ["about:messagepreview", "about:messagepreview?*"],
  },

  AboutMullvadBrowser: {
    parent: {
      esModuleURI: "resource:///actors/AboutMullvadBrowserParent.sys.mjs",
    },
    child: {
      esModuleURI: "resource:///actors/AboutMullvadBrowserChild.sys.mjs",
      events: {
        DOMContentLoaded: {},
      },
    },

    matches: ["about:mullvad-browser"],
  },

  AboutPlugins: {
    parent: {
      esModuleURI: "resource:///actors/AboutPluginsParent.sys.mjs",
+14 −0
Changes for browser/components/mullvad-browser/AboutMullvadBrowserChild.sys.mjs: 14 added lines, 0 removed lines.
Original line number Diff line number Diff line
export class AboutMullvadBrowserChild extends JSWindowActorChild {
  handleEvent(event) {
    switch (event.type) {
      case "DOMContentLoaded":
        this.sendQuery("AboutMullvadBrowser:GetUpdateData").then(data => {
          const updateEvent = new this.contentWindow.CustomEvent("UpdateData", {
            detail: Cu.cloneInto(data, this.contentWindow),
          });
          this.contentWindow.dispatchEvent(updateEvent);
        });
        break;
    }
  }
}
+23 −0
Changes for browser/components/mullvad-browser/AboutMullvadBrowserParent.sys.mjs: 23 added lines, 0 removed lines.
Original line number Diff line number Diff line
export class AboutMullvadBrowserParent extends JSWindowActorParent {
  receiveMessage(message) {
    const shouldNotifyPref = "mullvadbrowser.post_update.shouldNotify";
    switch (message.name) {
      case "AboutMullvadBrowser:GetUpdateData":
        if (!Services.prefs.getBoolPref(shouldNotifyPref, false)) {
          return Promise.resolve(null);
        }
        Services.prefs.clearUserPref(shouldNotifyPref);
        return Promise.resolve({
          version: Services.prefs.getCharPref(
            "browser.startup.homepage_override.mullvadbrowser.version"
          ),
          url:
            Services.prefs.getCharPref("mullvadbrowser.post_update.url", "") ||
            Services.urlFormatter.formatURLPref(
              "startup.homepage_override_url"
            ),
        });
    }
    return undefined;
  }
}
+3 −0
Changes for browser/components/mullvad-browser/content/2728-sparkles.svg: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
<!-- FROM https://github.com/twitter/twemoji
   - licensed under CC-BY 4.0: https://creativecommons.org/licenses/by/4.0/ -->
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><path fill="#FFAC33" d="M34.347 16.893l-8.899-3.294-3.323-10.891c-.128-.42-.517-.708-.956-.708-.439 0-.828.288-.956.708l-3.322 10.891-8.9 3.294c-.393.146-.653.519-.653.938 0 .418.26.793.653.938l8.895 3.293 3.324 11.223c.126.424.516.715.959.715.442 0 .833-.291.959-.716l3.324-11.223 8.896-3.293c.391-.144.652-.518.652-.937 0-.418-.261-.792-.653-.938z"/><path fill="#FFCC4D" d="M14.347 27.894l-2.314-.856-.9-3.3c-.118-.436-.513-.738-.964-.738-.451 0-.846.302-.965.737l-.9 3.3-2.313.856c-.393.145-.653.52-.653.938 0 .418.26.793.653.938l2.301.853.907 3.622c.112.444.511.756.97.756.459 0 .858-.312.97-.757l.907-3.622 2.301-.853c.393-.144.653-.519.653-.937 0-.418-.26-.793-.653-.937zM10.009 6.231l-2.364-.875-.876-2.365c-.145-.393-.519-.653-.938-.653-.418 0-.792.26-.938.653l-.875 2.365-2.365.875c-.393.146-.653.52-.653.938 0 .418.26.793.653.938l2.365.875.875 2.365c.146.393.52.653.938.653.418 0 .792-.26.938-.653l.875-2.365 2.365-.875c.393-.146.653-.52.653-.938 0-.418-.26-.792-.653-.938z"/></svg>
+28 −2
Changes for browser/components/mullvad-browser/content/aboutMullvadBrowser.css: 28 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -44,14 +44,14 @@ p {

#header {
  display: grid;
  grid-template-rows: auto auto;
  grid-template-columns: auto;
  grid-template: "heading" auto "text" auto / auto;
  justify-items: center;
  align-content: center;
  gap: 1.5em;
}

#headingContainer {
  grid-area: heading;
  display: inline flex;
  flex-direction: row;
  white-space: nowrap;
@@ -59,6 +59,32 @@ p {
  gap: 16px;
}

#mullvad-browser-update,
#mullvad-browser-intro {
  grid-area: text;
}

body:not(.has-update) #mullvad-browser-update {
  display: none;
}

body:not(.no-update) #mullvad-browser-intro {
  /* Invisible but still reserves space for when the page is initially loaded to
   * prevent the Mullvad title from jumping. */
  visibility: hidden;
}

#mullvad-browser-update-img {
  height: 1em;
  vertical-align: sub;
  margin-inline-end: 0.3em;
}

#mullvad-browser-update a {
  /* Increase gap between the link and the rest of the text. */
  margin-inline: 0.4em;
}

#footer {
  padding-block: 40px;
  background: rgba(0, 0, 0, 0.2);
Loading