This repository has been archived by the owner on Oct 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Merge chakra-core/ChakraCore@6a23c85c43] [1.6>1.7] [MERGE #3533 @jia…
…nchun] module circular reference GetExportedNames/ResolveExport bugs Merge pull request #3533 from jianchun:modfix GetExportedNames(): module namespace binds all names from `GetExportedNames(nullptr)`. However we incorrectly cached result from any `GetExportedNames(exportStarSet)` call. This causes module namespace having incomplete names, because a previous intermediate call with non-null exportStarSet did not include names from that set. This fails 3250-ext-a. Found this problem while investigating #3250. Fixed by only cache/reuse the result if exportStarSet is nullptr (root call). ResolveExport(): parameter `exportStarSet` were used to prevent infinite loop when looking up name under module circular references. However it broke the case that we lookup this module record recursively for a different name (indirect). This causes #3250 to throw SyntaxError for failing to resolve a binding (resolving f_indirectUninit for dep2, reenter to resolve c_localUninit1 but rejected by `exportStarSet`). Fixed by removing it -- another parameter 'resolveSet' already does the job well. It prevents recursion for the same {moduleRecord, name}, but allows looking up a different name. Finally, moved a fragment into try/catch and added an ENTER_SCRIPT_IF. The given call may throw JavaScriptException which requires in script.
- Loading branch information
Showing
9 changed files
with
95 additions
and
33 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,13 @@ | ||
//------------------------------------------------------------------------------------------------------- | ||
// Copyright (C) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. | ||
//------------------------------------------------------------------------------------------------------- | ||
|
||
// module-3250-bug-dep.js | ||
import * as ns from './module-3250-bug-dep.js'; | ||
|
||
export let c_localUninit1; | ||
export { c_localUninit1 as f_indirectUninit } from './module-3250-bug-dep2.js'; | ||
|
||
var stringKeys = Object.getOwnPropertyNames(ns); | ||
assert.areEqual('["c_localUninit1","f_indirectUninit"]', JSON.stringify(stringKeys)); |
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,7 @@ | ||
//------------------------------------------------------------------------------------------------------- | ||
// Copyright (C) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. | ||
//------------------------------------------------------------------------------------------------------- | ||
|
||
// module-3250-bug-dep2.js | ||
export * from './module-3250-bug-dep.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
//------------------------------------------------------------------------------------------------------- | ||
// Copyright (C) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. | ||
//------------------------------------------------------------------------------------------------------- | ||
|
||
// module-3250-ext-a.js | ||
import * as ns from './module-3250-ext-a.js'; | ||
|
||
export let a; | ||
export * from './module-3250-ext-b.js'; | ||
|
||
var stringKeys = Object.getOwnPropertyNames(ns); | ||
assert.areEqual('["a","b"]', JSON.stringify(stringKeys)); |
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 @@ | ||
//------------------------------------------------------------------------------------------------------- | ||
// Copyright (C) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. | ||
//------------------------------------------------------------------------------------------------------- | ||
|
||
// module-3250-ext-b.js | ||
export let b; | ||
export * from './module-3250-ext-a.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