Commit Graph

28292 Commits

Author SHA1 Message Date
Sam Atkins
0a4d9c6d31 LibWeb: Partially implement MediaQuery class :^)
The main thing that's missing is the actual matching, but this is enough
to get started.
2021-10-01 20:03:03 +02:00
Brian Gianforcaro
b90cc1148a Kernel: Switch RTL8168NetworkAdapter::possible_device_name to StringView
There is no need to allocate a `AK::String` for the device name, when
the list of devices is entirely static.
2021-10-01 17:22:17 +00:00
Brian Gianforcaro
2770433d30 Kernel: Convert network adapter names to Kernel::KString
Another step of incremental progress of removing `AK::String` from the
kernel, to harden against OOM.
2021-10-01 17:22:17 +00:00
Tobias Christiansen
33a9f908a6 LibWeb: Flexbox: Check for relative resolvability on the cross axis
If an element has a relative specified length on the cross axis, but in
the lineage there are no parents that have any fixed cross size, this
would have resulted in a 0 cross size.
We now catch that and check whether the relative length would result in
an actual definite length if resolved.
2021-10-01 13:52:41 +02:00
Ali Mohammad Pur
a3fe981daa RequestServer: Ignore preconnect requests for available connections
There's no need to schedule a useless job when the connection is already
there and established.
2021-10-01 13:52:26 +02:00
Liav A
4974727dbb Kernel: Move x86 IO instructions code into the x86 specific folder 2021-10-01 12:27:20 +02:00
Liav A
3e9dfd2e74 Kernel: Remove IO.h include from a bunch of places 2021-10-01 12:27:20 +02:00
Luke Wilde
c0a64f7317 LibWeb: Check for HTML integration points in the tree constructor
This particularly implements these two points:
- "If the adjusted current node is an HTML integration point and the
   token is a start tag"
- "If the adjusted current node is an HTML integration point and the
   token is a character token"

This also adds spec comments to the tree constructor.
2021-10-01 12:26:41 +02:00
Ali Mohammad Pur
36516a4c47 LibJS: Take a pointer in get_or_prune_cached_prototype_transition()
Prototypes can be set to null, and while the previous version also kinda
allowed null (by not reading through the null reference), it was making
UBSAN very sad.
2021-10-01 09:20:25 +03:30
Samuel Bowman
db98ed5ed0 Spreadsheet: Add a toolbar
This commit adds a basic toolbar with the following actions:
Add New Sheet, Open, Save, Cut, Copy, and Paste.
2021-10-01 08:34:59 +03:30
Samuel Bowman
e422bfbe88 Spreadsheet: Store actions in member variables on SpreadsheetWidget
Actions are now stored in member variables so they can be used
throughout SpreadsheetWidget.
2021-10-01 08:34:59 +03:30
Samuel Bowman
d8bac4dbda Spreadsheet: Move menu and action code to initialize_menubar()
Previously, all the code to add menus and actions was in main().
This was messy and didn't allow us to reference the actions from
SpreadsheetWidget, which is needed in order to add a toolbar.

This commit moves the menu and action adding code to method on
SpreadsheetWidget called initialize_menubar() which is based upon
applications such as TextEditor which have identically named methods
doing the same thing.

In additon, clipboard_action(), previouly a lambda in main(), has also
been made into a method on SpreadsheetWidget since it would otherwise
be destroyed when it goes out of scope. (This was previously avoided by
declaring the lambda in main() so it's always in scope.)
2021-10-01 08:34:59 +03:30
Andreas Kling
14c57b4b7f LibJS: Remove transition avoidance & start caching prototype transitions
The way that transition avoidance (foo_without_transition) was
implemented led to shapes being unshareable and caused shape explosion
instead, precisely what we were trying to avoid.

This patch removes all the attempts to avoid transitioning shapes, and
instead *adds* transitions when changing an object's prototype.
This makes transitions flow naturally, and as a result we end up with
way fewer shape objects in real-world situations.

When we run out of big problems, we can get back to avoiding transitions
as an optimization, but for now, let's avoid ballooning our processes
with a unique shape for every object.
2021-10-01 02:59:29 +02:00
Luke Wilde
46686f7f94 LibWeb: Implement MediaQueryList.onchange 2021-10-01 01:35:30 +01:00
Nico Weber
61e9e80232 LibMarkdown: Fix typo in variable name 2021-10-01 01:33:43 +01:00
Nico Weber
841a5fe81b Tests: Fix typos 2021-10-01 01:33:43 +01:00
Nico Weber
5e21759f3d AK: Fix typos 2021-10-01 01:33:43 +01:00
Nico Weber
97d27c312a Base: Fix typos 2021-10-01 01:18:52 +01:00
Nico Weber
6c9bc18a79 Userland: Fix typos 2021-10-01 01:18:52 +01:00
Luke Wilde
971d60c329 LibWeb: Implement AbortSignal.onabort 2021-10-01 02:10:56 +02:00
Nico Weber
de72332920 Libraries: Fix typos 2021-10-01 01:06:40 +01:00
Nico Weber
9ec9886b04 Meta: Fix typos 2021-10-01 01:06:40 +01:00
Nico Weber
cd7ec294db Documentation: Fix grammar-o in ProcFSIndexing.md 2021-10-01 01:06:40 +01:00
Nico Weber
5a951d6258 Kernel: Fix a few typos 2021-10-01 00:51:49 +01:00
Idan Horowitz
890d5e45ee Browser: Check m_console_client is non-null before dereferencing it
This added check matches CientConnection::js_console_input and makes
sure the webcontent process doesn't crash if the console is opened
while no page is available (like in a file not found situation)
2021-10-01 01:17:44 +02:00
Luke Wilde
10d4f2fc1e LibWeb: Implement HTMLStyleElement.sheet 2021-10-01 00:17:24 +01:00
Idan Horowitz
2c6c9b73c8 LibWeb: Add the Web::Crypto namespace, built-in, and getRandomValues
Since we don't support IDL typedefs or unions yet, the responsibility
of verifying the type of the argument is temporarily moved from the
generated Wrapper to the implementation.
2021-09-30 20:02:09 +02:00
Timothy Flynn
becbb0ea97 LibUnicode: Upgrade to Unicode version 14.0.0 2021-09-30 17:37:57 +01:00
Timothy Flynn
c8dbcdb0bc LibUnicode: Do not compare generated file contents before writing
This is now covered by unicode_data.cmake after the superbuild changes.
2021-09-30 17:37:57 +01:00
Timothy Flynn
a466b78bf3 LibUnicode: Remove cached UCD and CLDR files when their version changes 2021-09-30 17:37:57 +01:00
Timothy Flynn
0ec6b4f132 LibUnicode: Use consistent variable naming in unicode_data.cmake
I kept mixing these up in my head.
2021-09-30 17:37:57 +01:00
Timothy Flynn
583d703f61 LibUnicode: Functionalize extraction of CLDR data files 2021-09-30 17:37:57 +01:00
Timothy Flynn
ead30c26e5 LibUnicode: Functionalize downloading of UCD data files 2021-09-30 17:37:57 +01:00
Timothy Flynn
87bca78ef2 LibUnicode: Extract UCD and CLDR versions to a CMake variable
This also surrounds expansion of affected URL and path variables with
quotes.
2021-09-30 17:37:57 +01:00
Andreas Kling
eeb4f2fa9b Kernel: Exclude userspace heap memory from coredumps by default
When a process with a large heap crashes (e.g WebContent), it gets very
cumbersome to dump out a huge amount of memory.

In the vast majority of cases, we're only interested in generating a
nice backtrace from the coredump, so let's have the kernel skip over
userspace heap regions when dumping memory for now.

This is not ideal, and almost a little bit ugly, but it does make
investigating 500 MiB WebContent crashes significantly easier for now.
2021-09-30 17:54:32 +02:00
Nico Weber
94d0562569 Kernel: Make UART::print_num(0) work on aarch64 2021-09-30 15:38:43 +01:00
Nico Weber
d0c1db5efc Kernel: Zero out .bss contents on aarch64
After building and running

     objcopy -O binary Build/aarch64/Kernel/Prekernel/Prekernel \
                       /media/sdcard/kernel8.img

things start booting on an actual RPi4 :^)

(Assuming the sdcard contains RPi firmware, an empty config.txt,
and no other kernel*.img files).
2021-09-30 15:38:43 +01:00
davidot
715f9666f2 LibJS: Fix that in Bytecode mode functions where not created anymore
This is not a proper fix as we should follow the spec here but it gets
us back to a slightly more working state.
2021-09-30 15:37:56 +01:00
davidot
0f5fe3b70e SpreadSheet: Fix that non first sheets could not access global functions
Because we declare the functions in runtime.js we need the correct
global object to be setup otherwise they cannot be accessed when
switching to the SheetGlobalObject.
2021-09-30 15:37:56 +01:00
Ali Mohammad Pur
146aaec129 RequestServer: Avoid storing a strong reference to a socket in callbacks
Unused sockets created by EnsureConnection should not keep the socket
around (storing a strong reference will create a reference cycle).
This fixes a whole bunch more RS spins.
2021-09-30 11:46:37 +02:00
Ali Mohammad Pur
56bb7dde87 RequestServer: Use an OwnPtr for the connection cache vector
Just as removing individual connections can cause the vector entries to
change positions, adding or removing connections to the cache can also
move the connections around, which would make it possible for a
connection to avoid being deleted (and make the RS spin on the Notifier
for that connection).
This commit makes it so that no connection cache is left when it's
supposed to be deleted.
Fixes a few more RS spins.
2021-09-30 11:46:37 +02:00
Ali Mohammad Pur
b0a9c5673e LibHTTP: Respect the 'Connection: close' header on keep-alive jobs
If the server responds with this header, we _must_ close the connection,
as the server is allowed to ignore the socket and not respond to
anything past that response.
Fixes some RequestServer spins.
2021-09-30 11:46:37 +02:00
Rodrigo Tobar
d16131b100 Kernel: Implement getsockopt(SO_TYPE)
This is easy to implement, and is required by some applications like
python's ssl module.
2021-09-30 11:45:24 +02:00
Linus Groh
bc49ce72c1 Meta: Add David Tuin to the contributors list :^) 2021-09-30 08:35:26 +01:00
davidot
5611285312 SpreadSheet: Fix that the js integration abused global objects
Before this commit it only allocated the global object so when it wanted
to lookup 'thisSheet' it could not find it in the global environment.
We now hotswap the global object everytime a cell evaluated.

This also fixes that SheetGlobalObject did not have an
internal_has_property meaning 'A0' could not be referenced unless it was
via a member lookup (this.A0). This was already broken before the
bindings refactoring.

The correct behavior of realms in spreadsheet is not completely clear
since what is shared between sheets is not very well defined.

The reason that just setting the SheetGlobalObject as the
global_this_value is not enough is because ECMAScript does not check the
global_this_value for members when resolving a reference in the global
environment.
2021-09-30 08:16:32 +01:00
davidot
e5d48ee238 LibJS: Fix switch skipping case evaluation when hitting the default case
When no case match we should not just execute the statements of the
default case but also of any cases below the default case.
2021-09-30 08:16:32 +01:00
davidot
830ea0414c LibJS: Make scoping follow the spec
Before this we used an ad-hoc combination of references and 'variables'
stored in a hashmap. This worked in most cases but is not spec like.
Additionally hoisting, dynamically naming functions and scope analysis
was not done properly.

This patch fixes all of that by:
  - Implement BindingInitialization for destructuring assignment.
  - Implementing a new ScopePusher which tracks the lexical and var
    scoped declarations. This hoists functions to the top level if no
    lexical declaration name overlaps. Furthermore we do checking of
    redeclarations in the ScopePusher now requiring less checks all over
    the place.
  - Add methods for parsing the directives and statement lists instead
    of having that code duplicated in multiple places. This allows
    declarations to pushed to the appropriate scope more easily.
  - Remove the non spec way of storing 'variables' in
    DeclarativeEnvironment and make Reference follow the spec instead of
    checking both the bindings and 'variables'.
  - Remove all scoping related things from the Interpreter. And instead
    use environments as specified by the spec. This also includes fixing
    that NativeFunctions did not produce a valid FunctionEnvironment
    which could cause issues with callbacks and eval. All
    FunctionObjects now have a valid NewFunctionEnvironment
    implementation.
  - Remove execute_statements from Interpreter and instead use
    ASTNode::execute everywhere this simplifies AST.cpp as you no longer
    need to worry about which method to call.
  - Make ScopeNodes setup their own environment. This uses four
    different methods specified by the spec
    {Block, Function, Eval, Global}DeclarationInstantiation with the
    annexB extensions.
  - Implement and use NamedEvaluation where specified.

Additionally there are fixes to things exposed by these changes to eval,
{for, for-in, for-of} loops and assignment.

Finally it also fixes some tests in test-js which where passing before
but not now that we have correct behavior :^).
2021-09-30 08:16:32 +01:00
davidot
4428e494b0 LibJS: Handle escaped keywords in more cases and handle 'await' labels 2021-09-30 08:16:32 +01:00
davidot
79caca8ca2 LibJS: Allow multiple labels on the same statement
Since there are only a number of statements where labels can actually be
used we now also only store labels when necessary.
Also now tracks the first continue usage of a label since this might not
be valid but that can only be determined after we have parsed the
statement.
Also ensures the correct error does not get wiped by load_state.
2021-09-30 08:16:32 +01:00
davidot
bfc1b4ba61 LibJS: Allow member expressions in binding patterns
Also allows literal string and numbers as property names in object
binding patterns.
2021-09-30 08:16:32 +01:00