Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/Firefox/dom/base/test/unit/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  test_xhr_origin_attributes.js   Sprache: JAVA

 
let server = new HttpServer();
server.start(-1);

let body =
  "";

function handler(request, response) {
  response.setStatusLine(request.httpVersion, 200, "Ok");
  response.setHeader("Content-Type""text/html"false);

  if (!request.hasHeader("Cookie")) {
    response.setHeader("Set-Cookie""test"false);
    ok(true);
  } else {
    ok(false);
  }

  response.bodyOutputStream.write(body, body.length);
}

function run_test() {
  do_test_pending();
  server.registerPathHandler("/foo", handler);

  let xhr = new XMLHttpRequest();
  xhr.open(
    "GET",
    "http://localhost:" + server.identity.primaryPort + "/foo",
    true
  );
  xhr.send(null);

  xhr.onload = function () {
    // We create another XHR to connect to the same site, but this time we
    // specify with different origin attributes, which will make the XHR use a
    // different cookie-jar than the previous one.
    let xhr2 = new XMLHttpRequest();
    xhr2.open(
      "GET",
      "http://localhost:" + server.identity.primaryPort + "/foo",
      true
    );
    xhr2.setOriginAttributes({ userContextId: 1 });
    xhr2.send(null);

    let loadInfo = xhr2.channel.loadInfo;
    Assert.equal(loadInfo.originAttributes.userContextId, 1);

    xhr2.onload = function () {
      server.stop(do_test_finished);
    };
  };
}

Messung V0.5
C=89 H=100 G=94

¤ Dauer der Verarbeitung: 0.29 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

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.