summaryrefslogtreecommitdiff
path: root/toolkit/components/extensions/test/mochitest/webrequest_test.jsm
blob: bfb1483018eda9ebc308133157b244db2b866a29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"use strict";

this.EXPORTED_SYMBOLS = ["webrequest_test"];

Components.utils.importGlobalProperties(["fetch", "XMLHttpRequest"]);

this.webrequest_test = {
  testFetch(url) {
    return fetch(url);
  },

  testXHR(url) {
    return new Promise(resolve => {
      let xhr = new XMLHttpRequest();
      xhr.open("HEAD", url);
      xhr.onload = () => {
        resolve();
      };
      xhr.send();
    });
  },
};