tor-browser

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

browser_elementindtd.js (899B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * https://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 /*
      7 * Test for bug 1539759
      8 * Loads a chrome XML document that has an exteernal DTD file with an entity
      9 * that contains an element, and verifies that that element was not inserted
     10 * into the document (but its content was).
     11 */
     12 
     13 add_task(async function test() {
     14  await BrowserTestUtils.withNewTab(
     15    getRootDirectory(gTestPath) + "browser_elementindtd.xml",
     16    async function (newBrowser) {
     17      // NB: We load the chrome:// page in the parent process.
     18      testNoElementFromEntity(newBrowser);
     19    }
     20  );
     21 });
     22 
     23 function testNoElementFromEntity(newBrowser) {
     24  let doc = newBrowser.contentDocument;
     25  is(doc.body.textContent, "From dtd", "Should load DTD.");
     26  is(
     27    doc.body.firstElementChild,
     28    null,
     29    "Shouldn't have an element inserted from the DTD"
     30  );
     31 }