Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
open(method, uri, asynchronous, user, password) {
if (!this._ownerDocument) {
throw new DOMException("The object is in an invalid state.", "InvalidStateError");
}
const flag = this[xhrSymbols.flag];
const properties = this[xhrSymbols.properties];
const argumentCount = arguments.length;
if (argumentCount < 2) {
throw new TypeError("Not enough arguments (expected at least 2)");
}
method = conversions.ByteString(method);
uri = conversions.USVString(uri);
if (user) {
user = conversions.USVString(user);
}
if (password) {
password = conversions.USVString(password);
}
if (!tokenRegexp.test(method)) {
throw new DOMException("The string did not match the expected pattern.", "SyntaxError");
}
const upperCaseMethod = method.toUpperCase();
if (forbiddenRequestMethods.has(upperCaseMethod)) {
throw new DOMException("The operation is insecure.", "SecurityError");
}
const { client } = properties;
}
const args = [];
{
let curArg = arguments[0];
if (!utils.isObject(curArg)) {
throw new TypeError("Failed to construct 'File': parameter 1" + " is not an iterable object.");
} else {
const V = [];
const tmp = curArg;
for (let nextItem of tmp) {
if (isBlob(nextItem)) {
nextItem = utils.implForWrapper(nextItem);
} else if (nextItem instanceof ArrayBuffer) {
} else if (ArrayBuffer.isView(nextItem)) {
} else {
nextItem = conversions["USVString"](nextItem, {
context: "Failed to construct 'File': parameter 1" + "'s element"
});
}
V.push(nextItem);
}
curArg = V;
}
args.push(curArg);
}
{
let curArg = arguments[1];
curArg = conversions["USVString"](curArg, { context: "Failed to construct 'File': parameter 2" });
args.push(curArg);
}
{
let curArg = arguments[2];
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["USVString"](V, {
context: "Failed to set the 'username' property on 'HTMLAreaElement': The provided value"
});
this[impl]["username"] = V;
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["USVString"](V, {
context: "Failed to set the 'hash' property on 'HTMLAreaElement': The provided value"
});
this[impl]["hash"] = V;
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["USVString"](V, {
context: "Failed to set the 'port' property on 'Location': The provided value"
});
obj[impl]["port"] = V;
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["USVString"](V, { context: "Failed to set the 'password' property on 'URL': The provided value" });
this[impl]["password"] = V;
},
if (new.target === undefined) {
throw new TypeError(
"Failed to construct 'WebSocket'. Please use the 'new' operator; this constructor " +
"cannot be called as a function."
);
}
if (arguments.length < 1) {
throw new TypeError(
"Failed to construct 'WebSocket': 1 argument required, but only " + arguments.length + " present."
);
}
const args = [];
{
let curArg = arguments[0];
curArg = conversions["USVString"](curArg, { context: "Failed to construct 'WebSocket': parameter 1" });
args.push(curArg);
}
{
let curArg = arguments[1];
if (curArg !== undefined) {
if (utils.isObject(curArg)) {
if (curArg[Symbol.iterator] !== undefined) {
if (!utils.isObject(curArg)) {
throw new TypeError(
"Failed to construct 'WebSocket': parameter 2" + " sequence" + " is not an iterable object."
);
} else {
const V = [];
const tmp = curArg;
for (let nextItem of tmp) {
nextItem = conversions["DOMString"](nextItem, {
set data(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["USVString"](V, {
context: "Failed to set the 'data' property on 'HTMLObjectElement': The provided value"
});
this[impl]["data"] = V;
}
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["USVString"](V, {
context: "Failed to set the 'src' property on 'HTMLScriptElement': The provided value"
});
this[impl]["src"] = V;
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["USVString"](V, {
context: "Failed to set the 'search' property on 'HTMLAnchorElement': The provided value"
});
this[impl]["search"] = V;
},