tor-browser

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

summarizer-iframe.tentative.https.html (2457B)


      1 <!DOCTYPE html>
      2 <meta name="timeout" content="long">
      3 <script src="/resources/testdriver.js"></script>
      4 <script src="/resources/testdriver-vendor.js"></script>
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="/common/get-host-info.sub.js"></script>
      8 <script src="../resources/util.js"></script>
      9 <body></body>
     10 <script>
     11 'use strict';
     12 
     13 const { HTTPS_ORIGIN, HTTPS_NOTSAMESITE_ORIGIN } = get_host_info();
     14 const PATH = location.pathname.substring(0, location.pathname.lastIndexOf('/') + 1);
     15 const IFRAME_PATH = PATH + 'resources/iframe-helper.html';
     16 
     17 promise_test(async t => {
     18  const src = HTTPS_NOTSAMESITE_ORIGIN + IFRAME_PATH;
     19  const iframe = await load_iframe(src, /*permission_policy=*/'');
     20  await promise_rejects_dom(t, 'NotAllowedError', run_iframe_test(iframe, 'SummarizerCreate'));
     21 }, 'Throw a \'NotAllowedError\' when creating Summarizer within cross-origin iframe');
     22 
     23 promise_test(async t => {
     24  const src = HTTPS_NOTSAMESITE_ORIGIN + IFRAME_PATH;
     25  const iframe = await load_iframe(src, 'summarizer');
     26  assert_equals(await run_iframe_test(iframe, 'SummarizerCreate'), 'Success');
     27 }, 'Summarizer can be created within cross-origin iframe with permission policy');
     28 
     29 promise_test(async t => {
     30  const src = HTTPS_ORIGIN + IFRAME_PATH;
     31  const iframe = await load_iframe(src, /*permission_policy=*/'');
     32  assert_equals(await run_iframe_test(iframe, 'SummarizerCreate'), 'Success');
     33 }, 'Summarizer can be used within same-origin iframe');
     34 
     35 promise_test(async t => {
     36  const src = HTTPS_NOTSAMESITE_ORIGIN + IFRAME_PATH;
     37  const iframe = await load_iframe(src, /*permission_policy=*/'');
     38  assert_equals(
     39    await run_iframe_test(iframe, 'SummarizerAvailability'), 'unavailable');
     40 }, 'Summarizer is unavailable within cross-origin iframe');
     41 
     42 promise_test(async t => {
     43  const src = HTTPS_NOTSAMESITE_ORIGIN + IFRAME_PATH;
     44  const iframe = await load_iframe(src, 'summarizer');
     45  assert_in_array(
     46    await run_iframe_test(iframe, 'SummarizerAvailability'),
     47    kAvailableAvailabilities);
     48 }, 'Summarizer is available within cross-origin iframe with permission policy');
     49 
     50 promise_test(async t => {
     51  const src = HTTPS_ORIGIN + IFRAME_PATH;
     52  const iframe = await load_iframe(src, /*permission_policy=*/'');
     53  assert_in_array(
     54    await run_iframe_test(iframe, 'SummarizerAvailability'),
     55    kAvailableAvailabilities);
     56 }, 'Summarizer is available within same-origin iframe');
     57 
     58 </script>