summaryrefslogtreecommitdiff
path: root/Userland
AgeCommit message (Collapse)Author
2022-02-08LibWeb: Add Storage interface and window.localStorageAndreas Kling
This is a naive-but-somewhat-functional initial implementation of HTML Storage. Note that there is no persistence yet, everything is in-process only, and one local Storage object per origin.
2022-02-08LibWeb: Allow using Origin as a HashMap keyAndreas Kling
2022-02-08RequestServer: Avoid Vector OOB access in ConnectionCacheAli Mohammad Pur
`it.is_end()` could be updated to return false for a previously-invalid iterator after we append a new socket, copy its value out to a local variable to not hit this behaviour.
2022-02-08LibJS: Fix two typos in commentsLinus Groh
2022-02-08LibWeb: Implement the JS host hooks for promises, job callbacks and moreLuke Wilde
This overrides the JS host hooks to follow the spec for queuing promises, making/calling job callbacks, unhandled promise rejection handling and FinalizationRegistry queuing. This also allows us to drop the on_call_stack_emptied hook in Document::interpreter().
2022-02-08LibJS: Setup host hooks and have promise jobs work out the realmLuke Wilde
This allows the host of LibJS (notably LibWeb in this case) to override certain functions such as HostEnqueuePromiseJob, so it can do it's own thing in certain situations. Notably, LibWeb will override HostEnqueuePromiseJob to put promise jobs on the microtask queue. This also makes promise jobs use AK::Function instead of JS::NativeFunction. This removes the need to go through a JavaScript function and it more closely matches the spec's idea of "abstract closures"
2022-02-08LibWeb: Rewrite EventTarget to more closely match the specLuke Wilde
This isn't perfect (especially the global object situation in activate_event_handler), but I believe it's in a much more complete state now :^) This fixes the issue of crashing in prepare_for_ordinary_call with the `i < m_size` crash, as it now uses the IDL callback functions which requires the Environment Settings Object. The environment settings object for the callback is fetched at the time the callback is created, for example, WrapperGenerator gets the incumbent settings object for the callback at the time of wrapping. This allows us to remove passing in ScriptExecutionContext into EventTarget's constructor. With this, we can now drop ScriptExecutionContext.
2022-02-08LibWeb: Make FormAssociatedElement inherit from HTMLElementLuke Wilde
The new event target implementation requires us to downcast an EventTarget to a FormAssociatedElement to check if the current Element EventTarget has a form owner to setup a with scope for the form owner. This also makes all form associated elements inherit from FormAssociatedElement where it was previously missing. https://html.spec.whatwg.org/#form-associated-element
2022-02-08LibWeb: Introduce the Environment Settings ObjectLuke Wilde
The environment settings object is effectively the context a piece of script is running under, for example, it contains the origin, responsible document, realm, global object and event loop for the current context. This effectively replaces ScriptExecutionContext, but it cannot be removed in this commit as EventTarget still depends on it. https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object
2022-02-08LibWeb: Support passing more parameter types to HTML::report_exception()Andreas Kling
We now allow any JS::ThrowCompletion<T>, as well as JS::Completion directly (although we'll VERIFY() that it's a throw completion.)
2022-02-08LibWeb: Fixed disabled checkbox input behaviourRafał Babiarz
Previously disabled checkbox could be checked by clicking on it's label
2022-02-08LibWeb: Incorporate spread-distance into box-shadow renderingSam Atkins
We also pass whether the shadow goes inside or outside the element. Only outer shadows are rendered currently, and inner ones may want to be handled separately from them, as they will never interfere with each other.
2022-02-08LibWeb: Render multiple box-shadowsSam Atkins
Because why not? :^)
2022-02-08LibWeb: Parse multiple box-shadows :^)Sam Atkins
Again, we don't yet render these (we render nothing) but this gets rid of a decent amount of CSS spam on Discord.
2022-02-08LibWeb: Parse spread-distance and `inset` parts of box-shadowSam Atkins
We do not actually use these when rendering the shadow yet.
2022-02-08LibWeb: Reorganize box-shadow parsing codeSam Atkins
The pattern we've adopted for other multi-value properties is to run in a loop like this, since that makes it easier to cater for values appearing in different orders.
2022-02-08WindowServer: Preserve cursor position when dragging between statesthankyouverycool
Previously windows would end up in awkward positions relative to the move cursor when dragging between tile types or unmaximizing. This feels a bit more ergonomic.
2022-02-08WindowServer: Add Vertically/HorizontallyMaximized WindowTileTypesthankyouverycool
VerticallyMaximized tiling replaces set_vertically_maximized() to take advantage of tiling ergonomics. Middle-clicking a window's maximize button now tiles vertically; secondary-clicking tiles horizontally. Adds Super+Alt+Arrow shortcuts for both. Super+Left/Right tiling shortcuts now let windows shift between tile types directly.
2022-02-08WindowServer: Fix comments in WindowManagerthankyouverycool
2022-02-08WindowServer: Unify Window restore rectsthankyouverycool
Previously, different rects were used to restore tiled and maximized windows, creating edge cases for inconsistent restoration. All states now restore m_floating_rect, which saves the last valid size and location of a window while free-floating.
2022-02-08WindowServer: Rename Window::tiled() => tile_type() and add is_tiled()thankyouverycool
This seems more consistent with naming conventions across the system and makes conditionals easier to read.
2022-02-08LibCore: Make BufferedHelper::read() block at most once per readAli Mohammad Pur
The previous method could block multiple times, leading to a completely stuck/deadlocked read() call, and it could also consume data without telling the user about it, which is Not A Good Thing :tm:. This patch makes it block at most once, and fixes loading HTTP pages with LibHTTP :^)
2022-02-08LibJS+Everywhere: Remove all VM::clear_exception() callsdavidot
Since VM::exception() no longer exists this is now useless. All of these calls to clear_exception were just to clear the VM state after some (potentially) failed evaluation and did not use the exception itself.
2022-02-08LibJS+Everywhere: Remove VM::exception() and most related functionsdavidot
This commit removes all exception related code: Remove VM::exception(), VM::throw_exception() etc. Any leftover throw_exception calls are moved to throw_completion. The one method left is clear_exception() which is now a no-op. Most of these calls are just to clear whatever exception might have been thrown when handling a Completion. So to have a cleaner commit this will be removed in a next commit. It also removes the actual Exception and TemporaryClearException classes since these are no longer used. In any spot where the exception was actually used an attempt was made to preserve that behavior. However since it is no longer tracked by the VM we cannot access exceptions which were thrown in previous calls. There are two such cases which might have different behavior: - In Web::DOM::Document::interpreter() the on_call_stack_emptied hook used to print any uncaught exception but this is now no longer possible as the VM does not store uncaught exceptions. - In js the code used to be interruptable by throwing an exception on the VM. This is no longer possible but was already somewhat fragile before as you could happen to throw an exception just before a VERIFY.
2022-02-08Spreadsheet: No longer use vm.exception() to signal exception statedavidot
Instead, use the completions which are returned directly. This means we no longer have to worry about the global VM state when running code.
2022-02-08LibJS: Add a traceback to Errordavidot
Since we have the traceback we now also generate the stack string on demand instead of immediately on construction.
2022-02-08LibJS: Convert FinalizationRegistry::cleanup to ThrowCompletionOrdavidot
2022-02-08LibJS: Always pop the execution context if we pushed one for bytecodedavidot
2022-02-08LibJS: Convert Instruction::execute in bytecode to ThrowCompletionOrdavidot
This allows us to use TRY in these functions :^).
2022-02-08LibJS: Convert ArrayBuffer construction to ThrowCompletionOrdavidot
This also allows us to create TypedArrays with an existing buffer thus clearing up an additional FIXME in TextEncoder.
2022-02-08LibJS: Convert ScopeNode declaration functions to ThrowCompletionOrdavidot
This removes a number of vm.exception() checks which are now caught directly by TRY. Make use of these checks in {Global, Eval}DeclarationInstantiation and while we're here add spec comments.
2022-02-07LibJS: Add missing include to ShadowRealm.hAndreas Kling
2022-02-07LibWeb: Parse `display: inline-flex`Sam Atkins
This was already handled in the CSS machinery, we just never parsed it.
2022-02-07LibWeb: Add `pointer-events: all`Sam Atkins
This is basically the same as `auto` in the spec, so let's just treat them as identical for now. Gets rid of some Discord CSS parser spam. :^)
2022-02-07LibWeb: Allow percentages for border-radius :^)Sam Atkins
During the LengthPercentage split, I converted the individual-corner `border-foo-bar-radius` properties to LengthPercentage but forgot `border-radius` itself! Oops. Discord's CSS was doing `border-radius: 50%` a lot, so this cuts down on CSS parser spam.
2022-02-07RequestServer: Reenable socket notifications unconditionallyAli Mohammad Pur
There's a possible window where the notifications are disabled, and any request coming at that time will never get any data if it relies on socket notifications.
2022-02-07LibJS: Add missing include to ExecutionContext.hAndreas Kling
2022-02-07LibJS: Add missing include to Handle.hAndreas Kling
2022-02-07LibJS: Unbreak build with JS_MODULE_DEBUGAndreas Kling
Thanks to David for noticing this! :^)
2022-02-07LibJS: Reduce header dependency graph in Realm.hAndreas Kling
2022-02-07LibJS: Add [[HostDefined]] internal slot to Script objectsAndreas Kling
In C++, this is a raw pointer to a Script::HostDefined.
2022-02-07LibJS: Add [[HostDefined]] internal slot to Realm objectsAndreas Kling
In C++, this is an OwnPtr<Realm::HostDefined>.
2022-02-07LibJS: Make ScriptOrModule use WeakPtr instead of raw pointersAndreas Kling
2022-02-07Meta+Userland: Run the GML formatter on CI and pre-commitkleines Filmröllchen
Now that the GML formatter is both perserving comments and also mostly agrees to the existing GML style, it can be used to auto-format all the GML files in the system. This commit does not only contain the scripts for running the formatting on CI and the pre-commit hook, but also initially formats all the existing GML files so that the hook is successfull.
2022-02-07Playground: Remove the GML formatting warningkleines Filmröllchen
As we no longer remove comments when formatting GML, this gets rid of the warning presented to the user when there are comments in the GML.
2022-02-07LibGUI: Move GML parsing and formatting to new ASTkleines Filmröllchen
This commit introduces a couple of connected changes that are hard to untangle, unfortunately: - Parse GML into the AST instead of JSON - Change the load_from_json API on Widget to load_from_gml_ast - Remove this same API from Core::Object as it isn't used outside of LibGUI and was a workaround for the object registration detection; by verifying the objects we're getting and casting we can remove this constraint. - Format GML by calling the formating APIs on the AST itself; remove GMLFormatter.cpp as it's not needed anymore. After this change, GML formatting already respects comments :^)
2022-02-07LibGUI: Add a custom GML ASTkleines Filmröllchen
This Abstract Syntax Tree is specifically designed to represent GML and also includes comments. It will be used in the next commit to replace JSON in the GML system.
2022-02-07Userland: Undefine FOR_EACH_TOKEN_TYPE everywherekleines Filmröllchen
This was causing some macro redefinition errors after the headers ended up in the same file through some includes. The simple fix is to undefine the macro after use.
2022-02-07LibGUI: Remove GML prefix in favor of proper namespacekleines Filmröllchen
Prefixes are very much a C thing which we don't need in C++. This commit moves all GML-related classes in LibGUI into the GUI::GML namespace, a change somewhat overdue.
2022-02-07LibGfx: Return proper ColorRole for GutterBordersthankyouverycool