Skip to content

Commit d718ae7

Browse files
author
Cong Liu
committed
Unset weak status of compiled scripts from Node
Compiled scripts from Node were set to weak, which caused the script object in V8 being GCed shortly. Hence links of the script shown in console of DevTools become invalid after GC. Fixed nwjs/nw.js#4269
1 parent 5c8f26b commit d718ae7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/node_contextify.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,10 @@ class ContextifyScript : public BaseObject {
792792
ContextifyScript(Environment* env, Local<Object> object)
793793
: BaseObject(env, object) {
794794
MakeWeak<ContextifyScript>(this);
795+
// Unset weak of compiled script to survival from GC for Node modules.
796+
// Otherwise the links from console will be invalid shortly.
797+
// See https://github.com/nwjs/nw.js/issues/4269
798+
ClearWeak();
795799
}
796800

797801

0 commit comments

Comments
 (0)