summaryrefslogtreecommitdiffstats
path: root/toolkit/components/extensions/test/mochitest/webrequest_test.jsm
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/extensions/test/mochitest/webrequest_test.jsm')
-rw-r--r--toolkit/components/extensions/test/mochitest/webrequest_test.jsm22
1 files changed, 22 insertions, 0 deletions
diff --git a/toolkit/components/extensions/test/mochitest/webrequest_test.jsm b/toolkit/components/extensions/test/mochitest/webrequest_test.jsm
new file mode 100644
index 000000000..bfb148301
--- /dev/null
+++ b/toolkit/components/extensions/test/mochitest/webrequest_test.jsm
@@ -0,0 +1,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();
+ });
+ },
+};