refactor: primordials for instanceof (#13527)

This commit is contained in:
Bartek Iwańczuk 2022-02-01 18:06:11 +01:00 committed by GitHub
parent abf89f8c46
commit 8176a4d166
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 1030 additions and 660 deletions

View file

@ -9,14 +9,15 @@
const { serializePermissions } = window.__bootstrap.permissions;
const { assert } = window.__bootstrap.util;
const {
AggregateError,
AggregateErrorPrototype,
ArrayPrototypeFilter,
ArrayPrototypePush,
ArrayPrototypeShift,
ArrayPrototypeSome,
DateNow,
Error,
Function,
FunctionPrototype,
ObjectPrototypeIsPrototypeOf,
Number,
ObjectKeys,
Promise,
@ -530,7 +531,7 @@ finishing test case.`;
}
function formatError(error) {
if (error instanceof AggregateError) {
if (ObjectPrototypeIsPrototypeOf(AggregateErrorPrototype, error)) {
const message = error
.errors
.map((error) =>
@ -984,7 +985,7 @@ finishing test case.`;
/** @returns {TestStepDefinition} */
function getDefinition() {
if (typeof nameOrTestDefinition === "string") {
if (!(fn instanceof Function)) {
if (!(ObjectPrototypeIsPrototypeOf(FunctionPrototype, fn))) {
throw new TypeError("Expected function for second argument.");
}
return {