Commit graph

14042 commits

Author SHA1 Message Date
Ben Wiederhake 24009c07a7 Remove old .travis.yml 2020-11-08 09:58:55 +01:00
Ben Wiederhake a82a17eee8 Toolchain: Trust cache blindly
This is necessary because cache reusability will be determined by Github Actions.

Note that we only cache if explicitly asked to do so,
which only happens on Github Actions.
2020-11-08 09:58:55 +01:00
Ben Wiederhake 3cd39097f6 Meta: Add script that runs all lints 2020-11-08 09:58:55 +01:00
Andreas Kling a49802558d LibWeb: Use the system theme's button text color for <input> buttons 2020-11-08 01:36:45 +01:00
Andreas Kling 79b45f96ee LibC: Add two little assertions in malloc() and malloc_size() 2020-11-08 01:15:02 +01:00
Andreas Kling ae10c9d8ec UserspaceEmulator: Fix busted backtraces with --report-to-debug
Some of the output was still going to stderr in this mode, we need to
use reportln() to make sure it goes to the right place.
2020-11-08 01:15:02 +01:00
Andreas Kling 957e7d10d4 LibDebug: Handle the "set ISA" standard opcode
I don't know what to do with this information, but let's at least skip
over the opcode instead of asserting.
2020-11-08 01:15:02 +01:00
Andreas Kling 0f84e246b2 LibDebug: Handle AttributeDataForm::SData (DW_FORM_sdata)
This is a LEB128-encoded signed constant.
2020-11-08 01:15:02 +01:00
Andreas Kling 013c7ccd73 UserspaceEmulator: Don't audit accesses within realloc(), malloc_size()
These functions access malloc-related memory outside of UE's accounting
boundaries, so just ignore them.
2020-11-08 01:15:02 +01:00
Andreas Kling 6d841f2628 LibCore: Run clang-format on ArgsParser.cpp 2020-11-07 21:13:56 +01:00
Nico Weber c9c3667ea7 Kernel: Update TimeManagement::m_epoch_time directly in increment_time_since_boot 2020-11-07 18:28:35 +01:00
Nico Weber b143e604d7 LibCore: Add an ArgsParser::add_option() overload for doubles 2020-11-07 18:28:35 +01:00
Nico Weber e673abb93f AK: Remove duplicate begin()/end() methods
begin()/end() returning a ConstItertor already exist further up
in this file. Nothing uses these redundant versions, and they are not
callable.
2020-11-07 18:28:35 +01:00
Linus Groh 2c9e6585f8 Documentation: Update required GCC version to >= 10
I initially thought as long as Lagom is not built >= 9 would be fine,
but LagomCore is always built for the code generators.
2020-11-07 18:22:18 +01:00
Brendan Coles 02d6252949 LibWeb: Restrict HTML form submissions to permitted URL protocols
Form submissions to file:// URLs are now permitted only if the
submitting document is also a file:// URL and the form method is "get".

Form submissions to URLs with a http(s):// URL protocol are permitted.

Form submissions for all other URL protocols are rejected.
2020-11-07 17:57:22 +01:00
Andreas Kling 1da828b8bf Ext2FS: Zero out inode metadata when deleting them
This isn't strictly necessary but it seems like a reasonable thing
to be doing. Note that we still populate the dtime field with the
time of deletion.
2020-11-07 17:48:22 +01:00
Andreas Kling bab24ce34c Ext2FS: Deallocate block list meta blocks when freeing an inode
When computing the list of blocks to deallocate when freeing an inode,
we would stop collecting blocks after reaching the inode's block count.
Since we're getting rid of the inode, we need to also include the meta
blocks used by the on-disk block list itself.
2020-11-07 16:45:03 +01:00
Andreas Kling 508063ef85 LibGfx: Remove debug spam about successful font lookups 2020-11-07 14:23:31 +01:00
Andreas Kling 43ff2ea8d8 LibJS: Use regular stack for VM call frames instead of Vector storage
Keeping the VM call frames in a Vector could cause them to move around
underneath us due to Vector resizing. Avoid this issue by allocating
CallFrame objects on the stack and having the VM simply keep a list
of pointers to each CallFrame, instead of the CallFrames themselves.

Fixes #3830.
Fixes #3951.
2020-11-07 13:58:28 +01:00
Brendan Coles a950d3dd5f LibWeb: Reject iframing file:// URLs if document is not a file:// URL 2020-11-07 10:53:09 +01:00
Luke 8928607455 Lagom/Fuzzers: Add Fuzzilli version of FuzzJs
Fuzzilli is a JavaScript engine fuzzer made by googleprojectzero.

https://github.com/googleprojectzero/fuzzilli/
2020-11-07 10:09:55 +01:00
Luke f5aad71c15 LibJS: Remove unused variable m_has_property_table in Shape 2020-11-07 10:09:55 +01:00
Luke 020b782474 LibJS: Use pow instead of __bulitin_pow on clang
__bulitin_pow doesn't seem to exist on clang, at least
it didn't build with it.
2020-11-07 10:09:55 +01:00
Linus Groh 745ffca580 LibJS: Use element index as key for array spread in object
This fixes spreading of arrays with holes in object literals where the
inserted keys are not consecutive numbers.

Fixes #3967.
2020-11-07 10:08:28 +01:00
Linus Groh 06a3625545 LibJS: Set prototype of GlobalObject to ObjectPrototype
As the global object is constructed and initialized in a different way
than most other objects we were not setting its prototype! This made
things like "globalThis.toString()" fail unexpectedly.
2020-11-07 10:08:05 +01:00
Linus Groh 965050796f LibJS: Don't create StringOrSymbol(String) if from_value() fails
If value.to_string() throws an exception and returns a null string we
must create an invalid StringOrSymbol, not one from the null string
(which ASSERT()s).
2020-11-07 10:08:05 +01:00
Brendan Coles a0130b55d4 LibWeb: Load favicon.ico only for http/https URLs 2020-11-07 10:05:35 +01:00
Linus Groh 021c8dea1f LibJS: Skip trailing empty values in IndexedPropertyIterator
When we reach the end of the pre-computed indices vector we can just
skip to the end (array-like size) as only empty values will follow.

Fixes #3970.
2020-11-07 10:03:58 +01:00
Tom d5bb5d109b Kernel: Fix HPET timer not firing in Bochs
* Change the register structures to use the volatile keyword explicitly
  on the register values. This avoids accidentally omitting it as any
  access will be guaranteed volatile.
* Don't assume we can read/write 64 bit value to the main counter and
  the comparator. Not all HPET implementations may support this. So,
  just use 32 bit words to access the registers. This ultimately works
  around a bug in Bochs 2.6.11 that loses 32 bits of a 64 bit write to
  a timer's comparator register (it internally writes one half and
  clears the Tn_VAL_SET_CNF bit, and then because it's cleared it
  fails to write the second half).
* Properly calculate the tick duration in calculate_ticks_in_nanoseconds
* As per specification, changing the frequency of one periodic timer
  requires a restart of all periodic timers as it requires the main
  counter to be reset.
2020-11-06 15:51:56 +01:00
Joseph Bywater 348cd0fdc1 LibGUI: Clip rubber band to IconView widget content area
Add a clip rect for the rubber band painter of widget_inner_rect
This ensures the rubber band is not drawn over the scrollbars.

Fixes #3926
2020-11-06 15:50:46 +01:00
Linus Groh 82b42cefbd LibJS: Handle circular references in Array.prototype.toLocaleString()
Also use ArmedScopeGuard for removing seen objects to account for early
returns.

Fixes #3963.
2020-11-06 15:50:18 +01:00
Joseph Bywater 15bc42479a LibGUI: Fix AbstractView selection after initial focusin event
After moving the cursor to the home position, clear the
selection.

Fixes #3925.
2020-11-06 00:33:47 +01:00
Linus Groh dec6c0a207 LibJS: Use array-like size for IndexedProperties::is_empty()
Some things, like (the non-generic version of) Array.prototype.pop(),
check is_empty() to determine whether an action, like removing elements,
can be performed. We need to know the array-like size for that, not the
size of the underlying storage, which can be different - and is not
something IndexedProperties should expose so I removed its size().

Fixes #3948.
2020-11-05 20:01:30 +01:00
Linus Groh 0bb66890c8 LibJS: Fix Object::delete_property() with numeric string property
- We have to check if the property name is a string before calling
  as_string() on it
- We can't as_number() the same property name but have to use the parsed
  index number

Fixes #3950.
2020-11-05 19:15:00 +01:00
Linus Groh 8d96f428ef LibJS: ASSERT(property_name.is_valid()) in more Object methods 2020-11-05 19:15:00 +01:00
Andreas Kling e9403e2b03 AK: printf was not accounting for plus sign with "%+d"
We have to include the plus sign in the number of characters written,
otherwise sprintf() will put the null terminator too early.
2020-11-05 11:04:10 +01:00
Andreas Kling eed78ffa5a Base: Tweak CXXFLAGS for the "little" test projects
Let's build with -std=c++2a since we're C++20 nowadays. :^)
2020-11-05 10:02:57 +01:00
Andreas Kling 575c483310 AK: Always include <new> from compiler before our operators new
We had competing inline definitions of the placement operators new.
Avoid this by having <AK/kmalloc.h> pull in <new> from the compiler
and always using their definitions instead.

I feel like there must be an elegant solution to this whole situation
with the operators, but I'm not sure what it is.
2020-11-05 09:59:30 +01:00
Linus Groh 2cf8649d0e LibJS: Fix ProxyObject get/set with symbol property name
We can't assume that property names can be converted to strings anymore,
as we have symbols. Use name.to_value() instead.

This makes something like this possible:

    new Proxy(Object, { get(t, p) { return t[p] }  })[Symbol.hasInstance]
2020-11-04 23:06:44 +01:00
Linus Groh 44e38b8457 LibJS: Replace a bunch of vm() calls in ProxyObject with reference
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-04 23:06:44 +01:00
Linus Groh 2645dfafcf LibJS: Implement Object(value) constructor
Not sure why we didn't have this yet, it's super simple :^)
2020-11-04 23:06:44 +01:00
Andreas Kling 501cef2bd7 Revert "Kernel: Implement an asynchronous device request stack"
This reverts commit 2fd5ce1eb0.

This broke booting without SMP. (PR was #3921)
2020-11-04 21:25:26 +01:00
Andreas Kling 70eaadc1cd LibGfx: Load the system default fonts by name
Instead of loading them by absolute path, that is.
2020-11-04 21:21:52 +01:00
Tom 2fd5ce1eb0 Kernel: Implement an asynchronous device request stack
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-04 21:21:37 +01:00
Tom 96081010dc Kernel: Remove dead code from BlockDevice 2020-11-04 21:21:37 +01:00
Tom 28b109688b Kernel: Defer kmalloc heap contraction
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-04 21:21:37 +01:00
Tom b9a97ff81f Kernel: Add mechanism to queue deferred function calls
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-04 21:21:37 +01:00
Jesse Buhagiar 4713e6185f Chess: Add missing default config file in .config :^)
Following 9f8a8e07c2, let's add a default
`.ini` to prevent `unveil` from failing.
2020-11-04 19:36:54 +01:00
Brendan Coles e558f6b184 Minesweeper+Snake: load config file before calling unveil() 2020-11-04 19:36:27 +01:00
Linus Groh 0603402c80 LibJS: Handle circular references in Array.prototype.join()
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-04 19:35:43 +01:00