From 884143218fad0e18f7553aaf079d52de703f7601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 27 Jan 2022 13:36:36 +0100 Subject: refactor: update runtime code for primordial checks for "instanceof" (#13497) --- runtime/js/40_testing.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'runtime/js/40_testing.js') diff --git a/runtime/js/40_testing.js b/runtime/js/40_testing.js index 5979a523e..62eb1e9a9 100644 --- a/runtime/js/40_testing.js +++ b/runtime/js/40_testing.js @@ -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 { -- cgit v1.2.3