summaryrefslogtreecommitdiff
path: root/Userland
AgeCommit message (Collapse)Author
2021-06-11LibJS: Implement AggregateErrorLinus Groh
2021-06-11LibJS: Only initialize in add_constructor() if not already doneLinus Groh
2021-06-11LibJS: Rename JS_ENUMERATE_{ERROR_SUBCLASSES => NATIVE_ERRORS}Linus Groh
The fact that they *are* subclasses is an implementation detail and should not be highlighted. The spec calls these NativeErrors, so let's use that. Also added a comment explaining *why* they inherit from Error - I was about to change that :^)
2021-06-11LibJS: Parse only AssignmentExpressions in ComputedPropertyNamesGal Horowitz
The property name in an object literal can either be a literal or a computed name, in which case any AssignmentExpression can be used, we now only parse AssignmentExpression instead of the previous incorrect behaviour which allowed any Expression (Specifically, comma expressions).
2021-06-11LibJS: Use an enum class instead of 'bool is_generator'Ali Mohammad Pur
This avoid confusion in the order of the multiple boolean parameters that exist.
2021-06-11AK+LibX86: Generalize u128/256 to AK::UFixedBigIntHendiadyoin1
Doing these as custom classes might be faster, especially when writing them in SSE, but this would cause a lot of Code duplication and due to the nature of constexprs and the intelligence of the compiler they might be using SSE/MMX either way
2021-06-11LibTest: Don't try to pass stderr to warnlnHendiadyoin1
2021-06-11LibWeb: Set a detach key for ArrayBuffers returned from WASMIdan Horowitz
As required by the specification: `Set buffer.[[ArrayBufferDetachKey]] to "WebAssembly.Memory".`
2021-06-11LibJS: Implement bytecode generation for switchMarcin Gasperowicz
2021-06-11Libc: Silence debug spam from `strerror`Jelle Raaijmakers
Particularly noticeable in ports like openssl, which like to map the entire error message set from 0 through 128 on startup.
2021-06-11LibC: Let `strerror_r` fail if `errnum` < 0Jelle Raaijmakers
2021-06-11WebServer: Add support for HTTP basic authenticationMax Wipfli
This enables the WebServer to run protected by a username and password. While it isn't possible to access such a protected server from inside Serenity as of now (because neither the Browser nor pro(1) support this), this may very well be the case in the future. :^)
2021-06-11LibHTTP: Add HTTP Basic Authentication header generation and parsingMax Wipfli
This patch adds two new static methods to HttpRequest. get_http_basic_authentication_header generates a "Authorization" header from a given URL, where as parse_http_basic_authentication_header parses an "Authorization" header into username and password.
2021-06-11WebServer: Move server configuration into WebServer::ConfigurationMax Wipfli
This moves the configuration of the web server, which currently only consists of the root path, into a new class, Configuration. Since the configuration is global and not per client, it is accessed by a singleton getter. This change simplifies future extensions of the configurable parameters.
2021-06-11WebServer: Use canonical reasons phrases for error responsesMax Wipfli
This changes the Client::set_error_response() to not take a "message" anymore. It now uses the canonical reason phrase which is derived from the response code.
2021-06-11LibHTTP: Implement getting the correct reason phrase from HttpResponseMax Wipfli
This adds a reason_phrase() getter and a static reason_phrase_for_code() to the HttpResponse class. It also changes the class to use east const style.
2021-06-11WebServer: Sort entries in directory listingMax Wipfli
2021-06-11WebServer: Append trailing slash for directory linksMax Wipfli
This adds trailing slashes to all links to directories (when listing the directory contents). This avoids the redirect that would otherwise happen when browsing to those directories.
2021-06-11WebServer: Make ".." equal to "." in server root directoryMax Wipfli
In the web server root directory, ".." has to be handled specially, since everything above it does not exist from the point of view of the user. The most sensible thing to do is to make ".." equal to ".". This is also what ls(1) does for "/" and what "http://localhost/../" evaluates to. This also fixes a bug where stat() would fail on the directory above the root directory, since it hasn't been unveiled for the process.
2021-06-11WebServer: Refuse to respond to requests for device filesMax Wipfli
Responding with some device files such as /dev/random never terminates, so let's just refuse that.
2021-06-11WebServer: Use outln() instead of printf()Max Wipfli
2021-06-11WebServer: Defer invocation of Client::remove_from_parent()Max Wipfli
This is necessary to avoid trying to destruct the on_ready_to_read function from inside the function. This fixes #7810.
2021-06-11WebServer: Use east const style in Client.{cpp,h}Max Wipfli
This also removes two unused headers.
2021-06-11Chess: Remove 1:1 window aspect ratioJoshua Gollaher
2021-06-11LibJS: Add bytecode generation for FunctionExpression :^)Andreas Kling
2021-06-11LibJS: Move is_arrow_function() from FunctionExpression to FunctionNodeAndreas Kling
This will make it easier to write bytecode generation for function expressions in just a moment.
2021-06-11LibJS: Fix two accidentally incorrect ScriptFunction constructionsLinus Groh
The addition of an is_generator parameter broke this, as is_strict was being passed in, causing an assertion. This is being addressed by changing it to an enum in #7981, but in the meantime let's just fix these two cases.
2021-06-11LibJS: Set Error message attributes to writable and configurable onlyLinus Groh
20.5.1.1 Error ( message ) When the Error function is called with argument message, the following steps are taken: [...] 3b. Let msgDesc be the PropertyDescriptor { [[Value]]: msg, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }. 3c. Perform ! DefinePropertyOrThrow(O, "message", msgDesc).
2021-06-11LibJS: Set NativeError constructors' prototype to Error constructorLinus Groh
The FunctionPrototype is correct for ErrorConstructor itself: 20.5.2 Properties of the Error Constructor The Error constructor: - has a [[Prototype]] internal slot whose value is %Function.prototype%. However, not for all the other "NativeError" constructors: 20.5.6.2 Properties of the NativeError Constructors Each NativeError constructor: - has a [[Prototype]] internal slot whose value is %Error%.
2021-06-11LibJS: Basic bytecode support for computed member expressionsAndreas Kling
Expressions like foo[1 + 2] now work, and you can assign to them as well! :^)
2021-06-11LibJS: Switch AST.{h,cpp} to east constAli Mohammad Pur
2021-06-11LibJS: Implement generator functions (only in bytecode mode)Ali Mohammad Pur
2021-06-11LibJS: Resolve the `this' value in call expression bytecodeAli Mohammad Pur
2021-06-11LibJS: Automatically split linear bytecode into multiple blocksAli Mohammad Pur
...instead of crashing :^)
2021-06-10LibJS: Allow and check for detached ArrayBuffersIdan Horowitz
This is required by the specification and will be used for the $262.detachArrayBuffer method in test262.
2021-06-10LibJS: Throw TypeError on non-object this value in ArrayBuffer methodsIdan Horowitz
`1. If Type(O) is not Object, throw a TypeError exception.`
2021-06-10LibJS: Dont mask non-RangeError exceptions in ArrayBuffer constructionIdan Horowitz
Non-RangeError exceptions can be thrown by user implementations of valueOf (which are called by to_index), and the specification disallows changing the type of the thrown error.
2021-06-10LibJS: Bring ArrayBuffer.prototype.slice closer to specIdan Horowitz
The exception order was incorrect in the old implementation, and it did not use the Symbol.species constructor as required by the spec.
2021-06-10LibJS: Explicitly return and accept a Function* in species_constructorIdan Horowitz
The second argument (the default constructor) and the return value have to be constructors (as a result functions), so we can require that explicitly by using appropriate types.
2021-06-10Userland: Fix incorrect iflag/oflag printing in `stty`Daniel Bertalan
The `c_iflag` and `c_oflag` fields were swapped in the source code which caused the bit values to be interpreted as the wrong flag. It was a stupid mistake on my part.
2021-06-10LibJS: Remove GlobalObject& argument from VM::construct()Andreas Kling
We can just get the global object from the constructor function.
2021-06-10LibJS: Very basic support for "new" construction in bytecode VMAndreas Kling
This patch adds a CallType to the Bytecode::Op::Call instruction, which can be either Call or Construct. We then generate Construct calls for the NewExpression AST node. When executed, these get fed into VM::construct().
2021-06-10LibJS: Generate bytecode for entering nested lexical environmentsAndreas Kling
This adds a new PushLexicalEnvironment instruction that creates a new LexicalEnvironment and pushes it on the VM's scope stack. There is no corresponding PopLexicalEnvironment instruction yet, so this will behave incorrectly with let/const scopes for example.
2021-06-10LibJS: Allocate 4 KiB for Bytecode::BasicBlockAndreas Kling
There's no reason not to, since we're using mmap() for these anyway and that gives us memory in 4 KiB increments. :^)
2021-06-10LibJS: Always keep the global object in bytecode VM register $1Andreas Kling
2021-06-10LibJS: Perform function instantiation in bytecodeAndreas Kling
This replaces Bytecode::Op::EnterScope with a new NewFunction op that instantiates a ScriptFunction from a given FunctionNode (AST). This is then used to instantiate the local functions directly from bytecode when entering a ScopeNode. :^)
2021-06-10LibJS: Add empty bytecode generation for VariableDeclarationAndreas Kling
These will be partly handled by the relevant ScopeNode due to hoisting, same basic idea as function declarations. VariableDeclaration needs to do some work, but let's stub it out first and start empty.
2021-06-10LibJS: Implement bytecode generation for try..catch..finallyGunnar Beutner
EnterUnwindContext pushes an unwind context (exception handler and/or finalizer) onto a stack. LeaveUnwindContext pops the unwind context from that stack. Upon return to the interpreter loop we check whether the VM has an exception pending. If no unwind context is available we return from the loop. If an exception handler is available we clear the VM's exception, put the exception value into the accumulator register, clear the unwind context's handler and jump to the handler. If no handler is available but a finalizer is available we save the exception value + metadata (for later use by ContinuePendingUnwind), clear the VM's exception, pop the unwind context and jump to the finalizer. ContinuePendingUnwind checks whether a saved exception is available. If no saved exception is available it jumps to the resume label. Otherwise it stores the exception into the VM. The Jump after LeaveUnwindContext could be integrated into the LeaveUnwindContext instruction. I've kept them separate for now to make the bytecode more readable. > try { 1; throw "x" } catch (e) { 2 } finally { 3 }; 4 1: [ 0] EnterScope [ 10] EnterUnwindContext handler:@4 finalizer:@3 [ 38] EnterScope [ 48] LoadImmediate 1 [ 60] NewString 1 ("x") [ 70] Throw <for non-terminated blocks: insert LeaveUnwindContext + Jump @3 here> 2: [ 0] LoadImmediate 4 3: [ 0] EnterScope [ 10] LoadImmediate 3 [ 28] ContinuePendingUnwind resume:@2 4: [ 0] SetVariable 0 (e) [ 10] EnterScope [ 20] LoadImmediate 2 [ 38] LeaveUnwindContext [ 3c] Jump @3 String Table: 0: e 1: x
2021-06-10LibJS: Show the VM's last value after executing bytecode programsGunnar Beutner
2021-06-10LibJS: Don't generate bytecode after we've encountered a parser errorGunnar Beutner