зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1438055 - Switch Fluent Localization class to use weak observers. r=mossop
MozReview-Commit-ID: 4R8OyziLRUo --HG-- extra : rebase_source : 8a26c97c30e46af0a5f77060066046cd91ccb64c
This commit is contained in:
Родитель
b5f314390e
Коммит
168adb6f0b
|
@ -21,6 +21,7 @@
|
||||||
/* eslint no-console: ["error", { allow: ["warn", "error"] }] */
|
/* eslint no-console: ["error", { allow: ["warn", "error"] }] */
|
||||||
/* global console */
|
/* global console */
|
||||||
|
|
||||||
|
const { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm", {});
|
||||||
const { L10nRegistry } = ChromeUtils.import("resource://gre/modules/L10nRegistry.jsm", {});
|
const { L10nRegistry } = ChromeUtils.import("resource://gre/modules/L10nRegistry.jsm", {});
|
||||||
const LocaleService = Cc["@mozilla.org/intl/localeservice;1"].getService(Ci.mozILocaleService);
|
const LocaleService = Cc["@mozilla.org/intl/localeservice;1"].getService(Ci.mozILocaleService);
|
||||||
const ObserverService = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
|
const ObserverService = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
|
||||||
|
@ -254,11 +255,11 @@ class Localization {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register observers on events that will trigger cache invalidation
|
* Register weak observers on events that will trigger cache invalidation
|
||||||
*/
|
*/
|
||||||
registerObservers() {
|
registerObservers() {
|
||||||
ObserverService.addObserver(this, 'l10n:available-locales-changed', false);
|
ObserverService.addObserver(this, 'l10n:available-locales-changed', true);
|
||||||
ObserverService.addObserver(this, 'intl:requested-locales-changed', false);
|
ObserverService.addObserver(this, 'intl:requested-locales-changed', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -296,6 +297,10 @@ class Localization {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Localization.prototype.QueryInterface = XPCOMUtils.generateQI([
|
||||||
|
Ci.nsISupportsWeakReference
|
||||||
|
]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format the value of a message into a string.
|
* Format the value of a message into a string.
|
||||||
*
|
*
|
||||||
|
|
Загрузка…
Ссылка в новой задаче