Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions build/wpt_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ PORT_BINDINGS = [
### (Invokes wpt_js_test_gen, wpt_wd_test_gen and wd_test to assemble a complete test suite.)
### -----------------------------------------------------------------------------------------

def wpt_test(name, wpt_directory, config, compat_date = "", compat_flags = [], autogates = [], start_server = False, **kwargs):
def wpt_test(name, wpt_directory, config, compat_date = "", compat_flags = [], autogates = [], start_server = False, include_tentative = False, **kwargs):
"""
Main entry point.

Expand Down Expand Up @@ -51,6 +51,7 @@ def wpt_test(name, wpt_directory, config, compat_date = "", compat_flags = [], a
wpt_directory = wpt_directory,
test_config = test_config_as_js,
wpt_tsproject = wpt_tsproject,
include_tentative = include_tentative,
)

wd_test_gen_rule = "{}@_wpt_wd_test_gen".format(name)
Expand Down Expand Up @@ -153,7 +154,7 @@ def _wpt_js_test_gen_impl(ctx):
base = ctx.attr.wpt_directory[WPTModuleInfo].base

files = ctx.attr.wpt_directory.files.to_list()
test_files = [file for file in files if is_test_file(file)]
test_files = [file for file in files if is_test_file(file, ctx.attr.include_tentative)]

ctx.actions.write(
output = src,
Expand All @@ -180,6 +181,8 @@ _wpt_js_test_gen = rule(
"test_config": attr.label(allow_single_file = True),
# Dependency: The ts_project rule that compiles the tests to JS
"wpt_tsproject": attr.label(),
# Whether to include tentative test files
"include_tentative": attr.bool(default = False),
},
)

Expand All @@ -196,7 +199,7 @@ const {{ run, printResults }} = createRunner(config, '{test_name}', allTestFiles
export const zzz_results = printResults();
"""

def is_test_file(file):
def is_test_file(file, include_tentative = False):
if not file.path.endswith(".js"):
# Not JS code, not a test
return False
Expand All @@ -207,7 +210,7 @@ def is_test_file(file):
# into the main directory, and would need to manually be marked as skipAllTests
return False

if ".tentative." in file.path or "/tentative/" in file.path:
if not include_tentative and (".tentative." in file.path or "/tentative/" in file.path):
# Tentative tests are for proposed features that are not yet standardized.
# We skip these to avoid noise from unstable specifications.
return False
Expand Down
23 changes: 4 additions & 19 deletions src/workerd/api/crypto/aes.c++
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,6 @@ auto lookupAesGcmType(uint bitLength) {
}
}

// Ensure the tagLength passed to the AES-GCM algorithm is one of the allowed bit lengths.
void validateAesGcmTagLength(int tagLength) {
switch (tagLength) {
case 32:
case 64:
case 96:
case 104:
case 112:
case 120:
case 128:
break;
default:
JSG_FAIL_REQUIRE(DOMOperationError, "Invalid AES-GCM tag length ", tagLength, ".");
}
}

int decryptFinalHelper(kj::StringPtr algorithm,
size_t inputLength,
size_t outputLength,
Expand Down Expand Up @@ -151,8 +135,9 @@ class AesKeyBase: public CryptoKey::Impl {
}

SubtleCrypto::ExportKeyData exportKey(jsg::Lock& js, kj::StringPtr format) const override final {
JSG_REQUIRE(format == "raw" || format == "jwk", DOMNotSupportedError, getAlgorithmName(),
" key only supports exporting \"raw\" & \"jwk\", not \"", format, "\".");
JSG_REQUIRE(format == "raw" || format == "raw-secret" || format == "jwk", DOMNotSupportedError,
getAlgorithmName(),
" key only supports exporting \"raw\", \"raw-secret\" & \"jwk\", not \"", format, "\".");

if (format == "jwk") {
auto lengthInBytes = keyData.size();
Expand Down Expand Up @@ -786,7 +771,7 @@ kj::Own<CryptoKey::Impl> CryptoKey::Impl::importAes(jsg::Lock& js,

kj::Array<kj::byte> keyDataArray;

if (format == "raw") {
if (format == "raw" || format == "raw-secret") {
// NOTE: Checked in SubtleCrypto::importKey().
auto& source = keyData.get<jsg::JsRef<jsg::JsBufferSource>>();
auto handle = source.getHandle(js);
Expand Down
Loading
Loading