2024-01-01 14:58:21 -05:00
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2023-01-13 02:51:32 -05:00
|
|
|
|
2022-07-20 04:12:18 -04:00
|
|
|
import {
|
2024-05-07 17:02:29 -04:00
|
|
|
assert,
|
2022-07-20 04:12:18 -04:00
|
|
|
assertEquals,
|
|
|
|
assertNotEquals,
|
|
|
|
assertStringIncludes,
|
|
|
|
} from "./test_util.ts";
|
2021-07-08 09:43:36 -04:00
|
|
|
|
2021-11-23 11:45:18 -05:00
|
|
|
Deno.test(function customInspectFunction() {
|
2023-11-19 03:13:38 -05:00
|
|
|
const exception = new DOMException("test");
|
|
|
|
assertEquals(Deno.inspect(exception), exception.stack);
|
2021-07-08 09:43:36 -04:00
|
|
|
assertStringIncludes(Deno.inspect(DOMException.prototype), "DOMException");
|
|
|
|
});
|
2022-07-20 04:12:18 -04:00
|
|
|
|
|
|
|
Deno.test(function nameToCodeMappingPrototypeAccess() {
|
|
|
|
const newCode = 100;
|
|
|
|
const objectPrototype = Object.prototype as unknown as {
|
|
|
|
pollution: number;
|
|
|
|
};
|
|
|
|
objectPrototype.pollution = newCode;
|
|
|
|
assertNotEquals(newCode, new DOMException("test", "pollution").code);
|
|
|
|
Reflect.deleteProperty(objectPrototype, "pollution");
|
|
|
|
});
|
2024-05-07 17:02:29 -04:00
|
|
|
|
|
|
|
Deno.test(function callSitesEvalsDoesntThrow() {
|
|
|
|
const e2 = new DOMException("asdf");
|
|
|
|
// @ts-ignore no types for `__callSiteEvals` but it's observable.
|
|
|
|
assert(Array.isArray(e2.__callSiteEvals));
|
|
|
|
});
|