diff --git a/src/test/XSS_test.js b/src/test/XSS_test.js index 4337e2f..f723733 100644 --- a/src/test/XSS_test.js +++ b/src/test/XSS_test.js @@ -1,5 +1,5 @@ if (UA.isMozilla) { - let y = async (url, originUrl = '') => await XSS.maybe(XSS.parseRequest({originUrl, url, method: "GET"})); + let y = async (url, originUrl = '') => await XSS.test({originUrl, url, method: "GET"}); let n = async (...args) => !await y(...args); Promise.all([ () => y("https://noscript.net/ { let workersMap = new Map(); let promptsMap = new Map(); + let requestIdCount = 0; + async function getUserResponse(xssReq) { let {originKey} = xssReq; await promptsMap.get(originKey); @@ -309,6 +311,20 @@ var XSS = (() => { return false; }; }); + }, + + async test(urlOrRequest) { + let r = { + requestId: `fake${requestIdCount++}`, + originUrl: '', + method: "GET", + }; + if (typeof urlOrRequest === "string") { + r.url = urlOrRequest; + } else if (typeof urlOrRequest === "object") { + Object.assign(r, urlOrRequest); + } + return await XSS.maybe(XSS.parseRequest(r)); } }; })();