aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-07-19 22:53:28 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-07-19 22:53:28 -0700
commited8be46a7bf00321b4a10571e245e8fd744676d9 (patch)
treec8de521c4970a5b6c918103d202572e329177018 /src
parent36866c4d7941d36656ab684e4dccecab2f06ebef (diff)
downloadbun-ed8be46a7bf00321b4a10571e245e8fd744676d9.tar.gz
bun-ed8be46a7bf00321b4a10571e245e8fd744676d9.tar.zst
bun-ed8be46a7bf00321b4a10571e245e8fd744676d9.zip
Inline`bun` object from workers
Diffstat (limited to 'src')
-rw-r--r--src/bun.js/bindings/webcore/JSWorker.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/bun.js/bindings/webcore/JSWorker.cpp b/src/bun.js/bindings/webcore/JSWorker.cpp
index bcf670d63..4ddd97520 100644
--- a/src/bun.js/bindings/webcore/JSWorker.cpp
+++ b/src/bun.js/bindings/webcore/JSWorker.cpp
@@ -137,19 +137,15 @@ template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSWorkerDOMConstructor::const
}
}
- if (auto bunValue = optionsObject->getIfPropertyExists(lexicalGlobalObject, Identifier::fromString(vm, "bun"_s))) {
- if (bunValue.isObject()) {
- if (auto* bunObject = bunValue.getObject()) {
- if (auto miniModeValue = bunObject->getIfPropertyExists(lexicalGlobalObject, Identifier::fromString(vm, "smol"_s))) {
- options.bun.mini = miniModeValue.toBoolean(lexicalGlobalObject);
- RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
- }
-
- if (auto ref = bunObject->getIfPropertyExists(lexicalGlobalObject, Identifier::fromString(vm, "ref"_s))) {
- options.bun.unref = !ref.toBoolean(lexicalGlobalObject);
- RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
- }
- }
+ if (auto* bunObject = optionsObject) {
+ if (auto miniModeValue = bunObject->getIfPropertyExists(lexicalGlobalObject, Identifier::fromString(vm, "smol"_s))) {
+ options.bun.mini = miniModeValue.toBoolean(lexicalGlobalObject);
+ RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+ }
+
+ if (auto ref = bunObject->getIfPropertyExists(lexicalGlobalObject, Identifier::fromString(vm, "ref"_s))) {
+ options.bun.unref = !ref.toBoolean(lexicalGlobalObject);
+ RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
}
}
}