From 268711e9a5ed84270b5eaabc99074357e6b869e2 Mon Sep 17 00:00:00 2001 From: Toshit Chawda Date: Sat, 7 Sep 2024 12:40:53 -0700 Subject: [PATCH] chrome 60? support --- client/build.sh | 10 +++++++--- client/src/utils.rs | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/client/build.sh b/client/build.sh index ebdcfb1..003b763 100755 --- a/client/build.sh +++ b/client/build.sh @@ -23,12 +23,14 @@ else WASMOPTFLAGS="" fi +mv out/epoxy_client_bg.wasm out/epoxy_client_unoptimized.wasm +wasm-opt --signext-lowering out/epoxy_client_unoptimized.wasm -o out/epoxy_client_lowered.wasm + if [ "${RELEASE:-0}" = "1" ]; then - mv out/epoxy_client_bg.wasm out/epoxy_client_unoptimized.wasm ( G="--generate-global-effects" time wasm-opt $WASMOPTFLAGS \ - out/epoxy_client_unoptimized.wasm -o out/epoxy_client_bg.wasm \ + out/epoxy_client_lowered.wasm -o out/epoxy_client_bg.wasm \ --converge \ $G --type-unfinalizing $G --type-ssa $G -O4 $G --flatten $G --rereloop $G -O4 $G -O4 $G --type-merging $G --type-finalizing $G -O4 \ $G --type-unfinalizing $G --type-ssa $G -Oz $G --flatten $G --rereloop $G -Oz $G -Oz $G --type-merging $G --type-finalizing $G -Oz \ @@ -36,6 +38,8 @@ if [ "${RELEASE:-0}" = "1" ]; then $G --type-unfinalizing $G --type-ssa $G -O4 $G --flatten $G --rereloop $G -O4 $G -O4 $G --type-merging $G --type-finalizing $G -O4 \ $G --type-unfinalizing $G --type-ssa $G -Oz $G --flatten $G --rereloop $G -Oz $G -Oz $G --type-merging $G --type-finalizing $G -Oz ) +else + mv out/epoxy_client_lowered.wasm out/epoxy_client_bg.wasm fi echo "[epx] wasm-opt finished" @@ -77,7 +81,7 @@ echo "$AUTOGENERATED_SOURCE" > pkg/epoxy.js echo "$AUTOGENERATED_INFO_FUNC" >> pkg/epoxy.js WASM_BASE64=$(base64 -w0 out/epoxy_client_bg.wasm) -AUTOGENERATED_SOURCE=${AUTOGENERATED_SOURCE//__wbg_init(module_or_path, memory) \{/__wbg_init(module_or_path, memory) \{$'\n\t'module_or_path ||= $'{};\n\t'module_or_path.module_or_path=new URL(\'data:application/wasm;base64,$WASM_BASE64\')} +AUTOGENERATED_SOURCE=${AUTOGENERATED_SOURCE//__wbg_init(module_or_path) \{/__wbg_init(module_or_path) \{$'\n\t'module_or_path ||= $'{};\n\t'module_or_path.module_or_path=new URL(\'data:application/wasm;base64,$WASM_BASE64\')} echo "$AUTOGENERATED_SOURCE" > pkg/epoxy-bundled.js echo "$AUTOGENERATED_INFO_FUNC" >> pkg/epoxy-bundled.js diff --git a/client/src/utils.rs b/client/src/utils.rs index ac37545..466f4c6 100644 --- a/client/src/utils.rs +++ b/client/src/utils.rs @@ -312,7 +312,7 @@ pub fn is_null_body(code: u16) -> bool { export function object_get(obj, k) { try { return obj[k] - } catch { + } catch(x) { return undefined } };