зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1631957 - Clear the about:home cache on locale change. r=k88hudson
Differential Revision: https://phabricator.services.mozilla.com/D72490
This commit is contained in:
Родитель
f7c0240b75
Коммит
bd45126cc1
|
@ -5003,6 +5003,7 @@ var AboutHomeStartupCache = {
|
||||||
Services.obs.addObserver(this, "ipc:content-created");
|
Services.obs.addObserver(this, "ipc:content-created");
|
||||||
Services.obs.addObserver(this, "process-type-set");
|
Services.obs.addObserver(this, "process-type-set");
|
||||||
Services.obs.addObserver(this, "ipc:content-shutdown");
|
Services.obs.addObserver(this, "ipc:content-shutdown");
|
||||||
|
Services.obs.addObserver(this, "intl:app-locales-changed");
|
||||||
|
|
||||||
this._cacheEntryPromise = new Promise(resolve => {
|
this._cacheEntryPromise = new Promise(resolve => {
|
||||||
this._cacheEntryResolver = resolve;
|
this._cacheEntryResolver = resolve;
|
||||||
|
@ -5046,6 +5047,7 @@ var AboutHomeStartupCache = {
|
||||||
Services.obs.removeObserver(this, "ipc:content-created");
|
Services.obs.removeObserver(this, "ipc:content-created");
|
||||||
Services.obs.removeObserver(this, "process-type-set");
|
Services.obs.removeObserver(this, "process-type-set");
|
||||||
Services.obs.removeObserver(this, "ipc:content-shutdown");
|
Services.obs.removeObserver(this, "ipc:content-shutdown");
|
||||||
|
Services.obs.removeObserver(this, "intl:app-locales-changed");
|
||||||
|
|
||||||
if (this._cacheTask) {
|
if (this._cacheTask) {
|
||||||
this._cacheTask.disarm();
|
this._cacheTask.disarm();
|
||||||
|
@ -5554,6 +5556,10 @@ var AboutHomeStartupCache = {
|
||||||
|
|
||||||
observe(aSubject, aTopic, aData) {
|
observe(aSubject, aTopic, aData) {
|
||||||
switch (aTopic) {
|
switch (aTopic) {
|
||||||
|
case "intl:app-locales-changed": {
|
||||||
|
this.clearCache();
|
||||||
|
break;
|
||||||
|
}
|
||||||
case "process-type-set":
|
case "process-type-set":
|
||||||
// Intentional fall-through
|
// Intentional fall-through
|
||||||
case "ipc:content-created": {
|
case "ipc:content-created": {
|
||||||
|
|
|
@ -14,6 +14,7 @@ prefs =
|
||||||
|
|
||||||
[browser_basic_endtoend.js]
|
[browser_basic_endtoend.js]
|
||||||
[browser_bump_version.js]
|
[browser_bump_version.js]
|
||||||
|
[browser_locale_change.js]
|
||||||
[browser_no_cache.js]
|
[browser_no_cache.js]
|
||||||
[browser_overwrite_cache.js]
|
[browser_overwrite_cache.js]
|
||||||
[browser_process_crash.js]
|
[browser_process_crash.js]
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests that the about:home startup cache is cleared if the app
|
||||||
|
* locale changes.
|
||||||
|
*/
|
||||||
|
add_task(async function test_locale_change() {
|
||||||
|
await BrowserTestUtils.withNewTab("about:home", async browser => {
|
||||||
|
await simulateRestart(browser);
|
||||||
|
await ensureCachedAboutHome(browser);
|
||||||
|
|
||||||
|
Services.obs.notifyObservers(null, "intl:app-locales-changed");
|
||||||
|
|
||||||
|
await simulateRestart(browser, false);
|
||||||
|
await ensureDynamicAboutHome(browser);
|
||||||
|
});
|
||||||
|
});
|
Загрузка…
Ссылка в новой задаче