tor-browser

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

element-area.https.sub.html (16384B)


      1 <!DOCTYPE html>
      2 <!--
      3 This test was procedurally generated. Please do not modify it directly.
      4 Sources:
      5 - fetch/metadata/tools/fetch-metadata.conf.yml
      6 - fetch/metadata/tools/templates/element-area.sub.html
      7 -->
      8 <html lang="en">
      9  <meta charset="utf-8">
     10  <meta name="timeout" content="long">
     11  <title>HTTP headers on request for HTML "area" element navigation</title>
     12  <script src="/resources/testharness.js"></script>
     13  <script src="/resources/testharnessreport.js"></script>
     14  <script src="/resources/testdriver.js"></script>
     15  <script src="/resources/testdriver-vendor.js"></script>
     16  <script src="/fetch/metadata/resources/helper.sub.js"></script>
     17  <body>
     18  <script>
     19  'use strict';
     20 
     21  function induceRequest(url, {test, userActivated, attributes}) {
     22    const win = window.open();
     23    const area = win.document.createElement('area');
     24    area.setAttribute('href', url);
     25 
     26    for (const [ name, value ] of Object.entries(attributes)) {
     27      area.setAttribute(name, value);
     28    }
     29 
     30    win.document.body.appendChild(area);
     31 
     32    test.add_cleanup(() => win.close());
     33 
     34    if (userActivated) {
     35      test_driver.bless('enable user activation', () => area.click());
     36    } else {
     37      area.click();
     38    }
     39  }
     40 
     41  promise_test((t) => {
     42    const key = '{{uuid()}}';
     43 
     44    induceRequest(
     45      makeRequestURL(key, ['httpsOrigin'], {mime: 'text/html'}),
     46      {
     47        test: t,
     48        userActivated: false,
     49        attributes: {}
     50      }
     51    );
     52 
     53    // `induceRequest` does not necessarily trigger a navigation, so the Python
     54    // handler must be polled until it has received the initial request.
     55    return retrieve(key, {poll: true})
     56      .then((headers) => {
     57          assert_own_property(headers, 'sec-fetch-site');
     58          assert_array_equals(headers['sec-fetch-site'], ['same-origin']);
     59        });
     60  }, 'sec-fetch-site - Same origin - no attributes');
     61 
     62  promise_test((t) => {
     63    const key = '{{uuid()}}';
     64 
     65    induceRequest(
     66      makeRequestURL(key, ['httpsCrossSite'], {mime: 'text/html'}),
     67      {
     68        test: t,
     69        userActivated: false,
     70        attributes: {}
     71      }
     72    );
     73 
     74    // `induceRequest` does not necessarily trigger a navigation, so the Python
     75    // handler must be polled until it has received the initial request.
     76    return retrieve(key, {poll: true})
     77      .then((headers) => {
     78          assert_own_property(headers, 'sec-fetch-site');
     79          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
     80        });
     81  }, 'sec-fetch-site - Cross-site - no attributes');
     82 
     83  promise_test((t) => {
     84    const key = '{{uuid()}}';
     85 
     86    induceRequest(
     87      makeRequestURL(key, ['httpsSameSite'], {mime: 'text/html'}),
     88      {
     89        test: t,
     90        userActivated: false,
     91        attributes: {}
     92      }
     93    );
     94 
     95    // `induceRequest` does not necessarily trigger a navigation, so the Python
     96    // handler must be polled until it has received the initial request.
     97    return retrieve(key, {poll: true})
     98      .then((headers) => {
     99          assert_own_property(headers, 'sec-fetch-site');
    100          assert_array_equals(headers['sec-fetch-site'], ['same-site']);
    101        });
    102  }, 'sec-fetch-site - Same site - no attributes');
    103 
    104  promise_test((t) => {
    105    const key = '{{uuid()}}';
    106 
    107    induceRequest(
    108      makeRequestURL(key, ['httpsOrigin', 'httpsCrossSite', 'httpsOrigin'], {mime: 'text/html'}),
    109      {
    110        test: t,
    111        userActivated: false,
    112        attributes: {}
    113      }
    114    );
    115 
    116    // `induceRequest` does not necessarily trigger a navigation, so the Python
    117    // handler must be polled until it has received the initial request.
    118    return retrieve(key, {poll: true})
    119      .then((headers) => {
    120          assert_own_property(headers, 'sec-fetch-site');
    121          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
    122        });
    123  }, 'sec-fetch-site - Same-Origin -> Cross-Site -> Same-Origin redirect - no attributes');
    124 
    125  promise_test((t) => {
    126    const key = '{{uuid()}}';
    127 
    128    induceRequest(
    129      makeRequestURL(key, ['httpsOrigin', 'httpsSameSite', 'httpsOrigin'], {mime: 'text/html'}),
    130      {
    131        test: t,
    132        userActivated: false,
    133        attributes: {}
    134      }
    135    );
    136 
    137    // `induceRequest` does not necessarily trigger a navigation, so the Python
    138    // handler must be polled until it has received the initial request.
    139    return retrieve(key, {poll: true})
    140      .then((headers) => {
    141          assert_own_property(headers, 'sec-fetch-site');
    142          assert_array_equals(headers['sec-fetch-site'], ['same-site']);
    143        });
    144  }, 'sec-fetch-site - Same-Origin -> Same-Site -> Same-Origin redirect - no attributes');
    145 
    146  promise_test((t) => {
    147    const key = '{{uuid()}}';
    148 
    149    induceRequest(
    150      makeRequestURL(key, ['httpsCrossSite', 'httpsOrigin'], {mime: 'text/html'}),
    151      {
    152        test: t,
    153        userActivated: false,
    154        attributes: {}
    155      }
    156    );
    157 
    158    // `induceRequest` does not necessarily trigger a navigation, so the Python
    159    // handler must be polled until it has received the initial request.
    160    return retrieve(key, {poll: true})
    161      .then((headers) => {
    162          assert_own_property(headers, 'sec-fetch-site');
    163          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
    164        });
    165  }, 'sec-fetch-site - Cross-Site -> Same Origin - no attributes');
    166 
    167  promise_test((t) => {
    168    const key = '{{uuid()}}';
    169 
    170    induceRequest(
    171      makeRequestURL(key, ['httpsCrossSite', 'httpsSameSite'], {mime: 'text/html'}),
    172      {
    173        test: t,
    174        userActivated: false,
    175        attributes: {}
    176      }
    177    );
    178 
    179    // `induceRequest` does not necessarily trigger a navigation, so the Python
    180    // handler must be polled until it has received the initial request.
    181    return retrieve(key, {poll: true})
    182      .then((headers) => {
    183          assert_own_property(headers, 'sec-fetch-site');
    184          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
    185        });
    186  }, 'sec-fetch-site - Cross-Site -> Same-Site - no attributes');
    187 
    188  promise_test((t) => {
    189    const key = '{{uuid()}}';
    190 
    191    induceRequest(
    192      makeRequestURL(key, ['httpsCrossSite', 'httpsCrossSite'], {mime: 'text/html'}),
    193      {
    194        test: t,
    195        userActivated: false,
    196        attributes: {}
    197      }
    198    );
    199 
    200    // `induceRequest` does not necessarily trigger a navigation, so the Python
    201    // handler must be polled until it has received the initial request.
    202    return retrieve(key, {poll: true})
    203      .then((headers) => {
    204          assert_own_property(headers, 'sec-fetch-site');
    205          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
    206        });
    207  }, 'sec-fetch-site - Cross-Site -> Cross-Site - no attributes');
    208 
    209  promise_test((t) => {
    210    const key = '{{uuid()}}';
    211 
    212    induceRequest(
    213      makeRequestURL(key, ['httpsOrigin', 'httpsOrigin'], {mime: 'text/html'}),
    214      {
    215        test: t,
    216        userActivated: false,
    217        attributes: {}
    218      }
    219    );
    220 
    221    // `induceRequest` does not necessarily trigger a navigation, so the Python
    222    // handler must be polled until it has received the initial request.
    223    return retrieve(key, {poll: true})
    224      .then((headers) => {
    225          assert_own_property(headers, 'sec-fetch-site');
    226          assert_array_equals(headers['sec-fetch-site'], ['same-origin']);
    227        });
    228  }, 'sec-fetch-site - Same-Origin -> Same Origin - no attributes');
    229 
    230  promise_test((t) => {
    231    const key = '{{uuid()}}';
    232 
    233    induceRequest(
    234      makeRequestURL(key, ['httpsOrigin', 'httpsSameSite'], {mime: 'text/html'}),
    235      {
    236        test: t,
    237        userActivated: false,
    238        attributes: {}
    239      }
    240    );
    241 
    242    // `induceRequest` does not necessarily trigger a navigation, so the Python
    243    // handler must be polled until it has received the initial request.
    244    return retrieve(key, {poll: true})
    245      .then((headers) => {
    246          assert_own_property(headers, 'sec-fetch-site');
    247          assert_array_equals(headers['sec-fetch-site'], ['same-site']);
    248        });
    249  }, 'sec-fetch-site - Same-Origin -> Same-Site - no attributes');
    250 
    251  promise_test((t) => {
    252    const key = '{{uuid()}}';
    253 
    254    induceRequest(
    255      makeRequestURL(key, ['httpsOrigin', 'httpsCrossSite'], {mime: 'text/html'}),
    256      {
    257        test: t,
    258        userActivated: false,
    259        attributes: {}
    260      }
    261    );
    262 
    263    // `induceRequest` does not necessarily trigger a navigation, so the Python
    264    // handler must be polled until it has received the initial request.
    265    return retrieve(key, {poll: true})
    266      .then((headers) => {
    267          assert_own_property(headers, 'sec-fetch-site');
    268          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
    269        });
    270  }, 'sec-fetch-site - Same-Origin -> Cross-Site - no attributes');
    271 
    272  promise_test((t) => {
    273    const key = '{{uuid()}}';
    274 
    275    induceRequest(
    276      makeRequestURL(key, ['httpsSameSite', 'httpsOrigin'], {mime: 'text/html'}),
    277      {
    278        test: t,
    279        userActivated: false,
    280        attributes: {}
    281      }
    282    );
    283 
    284    // `induceRequest` does not necessarily trigger a navigation, so the Python
    285    // handler must be polled until it has received the initial request.
    286    return retrieve(key, {poll: true})
    287      .then((headers) => {
    288          assert_own_property(headers, 'sec-fetch-site');
    289          assert_array_equals(headers['sec-fetch-site'], ['same-site']);
    290        });
    291  }, 'sec-fetch-site - Same-Site -> Same Origin - no attributes');
    292 
    293  promise_test((t) => {
    294    const key = '{{uuid()}}';
    295 
    296    induceRequest(
    297      makeRequestURL(key, ['httpsSameSite', 'httpsSameSite'], {mime: 'text/html'}),
    298      {
    299        test: t,
    300        userActivated: false,
    301        attributes: {}
    302      }
    303    );
    304 
    305    // `induceRequest` does not necessarily trigger a navigation, so the Python
    306    // handler must be polled until it has received the initial request.
    307    return retrieve(key, {poll: true})
    308      .then((headers) => {
    309          assert_own_property(headers, 'sec-fetch-site');
    310          assert_array_equals(headers['sec-fetch-site'], ['same-site']);
    311        });
    312  }, 'sec-fetch-site - Same-Site -> Same-Site - no attributes');
    313 
    314  promise_test((t) => {
    315    const key = '{{uuid()}}';
    316 
    317    induceRequest(
    318      makeRequestURL(key, ['httpsSameSite', 'httpsCrossSite'], {mime: 'text/html'}),
    319      {
    320        test: t,
    321        userActivated: false,
    322        attributes: {}
    323      }
    324    );
    325 
    326    // `induceRequest` does not necessarily trigger a navigation, so the Python
    327    // handler must be polled until it has received the initial request.
    328    return retrieve(key, {poll: true})
    329      .then((headers) => {
    330          assert_own_property(headers, 'sec-fetch-site');
    331          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
    332        });
    333  }, 'sec-fetch-site - Same-Site -> Cross-Site - no attributes');
    334 
    335  promise_test((t) => {
    336    const key = '{{uuid()}}';
    337 
    338    induceRequest(
    339      makeRequestURL(key, ['httpsOrigin', 'httpOrigin', 'httpsOrigin'], {mime: 'text/html'}),
    340      {
    341        test: t,
    342        userActivated: false,
    343        attributes: {}
    344      }
    345    );
    346 
    347    // `induceRequest` does not necessarily trigger a navigation, so the Python
    348    // handler must be polled until it has received the initial request.
    349    return retrieve(key, {poll: true})
    350      .then((headers) => {
    351          assert_own_property(headers, 'sec-fetch-site');
    352          assert_array_equals(headers['sec-fetch-site'], ['cross-site']);
    353        });
    354  }, 'sec-fetch-site - HTTPS downgrade-upgrade - no attributes');
    355 
    356  promise_test((t) => {
    357    const key = '{{uuid()}}';
    358 
    359    induceRequest(
    360      makeRequestURL(key, [], {mime: 'text/html'}),
    361      {
    362        test: t,
    363        userActivated: false,
    364        attributes: {}
    365      }
    366    );
    367 
    368    // `induceRequest` does not necessarily trigger a navigation, so the Python
    369    // handler must be polled until it has received the initial request.
    370    return retrieve(key, {poll: true})
    371      .then((headers) => {
    372          assert_own_property(headers, 'sec-fetch-mode');
    373          assert_array_equals(headers['sec-fetch-mode'], ['navigate']);
    374        });
    375  }, 'sec-fetch-mode - no attributes');
    376 
    377  promise_test((t) => {
    378    const key = '{{uuid()}}';
    379 
    380    induceRequest(
    381      makeRequestURL(key, [], {mime: 'text/html'}),
    382      {
    383        test: t,
    384        userActivated: false,
    385        attributes: {"download": ""}
    386      }
    387    );
    388 
    389    // `induceRequest` does not necessarily trigger a navigation, so the Python
    390    // handler must be polled until it has received the initial request.
    391    return retrieve(key, {poll: true})
    392      .then((headers) => {
    393          assert_own_property(headers, 'sec-fetch-mode');
    394          assert_array_equals(headers['sec-fetch-mode'], ['no-cors']);
    395        });
    396  }, 'sec-fetch-mode - attributes: download');
    397 
    398  promise_test((t) => {
    399    const key = '{{uuid()}}';
    400 
    401    induceRequest(
    402      makeRequestURL(key, [], {mime: 'text/html'}),
    403      {
    404        test: t,
    405        userActivated: false,
    406        attributes: {}
    407      }
    408    );
    409 
    410    // `induceRequest` does not necessarily trigger a navigation, so the Python
    411    // handler must be polled until it has received the initial request.
    412    return retrieve(key, {poll: true})
    413      .then((headers) => {
    414          assert_own_property(headers, 'sec-fetch-dest');
    415          assert_array_equals(headers['sec-fetch-dest'], ['document']);
    416        });
    417  }, 'sec-fetch-dest - no attributes');
    418 
    419  promise_test((t) => {
    420    const key = '{{uuid()}}';
    421 
    422    induceRequest(
    423      makeRequestURL(key, [], {mime: 'text/html'}),
    424      {
    425        test: t,
    426        userActivated: false,
    427        attributes: {"download": ""}
    428      }
    429    );
    430 
    431    // `induceRequest` does not necessarily trigger a navigation, so the Python
    432    // handler must be polled until it has received the initial request.
    433    return retrieve(key, {poll: true})
    434      .then((headers) => {
    435          assert_own_property(headers, 'sec-fetch-dest');
    436          assert_array_equals(headers['sec-fetch-dest'], ['empty']);
    437        });
    438  }, 'sec-fetch-dest - attributes: download');
    439 
    440  promise_test((t) => {
    441    const key = '{{uuid()}}';
    442 
    443    induceRequest(
    444      makeRequestURL(key, [], {mime: 'text/html'}),
    445      {
    446        test: t,
    447        userActivated: false,
    448        attributes: {}
    449      }
    450    );
    451 
    452    // `induceRequest` does not necessarily trigger a navigation, so the Python
    453    // handler must be polled until it has received the initial request.
    454    return retrieve(key, {poll: true})
    455      .then((headers) => {
    456          assert_not_own_property(headers, 'sec-fetch-user');
    457        });
    458  }, 'sec-fetch-user - no attributes');
    459 
    460  promise_test((t) => {
    461    const key = '{{uuid()}}';
    462 
    463    induceRequest(
    464      makeRequestURL(key, [], {mime: 'text/html'}),
    465      {
    466        test: t,
    467        userActivated: true,
    468        attributes: {}
    469      }
    470    );
    471 
    472    // `induceRequest` does not necessarily trigger a navigation, so the Python
    473    // handler must be polled until it has received the initial request.
    474    return retrieve(key, {poll: true})
    475      .then((headers) => {
    476          assert_own_property(headers, 'sec-fetch-user');
    477          assert_array_equals(headers['sec-fetch-user'], ['?1']);
    478        });
    479  }, 'sec-fetch-user - no attributes with user activation');
    480 
    481  promise_test((t) => {
    482    const key = '{{uuid()}}';
    483 
    484    induceRequest(
    485      makeRequestURL(key, ['httpsCrossSite'], {mime: 'text/html'}),
    486      {
    487        test: t,
    488        userActivated: false,
    489        attributes: {}
    490      }
    491    );
    492 
    493    // `induceRequest` does not necessarily trigger a navigation, so the Python
    494    // handler must be polled until it has received the initial request.
    495    return retrieve(key, {poll: true})
    496      .then((headers) => {
    497          assert_not_own_property(headers, 'sec-fetch-storage-access');
    498        });
    499  }, 'sec-fetch-storage-access - Cross-site - no attributes');
    500 
    501  promise_test((t) => {
    502    const key = '{{uuid()}}';
    503 
    504    induceRequest(
    505      makeRequestURL(key, ['httpsSameSite'], {mime: 'text/html'}),
    506      {
    507        test: t,
    508        userActivated: false,
    509        attributes: {}
    510      }
    511    );
    512 
    513    // `induceRequest` does not necessarily trigger a navigation, so the Python
    514    // handler must be polled until it has received the initial request.
    515    return retrieve(key, {poll: true})
    516      .then((headers) => {
    517          assert_not_own_property(headers, 'sec-fetch-storage-access');
    518        });
    519  }, 'sec-fetch-storage-access - Same site - no attributes');
    520  </script>
    521  </body>
    522 </html>