Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/testing/web-platform/tests/cookies/path/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 3 kB image not shown  

Quelle  match.html   Sprache: HTML

 
 products/Sources/formale Sprachen/C/Firefox/testing/web-platform/tests/cookies/path/match.html


<!doctype html>
<html>
<head>
  <meta charset=utf-8>
  <title>tests for matching cookie paths</title>
  <meta name="timeout" content="long">
  <meta name=help href="http://tools.ietf.org/html/rfc6265#section-5.1.4">

  <script src="/resources/testharness.js"></script>
  <script src="/resources/testharnessreport.js"></script>
  <script src="/resources/testdriver.js"></script>
  <script src="/resources/testdriver-vendor.js"></script>
  <script src="/cookies/resources/testharness-helpers.js"></script>
</head>
<body>
<div id=log></div>

<script>
var body = document.getElementsByTagName('body')[0];
var createIframeThen = function (callback) {
  var iframe = document.createElement('iframe');
  iframe.src = "/cookies/resources/echo-cookie.html";
  body.appendChild(iframe);
  iframe.onload = callback;
  return iframe;
};
var testCookiePathFromDOM = function (testCase, test) {
  var iframe = createIframeThen(test.step_func(function () {
    iframe.contentWindow.setCookie('dom-' + testCase.name, testCase.path);
    var cookieSet = iframe.contentWindow.isCookieSet('dom-' + testCase.name, testCase.path);
    if (testCase.match === false) {
      assert_equals(cookieSet, null);
    } else {
      assert_not_equals(cookieSet, null, "Cookie path from DOM should not be `null`");
    }
    iframe.contentWindow.expireCookies().then(() => test.done());
  }));
};
var testCookiePathFromHeader = function (testCase, test) {
  var iframe = createIframeThen(test.step_func(function () {
    iframe.contentWindow.fetchCookieThen('header-' + testCase.name, testCase.path).then(test.step_func(function (response) {
      assert_true(response.ok);
      var cookieSet = iframe.contentWindow.isCookieSet('header-' + testCase.name, testCase.path);
      iframe.contentWindow.expireCookies().then(test.step_func(function () {
        if (testCase.match === false) {
          assert_equals(cookieSet, null);
        } else {
          assert_not_equals(cookieSet, null, "Cookie path from header should not be `null`");
        }
        test.done();
      }));
    })).catch(test.unreached_func());
  }));
};

var tests = [{
  "name""match-slash",
  "path""/",
}, {
  "name""match-page",
  "path""match.html",
}, {
  "name""match-prefix",
  "path""cookies",
}, {
  "name""match-slash-prefix",
  "path""/cookies",
}, {
  "name""match-slash-prefix-slash",
  "path""/cookies/",
}, {
  "name""match-exact-page",
  "path""/cookies/resources/echo-cookie.html",
}, {
  "name""no-match",
  "path""/cook",
  "match": false
}, {
  "name""no-match-subpath",
  "path""/w/",
  "match": false
}];

var domTests = tests.map(function (testCase) {
  var testName = "`document.cookie` on /cookies/resources/echo-cookie.html sets cookie with path: " + testCase.path;
  if (testCase.match === false) {
    testName = "`document.cookie` on /cookies/resources/echo-cookie.html DOES NOT set cookie for path: " + testCase.path;
  }
  return [
    testName,
    function () {
      testCookiePathFromDOM(testCase, this);
    }
  ];
});

var headerTests = tests.map(function (testCase) {
  var testName = "`Set-Cookie` on /cookies/resources/echo-cookie.html sets cookie with path: " + testCase.path;
  if (testCase.match === false) {
    testName = "`Set-Cookie` on /cookies/resources/echo-cookie.html DOES NOT set cookie for path: " + testCase.path;
  }
  return [
    testName,
    function () {
      testCookiePathFromHeader(testCase, this);
    }
  ];
});

executeTestsSerially(domTests.concat(headerTests));
</script>
</body>
</html>

Messung V0.5
C=80 H=100 G=90

¤ Dauer der Verarbeitung: 0.37 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.