morgan pushed to branch tor-browser-128.2.0esr-14.0-1 at The Tor Project / Applications / Tor Browser
Commits:
-
22170540
by Henry Wilkes at 2024-09-11T02:09:21+00:00
5 changed files:
- browser/components/BrowserGlue.sys.mjs
- browser/components/abouttor/AboutTorChild.sys.mjs
- browser/components/abouttor/content/aboutTor.css
- browser/components/abouttor/content/aboutTor.html
- browser/components/abouttor/content/aboutTor.js
Changes:
... | ... | @@ -513,6 +513,7 @@ let JSWINDOWACTORS = { |
513 | 513 | |
514 | 514 | events: {
|
515 | 515 | DOMContentLoaded: {},
|
516 | + L10nMutationsFinished: {},
|
|
516 | 517 | SubmitSearchOnionize: { wantUntrusted: true },
|
517 | 518 | },
|
518 | 519 | },
|
... | ... | @@ -16,6 +16,12 @@ export class AboutTorChild extends JSWindowActorChild { |
16 | 16 | case "SubmitSearchOnionize":
|
17 | 17 | this.sendAsyncMessage("AboutTor:SetSearchOnionize", !!event.detail);
|
18 | 18 | break;
|
19 | + case "L10nMutationsFinished":
|
|
20 | + // Pass on chrome-only event for completed localization to content.
|
|
21 | + this.contentWindow.dispatchEvent(
|
|
22 | + new this.contentWindow.CustomEvent("L10nMutationsFinished")
|
|
23 | + );
|
|
24 | + break;
|
|
19 | 25 | }
|
20 | 26 | }
|
21 | 27 | } |
... | ... | @@ -29,6 +29,13 @@ body { |
29 | 29 | repeat-x;
|
30 | 30 | }
|
31 | 31 | |
32 | +body:not(.initialized) {
|
|
33 | + /* Hide the components before the page is initialized.
|
|
34 | + * NOTE: The layout can still be adjusted or measured in this time since we
|
|
35 | + * use visibility rather than `display: none`. */
|
|
36 | + visibility: hidden;
|
|
37 | +}
|
|
38 | + |
|
32 | 39 | h1 {
|
33 | 40 | grid-area: heading;
|
34 | 41 | display: flex;
|
... | ... | @@ -45,6 +52,14 @@ h1 { |
45 | 52 | flex: 0 0 auto;
|
46 | 53 | }
|
47 | 54 | |
55 | +body.is-testing #tor-browser-home-heading-stable {
|
|
56 | + display: none;
|
|
57 | +}
|
|
58 | + |
|
59 | +body:not(.is-testing) #tor-browser-home-heading-testing {
|
|
60 | + display: none;
|
|
61 | +}
|
|
62 | + |
|
48 | 63 | #tor-check {
|
49 | 64 | grid-area: tor-check;
|
50 | 65 | max-width: var(--form-max-width);
|
... | ... | @@ -35,7 +35,14 @@ |
35 | 35 | alt=""
|
36 | 36 | src="chrome://branding/content/about-logo.svg"
|
37 | 37 | />
|
38 | - <span id="tor-browser-home-heading-text"></span>
|
|
38 | + <span
|
|
39 | + id="tor-browser-home-heading-stable"
|
|
40 | + data-l10n-id="tor-browser-home-heading-stable"
|
|
41 | + ></span>
|
|
42 | + <span
|
|
43 | + id="tor-browser-home-heading-testing"
|
|
44 | + data-l10n-id="tor-browser-home-heading-testing"
|
|
45 | + ></span>
|
|
39 | 46 | </h1>
|
40 | 47 | <p id="tor-check">
|
41 | 48 | <img
|
... | ... | @@ -137,12 +137,7 @@ const MessageArea = { |
137 | 137 | }
|
138 | 138 | |
139 | 139 | // Set heading.
|
140 | - document.l10n.setAttributes(
|
|
141 | - document.getElementById("tor-browser-home-heading-text"),
|
|
142 | - this._isStable
|
|
143 | - ? "tor-browser-home-heading-stable"
|
|
144 | - : "tor-browser-home-heading-testing"
|
|
145 | - );
|
|
140 | + document.body.classList.toggle("is-testing", !this._isStable);
|
|
146 | 141 | |
147 | 142 | document.body.classList.toggle("show-tor-check", !this._torConnectEnabled);
|
148 | 143 | |
... | ... | @@ -167,6 +162,20 @@ const MessageArea = { |
167 | 162 | "shown-message"
|
168 | 163 | );
|
169 | 164 | }
|
165 | + |
|
166 | + // In the case where we set the update message, we are still waiting for the
|
|
167 | + // l10n message to complete. We wait until then before showing the content.
|
|
168 | + if (document.hasPendingL10nMutations) {
|
|
169 | + window.addEventListener(
|
|
170 | + "L10nMutationsFinished",
|
|
171 | + () => {
|
|
172 | + document.body.classList.add("initialized");
|
|
173 | + },
|
|
174 | + { once: true }
|
|
175 | + );
|
|
176 | + } else {
|
|
177 | + document.body.classList.add("initialized");
|
|
178 | + }
|
|
170 | 179 | },
|
171 | 180 | };
|
172 | 181 |