Skip to content

Commit

Permalink
Direct Beta/Dev/Nightly downloads on old OS versions to ESR (Issue mo…
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgibson committed Jun 29, 2023
1 parent a014c6f commit e6c9ee2
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 13 deletions.
30 changes: 30 additions & 0 deletions bedrock/firefox/templates/firefox/channel/desktop.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@
class='mzp-t-product-beta mzp-t-firefox') %}

{{ download_firefox('beta', platform='desktop', force_direct=True, force_full_installer=True, alt_copy=ftl('download-button-download'), dom_id="desktop-beta-download") }}

<div class="fx-unsupported-message win" data-nosnippet="true">
<p><strong>{{ ftl('download-button-unsupported-platform', channel_name='Firefox Beta', os_version='Windows 8.1') }}</strong></p>
<p>{{ ftl('download-button-please-download-esr', url=url('firefox.enterprise.index')) }}</p>
</div>

<div class="fx-unsupported-message mac" data-nosnippet="true">
<p><strong>{{ ftl('download-button-unsupported-platform', channel_name='Firefox Beta', os_version='macOS 10.14') }}</strong></p>
<p>{{ ftl('download-button-please-download-esr', url=url('firefox.enterprise.index')) }}</p>
</div>
{% endcall %}

<div class="l-notes mzp-l-content">
Expand Down Expand Up @@ -56,6 +66,16 @@
class='mzp-t-product-developer mzp-t-firefox') %}

{{ download_firefox('alpha', platform='desktop', force_direct=True, alt_copy=ftl('download-button-download'), dom_id="desktop-developer-download") }}

<div class="fx-unsupported-message win" data-nosnippet="true">
<p><strong>{{ ftl('download-button-unsupported-platform', channel_name='Firefox Developer Edition', os_version='Windows 8.1') }}</strong></p>
<p>{{ ftl('download-button-please-download-esr', url=url('firefox.enterprise.index')) }}</p>
</div>

<div class="fx-unsupported-message mac" data-nosnippet="true">
<p><strong>{{ ftl('download-button-unsupported-platform', channel_name='Firefox Developer Edition', os_version='macOS 10.14') }}</strong></p>
<p>{{ ftl('download-button-please-download-esr', url=url('firefox.enterprise.index')) }}</p>
</div>
{% endcall %}

<div class="l-notes mzp-l-content">
Expand Down Expand Up @@ -86,6 +106,16 @@
class='mzp-t-product-nightly mzp-t-firefox') %}

{{ download_firefox('nightly', platform='desktop', force_direct=True, alt_copy=ftl('download-button-download'), dom_id="desktop-nightly-download") }}

<div class="fx-unsupported-message win" data-nosnippet="true">
<p><strong>{{ ftl('download-button-unsupported-platform', channel_name='Firefox Nightly', os_version='Windows 8.1') }}</strong></p>
<p>{{ ftl('download-button-please-download-esr', url=url('firefox.enterprise.index')) }}</p>
</div>

<div class="fx-unsupported-message mac" data-nosnippet="true">
<p><strong>{{ ftl('download-button-unsupported-platform', channel_name='Firefox Nightly', os_version='macOS 10.14') }}</strong></p>
<p>{{ ftl('download-button-please-download-esr', url=url('firefox.enterprise.index')) }}</p>
</div>
{% endcall %}

<div class="l-notes mzp-l-content">
Expand Down
9 changes: 9 additions & 0 deletions l10n/en/download_button.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,12 @@ download-button-firefox-ios = <span>{ -brand-name-firefox }</span> for { -brand-
download-button-firefox-privacy = { -brand-name-firefox } Privacy
download-button-firefox-privacy-notice = { -brand-name-firefox } Privacy Notice
download-button-download = Download
# Variables:
# $channel_name (string) - e.g. Firefox Beta, Firefox Nightly
# $os_version (string) - e.g. Windows 8.1, macOS 10.14
download-button-unsupported-platform = Note: { $channel_name } is no longer supported on { $os_version } and below.
# Variables:
# $url (url) - link to https://www.mozilla.org/firefox/enterprise/
download-button-please-download-esr = Please download <a href="{ $url }">{ -brand-name-firefox-esr } (Extended Support Release)</a> to use { -brand-name-firefox }.
17 changes: 17 additions & 0 deletions media/css/protocol/components/_download-button-ie.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,21 @@ ul.download-list {
.download-button .download-list .os_win {
display: block !important;
}

// Hide pre-release Firefox download buttons on unsupported
// operating system versions (issue #13317)
.download-button-beta,
.download-button-alpha,
.download-button-nightly {
display: none !important;
}

.fx-unsupported-message {
display: none !important;
}

.fx-unsupported-message.win {
display: block !important;
}

/* stylelint-enable */
20 changes: 20 additions & 0 deletions media/css/protocol/components/_download-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,26 @@ ul.download-list {
display: block !important;
}

// Hide pre-release Firefox download buttons on unsupported
// operating system versions (issue #13317)
.windows.fx-unsupported .download-button-beta,
.windows.fx-unsupported .download-button-alpha,
.windows.fx-unsupported .download-button-nightly,
.osx.fx-unsupported .download-button-beta,
.osx.fx-unsupported .download-button-alpha,
.osx.fx-unsupported .download-button-nightly {
display: none !important;
}

.fx-unsupported-message {
display: none !important;
}

.windows.fx-unsupported .fx-unsupported-message.win,
.osx.fx-unsupported .fx-unsupported-message.mac {
display: block !important;
}

.android .download-button-desktop,
.ios .download-button-desktop,
.no-js .download-button {
Expand Down
23 changes: 19 additions & 4 deletions media/js/base/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
return '10.0.0';
} else {
// Might be any Windows version less than 10, who knows.
return undefined;
// Rather than return undefined here, fallback to UA string.
return site.getPlatformVersion();
}
},

Expand Down Expand Up @@ -145,21 +146,35 @@

function updateHTML() {
var h = document.documentElement;
var _version = window.site.platformVersion
? parseFloat(window.site.platformVersion)
: 0;

if (window.site.platform === 'windows') {
// Detect Windows 10 "and up" to display installation
// messaging on the /firefox/download/thanks/ page.
var _version = window.site.platformVersion
? parseFloat(window.site.platformVersion)
: 0;

if (_version >= 10.0) {
h.className += ' windows-10-plus';
}

// Add fx-unsupported class name for Windows 8.1 and below
// https://github.com/mozilla/bedrock/issues/13317
if (_version <= 6.3) {
h.className += ' fx-unsupported';
}
} else {
h.className = h.className.replace('windows', window.site.platform);
}

if (window.site.platform === 'osx') {
// Add fx-unsupported class name for macOS 10.14 and below
// https://github.com/mozilla/bedrock/issues/13317
if (_version <= 10.14) {
h.className += ' fx-unsupported';
}
}

// Used to display a custom installation message and
// SUMO link on the /firefox/download/thanks/ page.
if (window.site.isARM()) {
Expand Down
16 changes: 7 additions & 9 deletions tests/unit/spec/base/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,17 +400,15 @@ describe('site.js', function () {
expect(window.site.getWindowsVersionClientHint(12)).toBe('10.0.0');
});

it('should return undefined for unknown Windows versions', function () {
it('should return fallback to using UA string for unknown Windows versions', function () {
spyOn(window.site, 'getPlatformVersion').and.returnValue('8.1');

expect(window.site.getWindowsVersionClientHint('0.0.0')).toBe(
undefined
);
expect(window.site.getWindowsVersionClientHint(0.0)).toBe(
undefined
);
expect(window.site.getWindowsVersionClientHint('0')).toBe(
undefined
'8.1'
);
expect(window.site.getWindowsVersionClientHint('')).toBe(undefined);
expect(window.site.getWindowsVersionClientHint(0.0)).toBe('8.1');
expect(window.site.getWindowsVersionClientHint('0')).toBe('8.1');
expect(window.site.getWindowsVersionClientHint('')).toBe('8.1');
});
});

Expand Down

0 comments on commit e6c9ee2

Please sign in to comment.