tor-browser

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

list-error.tentative.https.html (1536B)


      1 <!DOCTYPE html>
      2 <title>Sub Apps: Error cases for list()</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="resources/subapps-helpers.js"></script>
      6 
      7 <body></body>
      8 
      9 <script>
     10 
     11 promise_test(async t => {
     12  const iframe = document.createElement('iframe');
     13  document.body.appendChild(iframe);
     14 
     15  const iframeNavigator = iframe.contentWindow.navigator;
     16  const iframeDOMException = iframe.contentWindow.DOMException;
     17 
     18  // Detach the frame.
     19  iframe.remove();
     20 
     21  // At this point the iframe is detached and unloaded, and its execution
     22  // context is gone.
     23  await promise_rejects_dom(t, 'NotFoundError', iframeDOMException, iframeNavigator.subApps.list());
     24 }, "The object is no longer associated to a document.");
     25 
     26 promise_test(async t => {
     27  const iframe = document.createElement('iframe');
     28  document.body.appendChild(iframe);
     29 
     30  const iframeNavigator = iframe.contentWindow.navigator;
     31  const iframeDOMException = iframe.contentWindow.DOMException;
     32  t.add_cleanup(() => iframe.remove());
     33 
     34  await promise_rejects_dom(t, 'InvalidStateError', iframeDOMException, iframeNavigator.subApps.list());
     35 }, "API is only supported in top-level browsing contexts.");
     36 
     37 promise_test(async t => {
     38  t.add_cleanup(async () => {
     39      await mockSubAppsService.reset();
     40      mockSubAppsService = null;
     41  });
     42  await createMockSubAppsService(Status.FAILURE, [], []);
     43  return promise_rejects_dom(t, 'OperationError', navigator.subApps.list());
     44 }, 'List call failed.');
     45 
     46 </script>