tor-browser

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

idlharness-manual.https.html (1793B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>Presentation API IDL tests for Receiving User Agent</title>
      4 <link rel="author" title="Tomoyuki Shimizu" href="https://github.com/tomoyukilabs">
      5 <link rel="help" href="http://w3c.github.io/presentation-api/#dfn-receiving-user-agent">
      6 <script src="common.js"></script>
      7 <script src="support/stash.js"></script>
      8 
      9 <p>Click the button below and select the available presentation display, to start the manual test.</p>
     10 <button id="presentBtn">Start Presentation Test</button>
     11 
     12 <script>
     13    let connection;
     14    const presentBtn = document.getElementById('presentBtn');
     15    presentBtn.onclick = () => {
     16        presentBtn.disabled = true;
     17        const stash = new Stash(stashIds.toController, stashIds.toReceiver);
     18        const request = new PresentationRequest('support/idlharness_receiving-ua.html');
     19 
     20        return request.start().then(c => {
     21            connection = c;
     22            return stash.init();
     23        }).then(() => {
     24            return stash.receive();
     25        }).then(result => {
     26            const json = JSON.parse(result);
     27            // notify receiver's results of a parent window (e.g. test runner)
     28            if (window.opener && 'completion_callback' in window.opener) {
     29                window.opener.completion_callback(json.tests, json.status);
     30            }
     31            // display receiver's results as HTML
     32            const log = document.createElement('div');
     33            log.id = 'log';
     34            log.innerHTML = json.log;
     35            document.body.appendChild(log);
     36 
     37            connection.onconnect = () => { connection.terminate(); };
     38            if (connection.state === 'closed')
     39                request.reconnect(connection.id);
     40            else
     41                connection.terminate();
     42        });
     43    };
     44 </script>