summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-11-04LibJS: Replace a bunch of vm() calls in ProxyObject with referenceLinus Groh
This was probably a result of search & replace, it's quite ridiculous in some places. Let use the existing pattern of getting a reference to the VM once at each function start consistently.
2020-11-04LibJS: Implement Object(value) constructorLinus Groh
Not sure why we didn't have this yet, it's super simple :^)
2020-11-04Revert "Kernel: Implement an asynchronous device request stack"Andreas Kling
This reverts commit 2fd5ce1eb06e5cbbb180cba64a567e99f0cd846c. This broke booting without SMP. (PR was #3921)
2020-11-04LibGfx: Load the system default fonts by nameAndreas Kling
Instead of loading them by absolute path, that is.
2020-11-04Kernel: Implement an asynchronous device request stackTom
This allows issuing asynchronous requests for devices and waiting on the completion of the request. The requests can cascade into multiple sub-requests. Since IRQs may complete at any time, if the current process is no longer the same that started the process, we need to swich the paging context before accessing user buffers. Change the PATA driver to use this model.
2020-11-04Kernel: Remove dead code from BlockDeviceTom
2020-11-04Kernel: Defer kmalloc heap contractionTom
Because allocating/freeing regions may require locks that need to wait on other processors for completion, this needs to be delayed until it's safer. Otherwise it is possible to deadlock because we're holding the global heap lock.
2020-11-04Kernel: Add mechanism to queue deferred function callsTom
Function calls that are deferred will be executed before a thread enters a pre-emptable state (meaning it is not in a critical section and it is not in an irq handler). If it is not already in such a state, it will be called immediately. This is meant to be used from e.g. IRQ handlers where we might want to block a thread until an interrupt happens.
2020-11-04Chess: Add missing default config file in .config :^)Jesse Buhagiar
Following 9f8a8e07c2d25009268830c51f58c052a8f6936b, let's add a default `.ini` to prevent `unveil` from failing.
2020-11-04Minesweeper+Snake: load config file before calling unveil()Brendan Coles
2020-11-04LibJS: Handle circular references in Array.prototype.join()Linus Groh
This fixes Array.prototype.{join,toString}() crashing with arrays containing themselves, i.e. circular references. The spec is suspiciously silent about this, and indeed engine262, a "100% spec compliant" ECMA-262 implementation, can't handle these cases. I had a look at some major engines instead and they all seem to keep track or check for circular references and return an empty string for already seen objects. - SpiderMonkey: "AutoCycleDetector detector(cx, obj)" - V8: "CycleProtectedArrayJoin<JSArray>(...)" - JavaScriptCore: "StringRecursionChecker checker(globalObject, thisObject)" - ChakraCore: "scriptContext->CheckObject(thisArg)" To keep things simple & consistent this uses the same pattern as JSONObject, MarkupGenerator and js: simply putting each seen object in a HashTable<Object*>. Fixes #3929.
2020-11-04LibJS: Use "," separator in Array.prototype.join() if first arg is undefinedLinus Groh
This is how the spec describes it, not "if the first arg is missing". Also swap length & separator steps to match spec.
2020-11-04AK::URL: Check if URL requires a port set to be considered a valid URLBrendan Coles
`AK::URL` will now check if the URL requires a port to be set using `AK::URL.protocol_requires_port(protocol)`. If the URL does not specify a port, and no default port for the URL protocol is found with `AK::URL.default_port_for_protocol(protocol)`, the URL is considered to be invalid.
2020-11-04LibJS: Implement spec-compliant OrdinaryToPrimitiveLinus Groh
This renames Object::to_primitive() to Object::ordinary_to_primitive() for two reasons: - No confusion with Value::to_primitive() - To match the spec's name Also change existing uses of Object::to_primitive() to Value::to_primitive() when the spec uses the latter (which will still call Object::ordinary_to_primitive()). Object::to_string() has been removed as it's not needed anymore (and nothing the spec uses). This makes it possible to overwrite an object's toString and valueOf and have them provide results for anything that uses to_primitive() - e.g.: const o = { toString: undefined, valueOf: () => 42 }; Number(o) // 42, previously NaN ["foo", o].toString(); // "foo,42", previously "foo,[object Object]" ++o // 43, previously NaN etc.
2020-11-04LibJS: Implement RegExp.prototype.toString() as standalone functionLinus Groh
This should not just inherit Object.prototype.toString() (and override Object::to_string()) but be its own function, i.e. 'RegExp.prototype.toString !== Object.prototype.toString'.
2020-11-04LibJS: Don't create "valid" PropertyName from null stringLinus Groh
When value.to_string() throws an exception it returns a null string in which case we must not construct a valid PropertyName. Also ASSERT in PropertyName(String) and PropertyName(FlyString) to prevent this from happening in the future. Fixes #3941.
2020-11-04LibJS: Fix incorrect exception checks in ProxyObjectLinus Groh
We must *never* call some method that expects a non-empty value on the result of a function call without checking for exceptions first. It won't work reliably. Fixes #3939.
2020-11-03LibVT: Copying from terminal scrollback resulted in wrong textAndreas Kling
This regressed when turning the terminal history into a circular buffer as only the non-const version of Terminal::line() was updated with the new indexing logic.
2020-11-03AK: Really disallow making OwnPtrs from refcounted typesAnotherTest
This looks at three things: - if the type has a typedef `AllowOwnPtr', respect that - if not, disallow construction if both of `ref()' and `unref()' are present. Note that in the second case, if a type only defines `ref()' or only defines `unref()', an OwnPtr can be created, as a RefPtr of that type would be ill-formed. Also marks a `Performance' to explicitly allow OwnPtrs.
2020-11-03LibJS: Fix crashing exception in Value::ordinary_has_instance()Linus Groh
Two issues: - throw_exception() with ErrorType::InstanceOfOperatorBadPrototype would receive rhs_prototype.to_string_without_side_effects(), which would ASSERT_NOT_REACHED() as to_string_without_side_effects() must not be called on an empty value. It should (and now does) receive the RHS value instead as the message is "'prototype' property of {} is not an object". - Value::instance_of() was missing an exception check after calling has_instance_method, to_boolean() on an empty value result would crash as well. Fixes #3930.
2020-11-03Ports: Bump GCC port to 10.2.0Andreas Kling
Since we've already updated the toolchain, might as well update the port as well. :^)
2020-11-03Spreadsheet: Enable Drag&Drop and Copy/PasteAnotherTest
These currently only work on the current sheet, in the current Spreadsheet instance, but they're still freakin' cool!
2020-11-03Spreadsheet: Serialise Positions to URLs and add Sheet::from_uri()AnotherTest
2020-11-03LibGUI: Implement shift-selectAnotherTest
shift-selecting simply toggles all indices in the range between the cursor and the index that is being 'selected'.
2020-11-03HackStudio: Run clang-formatAndreas Kling
2020-11-03HackStudio: Store and restore the scrollbar values of ProjectFiles when they ↵Zac
are closed and reopened from the list of open files.
2020-11-02LibJS: Implement 'new.target'Linus Groh
This adds a new MetaProperty AST node which will be used for 'new.target' and 'import.meta' meta properties. The parser now distinguishes between "in function context" and "in arrow function context" (which is required for this). When encountering TokenType::New we will attempt to parse it as meta property and resort to regular new expression parsing if that fails, much like the parsing of labelled statements.
2020-11-02LibJS: Replace 'size_t line, size_t column' with 'Optional<Position>'Linus Groh
This is a bit nicer for two reasons: - The absence of line number/column information isn't based on 'values are zero' anymore but on Optional's value - When reporting syntax errors with position information other than the current token's position we had to store line and column ourselves, like this: auto foo_start_line = m_parser_state.m_current_token.line_number(); auto foo_start_column = m_parser_state.m_current_token.line_column(); ... syntax_error("...", foo_start_line, foo_start_column); Which now becomes: auto foo_start= position(); ... syntax_error("...", foo_start); This makes it easier to report correct positions for syntax errors that only emerge a few tokens later :^)
2020-11-02Applications: Use pledge and unveilBrendan Coles
2020-11-02LibGUI: Return early if drag_data_type is null (#3919)Joseph
If the user tries to drag an item with a null drag data type from an AbstractView, return from the mouse event early.
2020-11-02Applications: Use GUI::Icon::default_icon to set application iconBrendan Coles
2020-11-02HackStudio: Removes the file from the list of open filesKesse Jones
When a file is deleted from the project it will also be removed from the list of open files
2020-11-02WindowServer+LibGfx: Add Gfx::StandardCursor::Hidden cursorBrendan Coles
2020-11-02ChessEngine: Use pledge and unveilBrendan Coles
2020-11-02Games: Use pledge and unveilBrendan Coles
2020-11-02Demos: Use pledge and unveilBrendan Coles
2020-11-02Applications: Use GUI::CommonActions for save and save as menu optionsBrendan Coles
2020-11-02LibJS: Fix "use strict" directive false positivesLinus Groh
By having the "is this a use strict directive?" logic in parse_string_literal() we would apply it to *any* string literal, which is incorrect and would lead to false positives - e.g.: "use strict" + 1 `"use strict"` "\123"; ({"use strict": ...}) Relevant part from the spec which is now implemented properly: [...] and where each ExpressionStatement in the sequence consists entirely of a StringLiteral token [...] I also got rid of UseStrictDirectiveState which is not needed anymore. Fixes #3903.
2020-11-02Travis: Update host GCC to version 10Linus Groh
This allows us to use the latest C++20 features in programs which we compile and run as part of Lagom.
2020-11-02ls: Add colored output for set-gid filesBrendan Coles
2020-11-02AK+Kernel: Escape JSON keys & valuesAndreas Kling
Grab the escaping logic from JSON string value serialization and use it for serializing all keys and values. Fixes #3917.
2020-11-02LibGfx: Add some more assertions to Gfx::BitmapAndreas Kling
Let's also be paranoid about get_pixel() since we started worrying about set_pixel(). :^)
2020-11-01LibGfx: assert Bitmap::set_pixel does not write out of boundsPeter Nelson
2020-11-01LibGfx: add bounds checking before set_pixel call in GIF decoderPeter Nelson
This fixes a crash when a GIF frame extends beyond the limits of the logical screen, causing writes past the end of the frame buffer
2020-11-01Kernel+LibC: Don't allow a directory to become a subdirectory of itselfAndreas Kling
If you try to do this (e.g "mv directory directory"), sys$rename() will now fail with EDIRINTOSELF. Dr. POSIX says we should return EINVAL for this, but a custom error code allows us to print a much more helpful error message when this problem occurs. :^)
2020-11-01Kernel: Flush TLB when quick-mapping PD/PT that was mapped on other CPUTom
If a PD/PT was quick-mapped by another CPU we still need to flush the TLB on the current CPU. Fixes #3885
2020-11-01HackStudio: Fixed opening the project by always opening the main.cpp fileKesse Jones
Now when opening the project a search will be made for a file with the extension cpp or js and opening it. If not found, the first file will be opened.
2020-11-01Kernel: kmalloc_eternal should align pointersTom
2020-11-01Shell: Do not leak the value of ARGV in nested function callsAnotherTest
2020-11-01Shell: Search for variables in the last frame firstAnotherTest
Otherwise, we'll end up overwriting another frame's variables if the names match up.