tor-browser

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

idlharness.https.html (1803B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>Presentation API IDL tests for Controlling User Agent</title>
      4 <meta name="timeout" content="long">
      5 <link rel="author" title="Louay Bassbouss" href="http://www.fokus.fraunhofer.de">
      6 <link rel="help" href="http://w3c.github.io/presentation-api/#dfn-controlling-user-agent">
      7 <script src="/resources/testharness.js"></script>
      8 <script src="/resources/testharnessreport.js"></script>
      9 <script src="/resources/WebIDLParser.js"></script>
     10 <script src="/resources/idlharness.js"></script>
     11 
     12 <script>
     13  "use strict";
     14 
     15  promise_test(async () => {
     16    const srcs = ['presentation-api', 'dom', 'html'];
     17    const [idl, dom, html] = await Promise.all(
     18      srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text())));
     19 
     20    const idl_array = new IdlArray();
     21    idl_array.add_idls(idl, {
     22      except: [
     23        'PresentationReceiver',
     24        'PresentationConnectionList'
     25      ]
     26    });
     27    idl_array.add_dependency_idls(dom);
     28    idl_array.add_dependency_idls(html);
     29 
     30    try {
     31      window.presentation_request = new PresentationRequest("/presentation-api/receiving-ua/idlharness.html");
     32      window.presentation_request_urls = new PresentationRequest([
     33        "/presentation-api/receiving-ua/idlharness.html",
     34        "https://www.example.com/presentation.html"
     35      ]);
     36      navigator.presentation.defaultRequest = window.presentation_request;
     37    } catch (e) {
     38      // Will be surfaced in idlharness.js's test_object below.
     39    }
     40 
     41    idl_array.add_objects({
     42      Presentation: ['navigator.presentation'],
     43      PresentationRequest: [
     44        'navigator.presentation.defaultRequest',
     45        'presentation_request',
     46        'presentation_request_urls'
     47      ],
     48    });
     49    idl_array.test();
     50  }, "Test IDL implementation of Presentation API");
     51 </script>