tor-browser

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

browser_styleeditor_bom.js (941B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 const BOM_CSS = TEST_BASE_HTTPS + "utf-16.css";
      7 const DOCUMENT =
      8  "data:text/html;charset=UTF-8," +
      9  encodeURIComponent(
     10    [
     11      "<!DOCTYPE html>",
     12      "<html>",
     13      " <head>",
     14      "  <title>Bug 1301854</title>",
     15      '  <link rel="stylesheet" type="text/css" href="' + BOM_CSS + '">',
     16      " </head>",
     17      " <body>",
     18      " </body>",
     19      "</html>",
     20    ].join("\n")
     21  );
     22 
     23 const CONTENTS =
     24  "// Note that this file must be utf-16 with a " +
     25  "BOM for the test to make sense.\n";
     26 
     27 add_task(async function () {
     28  const { ui } = await openStyleEditorForURL(DOCUMENT);
     29 
     30  is(ui.editors.length, 1, "correct number of editors");
     31 
     32  const editor = ui.editors[0];
     33  await editor.getSourceEditor();
     34 
     35  const text = editor.sourceEditor.getText();
     36  is(text, CONTENTS, "editor contains expected text");
     37 });