Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  browser_cookie_sync_across_tabs.js

  Sprache: JAVA
 

/*
 * Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/
 */


"use strict";

add_task(async function () {
  info("Make sure cookie changes in one process are visible in the other");

  const kRoot = getRootDirectory(gTestPath).replace(
    "chrome://mochitests/content/",
    "https://example.com/"
  );
  const kTestPage = kRoot + "dummy.html";

  Services.cookies.removeAll();

  let tab1 = await BrowserTestUtils.openNewForegroundTab({
    gBrowser,
    url: kTestPage,
    forceNewProcess: true,
  });
  let tab2 = await BrowserTestUtils.openNewForegroundTab({
    gBrowser,
    url: kTestPage,
    forceNewProcess: true,
  });

  let browser1 = gBrowser.getBrowserForTab(tab1);
  let browser2 = gBrowser.getBrowserForTab(tab2);

  let pid1 = browser1.frameLoader.remoteTab.osPid;
  let pid2 = browser2.frameLoader.remoteTab.osPid;

  // Note, this might not be true once fission is implemented (Bug 1451850)
  Assert.notEqual(pid1, pid2, "We should have different processes here.");

  await SpecialPowers.spawn(browser1, [], async function () {
    is(content.document.cookie, """Expecting no cookies");
  });

  await SpecialPowers.spawn(browser2, [], async function () {
    is(content.document.cookie, """Expecting no cookies");
  });

  await SpecialPowers.spawn(browser1, [], async function () {
    content.document.cookie = "a1=test";
  });

  await SpecialPowers.spawn(browser2, [], async function () {
    is(content.document.cookie, "a1=test""Cookie should be set");
    content.document.cookie = "a1=other_test";
  });

  await SpecialPowers.spawn(browser1, [], async function () {
    is(content.document.cookie, "a1=other_test""Cookie should be set");
    content.document.cookie = "a2=again";
  });

  await SpecialPowers.spawn(browser2, [], async function () {
    is(
      content.document.cookie,
      "a1=other_test; a2=again",
      "Cookie should be set"
    );
    content.document.cookie = "a1=; expires=Thu, 01-Jan-1970 00:00:01 GMT;";
    content.document.cookie = "a2=; expires=Thu, 01-Jan-1970 00:00:01 GMT;";
  });

  await SpecialPowers.spawn(browser1, [], async function () {
    is(content.document.cookie, """Cookies should be cleared");
  });

  BrowserTestUtils.removeTab(tab1);
  BrowserTestUtils.removeTab(tab2);

  ok(true"Got to the end of the test!");
});

Messung V0.5 in Prozent
C=95 H=95 G=94

¤ Dauer der Verarbeitung: 0.16 Sekunden  (vorverarbeitet am  2026-06-05) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik