-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #991 from zloirock/dom-exception
- Loading branch information
Showing
31 changed files
with
631 additions
and
7 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
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 @@ | ||
// 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require('../../modules/es.error.cause'); | ||
require('../../modules/es.error.to-string'); | ||
var path = require('../../internals/path'); | ||
|
||
module.exports = path; |
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/es.error.to-string'); | ||
var toString = require('../../internals/error-to-string'); | ||
|
||
module.exports = toString; |
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/dom-exception/constructor'); | ||
|
||
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('../../stable/dom-exception'); | ||
|
||
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('../../stable/dom-exception/to-string-tag'); | ||
|
||
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('../../stable/error/to-string'); | ||
|
||
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,27 @@ | ||
module.exports = { | ||
IndexSizeError: { s: 'INDEX_SIZE_ERR', c: 1, m: 1 }, | ||
DOMStringSizeError: { s: 'DOMSTRING_SIZE_ERR', c: 2, m: 0 }, | ||
HierarchyRequestError: { s: 'HIERARCHY_REQUEST_ERR', c: 3, m: 1 }, | ||
WrongDocumentError: { s: 'WRONG_DOCUMENT_ERR', c: 4, m: 1 }, | ||
InvalidCharacterError: { s: 'INVALID_CHARACTER_ERR', c: 5, m: 1 }, | ||
NoDataAllowedError: { s: 'NO_DATA_ALLOWED_ERR', c: 6, m: 0 }, | ||
NoModificationAllowedError: { s: 'NO_MODIFICATION_ALLOWED_ERR', c: 7, m: 1 }, | ||
NotFoundError: { s: 'NOT_FOUND_ERR', c: 8, m: 1 }, | ||
NotSupportedError: { s: 'NOT_SUPPORTED_ERR', c: 9, m: 1 }, | ||
InUseAttributeError: { s: 'INUSE_ATTRIBUTE_ERR', c: 10, m: 1 }, | ||
InvalidStateError: { s: 'INVALID_STATE_ERR', c: 11, m: 1 }, | ||
SyntaxError: { s: 'SYNTAX_ERR', c: 12, m: 1 }, | ||
InvalidModificationError: { s: 'INVALID_MODIFICATION_ERR', c: 13, m: 1 }, | ||
NamespaceError: { s: 'NAMESPACE_ERR', c: 14, m: 1 }, | ||
InvalidAccessError: { s: 'INVALID_ACCESS_ERR', c: 15, m: 1 }, | ||
ValidationError: { s: 'VALIDATION_ERR', c: 16, m: 0 }, | ||
TypeMismatchError: { s: 'TYPE_MISMATCH_ERR', c: 17, m: 1 }, | ||
SecurityError: { s: 'SECURITY_ERR', c: 18, m: 1 }, | ||
NetworkError: { s: 'NETWORK_ERR', c: 19, m: 1 }, | ||
AbortError: { s: 'ABORT_ERR', c: 20, m: 1 }, | ||
URLMismatchError: { s: 'URL_MISMATCH_ERR', c: 21, m: 1 }, | ||
QuotaExceededError: { s: 'QUOTA_EXCEEDED_ERR', c: 22, m: 1 }, | ||
TimeoutError: { s: 'TIMEOUT_ERR', c: 23, m: 1 }, | ||
InvalidNodeTypeError: { s: 'INVALID_NODE_TYPE_ERR', c: 24, m: 1 }, | ||
DataCloneError: { s: 'DATA_CLONE_ERR', c: 25, m: 1 } | ||
}; |
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,30 @@ | ||
'use strict'; | ||
var DESCRIPTORS = require('../internals/descriptors'); | ||
var fails = require('../internals/fails'); | ||
var anObject = require('../internals/an-object'); | ||
var create = require('../internals/object-create'); | ||
var normalizeStringArgument = require('../internals/normalize-string-argument'); | ||
|
||
var nativeErrorToString = Error.prototype.toString; | ||
|
||
var INCORRECT_TO_STRING = fails(function () { | ||
if (DESCRIPTORS) { | ||
// Chrome 32- incorrectly call accessor | ||
// eslint-disable-next-line es/no-object-defineproperty -- safe | ||
var object = create(Object.defineProperty({}, 'name', { get: function () { | ||
return this === object; | ||
} })); | ||
if (nativeErrorToString.call(object) !== 'true') return true; | ||
} | ||
// FF10- does not properly handle non-strings | ||
return nativeErrorToString.call({ message: 1, name: 2 }) !== '2: 1' | ||
// IE8 does not properly handle defaults | ||
|| nativeErrorToString.call({}) !== 'Error'; | ||
}); | ||
|
||
module.exports = INCORRECT_TO_STRING ? function toString() { | ||
var O = anObject(this); | ||
var name = normalizeStringArgument(O.name, 'Error'); | ||
var message = normalizeStringArgument(O.message); | ||
return !name ? message : !message ? name : name + ': ' + message; | ||
} : nativeErrorToString; |
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,8 @@ | ||
var IS_NODE = require('../internals/engine-is-node'); | ||
|
||
module.exports = function (name) { | ||
try { | ||
// eslint-disable-next-line no-new-func -- safe | ||
if (IS_NODE) return Function('return require("' + name + '")')(); | ||
} 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,10 @@ | ||
var redefine = require('../internals/redefine'); | ||
var errorToString = require('../internals/error-to-string'); | ||
|
||
var ErrorPrototype = Error.prototype; | ||
|
||
// `Error.prototype.toString` method fix | ||
// https://tc39.es/ecma262/#sec-error.prototype.tostring | ||
if (ErrorPrototype.toString !== errorToString) { | ||
redefine(ErrorPrototype, 'toString', errorToString); | ||
} |
Oops, something went wrong.