-
-
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.
add a workaround for FF26- bug where
ArrayBuffer
s are non-extensibl…
…e, but `Object.isExtensible` does not report it
- Loading branch information
Showing
17 changed files
with
92 additions
and
27 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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// FF26- bug: ArrayBuffers are non-extensible, but Object.isExtensible does not report it | ||
var fails = require('../internals/fails'); | ||
|
||
module.exports = fails(function () { | ||
if (typeof ArrayBuffer == 'function') { | ||
var buffer = new ArrayBuffer(8); | ||
// eslint-disable-next-line es/no-object-isextensible, es/no-object-defineproperty -- safe | ||
if (Object.isExtensible(buffer)) Object.defineProperty(buffer, 'a', { value: 8 }); | ||
} | ||
}); |
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,16 @@ | ||
var fails = require('../internals/fails'); | ||
var isObject = require('../internals/is-object'); | ||
var classof = require('../internals/classof-raw'); | ||
var ARRAY_BUFFER_NON_EXTENSIBLE = require('../internals/array-buffer-non-extensible'); | ||
|
||
// eslint-disable-next-line es/no-object-isextensible -- safe | ||
var $isExtensible = Object.isExtensible; | ||
var FAILS_ON_PRIMITIVES = fails(function () { $isExtensible(1); }); | ||
|
||
// `Object.isExtensible` method | ||
// https://tc39.es/ecma262/#sec-object.isextensible | ||
module.exports = (FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE) ? function isExtensible(it) { | ||
if (!isObject(it)) return false; | ||
if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer') return false; | ||
return $isExtensible ? $isExtensible(it) : true; | ||
} : $isExtensible; |
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 |
---|---|---|
@@ -1,15 +1,9 @@ | ||
var $ = require('../internals/export'); | ||
var fails = require('../internals/fails'); | ||
var isObject = require('../internals/is-object'); | ||
|
||
// eslint-disable-next-line es/no-object-isextensible -- safe | ||
var $isExtensible = Object.isExtensible; | ||
var FAILS_ON_PRIMITIVES = fails(function () { $isExtensible(1); }); | ||
var $isExtensible = require('../internals/object-is-extensible'); | ||
|
||
// `Object.isExtensible` method | ||
// https://tc39.es/ecma262/#sec-object.isextensible | ||
$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, { | ||
isExtensible: function isExtensible(it) { | ||
return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false; | ||
} | ||
// eslint-disable-next-line es/no-object-isextensible -- safe | ||
$({ target: 'Object', stat: true, forced: Object.isExtensible !== $isExtensible }, { | ||
isExtensible: $isExtensible | ||
}); |
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 |
---|---|---|
@@ -1,15 +1,19 @@ | ||
var $ = require('../internals/export'); | ||
var fails = require('../internals/fails'); | ||
var isObject = require('../internals/is-object'); | ||
var classof = require('../internals/classof-raw'); | ||
var ARRAY_BUFFER_NON_EXTENSIBLE = require('../internals/array-buffer-non-extensible'); | ||
|
||
// eslint-disable-next-line es/no-object-isfrozen -- safe | ||
var $isFrozen = Object.isFrozen; | ||
var FAILS_ON_PRIMITIVES = fails(function () { $isFrozen(1); }); | ||
|
||
// `Object.isFrozen` method | ||
// https://tc39.es/ecma262/#sec-object.isfrozen | ||
$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, { | ||
$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE }, { | ||
isFrozen: function isFrozen(it) { | ||
return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true; | ||
if (!isObject(it)) return true; | ||
if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer') return true; | ||
return $isFrozen ? $isFrozen(it) : false; | ||
} | ||
}); |
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 |
---|---|---|
@@ -1,15 +1,19 @@ | ||
var $ = require('../internals/export'); | ||
var fails = require('../internals/fails'); | ||
var isObject = require('../internals/is-object'); | ||
var classof = require('../internals/classof-raw'); | ||
var ARRAY_BUFFER_NON_EXTENSIBLE = require('../internals/array-buffer-non-extensible'); | ||
|
||
// eslint-disable-next-line es/no-object-issealed -- safe | ||
var $isSealed = Object.isSealed; | ||
var FAILS_ON_PRIMITIVES = fails(function () { $isSealed(1); }); | ||
|
||
// `Object.isSealed` method | ||
// https://tc39.es/ecma262/#sec-object.issealed | ||
$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, { | ||
$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE }, { | ||
isSealed: function isSealed(it) { | ||
return isObject(it) ? $isSealed ? $isSealed(it) : false : true; | ||
if (!isObject(it)) return true; | ||
if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer') return true; | ||
return $isSealed ? $isSealed(it) : false; | ||
} | ||
}); |
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 |
---|---|---|
@@ -1,14 +1,12 @@ | ||
var $ = require('../internals/export'); | ||
var anObject = require('../internals/an-object'); | ||
|
||
// eslint-disable-next-line es/no-object-isextensible -- safe | ||
var objectIsExtensible = Object.isExtensible; | ||
var $isExtensible = require('../internals/object-is-extensible'); | ||
|
||
// `Reflect.isExtensible` method | ||
// https://tc39.es/ecma262/#sec-reflect.isextensible | ||
$({ target: 'Reflect', stat: true }, { | ||
isExtensible: function isExtensible(target) { | ||
anObject(target); | ||
return objectIsExtensible ? objectIsExtensible(target) : true; | ||
return $isExtensible(target); | ||
} | ||
}); |
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
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
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