File: no-vary-search.tentative.any.js

package info (click to toggle)
thunderbird 1%3A140.4.0esr-1~deb13u1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 4,609,412 kB
  • sloc: cpp: 7,672,442; javascript: 5,901,613; ansic: 3,898,954; python: 1,413,343; xml: 653,997; asm: 462,286; java: 180,927; sh: 113,489; makefile: 20,460; perl: 14,288; objc: 13,059; yacc: 4,583; pascal: 3,352; lex: 1,720; ruby: 1,222; exp: 762; sql: 715; awk: 580; php: 436; lisp: 430; sed: 70; csh: 10
file content (91 lines) | stat: -rw-r--r-- 2,593 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// META: global=window,worker
// META: title=NoVarySearch HTTP Cache
// META: timeout=long
// META: script=/common/utils.js
// META: script=/common/get-host-info.sub.js
// META: script=http-cache.js
/*
NOTE for testing No-Vary-Search-Header:
- If `params` is set to true, `expect=("dispatch" "uuid")` must be specified.
  Otherwise:
  - The same HTTP Cache will be used by other tests, which are supposed
    to be distinguished by uuid.
  - The test utility cannot get the server's states because UA will use the HTTP
    Cache instead of sending a new request to server to ask for the latest state.
- Do not test not_cached cases and cached cases within one test. Test infra
  checks the number of requests and responses without considering if the
  previous responses should be served from cache or not.
*/
var tests = [
  {
    name: "When params is set to true, URL differs only by their parameters (other than `dispatch` and `uuid`) should not be cached as different entries.",
    requests: [
      {
        url_params: "a=1&b=2",
        response_headers: [
          ["Cache-Control", "max-age=10000"],
          ["No-Vary-Search", "params, except=(\"dispatch\" \"uuid\")"],
        ],
      },
      {
        expected_type: "cached"
      }
    ]
  },
  {
    name: "Ground truth: When key-order is not set, URLs should be compared in an order-sensitive way.",
    requests: [
      {
        url_params: "a=1&b=2",
        response_headers: [
          ["Cache-Control", "max-age=10000"],
        ],
      },
      {
        url_params: "b=2&a=1",
        expected_type: "not_cached"
      }
    ]
  },
  {
    name: "When key-order is set , URLs should be compared in an order-insensitive way. Matched cases:",
    requests: [
      {
        url_params: "a=1&b=2",
        response_headers: [
          ["Cache-Control", "max-age=10000"],
          ["No-Vary-Search", "key-order"],
        ],
      },
      {
        url_params: "b=2&a=1",
        expected_type: "cached"
      }
    ]
  },
  {
    name: "When key-order is set , URLs should be compared in an order-insensitive way. Not matched cases",
    requests: [
      {
        url_params: "a=1&b=2",
        response_headers: [
          ["Cache-Control", "max-age=10000"],
          ["No-Vary-Search", "key-order"],
        ],
      },
      {
        url_params: "b=2",
        expected_type: "not_cached"
      },
      {
        url_params: "a=2&b=2",
        expected_type: "not_cached"
      },
      {
        url_params: "a=1&b=2&c=3",
        expected_type: "not_cached"
      }
    ]
  }
];
run_tests(tests);