From 90d68d4bf752c7f664554be230f0e54bc7285620 Mon Sep 17 00:00:00 2001 From: Tomasz Andrzejak Date: Thu, 31 Oct 2024 14:14:28 +0100 Subject: [PATCH] Fix default options tests --- builtins/web/blob.cpp | 8 +++++--- .../FileAPI/blob/Blob-constructor.any.js.json | 16 ++++++++-------- tests/wpt-harness/wpt.cmake | 14 +++++++------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/builtins/web/blob.cpp b/builtins/web/blob.cpp index 35475d0..dc30145 100644 --- a/builtins/web/blob.cpp +++ b/builtins/web/blob.cpp @@ -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); } @@ -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) { @@ -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; diff --git a/tests/wpt-harness/expectations/FileAPI/blob/Blob-constructor.any.js.json b/tests/wpt-harness/expectations/FileAPI/blob/Blob-constructor.any.js.json index 436677a..a91f3e0 100644 --- a/tests/wpt-harness/expectations/FileAPI/blob/Blob-constructor.any.js.json +++ b/tests/wpt-harness/expectations/FileAPI/blob/Blob-constructor.any.js.json @@ -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" diff --git a/tests/wpt-harness/wpt.cmake b/tests/wpt-harness/wpt.cmake index 23e9368..b536159 100644 --- a/tests/wpt-harness/wpt.cmake +++ b/tests/wpt-harness/wpt.cmake @@ -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