summaryrefslogtreecommitdiff
path: root/Userland
AgeCommit message (Collapse)Author
2020-04-10JS repl: Fix indentation when a line starts with '})]'AnotherTest
2020-04-09LibJS: Add globalThisLinus Groh
We already have "global" as a way to access the global object in js(1) (both REPL and script mode). This replaces it with "globalThis", which is available in all environments, not just js.
2020-04-08LibJS: Handle empty values in Value::to_string()Linus Groh
2020-04-06LibJS: Support array holes, encoded as empty JS::ValueAndreas Kling
This patch adds a new kind of JS::Value, the empty value. It's what you get when you do JSValue() (or most commonly, {} in C++.) An empty Value signifies the absence of a value, and should never be visible to JavaScript itself. As of right now, it's used for array holes and as a return value when an exception has been thrown and we just want to unwind. This patch is a bit of a mess as I had to fix a whole bunch of code that was relying on JSValue() being undefined, etc.
2020-04-06LibJS: Add a number-indexed property storage to all ObjectsAndreas Kling
Objects can have both named and indexed properties. Previously we kept all property names as strings. This patch separates named and indexed properties and splits them between Object::m_storage and m_elements. This allows us to do much faster array-style access using numeric indices. It also makes the Array class much less special, since all Objects now have number-indexed storage. :^)
2020-04-06Kernel & Userland: Allow to mount image files formatted with Ext2FSLiav A
2020-04-06Meta: Add missing copyright headersAndreas Kling
2020-04-05JS Repl: Add live syntax highlightingAnotherTest
This patchset adds live syntax highlighting to the js repl. It is turned off by default and can be enabled via the -s flag.
2020-04-05js: Add a new --test-mode option, which exposes an assert() function.Brian Gianforcaro
Introduce a central assert implementation so that the LibJS test suite can take advantage of one implementation instead of copy/pasting the same function into every test case file.
2020-04-05Kernel: Add the SO_BINDTODEVICE socket optionAnotherTest
This patch adds a way for a socket to ask to be routed through a specific interface. Currently, this option only applies to sending, however, it should also apply to receiving...somehow :^)
2020-04-05js: Add lines to historyLinus Groh
2020-04-04LibJS: Don't return the "last computed value" from Interpreter::run()Andreas Kling
Only return whatever a "return" statment told us to return. The last computed value is now available in Interpreter::last_value() instead, where the REPL can pick it up.
2020-04-04ProtocolServer+LibProtocol: Reject unhandled URLs instead of assertingAndreas Kling
StartDownload requests for unhandled protocols (or invalid URLs) will now refuse to load instead of asserting. A failure code is sent back to LibProtocol and Protocol::Client::start_download() returns nullptr. Fixes #1604.
2020-04-04Userland: Fix null-pointer deref on unknown user/group in chown/chgrpAndreas Kling
We can't just blindly dereference the result of getpwnam()/getgrnam()! Fixes #1625.
2020-04-04LibJS: Set length property in Object::put_native_function()Linus Groh
2020-04-04LibGUI: Add MenuBar::add_menu(name)Andreas Kling
This allows us to construct menus in a more natural way: auto& file_menu = menubar->add_menu("File"); file_menu.add_action(...); Instead of the old way: auto file_menu = GUI::Menu::construct(); file_menu->add_action(...); menubar->add_menu(file_menu);
2020-04-04LibJS: Add js_string(Interpreter&, String)Andreas Kling
2020-04-04js: Return 1 after exception in non-REPL modeLinus Groh
2020-04-04Userland/JS: Add the 'save("file")' repl commandDov Alperin
Calling save("file") in a repl saves all the typed lines so far into the specified file. It currently does not have great support for multilined functions since those get turned into one line.
2020-04-03Revert "Kernel & Userland: Allow to mount image files formatted with Ext2FS"Andreas Kling
This reverts commit a60ea79a41845767ce40f225de20da7c99534ad1. Reverting these changes since they broke things. Fixes #1608.
2020-04-02LibJS: Start implementing object shapesAndreas Kling
This patch adds JS::Shape, which implements a transition tree for our Object class. Object property keys, prototypes and attributes are now stored in a Shape, and each Object has a Shape. When adding a property to an Object, we make a transition from the old Shape to a new Shape. If we've made the same exact transition in the past (with another Object), we reuse the same transition and both objects may now share a Shape. This will become the foundation of inline caching and other engine optimizations in the future. :^)
2020-04-02Userland/JS: Print any exceptions after execution of a JS fileDov Alperin
2020-04-02js: Change wording from "Exception caught" to "Uncaught exception" :^)Andreas Kling
As Sergey pointed out, these exceptions are actually *not* caught!
2020-04-02js: Improve exception output for errors with empty messageLinus Groh
2020-04-02Kernel & Userland: Allow to mount image files formatted with Ext2FSLiav A
2020-04-02js: Handle exceptions thrown during REPL executionAndreas Kling
We now print thrown exceptions and clear the interpreter state so it can continue running instead of refusing to do anything after an exception has been thrown. Fixes #1572.
2020-04-01LibJS: Add argument(i) and argument_count() to InterpreterAndreas Kling
Add some convenience accessors for retrieving arguments from the current call frame.
2020-04-01LibJS: Make Value::as_object() return Object&Andreas Kling
Let's move towards using references over pointers in LibJS as well. I had originally steered away from it because that's how I've seen things done in other engines. But this is not the other engines. :^)
2020-04-01Userland/JS: Extend the global object when using a REPLDov Alperin
When we enter a repl we call initialize_global_object on our custom ReplObject in order to expose REPL specific features. Specifically: help(), exit(code), and load("file1.js", "file2.js", "fileEtc.js").
2020-04-01LibJS: Add Interpreter::create<GlobalObjectType>()Andreas Kling
Force Interpreter construction to go via a create() helper that takes the global object type as a template parameter.
2020-04-01LibWeb+LibJS: Move DOM Window object to dedicated classesAndreas Kling
LibWeb now creates a WindowObject which inherits from GlobalObject. Allocation of the global object is moved out of the Interpreter ctor to allow for specialized construction. The existing Window interfaces are moved to WindowObject with their implementation code in the new Window class.
2020-03-31js: Implement print function for Date objectsLinus Groh
2020-03-31js: Don't construct a Line::Editor unless we're going into the REPLAndreas Kling
Otherwise the Line::Editor will try to reset termios on exit, which can have unpleasant effects.
2020-03-31LibLine: Rename LineEditor.{cpp,h} => Editor.{cpp,h}Andreas Kling
2020-03-31LibLine: Rename LineEditor to Line::EditorAndreas Kling
2020-03-31LibLine: Rename from LibLineEditAndreas Kling
2020-03-31js: Don't exit the REPL when pressing enter on an empty lineAndreas Kling
2020-03-31Userland/js: Use the new line editor in replAnotherTest
We now get cursor movements for free! and we're rid of that icky `free` call, yay.
2020-03-31Userland: Add optional human readable output to /bin/dfBrendan Coles
/bin/df now allows the operator to view human readable output using `-h` or `--human-readable` optional flags.
2020-03-30LibJS: Start implementing Date :^)Linus Groh
This adds: - A global Date object (with `length` property and `now` function) - The Date constructor (no arguments yet) - The Date prototype (with `get*` functions)
2020-03-29LibGfx+LibIPC: Add Gfx::ShareableBitmap, a bitmap for easy IPC usageAndreas Kling
With this patch, it's now possible to pass a Gfx::ShareableBitmap in an IPC message. As long as the message itself is synchronous, the bitmap will be adopted by the receiving end, and disowned by the sender nicely without any accounting effort like we've had to do in the past. Use this in NotificationServer to allow sending arbitrary bitmaps as icons instead of paths-to-icons.
2020-03-28strace: Change implementation to use ptrace()Itamar
2020-03-27js: Publish the global object as "global"Andreas Kling
2020-03-26NotificationServer: Allow showing an icon in notificationsAndreas Kling
We currently use icon paths for this because I didn't want to deal with implementing icon bitmap sharing right now. In the future it would be better to post a bitmap somehow instead of a path.
2020-03-26js: Tweak pretty-printing of functions and nullAndreas Kling
2020-03-26js: Fix build on LinuxAndreas Kling
Apparently ESUCCESS is not a thing on my host machine.
2020-03-26js: Implement some modest pretty-printing of valuesAndreas Kling
2020-03-26Base: Add a man page for js(1)Sergey Bugaev
This also changes --ast-dump to --dump-ast, because I like it better and that is what the variable is actually called.
2020-03-26Userland: Implement JS REPLSergey Bugaev
If you invoke `js` without a script path, it will now enter REPL mode, where you input commands one by one and immediately get each one interpreted in one shared interpreter. We support multi-line commands in case we detect you have unclosed braces or parens or brackets.
2020-03-25uname: Remove trailing space characterAndreas Kling