tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_fluent.js (1116B)


      1 function whenMainPaneLoadedFinished() {
      2  return new Promise(function (resolve) {
      3    const topic = "main-pane-loaded";
      4    Services.obs.addObserver(function observer() {
      5      Services.obs.removeObserver(observer, topic);
      6      resolve();
      7    }, topic);
      8  });
      9 }
     10 
     11 // Temporary test for an experimental new localization API.
     12 // See bug 1402069 for details.
     13 add_task(async function () {
     14  // The string is used only when `browserTabsRemoteAutostart` is true
     15  if (!Services.appinfo.browserTabsRemoteAutostart) {
     16    ok(true, "fake test to avoid harness complaining");
     17    return;
     18  }
     19 
     20  await Promise.all([
     21    openPreferencesViaOpenPreferencesAPI("general", { leaveOpen: true }),
     22    whenMainPaneLoadedFinished(),
     23  ]);
     24 
     25  let doc = gBrowser.contentDocument;
     26  await doc.l10n.ready;
     27 
     28  let [msg] = await doc.l10n.formatMessages([{ id: "category-general" }]);
     29 
     30  let elem = doc.querySelector(`#category-general`);
     31 
     32  Assert.deepEqual(msg, {
     33    value: null,
     34    attributes: [
     35      { name: "tooltiptext", value: elem.getAttribute("tooltiptext") },
     36    ],
     37  });
     38 
     39  BrowserTestUtils.removeTab(gBrowser.selectedTab);
     40 });