Commit graph

27347 commits

Author SHA1 Message Date
Linus Groh
80e58dab9a LibJS: Make get_function_realm() actually return a Realm 2021-09-12 11:10:20 +01:00
Linus Groh
06e89311fa LibJS: Set the callee context's realm in prepare_for_ordinary_call()
This includes making FunctionObject::realm() actually return a Realm,
instead of a GlobalObject.
2021-09-12 11:10:20 +01:00
Linus Groh
332946ab4f LibJS: Prepare ExecutionContext to store the current Realm Record
Also add VM::current_realm() to retrieve it, similar to all the other
getters (running_execution_context() et al.).
2021-09-12 11:10:20 +01:00
Linus Groh
15c33477e4 LibJS: Make prepare_for_ordinary_call() new_target parameter an Object*
This got changed in the spec at some point, replacing the assertion in
step 1 with "... and newTarget (an Object or undefined)" in the
parameter description.
Subsequently, there's now one step less, so the numbers all change.
2021-09-12 11:10:20 +01:00
Linus Groh
f29a82dd84 LibJS: Move the GlobalEnvironment from GlobalObject to Realm
This is where the spec wants to have it. Requires a couple of hacks as
currently everything that needs a Realm actually has a GlobalObject, so
we need to go via the Interpreter.
2021-09-12 11:10:20 +01:00
Linus Groh
1e79934acf LibJS: Add [[GlobalThisValue]] internal slot to GlobalEnvironment
Instead of hardcoding the environment's global object as the return
value of GlobalEnvironment::global_this_value(), it now stores an Object
reference which is passed to the constructor for this purpose.

From the spec (https://tc39.es/ecma262/#sec-global-environment-records):

[[GlobalThisValue]] | Object | The value returned by this in global
scope. Hosts may provide any ECMAScript Object value.
2021-09-12 11:10:20 +01:00
Linus Groh
2b8d5696ab LibJS: Allocate a Realm next to GlobalObject in Interpreter::create()
Also pass a Realm reference to the Bytecode::Interpreter constructor,
just like we pass the GlobalObject.
2021-09-12 11:10:20 +01:00
Linus Groh
d9c3bafcd9 LibJS: Start adding a JS::Realm class (spec's "Realm Record") 2021-09-12 11:10:20 +01:00
Liav A
8d0dbdeaac Kernel+Userland: Introduce a new way to reboot and poweroff the machine
This change removes the halt and reboot syscalls, and create a new
mechanism to change the power state of the machine.
Instead of how power state was changed until now, put a SysFS node as
writable only for the superuser, that with a defined value, can result
in either reboot or poweroff.
In the future, a power group can be assigned to this node (which will be
the GroupID responsible for power management).

This opens an opportunity to permit to shutdown/reboot without superuser
permissions, so in the future, a userspace daemon can take control of
this node to perform power management operations without superuser
permissions, if we enforce different UserID/GroupID on that node.
2021-09-12 11:52:16 +02:00
Liav A
06e95d0fd7 Kernel/SysFS: Make it possible to have custom permissions for nodes 2021-09-12 11:52:16 +02:00
Liav A
33f033066c Kernel: Unify BIOS and ACPI components in the SysFS firmware directory
Both should reside in the SysFS firmware directory which is normally
located in /sys/firmware.
Also, apply some OOM-safety patterns when creating the BIOS and ACPI
directories.
2021-09-12 11:52:16 +02:00
Liav A
9132596b8e Kernel: Move ACPI and BIOS code into the new Firmware directory
This will somwhat help unify them also under the same SysFS directory in
the commit.
Also, it feels much more like this change reflects the reality that both
ACPI and the BIOS are part of the firmware on x86 computers.
2021-09-12 11:52:16 +02:00
Karol Kosek
a9ec98028b ThemeEditor: Accept drop events 2021-09-12 11:49:52 +02:00
Karol Kosek
4e1a794abe ThemeEditor: Update theme path on theme load
Prior to this change, the 'Save' action was saving a file to the startup
path (or just showed a File Picker dialog) if a file has been opened
by the Open action or by drag-n-dropping a file to the program.
2021-09-12 11:49:52 +02:00
Karol Kosek
be7ae76829 ThemeEditor: Rename main()'s preview_palette to startup_preview_palette
This is to avoid ambiguity from the preview_widget.preview_palette().
2021-09-12 11:49:52 +02:00
Karol Kosek
483db9334e ThemeEditor: Use preview_palette from the PreviewWidget
Prior this change, when you opened a file using the brand new Open
action and tried to change the Color Role or save it, then it would just
go back to the startup palette.
2021-09-12 11:49:52 +02:00
Karol Kosek
23137f0a8d ThemeEditor: Add 'Open file' menu action 2021-09-12 11:49:52 +02:00
Karol Kosek
f878e4464f LibGfx: Add SystemTheme::load_system_theme(Core::ConfigFile const&)
This makes loading system themes possible via FileSystemAccessClient
(needed for the Theme Editor). :^)
2021-09-12 11:49:52 +02:00
Karol Kosek
09314ad611 ThemeEditor: Open files from an argument
This commit allows you to open a theme file from an argument, i.e.
`ThemeEditor Theme.ini`.
2021-09-12 11:49:52 +02:00
Karol Kosek
8c47f38ca5 ThemeEditor: Reference FileSystemAccessClient::Result in save_to_result
Found by clazy. It says the size is 32 bytes.
2021-09-12 11:49:52 +02:00
Karol Kosek
6995e428db ThemeEditor: Create menu contents after creating widgets
My next commits will be more readable that way. :^)
2021-09-12 11:49:52 +02:00
TheFightingCatfish
a81b21c1a7 Kernel+LibC: Implement fsync 2021-09-12 11:24:02 +02:00
Callum Walker
fd3735199b LibCore: Fix link_file inverting src and dst paths on duplicate names
File::link_file takes the dst_path then the src_path so on duplicate
names we tried to create a link at the original file location, which
then flipped the parameters back round again and we ended up with a
broken link from "dst_path (1)" to "src_path (1)".
2021-09-12 04:58:22 +00:00
Andreas Kling
19de6bb1cc LibWeb+Browser: Add Debug menu action for toggling Same-Origin Policy
Sometimes it's useful to turn off the SOP for testing purposes.
Let's make that easy by having a Debug menu item for it. :^)
2021-09-12 02:13:28 +02:00
Liav A
c181494b19 Kernel/SysFS: Move the PCI bus directory to the /sys/bus directory
The USB bus directory is already in /sys/bus directory, so I don't see a
reason why the PCI bus directory shouldn't be in that directory too.
2021-09-12 01:44:19 +02:00
Luke Wilde
1927600852 LibWeb: Add the History object and stub pushState and replaceState
The spec allows us to optionally return from these for any reason.
Our reason is that we don't have all the infrastructure in place yet to
implement them.
2021-09-12 01:41:44 +02:00
Luke Wilde
3faed65e2b LibWeb: Add full support for optional and nullable to IDL string types
Used by History.
2021-09-12 01:41:44 +02:00
Luke Wilde
f8eb616fe3 LibWeb: Add support for the IDL any type
The any type is essentially a raw JS::Value.
2021-09-12 01:41:44 +02:00
Luke Wilde
3eca8cb243 LibWeb: Add Document::is_fully_active
This is used in a bunch of places in the HTML spec. The current use
case for this is History.
2021-09-12 01:41:44 +02:00
Timothy Flynn
f5c988b3ce LibJS: Convert MapIterator.prototype to be a PrototypeObject 2021-09-12 01:40:56 +02:00
Timothy Flynn
77efecadf7 LibJS: Convert Map.prototype to be a PrototypeObject 2021-09-12 01:40:56 +02:00
Timothy Flynn
9e57ea71af LibJS: Convert GeneratorObject.prototype to be a PrototypeObject
The added #include in GeneratorObject.h is to resolve usage of
Bytecode::RegisterWindow.
2021-09-12 01:40:56 +02:00
Timothy Flynn
43e4cec3e2 LibJS: Convert FinalizationRegistry.prototype to be a PrototypeObject 2021-09-12 01:40:56 +02:00
Timothy Flynn
94f076a774 LibJS: Convert Date.prototype to be a PrototypeObject 2021-09-12 01:40:56 +02:00
Timothy Flynn
8bfb665b72 LibJS: Convert DataView.prototype to be a PrototypeObject 2021-09-12 01:40:56 +02:00
Timothy Flynn
4d1d0f05a9 LibJS: Convert ArrayIterator.prototype to be a PrototypeObject 2021-09-12 01:40:56 +02:00
Timothy Flynn
bd4c116d08 LibJS: Convert ArrayBuffer.prototype to be a PrototypeObject 2021-09-12 01:40:56 +02:00
Timothy Flynn
696967d7b6 LibJS: Convert WeakSet.prototype to be a PrototypeObject 2021-09-12 01:40:56 +02:00
Timothy Flynn
777ae53615 LibJS: Convert WeakRef.prototype to be a PrototypeObject 2021-09-12 01:40:56 +02:00
Timothy Flynn
966f4faae4 LibJS: Convert WeakMap.prototype to be a PrototypeObject 2021-09-12 01:40:56 +02:00
Timothy Flynn
be0880fb2c LibJS: Convert StringIterator.prototype to be a PrototypeObject 2021-09-12 01:40:56 +02:00
Timothy Flynn
f195cb41a8 LibJS: Convert SetIterator.prototype to be a PrototypeObject 2021-09-12 01:40:56 +02:00
Timothy Flynn
75d5c17aec LibJS: Convert Set.prototype to be a PrototypeObject 2021-09-12 01:40:56 +02:00
Timothy Flynn
a41d0d23f9 LibJS: Convert Promise.prototype to be a PrototypeObject 2021-09-12 01:40:56 +02:00
Timothy Flynn
b749194e70 LibJS: Convert RegExpStringIterator.prototype to be a PrototypeObject 2021-09-12 01:40:56 +02:00
Timothy Flynn
65b0c26c44 LibJS: Convert RegExp.prototype to be a PrototypeObject 2021-09-12 01:40:56 +02:00
Timothy Flynn
1078d5e58a LibJS: Create a class to provide common methods for object prototypes
Almost every JS prototype class defines a static "typed_this" helper to
return the current "this" value as the analogous object type. This adds
a PrototypeObject class to be inserted between the prototype object and
the base Object class to define these methods on the prototype's behalf.

Note that the generated "display_name" method must be defined static
because the callers of typed_this are also static.
2021-09-12 01:40:56 +02:00
Mustafa Quraish
d38d03ce28 PixelPaint: Fit image to view when opened
When opening a file, make it fit on the screen. I think this is
sensible default behaviour.
2021-09-12 00:17:04 +02:00
Mustafa Quraish
f890f8529a PixelPaint: Make Fit Image To View account for rulers
Because of the way rulers are implemented in the ImageEditor
currently, the `Fit Image To View` action doesn't work correctly
with them enabled. This patch makes them adjust to the effective
viewport area and account for the rulers.

This is a bit of a hack, but the correct way to deal with this would
be to put the rulers in a new widget so they don't interfere with
the actual viewport rect (which is being used all over).
2021-09-12 00:17:04 +02:00
Mustafa Quraish
1e1e5bb5f7 PixelPaint: Remove unused methods to access files directly
After transitioning to FileSystemAccessServer, some of the methods
in `MainWidget` and `ProjectLoader` for opening files directly with
a filename as opposed to with a file descriptor are unused. This
commit removes them.
2021-09-12 00:17:04 +02:00