tor-browser

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

browser_caching_innerHTML.js (1283B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 /**
      8 * Test caching of innerHTML on math elements for Windows clients.
      9 */
     10 addAccessibleTask(
     11  `
     12 <p id="p">test</p>
     13 <math id="math"><mfrac><mi>x</mi><mi>y</mi></mfrac></math>
     14  `,
     15  async function (browser, docAcc) {
     16    const p = findAccessibleChildByID(docAcc, "p");
     17    let hasHtml;
     18    try {
     19      p.cache.getStringProperty("html");
     20      hasHtml = true;
     21    } catch (e) {
     22      hasHtml = false;
     23    }
     24    ok(!hasHtml, "p doesn't have cached html");
     25 
     26    const math = findAccessibleChildByID(docAcc, "math");
     27    is(
     28      math.cache.getStringProperty("html"),
     29      "<mfrac><mi>x</mi><mi>y</mi></mfrac>",
     30      "math cached html is correct"
     31    );
     32 
     33    info("Mutating math");
     34    await invokeContentTask(browser, [], () => {
     35      content.document.querySelectorAll("mi")[1].textContent = "z";
     36    });
     37    await untilCacheIs(
     38      () => math.cache.getStringProperty("html"),
     39      "<mfrac><mi>x</mi><mi>z</mi></mfrac>",
     40      "math cached html is correct after mutation"
     41    );
     42  },
     43  {
     44    topLevel: true,
     45    iframe: true,
     46    remoteIframe: true,
     47  }
     48 );