Commit graph

1454 commits

Author SHA1 Message Date
Hendiadyoin1
f682c9f100 LibC: Add netinet/in_systm.h 2021-04-18 15:52:07 +02:00
Gunnar Beutner
07adbf19c4 LibDebug: Implement support for AttributeDataForm::Data8
I came across this while analyzing a crash dump for openttd.
2021-04-18 15:51:13 +02:00
AnotherTest
ae49171755 LibCrypto: Avoid creating bools from anything except bools 2021-04-18 14:18:16 +02:00
AnotherTest
db8f0a2fa6 LibCore: Remove the no-longer-used Core::DateTime::is_before() function 2021-04-18 14:18:16 +02:00
AnotherTest
38f4441103 LibTLS: Parse X.509 certificates with the new ASN.1 parser
As a nice side effect, also correctly test for certificate validity :^)
2021-04-18 14:18:16 +02:00
AnotherTest
13abbc5ea8 LibCrypto: Implement UTCTime and GeneralizedTime parsers 2021-04-18 14:18:16 +02:00
AnotherTest
39997e2ab1 LibCore: Implement operator less-than for Core::DateTime
that just compares their timestamps.
2021-04-18 14:18:16 +02:00
AnotherTest
ed28008d78 LibCrypo: Add an ASN.1/DER pretty-printer
It's much easier to debug things when we can actually *see* them :P
2021-04-18 14:18:16 +02:00
AnotherTest
65de2d236d LibCrypto: Allow the user to override the DER read kind and class
This is useful for parsing non-universal types.
2021-04-18 14:18:16 +02:00
AnotherTest
581f9ff6bb LibCrypto: Add the GeneralizedTime ASN.1 type 2021-04-18 14:18:16 +02:00
Gunnar Beutner
f033416893 Kernel+LibC: Clean up how assertions work in the kernel and LibC
This also brings LibC's abort() function closer to the spec.
2021-04-18 11:11:15 +02:00
Andreas Kling
7ceb4f5330 LibGUI: Add some more status tips to common actions 2021-04-18 10:58:22 +02:00
Andreas Kling
a2086ad56e LibGUI: Rename Action::long_text to Action::status_tip
This feels a bit more descriptive.
2021-04-18 10:58:22 +02:00
Gunnar Beutner
407b066ba4 Ports: Update the gcc port with the patches from the toolchain 2021-04-18 10:55:25 +02:00
Gunnar Beutner
6cb28ecee8 LibC+LibELF: Implement support for the dl_iterate_phdr helper
This helper is used by libgcc_s to figure out where the .eh_frame sections
are located for all loaded shared objects.
2021-04-18 10:55:25 +02:00
Gunnar Beutner
8dc375da96 LibElf: Allow PT_GNU_EH_FRAME program headers
These are built when compiling an executable with exception support.
2021-04-18 10:55:25 +02:00
Gunnar Beutner
ebca6aabc0 LibC: Make atexit handlers thread-safe 2021-04-18 10:52:05 +02:00
Gunnar Beutner
4075b306f8 LibC+LibPthread: Make sure TLS keys are destroyed after everything else
This ensures that __thread variables can be used when global destructors
are being invoked.
2021-04-18 10:52:05 +02:00
Linus Groh
2b0c361d04 Everywhere: Fix a bunch of typos 2021-04-18 10:30:03 +02:00
Andreas Kling
d6c6880674 LibCore: Use is<T> in Object::find_*_of_type helpers
This allows us to add fast-paths for commonly used types.
2021-04-17 23:01:24 +02:00
AnotherTest
fb80d5adda LibLine: Check the terminal size at the start of get_line()
There are cases where the line editor could miss the WINCH signal
(e.g. in the shell, while another program is in the foreground),
This patch makes it so that LibLine notices the change in terminal size
in such cases.
2021-04-17 22:10:35 +02:00
AnotherTest
b58dbc29fc LibLine: Add support for ^X^E
This keybind opens the current buffer in an editor (determined by
EDITOR from the env, or the default_text_editor key in the config file,
and set to /bin/TextEditor by default), and later reads the file back
into the buffer.
Pretty handy :^)
2021-04-17 22:10:35 +02:00
Andreas Kling
5e945c5169 LibWeb: Don't load anything for <iframe> without src attribute
Completing an empty URL string from the document base URL will just
return the document URL, so any document that had an "<iframe>"
would endlessly load itself in recursive iframes.
2021-04-17 21:38:38 +02:00
Andreas Kling
22ed6a70eb LibGUI: Add "override text" to GUI::Statusbar
Each statusbar segment now has an optional "override text" which can
be set, and if non-null will be displayed instead of the regular text.

This allows programs to display contextual information in the statusbar
temporarily without losing whatever text was already on there.
2021-04-17 20:49:53 +02:00
Andreas Kling
3bf2f7a329 LibGUI: Make GUI::Toolbar buttons generate ActionEnter and ActionLeave
Now you'll get the same event whether you hover an action in a menu
or in a toolbar. :^)
2021-04-17 20:49:53 +02:00
Andreas Kling
7d0b59cb05 LibGUI: Add action enter/leave hooks on GUI::Application
Apps can now hook into these events by assigning a callback to the
on_action_enter and on_action_leave hooks on GUI::Application. :^)
2021-04-17 20:49:53 +02:00
Andreas Kling
4c6f541d5b LibGUI: Add Action* accessors on GUI::Button 2021-04-17 20:49:53 +02:00
Andreas Kling
e7263a7e75 LibGUI: Add a "long text" string to GUI::Action
Actions can now have a longer text description, in addition to its
regular UI string. The longer text will soon be used to display
a more detailed description of hovered actions in statusbars.
2021-04-17 20:49:53 +02:00
Andreas Kling
ba7e1ca2fb WindowServer+LibGUI: Notify GUI clients about menu item enter/leave
We now send out MenuItemEntered and MenuItemLeft messages to the client
when the user hovers/unhovers menu items.

On the client side, these become GUI::ActionEvent, with one of two
types: ActionEnter or ActionLeave. They are sent to the Application.

This will allow GUI applications to react to these events.
2021-04-17 20:49:53 +02:00
Linus Groh
eedde500eb LibJS: Replace MAX_U32 with NumericLimits<u32>::max() 2021-04-17 19:35:32 +02:00
Idan Horowitz
4a2c0d721f LibTextCodec: Implement a Windows-1255 decoder.
This is a superset of ascii that adds in the hebrew alphabet.
(Google currently assumes we are running windows due to not
recognizing Serenity as the OS in the user agent, resulting
in this encoding instead of UTF8 in google search results)
2021-04-17 18:13:20 +02:00
Idan Horowitz
79b1270711 LibJS: Take reference instead of pointer in prepare_arguments_list
This argument is always non-null (and the function assumes so), so
theres no point to taking a pointer instead of a reference.
2021-04-17 17:38:50 +02:00
Idan Horowitz
6cd318d784 LibJS: Convert matched regex result to string in Symbol.replace
This would crash on an undefined match (no match), since the matched
result was assumed to be a string (such as on discord.com). The spec
suggests converting it to a string as well:
https://tc39.es/ecma262/#sec-regexp.prototype-@@replace (14#c)
2021-04-17 16:10:45 +02:00
Andreas Kling
358697a32f LibGUI: Make sure we depend on the WindowManager IPC endpoints 2021-04-17 15:58:34 +02:00
sin-ack
aa56f9a1e0 LibGUI+WindowServer: Separate window manager IPC from regular IPC
With this patch the window manager related functionality is split out
onto a new endpoint pair named WindowManagerServer/Client.  This allows
window manager functionality to be potentially privilege separated in
the future.  To this end, a new client named WMConnectionClient
is used to maintain a window manager connection.  When a process
connects to the endpoint and greets the WindowServer as a window manager
(via Window::make_window_manager(int)), they're subscribed to the events
they requested via the WM event mask.

This patch also removes the hardcoding of the Taskbar WindowType to
receive WM events automatically.  However, being a window manager still
requires having an active window, at the moment.
2021-04-17 13:06:25 +02:00
Gunnar Beutner
c33592d28c Kernel+LibC: Update struct stat to use struct timespec instead of time_t
Some programs unconditionally expect struct stat to have nanosecond support.
2021-04-17 11:12:42 +02:00
Sahan Fernando
e6b396c248 LibGfx: Fix sse enabled builds by removing implicit float conversion 2021-04-17 11:00:04 +02:00
Luke
dfb23babbb LibGfx: Make top highlight of classic buttons fit to the top left corner 2021-04-17 09:56:22 +02:00
Egor Ananyin
1d343116a9 LibWeb: Fix height calculation for absolutely positioned boxes
This commit fixes algorithm for computing auto height (CSS 2.2 10.6.7)
by including floating boxes into computation and implements one of the cases
for computing the height of absolutely positioned, non-replaced elements (10.6.4 rule 3)
2021-04-17 09:48:27 +02:00
Andreas Kling
94b247c5a9 LibELF: Make get_library_name() take String instead of StringView 2021-04-17 01:27:31 +02:00
Andreas Kling
a1a6d30b54 LibCore: Make File take String instead of StringView 2021-04-17 01:27:31 +02:00
Andreas Kling
510aad6515 LibCore: Make DirIterator take String instead of StringView 2021-04-17 01:27:30 +02:00
Andreas Kling
0e4eb62dd8 LibGUI: Make some API's take String instead of StringView 2021-04-17 01:27:30 +02:00
Andreas Kling
36f27094d0 LibTTF: Make load_from_file() take String instead of StringView 2021-04-17 01:27:30 +02:00
Andreas Kling
e873d27ab1 LibGfx: Switch a bunch of API's from taking StringView to String
These were all getting converted into String internally anyway.
2021-04-17 01:27:30 +02:00
Andreas Kling
050648b270 LibGUI: Make Window::set_title() take a String 2021-04-17 01:27:29 +02:00
Andreas Kling
942a5afd23 LibCore: Don't needlessly use StringView in Core::Object APIs
Taking a StringView parameter that gets immediately converted to
a String anyway is silly. Just take a String directly instead.

This pattern is the main reason we have the "StringView internal
StringImpl pointer" optimization, and I suspect that we can throw
that whole thing out if we make a couple more patches like this.
2021-04-17 01:27:29 +02:00
Andreas Kling
d33fdc925b LibGUI: Make GUI::Widget::set_tooltip() take a String
There was no reason for this to take a StringView.
2021-04-17 01:27:29 +02:00
Idan Horowitz
586f10b6e1 LibJS: Accept symbol property in the in operator
This is used by discord.com and allowed by the specification:
https://tc39.es/ecma262/#sec-relational-operators-runtime-semantics-evaluation
2021-04-17 00:59:36 +02:00
Tobias Christiansen
7744048d0f LibWeb: Fix misplaced bullet points on list items
The bullet point should not be centered in the height of the list item,
but rather stay in front of the first line.
So, instead of giving the marker the full height of the ListItemBox,
it gets the height of a single line.

This closes #6384
2021-04-17 00:28:55 +02:00
Idan Horowitz
e3c634fdd0 LibJS: Implement initializing a TypedArray from an iterable object
Based on these specifications (which required IterableToList as well):
https://tc39.es/ecma262/#sec-typedarray
https://tc39.es/ecma262/#sec-initializetypedarrayfromlist
2021-04-17 00:24:09 +02:00
Idan Horowitz
06a2173586 LibJS: Implement initializing a TypedArray from an array-like object
Used by twitch.tv and based on the following specification:
https://tc39.es/ecma262/#sec-initializetypedarrayfromarraylike
2021-04-17 00:24:09 +02:00
James Triantafylos
c9196995be LibGUI: Allow arbitrary font size in FontPicker
This commit adds a SpinBox to the FontPicker dialog to allow users to
set arbitrary font sizes (1 to 255 inclusive) for TTF fonts.
The SpinBox is only visible when the user is selecting a TTF font.
2021-04-16 23:54:03 +02:00
AnotherTest
e4412f1f59 AK+Kernel: Make IntrusiveList capable of holding non-raw pointers
This should allow creating intrusive lists that have smart pointers,
while remaining free (compared to the impl before this commit) when
holding raw pointers :^)
As a sidenote, this also adds a `RawPtr<T>` type, which is just
equivalent to `T*`.
Note that this does not actually use such functionality, but is only
expected to pave the way for #6369, to replace NonnullRefPtrVector<T>
with intrusive lists.

As it is with zero-cost things, this makes the interface a bit less nice
by requiring the type name of what an `IntrusiveListNode` holds (and
optionally its container, if not RawPtr), and also requiring the type of
the container (normally `RawPtr`) on the `IntrusiveList` instance.
2021-04-16 22:26:52 +02:00
Linus Groh
ba3bc6fef2 LibGUI+WindowServer: Fix some misaligned CMakeLists.txt SOURCES entries 2021-04-16 21:30:53 +02:00
Idan Horowitz
223472c57f LibJS: Dont try to serialize symbol-keyed properties
As per the specification: "All Symbol-keyed properties will be
completely ignored, even when using the replacer function."
2021-04-16 19:22:29 +02:00
Idan Horowitz
fff7aceb9d LibJS: Accept symbol property in ObjectPrototype::hasOwnProperty
This is used by discord.com and allowed by the specification
(https://tc39.es/ecma262/#sec-topropertykey)
2021-04-16 19:22:29 +02:00
Timothy Flynn
2381b19719 Browser+LibWeb+WebContent: Parse cookies in the OOP tab
To protect the main Browser process against nefarious cookies, parse the
cookies out-of-process and then send the parsed result over IPC to the
main process. This way, if the cookie parser blows up, only that tab
will be affected.
2021-04-16 19:19:31 +02:00
Timothy Flynn
6e10c2cdb7 LibCore+LibIPC: Add IPC coder for Core::DateTime
Since LibCore cannot depend on LibIPC, the coders are defined in LibIPC
just like they are for Core::AnonymousBuffer.
2021-04-16 19:19:31 +02:00
Timothy Flynn
67884f6747 LibWeb: Impose a sane max cookie size
Drop cookies larger than 4KiB. This value is the RFC's recommendation:
https://tools.ietf.org/html/rfc6265#section-6.1
2021-04-16 19:19:31 +02:00
Gunnar Beutner
960079b020 LibELF: Add support for loading libraries from /usr/local 2021-04-16 19:04:24 +02:00
Nicholas-Baron
73dd293ec4 Everywhere: Add -Wdouble-promotion warning
This warning informs of float-to-double conversions. The best solution
seems to be to do math *either* in 32-bit *or* in 64-bit, and only to
cross over when absolutely necessary.
2021-04-16 19:01:54 +02:00
AnotherTest
6606d70826 LibDebug/Dwarf: Use dbgln_if() instead of '#if DWARF_DEBUG' 2021-04-16 19:00:30 +02:00
Gunnar Beutner
b731db6691 LibDebug: Add support for StandardOpcodes::FixAdvancePc 2021-04-16 19:00:30 +02:00
Gunnar Beutner
4f6914a0c0 LibDebug: Add array bounds check for m_source_files 2021-04-16 19:00:30 +02:00
Linus Groh
a5d4ef462c LibJS: Remove #if !defined(KERNEL)
AK::JsonValue::{is,as}_double() is not available in the kernel, but that
doesn't affect LibJS.
2021-04-16 18:57:58 +02:00
sin-ack
091d352526 Kernel: Add some missing socket ioctls
This patch adds a few missing ioctls which were required by Wine.
SIOCGIFNETMASK, SIOCGIFBRDADDR and SIOCGIFMTU are fully implemented,
while SIOCGIFFLAGS and SIOCGIFCONF are stubs.
2021-04-16 18:57:35 +02:00
Gunnar Beutner
92749d9a76 LibC: Don't call initializers in crt0
The dynamic linker is already taking care of this for us. Now
that crt0 is statically linked into each executable and shared
library this breaks things because initializers are invoked twice.

Before this PR this didn't crash because crt0 and its _start()
function was contained in LibC and thus only LibC's initializers were
invoked several times which wasn't as much of a problem because
these initializers didn't have any side effects (such as malloc/free).

However, user programs are more likely to have constructors with side
effects, e.g.:

    std::string g_test("hello!");

This would allocate memory when the constructor is invoked. When it is
invoked again the original allocation would be leaked and another copy
of the string would get allocated. Worse still, when the destructors are
invoked twice the memory would get free'd twice which would likely
crash the program.
2021-04-16 17:56:12 +02:00
Gunnar Beutner
50e4cad4a0 Toolchain+LibC: Don't link LibC against crt0
Instead GCC should be used to automatically link against crt0
and crt0_shared depending on the type of object file that is being
built.

Unfortunately this requires a rebuild of the toolchain as well
as everything that has been built with the old GCC.
2021-04-16 17:56:12 +02:00
Gunnar Beutner
67516fa555 LibC: Shared libraries shouldn't have an entry point
The _start() function attempts to call main() which is a
problem when trying to build a shared library with --no-undefined:

  $ echo > t.c
  $ gcc -shared -Wl,--no-undefined -o t.so t.c
  /usr/local/lib/gcc/i686-pc-serenity/10.2.0/../../../../i686-pc-serenity/bin/ld:
  /usr/lib/crt0_shared.o: in function `_start':
  ./Build/i686/../../Userland/Libraries/LibC/crt0_shared.cpp:56: undefined reference to `main'
  collect2: error: ld returned 1 exit status

Also, unless explicitly requested by the user shared libraries
should not have an entry point (e.g. _start) at all.
2021-04-16 17:56:12 +02:00
FalseHonesty
a5b4d4434e LibDebug: Fix typo in handle_special_opcode method name
handle_sepcial_opcode -> handle_special_opcode :)
2021-04-16 17:40:24 +02:00
sin-ack
5b95850e28 SystemServer+LibCore: Allow service to request multiple sockets
SystemServer only allowed a single socket to be created for a service
before this.  Now, SystemServer will allow any amount of sockets.  The
sockets can be defined like so:

[SomeService]
Socket=/tmp/portal/socket1,/tmp/portal/socket2,/tmp/portal/socket3
SocketPermissions=660,600

The last item in SocketPermissions is applied to the remainder of the
sockets in the Socket= line, so multiple sockets can have the same
permissions without having to repeat them.

Defining multiple sockets is not allowed for socket-activated services
at the moment, and wouldn't make much sense anyway.

This patch also makes socket takeovers more robust by removing the
assumption that the socket will always be passed in fd 3.  Now, the
SOCKET_TAKEOVER environment variable carries information about which
endpoint corresponds to which socket, like so:

SOCKET_TAKEOVER=/tmp/portal/socket1:3 /tmp/portal/socket2:4

and LocalServer/LocalService will parse this automatically and select
the correct one.  The old behavior of getting the default socket is
preserved so long as the service only requests a single socket in
SystemServer.ini.
2021-04-15 21:04:49 +02:00
Nicholas-Baron
c4ede38542 Everything: Add -Wnon-virtual-dtor flag
This flag warns on classes which have `virtual` functions but do not
have a `virtual` destructor.

This patch adds both the flag and missing destructors. The access level
of the destructors was determined by a two rules of thumb:
1. A destructor should have a similar or lower access level to that of a
   constructor.
2. Having a `private` destructor implicitly deletes the default
   constructor, which is probably undesirable for "interface" types
   (classes with only virtual functions and no data).

In short, most of the added destructors are `protected`, unless the
compiler complained about access.
2021-04-15 20:57:13 +02:00
Idan Horowitz
ad8e2f481d LibWeb: Expose the MouseEvent::{clientX, clientY} attributes
These provide the cursor coordinate within the viewport at which the
event occurred (as opposed to the page relative coordinates exposed via
offsetX, offsetY).
2021-04-15 20:22:08 +02:00
Idan Horowitz
815934a95d LibWeb: Expose the HTMLElement::{offsetLeft, offsetTop} attributes
These describe the border box of an element relative to their parent.
2021-04-15 20:22:08 +02:00
Idan Horowitz
c5769a7033 LibWeb: Check radius sign in CanvasRenderingContext2D::{arc, ellipse}
As required by the specification: 'If either radiusX or radiusY are
negative, then throw an "IndexSizeError" DOMException.'
2021-04-15 20:22:08 +02:00
Idan Horowitz
00114ab01d LibWeb: Add a naive implemention of CanvasRenderingContext2D::fill_text
This doesnt actually account for several unimplemented attributes
(like ltr/rtl, alignment, etc) yet, so this should be expanded in
the future.
2021-04-15 20:22:08 +02:00
Idan Horowitz
a257ef0f35 LibWeb: Add support for optional double arguments with no default value
This is implemented by emitting AK::Optional, similar to optional
boolean arguments.
2021-04-15 20:22:08 +02:00
Idan Horowitz
0072581693 LibWeb: Emit optional boolean variable definition in WrapperGenerator
The removed if in this commit was inside the else branch of an if with
the same condition, making it a no-op, as well as breaking optional
booleans.
2021-04-15 20:22:08 +02:00
AnotherTest
dbc5b05b7a LibM: Use fptan/fpatan instead of approximating atan2/tan
The previous versions were very inaccurate, and sometimes wrong.
2021-04-15 17:50:16 +02:00
AnotherTest
801daf47f0 LibGfx+LibWeb: Wire up CanvasRenderingContext2D.ellipse()
Note that this is *extremely* naive, and not very good at being correct.
2021-04-15 17:50:16 +02:00
AnotherTest
6c05d6d370 LibGfx: Add a Path::arc_to() helper
...That just uses elliptical_arc_to().
2021-04-15 17:50:16 +02:00
AnotherTest
1ea466661f LibGfx+LibWeb: Move out the EllipticArcTo() logic into Path
At its previous state, the interface allowed invalid "ellipses" to be
specified, instead of doing that, simply use the parameters that SVG
uses :^)
2021-04-15 17:50:16 +02:00
AnotherTest
cb04a441cf LibGfx: Un-recursive-ify the Bezier and Elliptic curve implementations 2021-04-15 17:50:16 +02:00
Timothy Flynn
0f47a23e8e LibWeb: Set Cookie header on remaining resource requests 2021-04-15 09:46:49 +02:00
Timothy Flynn
0cacc52990 LibWeb: Set Cookie header on <img> and <object> resource requests
This required passing a reference to the owning HTML*Element to
ImageLoader, the same way that CSSLoader has a reference to its owner.
2021-04-15 09:46:49 +02:00
Timothy Flynn
347838a240 LibWeb: Set Cookie header on <script> resource requests
This required changing the load_sync API to take a LoadRequest instead
of just a URL. Since HTMLScriptElement was the only (non-test) user of
this API, it didn't seem useful to instead add an overload of load_sync
for this.
2021-04-15 09:46:49 +02:00
Timothy Flynn
3cc5286565 LibWeb: Helper for creating load requests with a Cookie header
Instead of all interested parties needing to write out the code to get
the cookie value for a load request, add a static helper to do it in
one location.
2021-04-15 09:46:49 +02:00
Linus Groh
726d631527 LibJS: Use references in CallExpression::compute_this_and_callee()
This has the nice side effect of giving us a decent error message for
something like undefined.foo() - another useless "ToObject on null or
undefined" gone. :^)
Also turn the various ternary operators into two separate if branches,
they don't really share that much.
2021-04-15 09:45:20 +02:00
Gunnar Beutner
b3eb55ec9a LibPthread: Implement sem_getvalue() 2021-04-15 09:31:49 +02:00
Gunnar Beutner
a44ddc4793 LibPthread: Don't hold sem->mtx after sem_wait()/sem_trywait()
Semaphores with values greater than one didn't work because whoever
called sem_wait() first held the semaphore's mutex until a matching
sem_post() call.

Other callers then wouldn't be able to acquire the semaphore even
if the semaphore's value was still greater than zero at that point.
2021-04-15 09:31:49 +02:00
Gunnar Beutner
32794e00a1 LibPthread: Improve error handling for the semaphore functions
This patch makes sure we're propagating errors to the caller.
2021-04-15 09:31:49 +02:00
Gunnar Beutner
98403eccb0 LibPthread: Ensure we're not overflowing the semaphore's value 2021-04-15 09:31:49 +02:00
Timothy Flynn
b6093ae2e3 LibJS: Implement String.prototype.substr according to the spec
Fixes #6325

The JavaScript on the HTML Spec site that caused the crash is:
    window.location.hash.substr(1)

Of course, window.location.hash can be the empty string. The spec allows
for calling substr(1) on an empty string, but our partial implementation
wasn't handling it properly.
2021-04-15 08:38:19 +02:00
Idan Horowitz
bc9cd55da4 Browser+LibWeb: Add support for spoofing the browser user agent
This is helpful when testing certain sites like twitter.com which
display differently based on the user agent.
2021-04-14 23:06:32 +02:00
Idan Horowitz
aab99d5945 LibWeb: Implement the CanvasRenderingContext2D::rect path method
This method adds a rectangle to the current 2D path.
2021-04-14 23:01:23 +02:00
Idan Horowitz
4c0937225e LibWeb: Make CanvasRenderingContext2D::fill's fillRule argument optional
As defined by the specification (and used by the website i am testing):
interface mixin CanvasDrawPath {
  undefined fill(optional CanvasFillRule fillRule = "nonzero");
}
2021-04-14 23:01:23 +02:00
Idan Horowitz
0a580ef891 LibWeb: Request repaint on canvas path finalizaiton via fill/stroke
Since these were not requesting a repaint the drawn path was not being
rendered until a repaint was forced in some other way (window resize).
2021-04-14 23:01:23 +02:00
Idan Horowitz
b7c3f046f7 LibGfx: initialize winding number to 1 for NonZero winding rules
Since we first check the winding number and only then update it, fills
for "Rectangle-like" (made up of 2 parallel segments) paths would draw
nothing when filled by NonZero winding rules. (Fix by alimpfard)
2021-04-14 23:01:23 +02:00
Linus Groh
51a5427419 LibJS: Improve Reference::get() TypeError message for nullish base
"ToObject on null or undefined" is useless.
"Cannot get property 'foo' of undefined" isn't.
2021-04-14 22:37:12 +02:00
Linus Groh
73a92c79b8 LibJS: Use reference in MemberExpression::execute()
This was basically duplicated code.
2021-04-14 22:37:12 +02:00
Gunnar Beutner
1e1de4a542 LibC: Use __inline_isascii() in isascii() 2021-04-14 21:46:20 +02:00
Gunnar Beutner
3df7f868e8 LibC: Add support for isblank() 2021-04-14 21:46:20 +02:00
Gunnar Beutner
75d774ba29 LibC: Add missing macro for _SC_CLK_TCK 2021-04-14 21:46:20 +02:00
Gunnar Beutner
5a4206ef2e LibC: Turn regex_t and regmatch_t into typedefs
According to POSIX.1-2001 these should be anonymous structs with
a typedef.
2021-04-14 21:46:20 +02:00
Gunnar Beutner
546fa8cfb5 LibC: Change return type for sleep() to unsigned int
According to POSIX.1-2001 the return type should be unsigned int.
2021-04-14 21:46:20 +02:00
Timothy Flynn
c00760c5f9 Browser+LibWeb+WebContent: Track the source of document.cookie requests
To implement the HttpOnly attribute, the CookieJar needs to know where a
request originated from. Namely, it needs to distinguish between HTTP /
non-HTTP (i.e. JavaScript) requests. When the HttpOnly attribute is set,
requests from JavaScript are to be blocked.
2021-04-14 16:07:46 +02:00
Timothy Flynn
7193e518d1 Browser+LibWeb: Move the cookie structure into LibWeb 2021-04-14 16:07:46 +02:00
Timothy Flynn
c2d38abe6f Browser+LibWeb: Move cookie parser into LibWeb
This moves the cookie parsing steps out of CookieJar into their own file
inside LibWeb. It makes sense for the cookie structures to be in LibWeb
for a couple reasons:

1. There are some steps in the spec that will need to partially happen
   from LibWeb, such as the HttpOnly attribute.
2. Parsing the cookie string will be safer if it happens in the OOP tab
   rather than the main Browser process. Then if the parser blows up due
   to a malformed cookie, only that tab will be affected.
3. Cookies in general are a Web concept not specific to a browser.
2021-04-14 16:07:46 +02:00
Idan Horowitz
ba77b40808 LibJS: Implement the encode/decodeURI(Component) family of functions
These are generally useful and in particular needed for twitter.com
2021-04-14 13:30:10 +02:00
FalseHonesty
2d58549296 LibDebug: Add support for parsing array types
This includes multi-dimensional arrays :O
2021-04-14 13:28:48 +02:00
FalseHonesty
acbb119b27 LibDebug: Support unnamed variables and types
We were supposed to already support unnamed types, but due to a
little typo, we were actually causing more problems :^)
2021-04-14 13:28:48 +02:00
Gunnar Beutner
7d12c08bec LibC: Add definition for the NI_NAMEREQD macro 2021-04-14 13:13:06 +02:00
Gunnar Beutner
ea6d0aa1d4 LibPthread: Implement semaphore functions 2021-04-14 13:13:06 +02:00
Gunnar Beutner
f2ff8f2658 LibELF: Improve error messages for missing shared libraries 2021-04-14 13:13:06 +02:00
Gunnar Beutner
dce57cd085 LibC: Add definitions for INTMAX_C and UINTMAX_C 2021-04-14 13:13:06 +02:00
Gunnar Beutner
1946a4bee6 LibC: Add missing include in <syslog.h>
The include is necessary for __BEGIN_DECLS and __END_DECLS.
2021-04-14 13:13:06 +02:00
Gunnar Beutner
cd7512a2ad LibELF: Add support for loading objects with multiple data and text segments
This enables loading executables with multiple data and text segments. Also
it fixes loading executables where the text segment has a non-zero offset.

Example:

  $ echo "main () {}" > test.c
  $ gcc -Wl,-z,separate-code -o test test.c
  $ objdump -p test
  test:     file format elf32-i386

  Program Header:
      PHDR off    0x00000034 vaddr 0x00000034 paddr 0x00000034 align 2**2
           filesz 0x000000e0 memsz 0x000000e0 flags r--
    INTERP off    0x00000114 vaddr 0x00000114 paddr 0x00000114 align 2**0
           filesz 0x00000013 memsz 0x00000013 flags r--
      LOAD off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**12
           filesz 0x000003c4 memsz 0x000003c4 flags r--
      LOAD off    0x00001000 vaddr 0x00001000 paddr 0x00001000 align 2**12
           filesz 0x00000279 memsz 0x00000279 flags r-x
      LOAD off    0x00002000 vaddr 0x00002000 paddr 0x00002000 align 2**12
           filesz 0x00000004 memsz 0x00000004 flags r--
      LOAD off    0x00002004 vaddr 0x00003004 paddr 0x00003004 align 2**12
           filesz 0x00000100 memsz 0x00000124 flags rw-
   DYNAMIC off    0x00002014 vaddr 0x00003014 paddr 0x00003014 align 2**2
           filesz 0x000000c8 memsz 0x000000c8 flags rw-
2021-04-14 13:12:52 +02:00
Maciej Zygmanowski
e83caffccc LibCore: Use dbgln_if in EventLoop.cpp 2021-04-14 10:54:56 +02:00
Linus Groh
ea60b344eb LibJS: Add name and message properties to NativeError prototypes
Otherwise these will get their name/default message from the Error
prototype, and as a result would always just say "Error" in error
messages, not the specific type.
Something I missed in da177c6, now with tests. :^)
2021-04-14 10:11:04 +02:00
AnotherTest
339ae7873e LibHTTP: Trim the whitespace around the Transfer-Encoding header value
Fixes #6302.
2021-04-14 09:31:31 +02:00
Linus Groh
5da4c9bf1e LibWeb: Implement Node.cloneNode()
With this we can now successfully run a Vue.js 2 hello world! :^)
2021-04-14 09:30:29 +02:00
Linus Groh
d721c93beb LibWeb: Add Element::prefix()
Just a getter for m_qualified_name.prefix(), just like local_name() and
namespace_().
2021-04-14 09:30:29 +02:00
AnotherTest
d2b5c4d8dc LibWeb: Actually return an empty value when an exception is thrown via
throw_dom_exception_if_needed()

Fixes #6298.
2021-04-13 23:56:19 +02:00
AnotherTest
9c201767a0 LibWeb: Fix some FIXMEs related to ExceptionOr<T>
This fixes a few FIXMEs mentioned in 5beacf08a2,
which depended on #6075 being fixed.
2021-04-13 22:31:06 +02:00
AnotherTest
8ba2b5f36f LibWeb: Make ExceptionOr work with non-JS::Value types
Fixes #6075.
2021-04-13 22:31:06 +02:00
Egor Ananyin
d5def1cad0 LibWeb: Use min-height in calculating height 2021-04-13 22:04:25 +02:00
Egor Ananyin
fe544feb17 LibWeb: Start parsing font property 2021-04-13 22:04:25 +02:00
Linus Groh
e4b3591ac4 LibWeb: Fix a TODO in the adoption agency algorithm
There's still a much bigger one at the end of the function though. :^)
2021-04-13 21:59:55 +02:00
Jean-Baptiste Boric
c130161d9f LibCore: Don't leak file descriptor inside AnonymousBuffer on Linux 2021-04-13 21:52:34 +02:00
Andreas Kling
a2baab38fd Everywhere: It's now "Foobar", not "FooBar", and not "foo bar"
I hereby declare these to be full nouns that we don't split,
neither by space, nor by underscore:

- Breadcrumbbar
- Coolbar
- Menubar
- Progressbar
- Scrollbar
- Statusbar
- Taskbar
- Toolbar

This patch makes everything consistent by replacing every other variant
of these with the proper one. :^)
2021-04-13 16:58:15 +02:00
Linus Groh
45133d8ada LibJS: Unset m_unwind_until_label in stop_unwind()
I don't see a reason to keep this intact, that might only surprise us
down the line...
2021-04-13 15:40:52 +02:00
Linus Groh
4ee965f916 LibJS: Add set_exception() and change throw_exception() to take a reference
Sometimes we just want to set m_exception to some value we stored
previously, without really "throwing" it again - that's what
set_exception() does now. Since we have clear_exception(), it does take
a reference, i.e. you don't set_exception(nullptr). For consistency I
updated throw_exception() to do the same.
2021-04-13 15:40:52 +02:00
Linus Groh
f2abe42ecb LibJS: Update empty TryStatement result value to undefined
It's what the spec wants us to do, although I'm not sure if it has an
observable effect anywhere, as we don't expose empty values. Let's do it
anyway.
2021-04-13 15:40:52 +02:00
Linus Groh
7cbede4342 LibJS: Fix return value of TryStatement with finalizer
Previously we would always return the result of executing the finalizer,
however the spec dictates the finalizer result must only be returned for
a non-normal completion.
I added some more comments along the way, which should make it more
clear what's going on - the unwinding and exception flow isn't super
straightforward here.
2021-04-13 15:40:52 +02:00
Linus Groh
e8cbcc2fbf LibJS: Replace two more uses of unwind(ScopeType::None) with stop_unwind()
Same thing, but a lot more clear.
2021-04-13 15:40:52 +02:00
Itamar
f52c3cabcf HackStudio: Add ClassView tab for viewing classes in a tree structure
This enables the user to view and navigate classes with a TreeView that
is updated by the LanguageServer as it parses the code.

It offers a new neat way to view the project's structure :^)
2021-04-13 15:16:27 +02:00
Itamar
b87791cada LibCpp: Add 'Namespace' and 'Member' declaration types 2021-04-13 15:16:27 +02:00
Itamar
c6c83bd80e HackStudio+LibCpp: Include class members in Locator 2021-04-13 15:16:27 +02:00
tuqqu
c8ad1df143 LibJS: Array.from mapFn fixes + thisArg support
* Callback mapFn now properly supports second argument (index)
* Support of thisArg to be passed as "this" in vm.call
* Tests for all cases
2021-04-13 15:16:16 +02:00
FalseHonesty
2ed5d19407 LibGUI+HackStudio: Add way to tell FilePicker to open a folder
This now means that when trying to open a folder, one can click on
the folder and press open instead of having to actually step into
the desired folder. Of course, it also means it won't let you open
non-directories anymore.
2021-04-13 15:16:07 +02:00
Brendan Coles
ce010de74f LibC: getaddrinfo: Set addrinfo sin_port to 0 if service arg is NULL 2021-04-13 15:10:14 +02:00
Andreas Kling
1ca22b46f9 LibGUI: Allow GUI::ProgressBar to have min() == max() 2021-04-13 10:12:50 +02:00
Gunnar Beutner
30b038f8d9 LibC: Implement getaddrinfo(), freeaddrinfo(), gai_strerror() and getnameinfo() 2021-04-12 22:44:49 +02:00
Gunnar Beutner
8fcf91b030 LibC: The port numbers returned by getservby*() should be in network byte order 2021-04-12 22:44:49 +02:00
Gunnar Beutner
287a93a2a4 LibC: Validate the len argument for inet_ntop() 2021-04-12 22:44:49 +02:00
FalseHonesty
bffa1a0df8 LibDebug: Stop parsing unhandled variable types
Previously, when trying to debug variables with more complex
types (such as String), we would crash the debugger simply because
it didn't know how to handle types that were irrelevant anyways.
Now we just skip data we don't yet know how to handle.
2021-04-12 22:43:33 +02:00
FalseHonesty
d295095993 LibDebug+HackStudio: Fix crashes relating to debugger variable preview
For one, viewing a variable who's type contained a subprogram will
no longer crash HackStudio. Additionally, the variable view will
handle invalid enum values gracefully now, fixing another crash.
Finally, deeply nested (nest count > 1) structures will have their
memory addresses properly set, fixing the final crash I found.
2021-04-12 22:43:33 +02:00
Gunnar Beutner
0497986572 LibC: Use dbgln() in strerror() and strsignal()
Printing error messages to stdout can have unintended side effects
depending on what the program is doing.
2021-04-12 22:34:07 +02:00
Gunnar Beutner
44486e8818 LibC: Turn CRASH() into a function and add noreturn attribute
This way CRASH() can be used in functions that are themselves
marked as noreturn.
2021-04-12 22:30:06 +02:00
Egor Ananyin
86290c0e4e LibWeb: Set border width to zero if style is none 2021-04-12 17:47:59 +02:00
Egor Ananyin
d5eb09adc2 LibWeb: Parse border-style correctly 2021-04-12 17:47:59 +02:00
Peter Elliott
dcee024fee LibArchive: Support POSIX.1-1988 tar files
These old tar files didn't have magic numbers, so I've also added a checksum
check to TarInputStream::valid()
2021-04-12 14:06:24 +02:00
Stephan Unverwerth
8c80eb8870 LibJS: Memoize failed calls of try_parse_arrow_function_expression() 2021-04-12 11:24:09 +02:00
Linus Groh
da177c6517 LibJS: Make Errors fully spec compliant
The previous handling of the name and message properties specifically
was breaking websites that created their own error types and relied on
the error prototype working correctly - not assuming an JS::Error this
object, that is.

The way it works now, and it is supposed to work, is:

- Error.prototype.name and Error.prototype.message just have initial
  string values and are no longer getters/setters
- When constructing an error with a message, we create a regular
  property on the newly created object, so a lookup of the message
  property will either get it from the object directly or go though the
  prototype chain
- Internal m_name/m_message properties are no longer needed and removed

This makes printing errors slightly more complicated, as we can no
longer rely on the (safe) internal properties, and cannot trust a
property lookup either - get_without_side_effects() is used to solve
this, it's not perfect but something we can revisit later.

I did some refactoring along the way, there was some really old stuff in
there - accessing vm.call_frame().arguments[0] is not something we (have
to) do anymore :^)

Fixes #6245.
2021-04-12 09:38:57 +02:00
Linus Groh
6e9eb0a284 LibJS: Add Object::get_without_side_effects()
Similar to Value::to_string_without_side_effects() this is mostly a
regular object property lookup, but with the guarantee that it will be
side-effect free, i.e. no accessors or native property functions will
be called. This is needed when we want to access user-controlled object
properties for debug logging, for example. The specific use case will be
error objects which will soon no longer have internal name/message
properties, so we need to guarantee that printing an error, which may
already be the result of an exception, won't blow up in our face :^)
2021-04-12 09:38:57 +02:00
Luke
9ec4defdd2 LibWeb: Add Window.parent and fix Window.top attributes
This returns the parent frame of the current frame. If it's the
main frame, it returns itself.

Also fixes the attributes of Window.top, as they were accidentally
being passed in as the setter.

Required by Web Platform Tests.
2021-04-12 09:01:08 +02:00
AnotherTest
5a14f7ea2f LibRegex: Generate a 'Compare' op for empty character classes
Otherwise it would match zero-length strings.
Fixes #6256.
2021-04-12 08:54:58 +02:00
AnotherTest
7c98a6be17 LibHTTP: Handle running out of input between chunk body and ending CRLF
Fixes an issue where LibHTTP would incorrectly detect an end of stream
when it runs out of TLS application data between the chunk body and its
ending CRLF.
2021-04-12 08:36:21 +02:00
tuqqu
5438879277 LibJS: Removed a fixme in a test of BigInt.prototype.valueOf 2021-04-11 20:51:58 +02:00
Luke
83d2c3f2f5 LibWeb: Move element_child_count to ParentNode and add its IDL attribute
I initially had it in Node just because, but then saw it was part of
ParentNode in the spec.
2021-04-11 18:32:42 +02:00
Luke
fc9abee84b LibWeb: Add Event.initEvent
Used by YouTube after creating an event with Document.createEvent
2021-04-11 18:27:52 +02:00
Luke
8da14bf880 LibWeb: Add support for optional default values and optional bools in IDL
Fixed the DOMException constructor as it had the default value version
commented out.
2021-04-11 18:27:52 +02:00
Timothy Flynn
4152f807bc LibWeb: Store cookies sent via the Set-Cookie HTTP header
Note: HTTP response headers are currently stored in a hash map, so the
Set-Cookie entry will only appear once here.
2021-04-11 18:24:34 +02:00
Timothy Flynn
1ef48d50ff LibWeb+WebContent: Hook document.cookie to the backend cookie storage 2021-04-11 18:24:34 +02:00
Timothy Flynn
e54837add5 Browser+LibWeb: Add hooks for getting and setting cookies 2021-04-11 18:24:34 +02:00
Linus Groh
433a23cfde LibJS: Fix array hole and string object indexing prototype indirection
This fixes two cases of indexed access (array holes, out-of-bounds
string object access) where we would not follow the prototype chain and
incorrectly return undefined:

    // Should be "a", returned undefined
    Object.setPrototypeOf([,], ["a"])[0]

    // Should be "a", returned undefined
    Object.setPrototypeOf(new String(""), new String("a"))[0]

The actual fix is simple, instead of returning early if the requested
index is past the string's length or within the indexed properties size
but has no value, we just continue the prototype chain traversal and get
correct behaviour from that.
2021-04-11 18:15:47 +02:00
Andreas Kling
54cd8dfc4d LibWeb+WebContent: Support image context menus in OOPWV
You can now right-click images in web content and get a context menu.
2021-04-11 16:49:25 +02:00
Andreas Kling
a2686f9bec LibGUI: Avoid unnecessary Gfx::Bitmap cloning in FileIconProvider 2021-04-11 12:52:42 +02:00
Andreas Kling
0c02dfcad5 LibGUI: Add convenient helpers for getting the sibling of a ModelIndex 2021-04-11 12:52:42 +02:00
Brian Gianforcaro
dc98c417ca LibGUI: Remove an unused AK/Debug.h include 2021-04-11 12:50:33 +02:00
Brian Gianforcaro
c4226ca646 LibWeb: Remove trailing ';' from WrapperGenerator functions. 2021-04-11 12:50:33 +02:00
Gunnar Beutner
64740a0214 LibC: getopt() and getopt_long() shouldn't modify argv 2021-04-11 09:51:20 +02:00
Gunnar Beutner
8ca5b8c065 LibC: Move S_* defines into <fcntl.h>
According to the Single UNIX Specification, Version 2 that's where
those macros should be defined. This fixes the libiconv port.

This also fixes some (but not all) build errors for the diffutils and nano ports.
2021-04-11 09:51:20 +02:00
Gunnar Beutner
be4b20c14d LibC: Make <limits.h> compatible with GCC so that it doesn't install a fixed header
GCC installs a fixed version of the <limits.h> header as per https://gcc.gnu.org/onlinedocs/gcc/Fixed-Headers.html.
The fixed header doesn't include the target's <limits.h> which in turn means that some definitions (such as PATH_MAX)
aren't available. This change requires rebuilding the toolchain (Toolchain/BuildIt.sh).

This fixes the flatbuffers port.

The commit also removes some non-standard defines (U*_MIN) which don't appear to be used
anywhere. By definition they're always 0 though so they're not strictly necessary.
2021-04-11 09:51:20 +02:00
Brian Gianforcaro
988c23fff0 LibWeb: Add implementation of Node.compareDocumentPosition()
While looking into getting Duck Duck Go loading further in the
Browser, I noticed that it was complaining about the missing
method Node.compareDocumentPosition.

This change implements as much of the DOM spec as possible
with the current implementation of the DOM to date. The
implementation is validated by new tests in the Node.js.
2021-04-11 09:40:06 +02:00
Brian Gianforcaro
0f8932d7ab LibWeb: Connect existing implementation of Node::is_connected to JS.
I was looking at implementing something else, and saw this was low
hanging fruit, that brings the browser closer to standards conformance.

Add a basic test as well to validate it's implementation.
2021-04-11 09:40:06 +02:00
Gunnar Beutner
03ffdeb43a LibC: Provide macros for the <ctype.h> functions
These are required for the 'tr' port.
2021-04-11 01:18:02 +02:00
Gunnar Beutner
fe8b1a732e LibC: Include additional headers in <arpa/inet.h>
According to the Single UNIX Specification, Version 2 the <arpa/inet.h>
header may optionally include <netinet/in.h> and <inttypes.h>. This
helps with porting software like c-ray that expects this to be the case.
2021-04-11 01:18:02 +02:00
thankyouverycool
c283429196 LibGfx: Add a count to FontTypes and a helper to return type names 2021-04-11 01:16:34 +02:00
thankyouverycool
25bd4b33a7 LibGUI: Move FontPickerWeightModel and helpers to their own header
Avoids maintaining multiple weight-name lists
2021-04-11 01:16:34 +02:00
Andreas Kling
d4d8d9ea0b LibGfx: Make sure draw_ui_text() paints underlines with text color
We shouldn't hard-code black here, then we won't respect the system
theme colors. :^)
2021-04-11 01:11:56 +02:00
Andreas Kling
a4992b5ece LibGUI+LibGfx: Collapse the '&' from Alt shortcuts in tooltip texts
Also resolve a FIXME about using GUI::Label auto-sizing since we're
changing this code and it simplifies what we're doing.

Fixes #6219.
2021-04-11 01:11:09 +02:00
Luke
ccd21614a3 LibJS: Replace Vector with MarkedValueList in RegExpPrototype::symbol_replace
Otherwise the GC won't be able to keep track of the stored values
and they may suddenly disappear from underneath us, thinking
they're not in use.

Fixes a crash when going to the Bootstrap website, where the first
replace call in jQuery caused a jump to a bogus address.
2021-04-11 00:32:59 +02:00
Andreas Kling
2146d22432 LibCore: Save errno before it gets clobbered in Core::IODevice::write() 2021-04-10 22:31:29 +02:00
Jelle Raaijmakers
06353077b7 LibGUI/ScrollBar: Only paint buttons as pressed when also hovered
Fixes #6185
2021-04-10 22:28:00 +02:00
Jelle Raaijmakers
f733b85957 LibTLS: Remove excessive CloseNotify logging 2021-04-10 21:05:00 +02:00
AnotherTest
a6e4482080 AK+Everywhere: Make StdLibExtras templates less wrapper-y
This commit makes the user-facing StdLibExtras templates and utilities
arguably more nice-looking by removing the need to reach into the
wrapper structs generated by them to get the value/type needed.
The C++ standard library had to invent `_v` and `_t` variants (likely
because of backwards compat), but we don't need to cater to any codebase
except our own, so might as well have good things for free. :^)
2021-04-10 21:01:31 +02:00
Linus Groh
d8d16dea95 LibWeb: Add a basic implementation of Document.createEvent()
This is a legacy function providing a way of constructing events without
using their constructors exposed on the global object.
We don't have many of the events it supports yet, nor can we throw a
DOMException from it, so that's two FIXMEs for later.
2021-04-10 21:00:04 +02:00
Linus Groh
9d2635d94b LibWeb: Support nullable EventListener parameters in WrapperGenerator
The internal C++ function will now receive a RefPtr<EventListener> for
'EventListener?' and a NonnullRefPtr<EventListener> for 'EventListener'.

Examples of this are addEventListener() and removeEventListener(), which
both have nullable callback parameters.
2021-04-10 21:00:04 +02:00
Linus Groh
2172e51246 LibJS: Implicitly break for..in loop if the RHS result is nullish
This implements the missing step 6a of 14.7.5.6 ForIn/OfHeadEvaluation:

    a. If exprValue is undefined or null, then
        i. Return Completion { [[Type]]: break, [[Value]]: empty, [[Target]]: empty }.

In other words, this should just do nothing instead of throwing during
the undefined to object coercion:

    for (const x in undefined);
2021-04-10 21:00:04 +02:00
Linus Groh
9cd010167a LibJS: Implement Object.create() 2021-04-10 21:00:04 +02:00
Linus Groh
da8a35a79e LibJS: Implement Object.defineProperties() 2021-04-10 21:00:04 +02:00
Linus Groh
275da6fcc9 LibJS: Update Object::define_accessor() to take both getter and setter
This replaces the current 'function plus boolean indicating the type'
API, which makes it easier to set both getter and setter at once.
This was already possible before but required two calls of this
function, which wasn't intuitive:

    define_accessor(name, getter, true, ...);
    define_accessor(name, setter, false, ...);

Which now becomes:

    define_accessor(name, getter, setter, ...);
2021-04-10 21:00:04 +02:00
Linus Groh
ec62783af9 LibJS: Let Object::delete_property() return a bool, not Value
Just like the various define_property functions, this should return a
bool directly and let the caller deal with wrapping it in a Value, if
necessary.
2021-04-10 21:00:04 +02:00
Linus Groh
4788c94d34 LibJS: Remove superfluous exception check from get_own_property_descriptor()
Accessing elements of the storage Vector can't throw.
2021-04-10 21:00:04 +02:00
Andreas Kling
d0813be65a LibGUI: Ignore right-clicks on HeaderViews
This prevents right-clicking a column header from making it appear
depressed right before the context menu is shown.
2021-04-10 16:50:43 +02:00
Jelle Raaijmakers
55d9f36dae LibTLS: Convert some #ifs to dbgln_if() 2021-04-10 14:45:14 +02:00
Jelle Raaijmakers
7d5995f08c LibTLS: Support empty SNI data in ServerHello
According to RFC6066, empty extension_data for an SNI extension is
absolutely one of the possibilities - so let's support this instead of
spamming the debug log.
2021-04-10 14:45:14 +02:00
Andreas Kling
48eb58230b LibGUI: List directories before files in FileSystemModel
Instead of mixing directories and files, sorting a FileSystemModel by
the Name column will now give you all the directories first, followed
by all the files.
2021-04-10 13:58:13 +02:00
AnotherTest
c128b3fd91 LibRegex: Remove 'ReadDigitFollowPolicy' as it's no longer needed
Thanks to @GMTA: 1b071455b1 (r49343474)
2021-04-10 12:10:45 +02:00
AnotherTest
1b071455b1 LibRegex: Treat brace quantifiers with invalid contents as literals
Fixes #6208.
2021-04-10 09:16:03 +02:00
AnotherTest
25d336bc27 LibRegex: Take the regex as a const reference in print_bytecode() 2021-04-10 09:16:03 +02:00
AnotherTest
e9279d1790 LibRegex: Allow a '?' suffix for brace quantifiers
This fixes another compat point in #6042.
2021-04-10 09:16:03 +02:00
AnotherTest
8d7bcc2476 LibRegex: Give ByteCode a copy ctor and and a move assignment operator
Previously all move assignments were actually copies. oops.
2021-04-10 09:16:03 +02:00
Andreas Kling
192e2d5d50 LibVT: Update TerminalWidget after double-click selection
Previously we had to wait for the cursor to blink before we actually
got to see what got selected from double-clicking.
2021-04-10 00:11:10 +02:00
Andreas Kling
088ae37541 LibGUI: Reflow+update TextEditor widget after ruler visibility change 2021-04-10 00:09:44 +02:00
Andreas Kling
58106f57de LibGUI: Remove 2px of vertical space around FilePicker common places
The extra margin is not needed with the new "Tray" look. :^)
2021-04-09 23:58:04 +02:00
Andreas Kling
42ec6718f2 Base+LibGUI: Add an familiar-looking icon for the desktop directory 2021-04-09 23:45:21 +02:00
Andreas Kling
2de1f32433 LibGUI: Yet another FilePicker UI tweak
Make sure the "Look in:" label is vertically centered within its
corresponding location box.
2021-04-09 23:09:52 +02:00
Andreas Kling
8db4819271 LibGUI: Allow navigating into symlinked directories in FilePicker
If you double-click on a symlink to a directory while browsing with
a FilePicker, you most likely want to open the directory the symlink
points to, not open the symlink itself. So let's do that. :^)
2021-04-09 23:04:04 +02:00
Andreas Kling
bcd05e199b LibGUI: Fix uniform TabWidget tabs bleeding outside the widget
The last uniform-sized tab button would bleed outside the tab bar area
due to us not taking the bar margin into account.
2021-04-09 22:30:41 +02:00
Andreas Kling
c8ff507534 LibGUI: Add TabWidget::on_tab_count_change hook 2021-04-09 22:23:14 +02:00
Andreas Kling
2aaf12e9cd LibGUI: More tweaks for the FilePicker UI layout 2021-04-09 21:53:43 +02:00
Andreas Kling
da7dbc116e LibGUI: Use "Tray" look & feel for the common locations frame :^) 2021-04-09 21:53:43 +02:00
Andreas Kling
11bea5d633 LibGfx+Base: Add Tray/TrayText theme colors and Gfx::ButtonStyle::Tray
A "Tray" is a sunken container area for widgets. The first intended
client of this style is the GUI::FilePicker's common locations frame.

Thanks to @nvella for coming up with the term "Tray" :^)
2021-04-09 21:53:43 +02:00
Andreas Kling
3e43b1f173 LibGUI: Tweak FilePickerDialog UI layout 2021-04-09 21:53:43 +02:00
Jelle Raaijmakers
db321db5f4 LibRegex: Parse \0 as a zero-byte instead of 0x30 ("0")
This was causing some regexes to trip up. Fixes #6202.
2021-04-09 21:53:14 +02:00
Andreas Kling
c2b760e335 Terminal+LibVT: Add Alt shortcuts to menu actions 2021-04-09 17:08:49 +02:00
Andreas Kling
afb6e3a79d LibGUI: Give Alt shortcuts to all the CommonActions :^) 2021-04-09 17:08:49 +02:00
Andreas Kling
eecf60767a LibGfx: Make draw_ui_text() underlines take glyph spacing into account
Without this, the underline was ending up too far to the left.
2021-04-09 17:08:49 +02:00
Andreas Kling
2b9bc605d2 LibGfx: Add a Gfx::TextAlignment parameter to Painter::draw_ui_text() 2021-04-09 17:08:49 +02:00
Andreas Kling
b7a25bfaac LibGfx: Adjust parameter order for Painter::draw_ui_text()
Let's put the rect first so it's the same as draw_text().
2021-04-09 17:08:49 +02:00
Amjad Alsharafi
b758654840 LibJS: Added tests for constructing TypeArray from another 2021-04-09 09:05:19 +02:00
Amjad Alsharafi
5d44544401 LibJS: Added construction of TypedArray from another 2021-04-09 09:05:19 +02:00
Dmitrii Trifonov
323b7021bc LibGfx: Added dirty and raw cyrillic support for bitmap fonts.
This is a very quick and diry hack to implement support for cyrillic bitmap fonts.
2021-04-09 08:33:12 +02:00
Hendiadyoin1
c0c4e99c74 LibJS: Use dbgln_if in Heap.cpp 2021-04-08 23:57:16 +02:00
Hendiadyoin1
e8ef10e2a6 Kernel/LibC: Make memset implementations the same
I dont know why we do a fast path in the Kernel, but not in Userspace

Also simplified the byte explosion in memset to "explode_byte"
it even seemed so, that we missed the highest byte when memseting something
2021-04-08 23:57:16 +02:00
Andreas Kling
ce80f0d552 LibC: Fix coding style in scanf helpers 2021-04-08 20:32:44 +02:00
Idan Horowitz
34c05a744f LibGfx: Update to PNGLoader to modern dbgln_if and if constexpr logging 2021-04-07 19:36:24 +02:00
Idan Horowitz
8a0f1d87c0 LibGfx: Fix IHDR filter method field validation
As per the PNG specification: "Filter method is a single-byte
integer that indicates the preprocessing method applied to the
image data before compression. At present, only filter method 0
(adaptive filtering with five basic filter types) is defined."
2021-04-07 19:36:24 +02:00
Idan Horowitz
f0bd17e610 LibGfx: Zero out dummy filter scanline
As per the PNG specification: "For all x < 0, assume Raw(x) = 0 and
Prior(x) = 0. On the first scanline of an image (or of a pass of an
interlaced image), assume Prior(x) = 0 for all x."
2021-04-07 19:36:24 +02:00
Linus Groh
57c6264877 LibTLS: Hide some debug spam, use more dbgln_if and if constexpr
The debug console was full of 'Update hash with message of size x'.
2021-04-07 19:21:26 +02:00
Andreas Kling
2f9321a0d4 LibWeb: Implement window.top
This simply returns the main frame's window object. If accessed inside
the main frame, it will return itself.
2021-04-07 11:19:51 +02:00
Linus Groh
f3264b0dbd LibJS: Implement Object.isFrozen() and Object.isSealed() 2021-04-07 09:05:01 +02:00
Linus Groh
9af07c7803 LibJS: Implement Object.freeze() and Object.seal() 2021-04-07 09:05:01 +02:00
Linus Groh
1c3eef5317 LibJS: Use MarkedValueList for internal own properties getter functions
Letting these create and return a JS::Array directly is pretty awkward
since we then need to go through the indexed properties for iteration.
Just use a MarkedValueList (i.e. Vector<Value>) for this and add a new
Array::create_from() function to turn the Vector into a returnable
Array as we did before.

This brings it a lot closer to the spec as well, which uses the
CreateArrayFromList abstract operation to do exactly this.

There's an optimization opportunity for the future here, since we know
the Vector's size we could prepare the newly created Array accordingly,
e.g. by switching to generic storage upfront if needed.
2021-04-07 09:05:01 +02:00
AnotherTest
a42886d8ff LibGUI: Update the autocomplete suggestions after processing keys
Previously, this was updating the suggestions before processing the keys
and whatever changes they caused, making the suggestions stale until the
periodic auto-autocomplete timer fired (if enabled).
2021-04-07 08:48:50 +02:00
Luke
d215578f55 LibWeb: Implement "select" portion of reset_the_insertion_mode_appropriately
Required by Dromaeo. With this, it no longer crashes.
2021-04-06 23:47:05 +02:00
tuqqu
7bd0384fa6 LibJS: Support mapFn argument of Array.from 2021-04-06 22:25:05 +02:00
thankyouverycool
e8c1288e2c LibGUI: Add autosize to CheckBox 2021-04-06 22:24:05 +02:00
thankyouverycool
8afe013069 LibGUI:: Let open/save specify starting directory in FilePicker 2021-04-06 22:24:05 +02:00
Itamar
9e2e36724d LibCpp: Add TemplatizedName
This type represents templatized names, and replaces our previous use
of 'TemplatizedType' and 'TemplatizedFunctionCall'.

Also, we now parse function calls as secondary expressions.
2021-04-06 21:51:58 +02:00
Itamar
510b5073de LanguageServers/Cpp: Refactor logic of find declaration 2021-04-06 21:51:58 +02:00
Itamar
e16036b9cc LibCpp: Introduce DummyASTNode
This allows us to use pase_* methods inside match_* methods,
without adding any actual AST nodes to the m_nodes list.
2021-04-06 21:51:58 +02:00
Itamar
aa717e6a62 LibCpp: Parse C-Style parse expressions 2021-04-06 21:51:58 +02:00
Itamar
ec2c54ee2e LibCpp: Parse "arrow" operator 2021-04-06 21:51:58 +02:00
Itamar
44833f1621 LibCpp: Parse braced initialization list 2021-04-06 21:51:58 +02:00
Itamar
d482b3fd60 LibCpp: Parse empty for loops 2021-04-06 21:51:58 +02:00
Itamar
fc503b1368 LibCpp: Parse sizeof() expression 2021-04-06 21:51:58 +02:00