aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/ZigSourceProvider.cpp
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-06-20 17:12:47 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-06-20 17:12:47 -0700
commit83d7ec728f073261176b0bea8451b936c5a376ad (patch)
treed7cd3c9343ee27bcc04211f8bb394189ed73e900 /src/bun.js/bindings/ZigSourceProvider.cpp
parent9f301e13c5d8f057e6e9308e23cba7ecc27dab09 (diff)
downloadbun-83d7ec728f073261176b0bea8451b936c5a376ad.tar.gz
bun-83d7ec728f073261176b0bea8451b936c5a376ad.tar.zst
bun-83d7ec728f073261176b0bea8451b936c5a376ad.zip
Clone SourceOrigin string
Diffstat (limited to 'src/bun.js/bindings/ZigSourceProvider.cpp')
-rw-r--r--src/bun.js/bindings/ZigSourceProvider.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/bun.js/bindings/ZigSourceProvider.cpp b/src/bun.js/bindings/ZigSourceProvider.cpp
index d42d6b445..ab3062cd5 100644
--- a/src/bun.js/bindings/ZigSourceProvider.cpp
+++ b/src/bun.js/bindings/ZigSourceProvider.cpp
@@ -59,6 +59,7 @@ Ref<SourceProvider> SourceProvider::create(Zig::GlobalObject* globalObject, Reso
}
}
auto stringImpl = Bun::toWTFString(resolvedSource.source_code);
+ auto sourceURLString = toStringCopy(resolvedSource.source_url);
if (stringImpl.impl()->refCount() > 1)
// Deref because we don't call a destructor for BunString
@@ -67,8 +68,8 @@ Ref<SourceProvider> SourceProvider::create(Zig::GlobalObject* globalObject, Reso
auto provider = adoptRef(*new SourceProvider(
globalObject->isThreadLocalDefaultGlobalObject ? globalObject : nullptr,
resolvedSource, stringImpl.releaseImpl().releaseNonNull(),
- JSC::SourceOrigin(WTF::URL::fileURLWithFileSystemPath(toString(resolvedSource.source_url))),
- toStringNotConst(resolvedSource.source_url), TextPosition(),
+ JSC::SourceOrigin(WTF::URL::fileURLWithFileSystemPath(sourceURLString)),
+ sourceURLString.impl(), TextPosition(),
sourceType));
if (providerKey) {