diff options
author | 2022-07-05 00:55:24 -0700 | |
---|---|---|
committer | 2022-07-05 00:55:24 -0700 | |
commit | 9137862bc7777ce5fed0e155e11eb5d04957a839 (patch) | |
tree | c139a5cb555fd75c4436b6a24c58c6595d9af4fd /src/bun.js | |
parent | 288178e94c7ca93f026c70f0b0cd4fb32c63e98f (diff) | |
download | bun-9137862bc7777ce5fed0e155e11eb5d04957a839.tar.gz bun-9137862bc7777ce5fed0e155e11eb5d04957a839.tar.zst bun-9137862bc7777ce5fed0e155e11eb5d04957a839.zip |
Fix crash in dynamic import?
Diffstat (limited to 'src/bun.js')
-rw-r--r-- | src/bun.js/bindings/ZigSourceProvider.cpp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/bun.js/bindings/ZigSourceProvider.cpp b/src/bun.js/bindings/ZigSourceProvider.cpp index c2959a8fa..3a313a0c1 100644 --- a/src/bun.js/bindings/ZigSourceProvider.cpp +++ b/src/bun.js/bindings/ZigSourceProvider.cpp @@ -27,24 +27,20 @@ using SourceOrigin = JSC::SourceOrigin; using String = WTF::String; using SourceProviderSourceType = JSC::SourceProviderSourceType; -static char* wasmSourceName = "[WebAssembly Source]"; -static size_t wasmSourceName_len = 20; - Ref<SourceProvider> SourceProvider::create(ResolvedSource resolvedSource) { void* allocator = resolvedSource.allocator; JSC::SourceProviderSourceType sourceType = JSC::SourceProviderSourceType::Module; - // JSC owns the memory - if (resolvedSource.hash == 1) { - Ref<WTF::StringImpl> stringImpl_ = WTF::StringImpl::create(resolvedSource.source_code.ptr, resolvedSource.source_code.len); - return adoptRef(*new SourceProvider( - resolvedSource, WTFMove(stringImpl_), - JSC::SourceOrigin(WTF::URL::fileURLWithFileSystemPath(toString(resolvedSource.source_url))), - toStringNotConst(resolvedSource.source_url), TextPosition(), - sourceType)); - } + // // JSC owns the memory + // if (resolvedSource.hash == 1) { + // return adoptRef(*new SourceProvider( + // resolvedSource, WTF::StringImpl::create(resolvedSource.source_code.ptr, resolvedSource.source_code.len), + // JSC::SourceOrigin(WTF::URL::fileURLWithFileSystemPath(toString(resolvedSource.source_url))), + // toStringNotConst(resolvedSource.source_url).isolatedCopy(), TextPosition(), + // sourceType)); + // } if (allocator) { Ref<WTF::ExternalStringImpl> stringImpl_ = WTF::ExternalStringImpl::create( @@ -52,7 +48,7 @@ Ref<SourceProvider> SourceProvider::create(ResolvedSource resolvedSource) allocator, RefString__free); return adoptRef(*new SourceProvider( - resolvedSource, WTFMove(stringImpl_), + resolvedSource, stringImpl_, JSC::SourceOrigin(WTF::URL::fileURLWithFileSystemPath(toString(resolvedSource.source_url))), toStringNotConst(resolvedSource.source_url), TextPosition(), sourceType)); @@ -60,7 +56,7 @@ Ref<SourceProvider> SourceProvider::create(ResolvedSource resolvedSource) Ref<WTF::ExternalStringImpl> stringImpl_ = WTF::ExternalStringImpl::createStatic( resolvedSource.source_code.ptr, resolvedSource.source_code.len); return adoptRef(*new SourceProvider( - resolvedSource, WTFMove(stringImpl_), + resolvedSource, stringImpl_, JSC::SourceOrigin(WTF::URL::fileURLWithFileSystemPath(toString(resolvedSource.source_url))), toStringNotConst(resolvedSource.source_url), TextPosition(), sourceType)); |