tor-browser

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

change-src-attribute-after-config-installation-does-not-trigger-navigation.https.html (1858B)


      1 <!DOCTYPE html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <script src="/common/utils.js"></script>
      5 <script src="/common/get-host-info.sub.js"></script>
      6 <script src="resources/utils.js"></script>
      7 <title>Test changing a fenced frame's src attribute when there has been a config
      8 with url installed already does not trigger navigation.</title>
      9 
     10 <body>
     11 
     12 <script>
     13 function getTimeoutPromise(t) {
     14  return new Promise(resolve =>
     15    t.step_timeout(() => resolve("NOT LOADED"), 2000));
     16 }
     17 
     18 promise_test(async (t) => {
     19  const fenced_frame_loaded_key = token();
     20 
     21  const url = generateURL(
     22    'resources/fenced-frame-loaded.html', [fenced_frame_loaded_key]);
     23  const url_string = url.toString();
     24 
     25  // Create a fenced frame and install an inner config constructed with an url.
     26  const fenced_frame = document.createElement('fencedframe');
     27  const config = new FencedFrameConfig(url_string);
     28  fenced_frame.config = config;
     29  document.body.append(fenced_frame);
     30 
     31  // Installing a config to the fenced frame triggers navigation.
     32  const load_expected = "fenced frame loaded";
     33  const load_actual = await nextValueFromServer(fenced_frame_loaded_key);
     34  assert_equals(load_actual, load_expected,
     35    "Fenced frame successfully loaded.");
     36 
     37  const src_key = token();
     38  const src_url = generateURL(
     39    'resources/fenced-frame-loaded.html', [src_key]);
     40 
     41  // Changing the src attribute, should not trigger navigation.
     42  fenced_frame.src = src_url;
     43  const src_loaded_promise = nextValueFromServer(src_key);
     44  const src_loaded_result = await Promise.any([src_loaded_promise,
     45    getTimeoutPromise(t)]);
     46  assert_equals(src_loaded_result, "NOT LOADED");
     47 
     48 }, 'Changing the src attribute of a fenced frame when a config with url',
     49  'has already been installed does not trigger navigation.');
     50 </script>
     51 
     52 </body>