tor-browser

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

browser_ManifestObtainer_credentials.js (1725B)


      1 "use strict";
      2 
      3 Services.prefs.setBoolPref("dom.manifest.enabled", true);
      4 
      5 const { ManifestObtainer } = ChromeUtils.importESModule(
      6  "resource://gre/modules/ManifestObtainer.sys.mjs"
      7 );
      8 
      9 // Don't send cookies
     10 add_task(async function () {
     11  const testPath = "/browser/dom/manifest/test/cookie_setter.html";
     12  const tabURL = `https://example.com${testPath}`;
     13  const browser = BrowserTestUtils.addTab(gBrowser, tabURL).linkedBrowser;
     14  await BrowserTestUtils.browserLoaded(browser);
     15  const { short_name } = await ManifestObtainer.browserObtainManifest(browser);
     16  is(short_name, "no cookie");
     17  const tab = gBrowser.getTabForBrowser(browser);
     18  gBrowser.removeTab(tab);
     19 });
     20 
     21 // Send cookies
     22 add_task(async function () {
     23  const testPath =
     24    "/browser/dom/manifest/test/cookie_setter_with_credentials.html";
     25  const tabURL = `https://example.com${testPath}`;
     26  const browser = BrowserTestUtils.addTab(gBrowser, tabURL).linkedBrowser;
     27  await BrowserTestUtils.browserLoaded(browser);
     28  const { short_name } = await ManifestObtainer.browserObtainManifest(browser);
     29  is(short_name, "🍪");
     30  const tab = gBrowser.getTabForBrowser(browser);
     31  gBrowser.removeTab(tab);
     32 });
     33 
     34 // Cross origin - we go from example.com to example.org
     35 add_task(async function () {
     36  const testPath =
     37    "/browser/dom/manifest/test/cookie_setter_with_credentials_cross_origin.html";
     38  const tabURL = `https://example.com${testPath}`;
     39  const browser = BrowserTestUtils.addTab(gBrowser, tabURL).linkedBrowser;
     40  await BrowserTestUtils.browserLoaded(browser);
     41  const { short_name } = await ManifestObtainer.browserObtainManifest(browser);
     42  is(short_name, "no cookie");
     43  const tab = gBrowser.getTabForBrowser(browser);
     44  gBrowser.removeTab(tab);
     45 });