tor-browser

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

test_unregister_not_found.js (968B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 function run_test() {
      7  do_get_profile();
      8  setPrefs();
      9  run_next_test();
     10 }
     11 
     12 add_task(async function test_unregister_not_found() {
     13  PushService.init({
     14    serverURI: "wss://push.example.org/",
     15    makeWebSocket(uri) {
     16      return new MockWebSocket(uri, {
     17        onHello() {
     18          this.serverSendMsg(
     19            JSON.stringify({
     20              messageType: "hello",
     21              status: 200,
     22              uaid: "f074ed80-d479-44fa-ba65-792104a79ea9",
     23            })
     24          );
     25        },
     26      });
     27    },
     28  });
     29 
     30  let result = await PushService.unregister({
     31    scope: "https://example.net/nonexistent",
     32    originAttributes: ChromeUtils.originAttributesToSuffix({
     33      inIsolatedMozBrowser: false,
     34    }),
     35  });
     36  Assert.strictEqual(
     37    result,
     38    false,
     39    "unregister should resolve with false for nonexistent scope"
     40  );
     41 });