-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
module: don't cache uninitialized builtins
Don't cache the exported values of fully uninitialized builtins. This works by adding an additional `loading` flag that is only active during initial loading of an internal module and checking that either the module is fully loaded or is in that state before using its cached value. This has the effect that builtins modules which could not be loaded (e.g. because compilation failed due to missing stack space) can be loaded at a later point. Fixes: #6899 Ref: #6899 PR-URL: #6907 Reviewed-By: Ben Noordhuis <[email protected]>
- Loading branch information
Showing
3 changed files
with
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
// copy console accessor because requiring ../common touches it | ||
const consoleDescriptor = Object.getOwnPropertyDescriptor(global, 'console'); | ||
delete global.console; | ||
global.console = {}; | ||
|
||
require('../common'); | ||
|
||
function a() { | ||
try { | ||
return a(); | ||
} catch (e) { | ||
const console = consoleDescriptor.get(); | ||
if (console.log) { | ||
console.log('Hello, World!'); | ||
} else { | ||
throw e; | ||
} | ||
} | ||
} | ||
|
||
a(); |
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 @@ | ||
Hello, World! |