Sha256: e58e5a5d174d4e5fe7155640ddc025458341a94d510324e43dcdab150f146663
Contents?: true
Size: 1.45 KB
Versions: 4
Compression:
Stored size: 1.45 KB
Contents
'use strict'; var $ = require('../internals/export'); var global = require('../internals/global'); var defineBuiltInAccessor = require('../internals/define-built-in-accessor'); var DESCRIPTORS = require('../internals/descriptors'); var $TypeError = TypeError; // eslint-disable-next-line es/no-object-defineproperty -- safe var defineProperty = Object.defineProperty; var INCORRECT_VALUE = global.self !== global; // `self` getter // https://html.spec.whatwg.org/multipage/window-object.html#dom-self try { if (DESCRIPTORS) { // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var descriptor = Object.getOwnPropertyDescriptor(global, 'self'); // some engines have `self`, but with incorrect descriptor // https://github.com/denoland/deno/issues/15765 if (INCORRECT_VALUE || !descriptor || !descriptor.get || !descriptor.enumerable) { defineBuiltInAccessor(global, 'self', { get: function self() { return global; }, set: function self(value) { if (this !== global) throw new $TypeError('Illegal invocation'); defineProperty(global, 'self', { value: value, writable: true, configurable: true, enumerable: true }); }, configurable: true, enumerable: true }); } } else $({ global: true, simple: true, forced: INCORRECT_VALUE }, { self: global }); } catch (error) { /* empty */ }
Version data entries
4 entries across 4 versions & 1 rubygems