tor-browser

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

download.https.html (1700B)


      1 <!DOCTYPE html>
      2 <title>Test fenced frame does not allow triggering download</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="/resources/testdriver.js"></script>
      6 <script src="/resources/testdriver-actions.js"></script>
      7 <script src="/resources/testdriver-vendor.js"></script>
      8 <script src="/common/utils.js"></script>
      9 <script src="resources/utils.js"></script>
     10 <script src="resources/download-helper.js"></script>
     11 
     12 <body>
     13  <script>
     14    const testTypes = [
     15      {
     16        type: "anchor",
     17        description: "Anchor click triggering download in fenced frames is blocked."
     18      },
     19      {
     20        type: "navigation",
     21        description: "Navigation resulted download in fenced frames is blocked."
     22      }
     23    ];
     24 
     25    testTypes.forEach(({type, description}) => {
     26      promise_test(async t => {
     27        const download_key = token();
     28        const download_ack_key = token();
     29 
     30        // The download link is clicked inside the fenced frame after the loading
     31        const fenced_frame_url = generateURL("resources/download-inner.html", [download_key, download_ack_key]) + `&type=${type}`;
     32        const fenced_frame = attachFencedFrame(fenced_frame_url);
     33 
     34        const response = await nextValueFromServer(download_ack_key);
     35        assert_equals(response, 'Triggered the action for download');
     36 
     37        // Clicks must originate from the primary frame.
     38        if (type === "anchor") {
     39          await multiClick(20, 20, fenced_frame);
     40        }
     41 
     42        const result = await VerifyDownload(t, download_key);
     43        assert_false(result, 'Expect no download to happen');
     44      }, description);
     45    });
     46  </script>
     47 </body>