diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /js/src/jsapi-tests | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jsapi-tests')
-rw-r--r-- | js/src/jsapi-tests/testCompileScript.cpp | 30 | ||||
-rw-r--r-- | js/src/jsapi-tests/testFrontendCompileStencil.cpp | 8 | ||||
-rw-r--r-- | js/src/jsapi-tests/testFrontendErrors.cpp | 6 | ||||
-rw-r--r-- | js/src/jsapi-tests/testStencil.cpp | 2 |
4 files changed, 14 insertions, 32 deletions
diff --git a/js/src/jsapi-tests/testCompileScript.cpp b/js/src/jsapi-tests/testCompileScript.cpp index 45f5e8301a..ff7432b14b 100644 --- a/js/src/jsapi-tests/testCompileScript.cpp +++ b/js/src/jsapi-tests/testCompileScript.cpp @@ -53,9 +53,8 @@ bool testCompile() { CHECK(buf16.init(cx, src_16.data(), src_16.length(), JS::SourceOwnership::Borrowed)); - JS::CompilationStorage compileStorage; RefPtr<JS::Stencil> stencil = - CompileGlobalScriptToStencil(fc, options, buf16, compileStorage); + CompileGlobalScriptToStencil(fc, options, buf16); CHECK(stencil); CHECK(stencil->scriptExtra.size() == 1); CHECK(stencil->scriptExtra[0].extent.sourceStart == 0); @@ -63,7 +62,6 @@ bool testCompile() { CHECK(stencil->scriptData.size() == 1); CHECK(stencil->scriptData[0].hasSharedData()); // has generated bytecode CHECK(stencil->scriptData[0].gcThingsLength == 1); - CHECK(compileStorage.hasInput()); } { // 8-bit characters @@ -71,9 +69,8 @@ bool testCompile() { CHECK( buf8.init(cx, src.data(), src.length(), JS::SourceOwnership::Borrowed)); - JS::CompilationStorage compileStorage; RefPtr<JS::Stencil> stencil = - CompileGlobalScriptToStencil(fc, options, buf8, compileStorage); + CompileGlobalScriptToStencil(fc, options, buf8); CHECK(stencil); CHECK(stencil->scriptExtra.size() == 1); CHECK(stencil->scriptExtra[0].extent.sourceStart == 0); @@ -81,7 +78,6 @@ bool testCompile() { CHECK(stencil->scriptData.size() == 1); CHECK(stencil->scriptData[0].hasSharedData()); // has generated bytecode CHECK(stencil->scriptData[0].gcThingsLength == 1); - CHECK(compileStorage.hasInput()); } { // propagates failures @@ -90,9 +86,8 @@ bool testCompile() { CHECK(srcBuf.init(cx, badSrc.data(), badSrc.length(), JS::SourceOwnership::Borrowed)); - JS::CompilationStorage compileStorage; RefPtr<JS::Stencil> stencil = - CompileGlobalScriptToStencil(fc, options, srcBuf, compileStorage); + CompileGlobalScriptToStencil(fc, options, srcBuf); CHECK(!stencil); CHECK(fc->maybeError().isSome()); const js::CompileError& error = fc->maybeError().ref(); @@ -120,9 +115,8 @@ bool testNonsyntacticCompile() { auto destroyFc = mozilla::MakeScopeExit([fc] { JS::DestroyFrontendContext(fc); }); - JS::CompilationStorage compileStorage; RefPtr<JS::Stencil> stencil = - CompileGlobalScriptToStencil(fc, options, srcBuf, compileStorage); + CompileGlobalScriptToStencil(fc, options, srcBuf); CHECK(stencil); JS::InstantiateOptions instantiateOptions(options); @@ -153,9 +147,8 @@ bool testCompileModule() { CHECK(buf16.init(cx, src_16.data(), src_16.length(), JS::SourceOwnership::Borrowed)); - JS::CompilationStorage compileStorage; RefPtr<JS::Stencil> stencil = - CompileModuleScriptToStencil(fc, options, buf16, compileStorage); + CompileModuleScriptToStencil(fc, options, buf16); CHECK(stencil); CHECK(stencil->isModule()); CHECK(stencil->scriptExtra.size() == 1); @@ -164,7 +157,6 @@ bool testCompileModule() { CHECK(stencil->scriptData.size() == 1); CHECK(stencil->scriptData[0].hasSharedData()); // has generated bytecode CHECK(stencil->scriptData[0].gcThingsLength == 1); - CHECK(compileStorage.hasInput()); } { // 8-bit characters @@ -172,9 +164,8 @@ bool testCompileModule() { CHECK( buf8.init(cx, src.data(), src.length(), JS::SourceOwnership::Borrowed)); - JS::CompilationStorage compileStorage; RefPtr<JS::Stencil> stencil = - CompileModuleScriptToStencil(fc, options, buf8, compileStorage); + CompileModuleScriptToStencil(fc, options, buf8); CHECK(stencil); CHECK(stencil->scriptExtra.size() == 1); CHECK(stencil->scriptExtra[0].extent.sourceStart == 0); @@ -182,7 +173,6 @@ bool testCompileModule() { CHECK(stencil->scriptData.size() == 1); CHECK(stencil->scriptData[0].hasSharedData()); // has generated bytecode CHECK(stencil->scriptData[0].gcThingsLength == 1); - CHECK(compileStorage.hasInput()); } { // propagates failures @@ -191,9 +181,8 @@ bool testCompileModule() { CHECK(srcBuf.init(cx, badSrc.data(), badSrc.length(), JS::SourceOwnership::Borrowed)); - JS::CompilationStorage compileStorage; RefPtr<JS::Stencil> stencil = - CompileModuleScriptToStencil(fc, options, srcBuf, compileStorage); + CompileModuleScriptToStencil(fc, options, srcBuf); CHECK(!stencil); CHECK(fc->maybeError().isSome()); const js::CompileError& error = fc->maybeError().ref(); @@ -220,15 +209,12 @@ bool testPrepareForInstantiate() { auto destroyFc = mozilla::MakeScopeExit([fc] { JS::DestroyFrontendContext(fc); }); - JS::CompilationStorage compileStorage; RefPtr<JS::Stencil> stencil = - CompileGlobalScriptToStencil(fc, options, buf16, compileStorage); + CompileGlobalScriptToStencil(fc, options, buf16); CHECK(stencil); CHECK(stencil->scriptData.size() == 2); CHECK(stencil->scopeData.size() == 1); // function f CHECK(stencil->parserAtomData.size() == 1); // 'field' - CHECK(compileStorage.hasInput()); - CHECK(compileStorage.getInput().atomCache.empty()); JS::InstantiationStorage storage; CHECK(JS::PrepareForInstantiate(fc, *stencil, storage)); diff --git a/js/src/jsapi-tests/testFrontendCompileStencil.cpp b/js/src/jsapi-tests/testFrontendCompileStencil.cpp index ba29b5aea2..39e46ba0b1 100644 --- a/js/src/jsapi-tests/testFrontendCompileStencil.cpp +++ b/js/src/jsapi-tests/testFrontendCompileStencil.cpp @@ -41,11 +41,9 @@ BEGIN_FRONTEND_TEST(testFrontendContextCompileGlobalScriptToStencil) { JS::SourceText<mozilla::Utf8Unit> srcBuf; CHECK( srcBuf.init(fc, source, strlen(source), JS::SourceOwnership::Borrowed)); - JS::CompilationStorage compileStorage; RefPtr<JS::Stencil> stencil = - JS::CompileGlobalScriptToStencil(fc, options, srcBuf, compileStorage); + JS::CompileGlobalScriptToStencil(fc, options, srcBuf); CHECK(stencil); - CHECK(compileStorage.hasInput()); } { @@ -54,11 +52,9 @@ BEGIN_FRONTEND_TEST(testFrontendContextCompileGlobalScriptToStencil) { JS::SourceText<char16_t> srcBuf; CHECK(srcBuf.init(fc, source, std::char_traits<char16_t>::length(source), JS::SourceOwnership::Borrowed)); - JS::CompilationStorage compileStorage; RefPtr<JS::Stencil> stencil = - JS::CompileGlobalScriptToStencil(fc, options, srcBuf, compileStorage); + JS::CompileGlobalScriptToStencil(fc, options, srcBuf); CHECK(stencil); - CHECK(compileStorage.hasInput()); } JS::DestroyFrontendContext(fc); diff --git a/js/src/jsapi-tests/testFrontendErrors.cpp b/js/src/jsapi-tests/testFrontendErrors.cpp index c9d3ee1eb5..47acf559d7 100644 --- a/js/src/jsapi-tests/testFrontendErrors.cpp +++ b/js/src/jsapi-tests/testFrontendErrors.cpp @@ -51,9 +51,8 @@ BEGIN_TEST(testFrontendErrors_error) { JS::SourceText<mozilla::Utf8Unit> srcBuf; CHECK( srcBuf.init(fc, source, strlen(source), JS::SourceOwnership::Borrowed)); - JS::CompilationStorage compileStorage; RefPtr<JS::Stencil> stencil = - JS::CompileGlobalScriptToStencil(fc, options, srcBuf, compileStorage); + JS::CompileGlobalScriptToStencil(fc, options, srcBuf); CHECK(!stencil); } @@ -133,9 +132,8 @@ BEGIN_TEST(testFrontendErrors_warning) { JS::SourceText<mozilla::Utf8Unit> srcBuf; CHECK( srcBuf.init(fc, source, strlen(source), JS::SourceOwnership::Borrowed)); - JS::CompilationStorage compileStorage; RefPtr<JS::Stencil> stencil = - JS::CompileGlobalScriptToStencil(fc, options, srcBuf, compileStorage); + JS::CompileGlobalScriptToStencil(fc, options, srcBuf); CHECK(stencil); } diff --git a/js/src/jsapi-tests/testStencil.cpp b/js/src/jsapi-tests/testStencil.cpp index ab89222ebd..7d6b78d7d8 100644 --- a/js/src/jsapi-tests/testStencil.cpp +++ b/js/src/jsapi-tests/testStencil.cpp @@ -85,6 +85,8 @@ bool basic_test(const CharT* chars) { CHECK(srcBuf.init(cx, chars, length, JS::SourceOwnership::Borrowed)); JS::CompileOptions options(cx); + options.setFile("testStencil_Module"); + RefPtr<JS::Stencil> stencil = JS::CompileModuleScriptToStencil(cx, options, srcBuf); CHECK(stencil); |