tor-browser

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

garbage-collection-ran-during-error.js (1025B)


      1 'use strict';
      2 const test_desc = 'Garbage Collection ran during a FUNCTION_NAME ' +
      3    'call that failed. Should not crash.'
      4 const expected = new DOMException(
      5    'GATT Server is disconnected. Cannot retrieve services. (Re)connect first ' +
      6        'with `device.gatt.connect`.',
      7    'NetworkError');
      8 let promise;
      9 
     10 bluetooth_bidi_test(
     11    () => getEmptyHealthThermometerDevice()
     12              .then(({device}) => {
     13                promise = assert_promise_rejects_with_message(
     14                    device.gatt.CALLS(
     15                        [getPrimaryService('health_thermometer') |
     16                         getPrimaryServices() |
     17                         getPrimaryServices('health_thermometer')[UUID]]),
     18                    expected);
     19                // Disconnect called to clear attributeInstanceMap and allow the
     20                // object to get garbage collected.
     21                device.gatt.disconnect();
     22                return garbageCollect();
     23              })
     24              .then(() => promise),
     25    test_desc);