summaryrefslogtreecommitdiff
path: root/Libraries/LibJS
AgeCommit message (Collapse)Author
2020-08-05Unicode: Try s/codepoint/code_point/g againNico Weber
This time, without trailing 's'. Ran: git grep -l 'codepoint' | xargs sed -ie 's/codepoint/code_point/g
2020-08-05Revert "Unicode: s/codepoint/code_point/g"Nico Weber
This reverts commit ea9ac3155d1774f13ac4e9a96605c0e85a8f299e. It replaced "codepoint" with "code_points", not "code_point".
2020-08-04LibJS: The Math.ceil() of a number between -1 and 0 should be -0,Melissa Goad
according to the spec.
2020-08-03Unicode: s/codepoint/code_point/gAndreas Kling
Unicode calls them "code points" so let's follow their style.
2020-07-28LibJS: Soothe gcc about printf-%s on (non-)nullptrBen Wiederhake
2020-07-25LibJS: Use allocate_without_global_object for primitive cell typesAndreas Kling
More steps towards multiple global object support. Primitive cells like strings, bigints, etc, don't actually have any connection to the global object. Use the explicit API to clarify this.
2020-07-23Browser: Escape JS source operators for HTML display in consoleNico Weber
Console inputs to try before and after this patch: - `0xffff & 0xff` - `"a & b"` - `"<div>"` - `a &` (to see the escaping in the error hint)
2020-07-23LibJS: Simplify Cell::initialize()Andreas Kling
Remove the Interpreter& argument and pass only GlobalObject&. We can find everything we need via the global object anyway.
2020-07-23LibJS: Add tests for bitwise & and ^Nico Weber
And fix some edge case conversion bugs found by the tests.
2020-07-22LibWeb: Make btoa() and atob() correctly handle values between 128 and 255Nico Weber
btoa() takes a byte string, so it must decode the UTF-8 argument into a Vector<u8> before calling encode_base64. Likewise, in atob() decode_base64 returns a byte string, so that needs to be converted to UTF-8. With this, `btoa(String.fromCharCode(255))` is '/w==' as it should be, and `atob(btoa(String.fromCharCode(255))) == String.fromCharCode(255)` remains true.
2020-07-22LibJS: Fix \x escapes of bytes with high bit setNico Weber
With this, typing `"\xff"` into Browser's console no longer makes the app crash. While here, also make the \u handler call append_codepoint() instead of calling an overload where it's not immediately clear which overload is getting called. This has no behavior change.
2020-07-22LibJS: Add FIXMEs to a few functions that need UTF-16 handlingNico Weber
2020-07-22LibJS: Implement String.prototype.charCodeAtNico Weber
It's broken for strings with characters outside 7-bit ASCII, but it's broken in the same way as several existing functions (e.g. charAt()), so that's probably ok for now.
2020-07-15LibJS: Add Number.prototype.toStringMatthew Olsson
2020-07-14LibJS: Add Symbol.hasInstance testsMatthew Olsson
2020-07-14LibJS: Implement Symbol.hasInstanceMatthew Olsson
2020-07-14LibJS: Implement spec-complient instance_of operationMatthew Olsson
2020-07-14LibJS: Integrate iterator protocol into language featuresMatthew Olsson
Finally use Symbol.iterator protocol in language features :) currently only used in for-of loops and spread expressions, but will have more uses later (Maps, Sets, Array.from, etc).
2020-07-13LibJS: Add String Iterator testsMatthew Olsson
2020-07-13LibJS: Add StringIteratorMatthew Olsson
2020-07-11LibJS: Implement Symbol.toStringTagMatthew Olsson
2020-07-11LibJS: Implement spec-compliant Object.prototype.toStringMatthew Olsson
2020-07-11LibJS: Prefer "define_property" over "put"Matthew Olsson
2020-07-11LibJS: Use macros to enumerate well-known symbolsMatthew Olsson
Not only is this a much nicer api (can't pass a typo'd string into the get_well_known_symbol function), it is also a bit more performant since there are no hashmap lookups.
2020-07-11LibJS: Start implementing iterable framework, add ArrayIteratorMatthew Olsson
With the addition of symbol keys, work can now be done on starting to implement the well-known symbol functionality. The most important of these well-known symbols is by far Symbol.iterator. This patch adds IteratorPrototype, as well as ArrayIterator and ArrayIteratorPrototype. In the future, sometime after StringIterator has also been added, this will allow us to use Symbol.iterator directly in for..of loops, enabling the use of custom iterator objects. Also makes adding iterator support to native objects much easier (as will have to be done for Map and Set, when they get added).
2020-07-11LibJS: Renamed Object::GetOwnPropertyReturnMode to Object::PropertyKindMatthew Olsson
This enum will be used by iterators, so it makes sense to use a more general name.
2020-07-11LibJS: Remove a few superfluous exception checksLinus Groh
We don't need to check for exceptions when defining properties on an array we literally created ourselves a few lines earlier.
2020-07-09LibJS: Add tests for symbol object integrationMatthew Olsson
2020-07-09LibJS: Integrate Symbols into objects as valid keysMatthew Olsson
This allows objects properties to be created for symbol keys in addition to just plain strings/numbers
2020-07-09LibJS: Add test for well-known symbolsMatthew Olsson
2020-07-09LibJS: Uncomment remaining symbol testsMatthew Olsson
2020-07-09LibJS: Move global symbol map from SymbolObject to InterpreterMatthew Olsson
This allows different instances of the Interpreter to have their own global symbols. Also makes Symbol non-copyable and non-moveable.
2020-07-07LibJS: Object.preventExtensions should allow property modficationMatthew Olsson
Existing properties on a non-extensible object should be changable and deletable.
2020-07-06LibJS: Convert Array tests to new testing frameworkLinus Groh
2020-07-06LibJS: Split isNaN tests into multiple sectionsLinus Groh
2020-07-06LibJS: Indent tests with 4 spaces instead of 2Matthew Olsson
2020-07-06LibJS: Convert all remaining non-Array tests to the new system :)Matthew Olsson
2020-07-06LibJS: Convert remaining top-level tests to new systemMatthew Olsson
2020-07-06test-js: Use prettier and format all filesMatthew Olsson
2020-07-06test-js: Display messages from console.log in test outputMatthew Olsson
This will help greatly with debugging!
2020-07-06test-js: Allow skipping tests with "test.skip(name, callback)"Matthew Olsson
Skipped tests count as a "pass" rather than a "fail" (i.e. a test suite with a skipped test will pass), however it does display a message when the test is printing. This is intended for tests which _should_ work, but currently do not. This should be preferred over "// FIXME" notes if possible.
2020-07-06test-js: Remove run-tests.shMatthew Olsson
The shell script is no longer necessary -- simply run "test-js" from inside Serenity, or $SERENITY_ROOT/Build/Meta/Lagom/test-js from the host.
2020-07-06LibJS/test-js: Clean up test-js codeMatthew Olsson
This commit also exposes JSONObject's implementation of stringify to the public, so that it can be used by test-js without having to go through the interpreter's environment.
2020-07-06LibJS: Fix String.raw.lengthMatthew Olsson
2020-07-06LibJS: Convert most builtin tests to new systemMatthew Olsson
2020-07-06LibJS: Convert Reflect object tests to new testing frameworkLinus Groh
2020-07-06LibJS: Add more test matchersMatthew Olsson
2020-07-06LibJS: Hide some debug output behind flagsMatthew Olsson
This hides some Object.cpp output, as well as removing the "debugger" debug output.
2020-07-06LibJS: Convert Proxy testsMatthew Olsson
2020-07-06LibJS: Add test-common.js tests, remove unused matchersMatthew Olsson
Now that test-common.js is quite a bit more complicated, we need tests for test-common to make sure all of the matchers behave correctly