tor-browser

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

browser_dbg-wrong-fetch.js (1016B)


      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 // Test that incorrect source contents are not shown if the server refetches
      6 // different HTML when attaching to an open page.
      7 
      8 "use strict";
      9 
     10 add_task(async function () {
     11  await addTab(`${EXAMPLE_URL}different_html.sjs`);
     12 
     13  // This goop is here to manually clear the HTTP cache because setting response
     14  // headers in different_html.sjs to not cache the response doesn't work.
     15  Services.cache2.clear();
     16 
     17  const toolbox = await openToolboxForTab(gBrowser.selectedTab, "jsdebugger");
     18  const dbg = createDebuggerContext(toolbox);
     19  await selectSource(dbg, "different_html.sjs");
     20  await waitForLoadedSource(dbg, "different_html.sjs");
     21  const contents = findSourceContent(dbg, "different_html.sjs");
     22 
     23  ok(
     24    contents.value.includes("Incorrect contents fetched"),
     25    "Error message is shown"
     26  );
     27 });