tor-browser

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

gen-garbage-collection-ran-during-error.https.window.js (1193B)


      1 // META: script=/resources/testdriver.js?feature=bidi
      2 // META: script=/resources/testdriver-vendor.js
      3 // META: script=/common/gc.js
      4 // META: script=/bluetooth/resources/bluetooth-test.js
      5 // META: script=/bluetooth/resources/bluetooth-fake-devices.js
      6 // META: timeout=long
      7 // Generated by
      8 // //bluetooth/bidi/generate.py
      9 'use strict';
     10 const test_desc = 'Garbage Collection ran during a getPrimaryService ' +
     11    'call that failed. Should not crash.'
     12 const expected = new DOMException(
     13    'GATT Server is disconnected. Cannot retrieve services. (Re)connect first ' +
     14        'with `device.gatt.connect`.',
     15    'NetworkError');
     16 let promise;
     17 
     18 bluetooth_bidi_test(
     19    () => getEmptyHealthThermometerDevice()
     20              .then(({device}) => {
     21                promise = assert_promise_rejects_with_message(
     22                    device.gatt.getPrimaryService('health_thermometer'),
     23                    expected);
     24                // Disconnect called to clear attributeInstanceMap and allow the
     25                // object to get garbage collected.
     26                device.gatt.disconnect();
     27                return garbageCollect();
     28              })
     29              .then(() => promise),
     30    test_desc);