Commit graph

22977 commits

Author SHA1 Message Date
Gunnar Beutner 50839bd1f1 Kernel: Properly initialize r8-r15 for new threads on x86_64 2021-06-30 15:13:30 +02:00
Gunnar Beutner cafccb866c Kernel: Don't start usermode threads on x86_64 for now
Starting usermode threads doesn't currently work on x86_64. With this
stubbed out we can get text mode to boot though.
2021-06-30 15:13:30 +02:00
Timothy Flynn 2a6e6c42d2 LibWeb: Define hot DOMTreeJSONModel methods in-line 2021-06-30 15:13:18 +02:00
Timothy Flynn 067f7ae60a LibWeb: Store JSON pointers in the OOPWV DOM Inspector model indices
Currently, the DOM Inspector stores a numeric ID for each DOM node. This
is used to look up the data for that node in the JSON representation of
the DOM. The method to do this search performs a depth-first search
through the JSON value, and is invoked quite frequently.

Instead, we can just store a pointer to the JSON value in the index, and
avoid this search altogether. This is similar to how the IPWV stores a
pointer to the DOM node.
2021-06-30 15:13:18 +02:00
Timothy Flynn 7604c2f38e LibWeb: Do not create copies of JSON values in OOPWV DOM Inspector
To improve the performance of the DOM Inspector when the Browser is run
in multi-process mode, do not create copies of the JSON values sent via
IPC when searching for a model index. Methods that are guaranteed to
return a value now return a reference. Methods that do not have such a
guarantee return a pointer (rather than an Optional, because Optional
cannot hold references).

The DOM Inspector performs well at first, but will start lagging again
once the tree is expanded a few nodes deep and/or with many nodes
visible in the tree.
2021-06-30 15:13:18 +02:00
Idan Horowitz 7d055dd039 LibJS: Optimize & Bring String.prototype.repeat closer to the spec
Specifically, we immediately return an empty string when `this` is an
empty string, instead of wasting time in a loop doing nothing N times.
2021-06-30 14:01:25 +01:00
Idan Horowitz 5f09d78b9d LibJS: Bring the Array constructor slightly closer to the specification
Specifically, we now cast to a u32 instead of an i32, as well as use
the validity check required by the specification. The current
constructor is still quite far from the specification, as we directly
set the indexed properties' length instead of going through the Array's
overriden DefineOwnProperty. (and as a result the checks imposed by the
ArraySetLength abstract operation)
2021-06-30 12:35:24 +01:00
Andreas Kling 80cf8bb27c Assistant: Use static_cast instead of dynamic_cast
When the type is guaranteed to be known, there's no need to use RTTI.
2021-06-30 11:44:52 +02:00
Andreas Kling 6c630437e9 Assistant: Don't add a subtitle label widget if we don't need it 2021-06-30 11:44:34 +02:00
Andreas Kling 6f0e8f823b Kernel: Don't compile JsonValue & friends into the kernel 2021-06-30 11:31:12 +02:00
Andreas Kling 65db56cd9f LibKeyboard: Remove an unnecessary #include when building with KERNEL 2021-06-30 11:30:28 +02:00
Andreas Kling 050db0cc33 run-tests: Update for LexicalPath API changes 2021-06-30 11:19:21 +02:00
Max Wipfli fb8bbdabb7 AK: Use canonicalized_path in LexicalPath::relative_path
This avoids construction of LexicalPath objects.
2021-06-30 11:13:54 +02:00
Max Wipfli 36c3962670 AK: Add [[nodiscard]] to LexicalPath methods construction objects 2021-06-30 11:13:54 +02:00
Max Wipfli dde888a3d4 AK: Move path canonicalization into LexicalPath::canonicalized_path
This moves the path canonicalization from the LexicalPath constructor to
canonicalized_path. This allows canonicalized path to no longer
construct a LexicalPath object and initialize all its member variables.
2021-06-30 11:13:54 +02:00
Max Wipfli d8be530397 AK+Everywhere: Remove "null state" of LexicalPath
This removes the default constructor of LexicalPath, and subsequently
modifies all its users to accommodate the change.
2021-06-30 11:13:54 +02:00
Max Wipfli 4c018909f7 AK: Make LexicalPath immutable
This replaces the current LexicalPath::append() API with a new method
that returns a new LexicalPath object and doesn't touch the this-object.
With this, LexicalPath is now immutable. It also adds a
LexicalPath::parent() method and the relevant test cases.
2021-06-30 11:13:54 +02:00
Max Wipfli 1e80022282 Tests: Rewrite tests for LexicalPath 2021-06-30 11:13:54 +02:00
Max Wipfli 7405536a1a AK+Everywhere: Use mostly StringView in LexicalPath
This changes the m_parts, m_dirname, m_basename, m_title and m_extension
member variables to StringViews onto the m_string String. It also
removes the m_is_absolute member in favour of computing if a path is
absolute in the is_absolute() getter. Due to this, the canonicalize()
method has been completely rewritten.

The parts() getter still returns a Vector<String>, although it is no
longer a const reference as m_parts is no longer a Vector<String>.
Rather, it is constructed from the StringViews in m_parts upon request.
The parts_view() getter has been added, which returns Vector<StringView>
const&. Most previous users of parts() have been changed to use
parts_view(), except where Strings are required.

Due to this change, it's is now no longer allow to create temporary
LexicalPath objects to call the dirname, basename, title, or extension
getters on them because the returned StringViews will point to possible
freed memory.
2021-06-30 11:13:54 +02:00
Max Wipfli fc6d051dfd AK+Everywhere: Add and use static APIs for LexicalPath
The LexicalPath instance methods dirname(), basename(), title() and
extension() will be changed to return StringView const& in a further
commit. Due to this, users creating temporary LexicalPath objects just
to call one of those getters will recieve a StringView const& pointing
to a possible freed buffer.

To avoid this, static methods for those APIs have been added, which will
return a String by value to avoid those problems. All cases where
temporary LexicalPath objects have been used as described above haven
been changed to use the static APIs.
2021-06-30 11:13:54 +02:00
Max Wipfli 9b8f35259c AK: Remove the LexicalPath::is_valid() API
Since this is always set to true on the non-default constructor and
subsequently never modified, it is somewhat pointless. Furthermore,
there are arguably no invalid relative paths.
2021-06-30 11:13:54 +02:00
Max Wipfli caa9daf59e AK: Use east const style in LexicalPath.{cpp,h} 2021-06-30 11:13:54 +02:00
Luke 37361821dd Kernel/PCI: Keep track of the currently mapped bus in MMIO mode
There is a check in map_bus_region to make sure we don't pointlessly
remap the bus region if the previous mapping was for the same bus.
This is tracked with `m_mapped_bus`.

However, nothing was actually updating `m_mapped_bus`, and it is
initialised to 0. This means that if we start with a device on bus 0,
the read in data will be valid. If we map say bus 1 then bus 0 again,
the map for bus 0 will now be ignored and invalid data will be read in.

Fixed by updating `m_mapped_bus` with the currently mapped bus.
2021-06-30 11:13:04 +02:00
Luke 02810f15b1 Kernel/PCI: Don't unmap determine_memory_mapped_bus_region after init
This can be accessed after init via lspci.
2021-06-30 11:12:44 +02:00
Max Wipfli 9f0ce2dc81 LibGUI: Add PasswordBox
This patch adds a PasswordBox. At the moment, it's simply a TextBox with
it's substitution code point set to '*', and the undo and redo actions
disabled.
2021-06-30 11:12:25 +02:00
Max Wipfli de67d86696 LibGUI: Add glyph substitution to TextEditor
This patch adds the member variable m_substitution_code_point to
GUI::TextEditor. If non-zero, all gylphs to be drawn will be substituted
with the specified code point. This is mainly needed to support a
PasswordBox.

While the primary use-case is for single-line editors, multi-line
editors are also supported.

To prevent repeated String construction, a m_substitution_string_data
members has been added, which is an OwnPtr<Vector<u32>>. This is used as
a UTF-32 string builder. The substitution_code_point_view method uses
that Vector to provide a Utf32View of the specified length.
2021-06-30 11:12:25 +02:00
Max Wipfli 37961bf7cb LibGUI: Fix double-clicking words in syntax-highlighted text
This patch fixes a bug where double-clicking on a word in a TextEditor
with syntax highlighting would also select an additional character after
the word. This also simplifies the logic for double- and
triple-clicking.
2021-06-30 11:12:25 +02:00
FalseHonesty 988e17ed05 LibVideo: Migrate to east-const style & apply other minor fixes
This patch brings all of LibVideo up to the east-const style in the
project. Additionally, it applies a few fixes from the reviews in #8170
that referred to older LibVideo code.
2021-06-30 11:03:51 +02:00
FalseHonesty 7d4053dde1 LibVideo/VP9: Implement most of block_mode_info methods (6.4.15-6.4.18) 2021-06-30 11:03:51 +02:00
FalseHonesty 42fdaa7f60 LibVideo/VP9: Implement most of inter_frame_mode_info (6.4.11-6.4.14) 2021-06-30 11:03:51 +02:00
FalseHonesty e687f05b42 LibVideo/VP9: Implement intra_frame_mode_info procedure (6.4.6) 2021-06-30 11:03:51 +02:00
FalseHonesty cc1a9e3d1c LibVideo/VP9: Add SAFE_CALL macro to help propagate failure state 2021-06-30 11:03:51 +02:00
FalseHonesty 741677b992 LibVideo/VP9: Refactor how TreeParser accesses decoder data
The TreeParser requires information about a lot of the decoder's
current state in order to parse syntax tree elements correctly, so
there has to be some communication between the Decoder and the
TreeParser. Previously, the Decoder would copy its state to the
TreeParser when it changed, however, this was a poor choice. Now,
the TreeParser simply has a reference to its owning Decoder, and
accesses its state directly.
2021-06-30 11:03:51 +02:00
FalseHonesty 375dbad144 LibVideo/VP9: Begin decoding VP9 blocks 2021-06-30 11:03:51 +02:00
FalseHonesty 2ce4155b42 LibVideo/VP9: Successfully parse partition syntax element 2021-06-30 11:03:51 +02:00
FalseHonesty 7ff6315246 LibVideo/VP9: Begin creating a tree parser to parse syntax elements 2021-06-30 11:03:51 +02:00
FalseHonesty cfd65eafa9 LibVideo/VP9: Begin decoding tiles 2021-06-30 11:03:51 +02:00
FalseHonesty f9899fc17f LibVideo/VP9: Parse compressed header data
This patch adds compressed header parsing to the VP9 decoder (section
6.4 of the spec). This is the final decoder step before we can start to
decode tiles.
2021-06-30 11:03:51 +02:00
Andrew Kaster e821b349b2 Kernel: Give Devices without a custody a less fake absoulte_path
This hack allows self-test mode run-tests-and-shutdown.sh to give
TestProcFs a stat(2)-able /proc/self/fd/0. For some reason, when
stdin is a SerialDevice, /proc/self/fd/0 will be a symlink to the device
as expected, but, calling realpath or stat on /proc/self/fd/0 will error
out. realpath will give the string from Device::absolute_path() which
would be something like "device:4,64 (SerialDevice)". When VFS is trying
to resolve_path so that we can stat the file, it would bail out on this
fake-y path.

Change the fake path (that doesn't show up when you ls a device, nor
when checking the devices tab in SystemMonitor) from the major/minor
device number and class_name() to /dev/device_name(). There's probably
a very hairy yak standing behind this issue that was only discovered due
to the ProcFS rework.
2021-06-30 12:07:57 +04:30
Andrew Kaster ae4240788c Userland: Unlink file after waiting for child in run-tests
TestProcFs expects to be able to stat its stdout and stderr. The new
ProcFS implemetnation properly forwards the symlinks for
/proc/pid/fd/[1,2] to the temporary file that we had unlinked prior to
spawning the process. However, this makes it so that a normal stat on
the symlink to that file fails (as expected). Move the unlink to after
we've waited on the child, so that we know it won't be trying any funny
business with its stdout/stderr anymore.
2021-06-30 09:39:57 +04:30
Andrew Kaster cc0a376c95 Base+Utilities: Add run-tests program to run system tests with LibTest
This test program heavily pulls from the JavaScriptTestRunner/test-js,
but with a twist. Instead of loading JavaScript files into the current
process, constructing a JS environment for them, and executing test
suites/tests directly, run-tests posix_spawns each test file.

Test file stdout is written to a temp file, and only dumped to console
if the test fails or the verbose option is passed to the program. Unlike
test-js, times are always printed for every test executed for better
visibility in CI.
2021-06-30 08:18:28 +04:30
Andrew Kaster 601c9e89de Userland+Tests: Split out generic test runner from JS TestRunner
Split out the functionality to gather multiple tests from the filesystem
and run them in turn into Test::TestRunner, and leave the JavaScript
specific test harness logic in Test::JS::TestRunner and friends.
2021-06-30 08:18:28 +04:30
Andrew Kaster 44a6715584 Tests: TestProcFs cannot assume stdin/stdout/stderr are the same
If someone runs the test with shell redirection going on, or in a way
that changes any of the standard file descriptors this assumption will
not hold. When running from a terminal normally, it is true however.

Instead, check that /proc/self/fd/[0,1,2] are symlinks, and can be
stat-d by verifying that both stat and lstat succeed, and give different
struct stat contents.
2021-06-30 08:18:28 +04:30
Andrew Kaster 5e8a0c014e LibRegex: Make regex::Regex move-constructible and move-assignable
For some reason the default move constructor and default move-assign
operator were deleted, so we explicitly default them instead.
2021-06-30 08:18:28 +04:30
Andrew Kaster b15fe2b926 LibCore: Add getter for how many groups exist in a Core::ConfigFile
This can be used by an application to find out if any config sections
were loaded from the file after a reparse.
2021-06-30 08:18:28 +04:30
davidot fc9cc74555 LibJS: Handle the different realms case in ArraySpeciesCreate 2021-06-29 23:34:06 +01:00
Andreas Kling 384cffaa04 LibWeb: Fix build breakage after merging the oldish DOM inspector PR 2021-06-29 23:11:09 +02:00
Andreas Kling fd06b8b713 Kernel: ProcFS and SysFS component indices should be InodeIndex
This fixes the x86_64 kernel build. :^)
2021-06-29 23:07:02 +02:00
Adam Hodgen 1e5e02c70b LibWeb+Browser: Support DOM Inspector for OutOfProcessWebView
This introduces a new DOMTreeJSONModel, which provides the Model for the
InspectorWidget when the Browser is running using the
OutOfProcessWebView.

This Model is constructed with a JSON object received via IPC from the
WebContentServer.
2021-06-29 23:06:48 +02:00
Adam Hodgen cd6b9613c5 LibWeb+WebContent: Add IPC flow for Inspect DOM Tree
Add `inspect_dom_tree` to WebContentServer and 'did_get_dom_tree' to
WebContentClient.

These two async methods form a request & response for requesting a JSON
representation of the Content's DOM tree.
2021-06-29 23:06:48 +02:00