tor-browser

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

startNewPresentation_unsettledpromise-manual.https.html (1899B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>Calling "start" when there is already an unsettled Promise returns a Promise rejected with an OperationError exception.</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-controlling-user-agent">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 <script src="common.js"></script>
      9 
     10 <p>Click the button below to start the manual test. If prompted to select a device, please dismiss the dialog box. The test passes if a "PASS" result appears.</p>
     11 <button id="presentBtn">Start Presentation Test</button>
     12 
     13 <script>
     14    // disable the timeout function for the tests
     15    setup({explicit_timeout: true});
     16 
     17    // ----------
     18    // DOM Object
     19    // ----------
     20    var presentBtn = document.getElementById("presentBtn");
     21 
     22    // -----------------------------------------------
     23    // Terminate a presentation if started by accident
     24    // -----------------------------------------------
     25    function terminate(connection) {
     26        connection.terminate();
     27    }
     28 
     29    // -------------------------------------------
     30    // Start New Presentation Test (error) - begin
     31    // -------------------------------------------
     32    presentBtn.onclick = function () {
     33        presentBtn.disabled = true;
     34        promise_test(function (t) {
     35            var request1 = new PresentationRequest(presentationUrls),
     36                request2 = new PresentationRequest(presentationUrls);
     37            request1.start().then(terminate, function(){});
     38            return promise_rejects_dom(t, 'OperationError', request2.start().then(terminate));
     39        });
     40    };
     41    // -----------------------------------------
     42    // Start New Presentation Test (error) - end
     43    // -----------------------------------------
     44 </script>