summaryrefslogtreecommitdiff
path: root/Tests/LibJS
AgeCommit message (Collapse)Author
2022-01-04Tests: Link some tests directly against LibUnicodeDataTimothy Flynn
These were missed in 565a880ce5a14bac817c73916e91ebfa04c8b99b. This wasn't an issue because these tests don't pledge/unveil anything, so they could happily dlopen() the library at runtime. But this is now needed in order to migrate LibUnicode towards weak symbols instead.
2021-12-30LibJS: Convert resolve_binding() to ThrowCompletionOrdavidot
The spec has a note stating that resolve binding will always return a reference whose [[ReferencedName]] field is name. However this is not correct as the underlying method GetIdentifierReference may throw on env.HasBinding(name) thus it can throw. However, there are some scenarios where it cannot throw because the reference is known to exist in that case we use MUST with a comment.
2021-12-29LibJS: Detect invalid unicode and stop lexing at that pointdavidot
Previously we might swallow invalid unicode point which would skip valid ascii characters. This could be dangerous as we might skip a '"' thus not closing a string where we should. This might have been exploitable as it would not have been clear what code gets executed when looking at a script. Another approach to this would be simply replacing all invalid characters with the replacement character (this is what v8 does). But our lexer and parser are currently not set up for such a change.
2021-12-05Tests: Cast unused smart-pointer return values to voidSam Atkins
2021-11-11Everywhere: Pass AK::StringView by valueAndreas Kling
2021-11-02LibJS: Convert the GetValue AO to ThrowCompletionOrIdan Horowitz
2021-11-02LibJS: Convert reference deletion to ThrowCompletionOrIdan Horowitz
2021-10-20LibJS: Convert test-js/test-web/test-wasm to ThrowCompletionOrIdan Horowitz
2021-10-13LibJS: Convert to_object() to ThrowCompletionOrLinus Groh
2021-10-13LibJS: Convert to_string() to ThrowCompletionOrLinus Groh
Also update get_function_name() to use ThrowCompletionOr, but this is not a standard AO and should be refactored out of existence eventually.
2021-10-03LibJS: Add a specific test for invalid unicode characters in the lexerdavidot
Also fixes that it tried to make substrings past the end of the source if we overran the source length.
2021-09-30LibJS + test-js: Get results from the global object directlydavidot
This is as the spec would require you to do it and necessary for changes to come in the following commits.
2021-09-14LibJS+LibTest: Use JS::Script and JS::SourceTextModule in test-jsAndreas Kling
Instead of creating a Parser and Lexer manually in test-js, we now use either JS::Script::parse() or JS::SourceTextModule::parse() to load tests.
2021-09-12LibJS: Use ErrorType::NotAnObjectOfType instead of NotATimothy Flynn
2021-09-08test-js: Add a mark_as_garbage method to force GC to collect that objectdavidot
This should fix the flaky tests of test-js. It also fixes the tests when running with the -g flag since the values will not be garbage collected too soon.
2021-08-15LibJS: Add a mode to parse JS as a moduledavidot
In a module strict mode should be enabled at the start of parsing and we allow import and export statements.
2021-06-30Userland+Tests: Split out generic test runner from JS TestRunnerAndrew Kaster
Split out the functionality to gather multiple tests from the filesystem and run them in turn into Test::TestRunner, and leave the JavaScript specific test harness logic in Test::JS::TestRunner and friends.
2021-06-17Everywhere: Add component declarationsGunnar Beutner
This adds component declarations so that users can select to not build certain parts of the OS.
2021-06-12LibJS: Add all of the WeakMap.prototype methods (delete, get, has, set)Idan Horowitz
2021-06-09LibJS: Notify WeakSets when heap cells are sweepedIdan Horowitz
This is an implementation of the following optional optimization: https://tc39.es/ecma262/#sec-weakref-execution
2021-05-30LibTest+test-js: Add back the lost test262 parser test optionAli Mohammad Pur
Fixes #7566.
2021-05-18LibJS+LibTest: Move out the test-js test runner into LibTestAli Mohammad Pur
2021-05-14Tests: Don't use TestRunners after their scope ends in test-jsAndrew Kaster
The TestRunner objects at the end of test-js are destroyed after the if/else that chooses whether to run the 262 parser tests or the standard tests. Accessing TestRunner::the() after the lifetime of the TestRunners ends is UB, so return the Test::Counts from run() instead. Also, fix the destructor of TestRunner to set s_the to nullptr so that if anyone tries this type of shenanigains again, they'll get a crash :^).
2021-05-12LibCore+Everywhere: Move OpenMode out of IODeviceAli Mohammad Pur
...and make it an enum class so people don't omit "OpenMode".
2021-05-09Tests: Fix install of test-js and test-webBrian Gianforcaro
When these were moved, there was a copy paste bug in the install directives of both of these binaries.
2021-05-08Tests: Move Userland/Utilities/test-js to Tests/LibJSBrian Gianforcaro