Skip to content

Commit

Permalink
Fix default options tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiltd committed Oct 31, 2024
1 parent 48df322 commit 90d68d4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
8 changes: 5 additions & 3 deletions builtins/web/blob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ JSString* normalize_type(JSContext *cx, HandleValue value) {
return JS::ToString(cx, value);
}

if (value.isUndefined()) {
if (value.isUndefined() || !value.isString()) {
return JS_GetEmptyString(cx);
}

Expand Down Expand Up @@ -394,7 +394,8 @@ bool Blob::init_options(JSContext *cx, HandleObject self, HandleValue initv) {
}

if (!has_type && !has_endings) {
return false;
// Use defaults
return true;
}

if (has_type) {
Expand Down Expand Up @@ -424,7 +425,8 @@ bool Blob::init_options(JSContext *cx, HandleObject self, HandleValue initv) {
}

if (!is_transparent && !is_native) {
return false;
// Use defaults
return true;
}

auto endings = is_native ? Blob::Endings::Native : Blob::Endings::Transparent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,28 +102,28 @@
"status": "PASS"
},
"Passing object \"[object Object]\" (index 2) for options should use the defaults.": {
"status": "FAIL"
"status": "PASS"
},
"Passing object \"[object Object]\" (index 2) for options should use the defaults (with newlines).": {
"status": "FAIL"
"status": "PASS"
},
"Passing object \"[object Object]\" (index 3) for options should use the defaults.": {
"status": "FAIL"
"status": "PASS"
},
"Passing object \"[object Object]\" (index 3) for options should use the defaults (with newlines).": {
"status": "FAIL"
"status": "PASS"
},
"Passing object \"/regex/\" (index 4) for options should use the defaults.": {
"status": "FAIL"
"status": "PASS"
},
"Passing object \"/regex/\" (index 4) for options should use the defaults (with newlines).": {
"status": "FAIL"
"status": "PASS"
},
"Passing function \"function() {}\" (index 5) for options should use the defaults.": {
"status": "FAIL"
"status": "PASS"
},
"Passing function \"function() {}\" (index 5) for options should use the defaults (with newlines).": {
"status": "FAIL"
"status": "PASS"
},
"Passing 123 for options should throw": {
"status": "PASS"
Expand Down
14 changes: 7 additions & 7 deletions tests/wpt-harness/wpt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ endif()
if(DEFINED ENV{WPT_ROOT})
set(WPT_ROOT $ENV{WPT_ROOT})
else()
CPMAddPackage(
NAME wpt-suite
GITHUB_REPOSITORY web-platform-tests/wpt
GIT_TAG 04d2e6c42ddce90925d73a076f6cfdd5786e8e54
DOWNLOAD_ONLY TRUE
)
set(WPT_ROOT ${CPM_PACKAGE_wpt-suite_SOURCE_DIR})
CPMAddPackage(
NAME wpt-suite
GITHUB_REPOSITORY web-platform-tests/wpt
GIT_TAG 04d2e6c42ddce90925d73a076f6cfdd5786e8e54
DOWNLOAD_ONLY TRUE
)
set(WPT_ROOT ${CPM_PACKAGE_wpt-suite_SOURCE_DIR})
endif()

add_builtin(wpt_support
Expand Down

0 comments on commit 90d68d4

Please sign in to comment.