LibSQL aims to be a SQLite clone for SerenityOS. Step 1 is creating a
tokenizer to lex SQL tokens. This lexer is heavily influenced by the
LibJS lexer.
HTMLInputElement now inherits from FormAssociatedElement, which will
be a common base for the handful of elements that need to track their
owner form (and register with it for the form.elements collection.)
At the moment, the owner form is assigned during DOM insertion/removal
of an HTMLInputElement. I didn't implement any of the legacy behaviors
defined by the HTML parsing spec yet.
The "Wrapper" suffix is not useful information to someone using the
JS console, so let's just drop it from the string returned when calling
class_name() on a JS binding wrapper.
IPC::Connection::send_sync asserts that a response was received, so the
current gracefull fail check was useless, as LibIPC would always assert
before reaching it.
This was failing to take two things into account:
- When constructing a PropertyName from a value, it won't automatically
convert to Type::Number for something like string "0", even though
that's how things work internally, since indexed properties are stored
separately. This will be improved in a future patch, it's a footgun
and should happen automatically.
- Those can't be looked up on the shape, we have to go through the
indexed properties instead.
Additionally it now operates on the shape or indexed properties directly
as define_property() was overly strict and would throw if a property was
already non-configurable.
Fixes#6469.
Changing the statusbar appearance when overriding text makes it less
confusing as it's supposed to be something temporary, e.g. only when
hovering over a toolbar or menu item.
This behavior is present on old Windows systems, although things work
slightly differently there (where only the overridden text is displayed
rather than all the segments).
The shared library libicudata.so has a DT_SYMBOLIC entry:
Dynamic Section:
NEEDED libgcc_s.so
SONAME libicudata.so.69
SYMBOLIC 0x00000000
HASH 0x00000094
STRTAB 0x000000c8
SYMTAB 0x000000a8
STRSZ 0x0000002a
SYMENT 0x00000010
According to the ELF spec DT_SYMBOLIC has no special meaning
for the dynamic loader.
This commit adds an event called WM_SuperKeyPressed which is sent to all
windows via WindowManagerServerConnection.
The event is fired from WindowManager when the super key is pressed,
which is the windows key on most keyboards :)
As well as correctly calculating the height of TableRowBox, this change
calculates the heights of TableRowGroupBoxs also.
As before, this does not correctly take into consideration the 'height'
attribute.
Now the horizontal layout is approximately correct for the
TableRowGroupBoxs we can now see that the `layout_row` method will need
updating to correctly calculate cell width across all rows, not just the
current TableRowGroupBox.
As the spec for the table fixup algorythm says:
> Treat table-row-groups in this spec also encompass the specialized
> table-header-groups and table-footer-groups.
The calculation for TLS relocations was incorrect which would
result in overlapping TLS variables when more than one shared
object used TLS variables.
This bug can be reproduced with a shared library and a program
like this:
$ cat tlstest.c
#include <string.h>
__thread char tls_val[1024];
void set_val() { memset(tls_val, 0, sizeof(tls_val)); }
$ gcc -g -shared -o usr/lib/libtlstest.so tlstest.c
$ cat test.c
void set_val();
int main() { set_val(); }
$ gcc -g -o tls test.c -ltlstest
Due to the way the TLS relocations are done this program would
clobber libc's TLS variables (e.g. errno).
This uses the per glyph width to determine if the glyph is actually
present in the font, and not just inside the range the font can covers
This means that characters that are in the font's range but that are
missing a glyph will show up as the missing character glyph instead of
being invisible.
This replaces the glyph width spinbox in the font editor with a
checkbox when editing fixed width fonts that indicates if the
currently selected character's glyph is present in the edited font
(For variable width fonts a non zero width implies presence)
This commit also changes the background color of glyphs in the glyph
map based on the presence of each specific glyph in the font.
Since we were always saving the glyph widths array to the font file, we
now also always load it, even on (which also simplifies the logic a bit)
fixed width fonts. We also set it initially to 0 instead of the default
fixed width, which allows us to use it to check for glyph presence in
both fixed width and variable width fonts.
This adds PT_PEEKDEBUG and PT_POKEDEBUG to allow for reading/writing
the debug registers, and updates the Kernel's debug handler to read the
new information from the debug status register.
The vsscanf library function lets the user skip assigning
parsed values to the arguments, e.g. with %*c - even though
a character is scanned it is not assigned to one of the
arguments.
The figlet port uses this. With this patch the port is actually
usable.
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.
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 :^)
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.
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.
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.
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.
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)
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)
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.
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)
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
These provide the cursor coordinate within the viewport at which the
event occurred (as opposed to the page relative coordinates exposed via
offsetX, offsetY).
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.
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.
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.
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.
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.
As defined by the specification (and used by the website i am testing):
interface mixin CanvasDrawPath {
undefined fill(optional CanvasFillRule fillRule = "nonzero");
}
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)
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.
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.
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. :^)
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. :^)
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.
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.
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 :^)
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.
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.
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.