source: imaps-frontend/node_modules/core-js/modules/web.self.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.5 KB
Line 
1'use strict';
2var $ = require('../internals/export');
3var globalThis = require('../internals/global-this');
4var defineBuiltInAccessor = require('../internals/define-built-in-accessor');
5var DESCRIPTORS = require('../internals/descriptors');
6
7var $TypeError = TypeError;
8// eslint-disable-next-line es/no-object-defineproperty -- safe
9var defineProperty = Object.defineProperty;
10var INCORRECT_VALUE = globalThis.self !== globalThis;
11
12// `self` getter
13// https://html.spec.whatwg.org/multipage/window-object.html#dom-self
14try {
15 if (DESCRIPTORS) {
16 // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
17 var descriptor = Object.getOwnPropertyDescriptor(globalThis, 'self');
18 // some engines have `self`, but with incorrect descriptor
19 // https://github.com/denoland/deno/issues/15765
20 if (INCORRECT_VALUE || !descriptor || !descriptor.get || !descriptor.enumerable) {
21 defineBuiltInAccessor(globalThis, 'self', {
22 get: function self() {
23 return globalThis;
24 },
25 set: function self(value) {
26 if (this !== globalThis) throw new $TypeError('Illegal invocation');
27 defineProperty(globalThis, 'self', {
28 value: value,
29 writable: true,
30 configurable: true,
31 enumerable: true
32 });
33 },
34 configurable: true,
35 enumerable: true
36 });
37 }
38 } else $({ global: true, simple: true, forced: INCORRECT_VALUE }, {
39 self: globalThis
40 });
41} catch (error) { /* empty */ }
Note: See TracBrowser for help on using the repository browser.