Bug 1300735 - Flush cached locale strings when l10n SDK module is loaded. r=zer0
authorWladimir Palant <trev.moz@adblockplus.org>
Wed, 07 Sep 2016 16:46:04 +0200
changeset 313445 142fd07295b031014a9a221c08d34dbd4809a446
parent 313444 4c66e0814004e1226362e63581d10c941961cc4c
child 313446 924be2624797eb7a3db7ad3532e389a0a6964cb8
push id30685
push userphilringnalda@gmail.com
push dateSun, 11 Sep 2016 05:38:20 +0000
treeherdermozilla-central@7e873393cc11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerszer0
bugs1300735
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1300735 - Flush cached locale strings when l10n SDK module is loaded. r=zer0 MozReview-Commit-ID: HAOc29ebXsR
addon-sdk/source/lib/sdk/l10n/properties/core.js
--- a/addon-sdk/source/lib/sdk/l10n/properties/core.js
+++ b/addon-sdk/source/lib/sdk/l10n/properties/core.js
@@ -8,16 +8,20 @@ const { newURI } = require('../../url/ut
 const { getRulesForLocale } = require("../plural-rules");
 const { getPreferedLocales } = require('../locale');
 const { rootURI } = require("@loader/options");
 const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
 
 const baseURI = rootURI + "locale/";
 const preferedLocales = getPreferedLocales(true);
 
+// Make sure we don't get stale data after an update
+// (See Bug 1300735 for rationale).
+Services.strings.flushBundles();
+
 function getLocaleURL(locale) {
   // if the locale is a valid chrome URI, return it
   try {
     let uri = newURI(locale);
     if (uri.scheme == 'chrome')
       return uri.spec;
   }
   catch(_) {}