diff --git a/CMakeLists.txt b/CMakeLists.txt index 26316b2..895552d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -128,7 +128,7 @@ function(componentize OUTPUT) add_custom_command( OUTPUT ${OUTPUT}.wasm WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${CMAKE_COMMAND} -E env "PATH=${WASM_TOOLS_DIR};${WIZER_DIR};$ENV{PATH}" ${RUNTIME_DIR}/componentize.sh ${SOURCES} -o ${OUTPUT}.wasm + COMMAND ${CMAKE_COMMAND} ${RUNTIME_DIR}/componentize.sh ${SOURCES} -o ${OUTPUT}.wasm DEPENDS ${ARG_SOURCES} ${RUNTIME_DIR}/componentize.sh starling.wasm VERBATIM ) diff --git a/builtins/web/fetch/headers.cpp b/builtins/web/fetch/headers.cpp index 085a99c..6751740 100644 --- a/builtins/web/fetch/headers.cpp +++ b/builtins/web/fetch/headers.cpp @@ -101,7 +101,15 @@ host_api::HostString normalize_and_validate_header_value(JSContext *cx, HandleVa } bool valid = normalize_header_value(value); if (!valid) { - api::throw_error(cx, FetchErrors::InvalidHeaderValue, fun_name, value.begin()); + // need to coerce to utf8 to report the error value + JS::RootedString str(cx, JS::ToString(cx, value_val)); + if (!str) { + return host_api::HostString{}; + } + auto maybe_utf8 = core::encode(cx, str); + if (maybe_utf8) { + api::throw_error(cx, FetchErrors::InvalidHeaderValue, fun_name, maybe_utf8.begin()); + } return host_api::HostString{}; } return value; diff --git a/componentize.sh b/componentize.sh index e57f328..729a5cb 100755 --- a/componentize.sh +++ b/componentize.sh @@ -2,8 +2,8 @@ #set -euo pipefail -wizer="${WIZER:-wizer}" -wasm_tools="${WASM_TOOLS:-wasm-tools}" +wizer="${WIZER:-@WIZER_DIR@/wizer}" +wasm_tools="${WASM_TOOLS:-@WASM_TOOLS_BIN@}" weval="${WEVAL:-@WEVAL_BIN@}" aot=@AOT@ preopen_dir="${PREOPEN_DIR:-}"