Skip to content

Commit cc0c1bc

Browse files
authored
Merge pull request #1153 from lightpanda-io/normalized_specifier_lifetime
Fix a potential segfault on log message for failing to load module
2 parents 4bfe3b6 + 55746f1 commit cc0c1bc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/browser/js/Context.zig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ pub fn module(self: *Context, comptime want_result: bool, src: []const u8, url:
262262
const owned_specifier = try self.arena.dupeZ(u8, normalized_specifier);
263263
gop.key_ptr.* = owned_specifier;
264264
gop.value_ptr.* = .{};
265-
try self.script_manager.?.getModule(owned_specifier, src);
265+
try self.script_manager.?.getModule(owned_specifier, url);
266266
}
267267
}
268268
}
@@ -1171,7 +1171,7 @@ fn _resolveModuleCallback(self: *Context, referrer: v8.Module, specifier: []cons
11711171
};
11721172

11731173
const normalized_specifier = try self.script_manager.?.resolveSpecifier(
1174-
self.call_arena,
1174+
self.arena, // might need to survive until the module is loaded
11751175
specifier,
11761176
referrer_path,
11771177
);
@@ -1207,7 +1207,7 @@ fn _resolveModuleCallback(self: *Context, referrer: v8.Module, specifier: []cons
12071207

12081208
const entry = self.module(true, fetch_result.src(), normalized_specifier, true) catch |err| {
12091209
log.warn(.js, "compile resolved module", .{
1210-
.specifier = specifier,
1210+
.specifier = normalized_specifier,
12111211
.stack = try_catch.stack(self.call_arena) catch null,
12121212
.src = try_catch.sourceLine(self.call_arena) catch "err",
12131213
.line = try_catch.sourceLineNumber() orelse 0,

0 commit comments

Comments
 (0)