-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,5 +160,6 @@ export default { | |
3.26: [ | ||
'esnext.string.is-well-formed', | ||
'esnext.string.to-well-formed', | ||
'web.self', | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
var $ = require('../internals/export'); | ||
var global = require('../internals/global'); | ||
|
||
// `self` getter | ||
// https://html.spec.whatwg.org/multipage/window-object.html#dom-self | ||
$({ global: true, forced: global.self !== global }, { | ||
self: global | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var parent = require('../stable/self'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var parent = require('../actual/self'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
'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 $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 */ } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
require('../modules/web.self'); | ||
var path = require('../internals/path'); | ||
|
||
module.exports = path.self; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import self from 'core-js-pure/stable/self'; | ||
|
||
QUnit.test('self', assert => { | ||
assert.same(self, Object(self), 'is object'); | ||
assert.same(self.Math, Math, 'contains globals'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* eslint-disable no-restricted-globals -- safe */ | ||
import { DESCRIPTORS } from '../helpers/constants'; | ||
|
||
QUnit.test('self', assert => { | ||
assert.same(self, Object(self), 'is object'); | ||
assert.same(self.Math, Math, 'contains globals'); | ||
if (DESCRIPTORS) { | ||
const descriptor = Object.getOwnPropertyDescriptor(self, 'self'); | ||
// can't be properly defined (non-configurable) in some ancient engines like PhantomJS | ||
// assert.isFunction(descriptor.get, 'a getter'); | ||
// assert.true(descriptor.configurable, 'configurable'); | ||
assert.true(descriptor.enumerable, 'enumerable'); | ||
} | ||
}); |