This repository has been archived by the owner on Feb 1, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 #400 from ljharb/patch-1
Conditionally set `Symbol.toStringTag`, since it may be nonwritable if already defined.
- Loading branch information
Showing
3 changed files
with
48 additions
and
6 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,27 @@ | ||
/** | ||
* Copyright (c) 2014-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
var hasOwn = Object.prototype.hasOwnProperty; | ||
var getProto = Object.getPrototypeOf; | ||
var NativeIteratorPrototype = | ||
typeof Symbol === "function" && | ||
typeof Symbol.iterator === "symbol" && | ||
typeof [][Symbol.iterator] === "function" && | ||
getProto && | ||
getProto(getProto([][Symbol.iterator]())); | ||
|
||
// https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype-@@tostringtag | ||
Object.defineProperty(NativeIteratorPrototype, Symbol.toStringTag, { | ||
configurable: true, | ||
value: "Iterator", | ||
}); | ||
|
||
describe("Symbol.toStringTag safety (#399, #400)", function () { | ||
it("regenerator-runtime doesn't fail to initialize when native iterator prototype has a non-writable @@toStringTag property", function() { | ||
require("./runtime.js"); | ||
}); | ||
}); |
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