Commit graph

13415 commits

Author SHA1 Message Date
Andreas Kling
ceda137bf2 LibWeb: Support <form method=POST>
Use the new support for HTTP method and request body to implement basic
support for POST'ed forms. This is pretty cool! :^)
2020-09-28 11:56:26 +02:00
Andreas Kling
2946a684ef ProtocolServer+LibWeb: Support more detailed HTTP requests
This patch adds the ability for ProtocolServer clients to specify which
HTTP method to use, and also to include an optional HTTP request body.
2020-09-28 11:55:26 +02:00
Andreas Kling
cfafd4d52d LibWeb: Expand LoadRequest class to include method, headers and body
This will allow us to create more detailed requests from inside the
web engine.
2020-09-28 11:53:32 +02:00
asynts
56bfefabb6 AK+Format: Keep type information for integers in TypeErasedParameter.
It's now save to pass a signed integer as parameter and then use it as
replacement field (previously, this would just cast it to size_t which
would be bad.)
2020-09-28 10:53:16 +02:00
asynts
6a2f5f4522 AK+Format: Clean up format specifier parsing using GenericLexer.
Also adds support for replacement fields.
2020-09-28 10:53:16 +02:00
Andreas Kling
ebe1288aea LibJS: Add missing <AK/Function.h> include in JSONObject.cpp 2020-09-28 09:17:33 +02:00
Benoît Lormeau
f0f6b09acb AK: Remove the ctype adapters and use the actual ctype functions instead
This finally takes care of the kind-of excessive boilerplate code that were the
ctype adapters. On the other hand, I had to link `LibC/ctype.cpp` to the Kernel
(for `AK/JsonParser.cpp` and `AK/Format.cpp`). The previous commit actually makes
sense now: the `string.h` includes in `ctype.{h,cpp}` would require to link more LibC
stuff to the Kernel when it only needs the `_ctype_` array of `ctype.cpp`, and there
wasn't any string stuff used in ctype.
Instead of all this I could have put static derivatives of `is_any_of()` in the
concerned AK files, however that would have meant more boilerplate and workarounds;
so I went for the Kernel approach.
2020-09-27 21:15:25 +02:00
Benoit Lormeau
f158cb27ea LibC: Remove an unneeded string.h include in ctype.h/cpp
And include string.h in the files that actually needed it
2020-09-27 21:15:25 +02:00
Benoit Lormeau
e4da2875c5 AK: Use templates instead of Function for Conditions in the GenericLexer
Since commit 1ec59f28ce turns the ctype macros
into functions we can now feed them directly to a GenericLexer! This will lead to
removing the ctype adapters that were kind-of excessive boilerplate, but needed as
the Kernel doesn't compile with the LibC.
2020-09-27 21:15:25 +02:00
AnotherTest
eef794b8c6 LibMarkdown: Parse paragraphs line-wise
This gets rid of the doubled-up checks in `Paragraph::parse()`, and
makes a paragraph the last possible kind of block to be parsed.
2020-09-27 21:14:18 +02:00
AnotherTest
176a2f193c LibMarkdown: Add support for Tables
This adds support for GFM-like tables.
The HTML rendering ignores the alignments and relative sizes, but the
terminal view does not!
2020-09-27 21:14:18 +02:00
AnotherTest
7640cb8ec4 LibMarkdown: Add a Text(String) constructor 2020-09-27 21:14:18 +02:00
AnotherTest
445bd86533 LibMarkdown: Make Text default-constructible and move-assignable 2020-09-27 21:14:18 +02:00
AnotherTest
aa65f664a9 LibMarkdown: Take a 'view_width' argument for render_for_terminal()
Some constructs will require the width of the terminal (or a general
'width') to be rendered correctly, such as tables.
2020-09-27 21:14:18 +02:00
AnotherTest
5fbec2b003 AK: Move trim_whitespace() into StringUtils and add it to StringView
No behaviour change; also patches use of `String::TrimMode` in LibJS.
2020-09-27 21:14:18 +02:00
Brian Pfeil
50e9000b40
Toolchain: Fix outdated error message about SERENITY_ROOT (#3624) 2020-09-27 21:13:04 +02:00
Andreas Kling
700cbc02ec LibWeb: Use JS::VM::call() in timer and RAF callback invocation
This removes assumptions about having an Interpreter, and also unbreaks
requestAnimationFrame which was asserting.
2020-09-27 20:31:13 +02:00
Andreas Kling
340d6b0ef7 LibJS: Stop using Interpreter& in the iterator operations helpers 2020-09-27 20:26:58 +02:00
Andreas Kling
2bc5bc64fb LibJS: Remove a whole bunch of includes of <LibJS/Interpreter.h> 2020-09-27 20:26:58 +02:00
Andreas Kling
861815596f LibWeb: Bypass the JS::Interpreter when invoking JS event callbacks
Use VM::call() instead of Interpreter::call().
2020-09-27 20:26:58 +02:00
Andreas Kling
063acda76e LibJS: Remove a bunch of unnecessary uses of Cell::interpreter()
We'll want to get rid of all uses of this, to free up the engine from
the old assumption that there's always an Interpreter available.
2020-09-27 20:26:58 +02:00
Andreas Kling
591b7b7031 LibJS: Remove js_string(Interpreter&, ...) 2020-09-27 20:26:58 +02:00
Andreas Kling
adf0a537af LibJS: Remove js_bigint(Interpreter&, ...) 2020-09-27 20:26:58 +02:00
Andreas Kling
a61ede51e2 LibJS: Don't require Interpreter& for constructing an Accessor 2020-09-27 20:26:58 +02:00
Andreas Kling
c59a8d84d3 LibJS: Reduce Interpreter& usage in the Object class 2020-09-27 20:26:58 +02:00
Andreas Kling
b9793e603c LibJS: Don't require Interpreter& in PropertyName and StringOrSymbol 2020-09-27 20:26:58 +02:00
Andreas Kling
1df18c58f5 LibJS: Make all the JS::Value binary op helpers take GlobalObject&
We don't need the Interpreter& for anything here, the GlobalObject is
enough for getting to the VM and possibly throwing exceptions.
2020-09-27 20:26:58 +02:00
Andreas Kling
30ca9acd9c LibJS: Remove unused js_symbol(Interpreter&, ...) 2020-09-27 20:26:58 +02:00
Andreas Kling
aaa8b48a4c LibJS: Remove use of Interpreter& in JSONObject code 2020-09-27 20:26:58 +02:00
Andreas Kling
f79d4c7347 LibJS: Remove Interpreter& argument to Function::construct()
This is no longer needed, we can get everything we need from the VM.
2020-09-27 20:26:58 +02:00
Andreas Kling
340a115dfe LibJS: Make native function/property callbacks take VM, not Interpreter
More work on decoupling the general runtime from Interpreter. The goal
is becoming clearer. Interpreter should be one possible way to execute
code inside a VM. In the future we might have other ways :^)
2020-09-27 20:26:58 +02:00
Andreas Kling
1ff9d33131 LibJS: Make Function::call() not require an Interpreter&
This makes a difference inside ScriptFunction::call(), which will now
instantiate a temporary Interpreter if one is not attached to the VM.
2020-09-27 20:26:58 +02:00
Andreas Kling
be31805e8b LibJS: Move scope stack from VM back to Interpreter
Okay, my vision here is improving. Interpreter should be a thing that
executes an AST. The scope stack is irrelevant to the VM proper,
so we can move that to the Interpreter. Same with execute_statement().
2020-09-27 20:26:58 +02:00
Andreas Kling
6861c619c6 LibJS: Move most of Interpreter into VM
This patch moves the exception state, call stack and scope stack from
Interpreter to VM. I'm doing this to help myself discover what the
split between Interpreter and VM should be, by shuffling things around
and seeing what falls where.

With these changes, we no longer have a persistent lexical environment
for the current global object on the Interpreter's call stack. Instead,
we push/pop that environment on Interpreter::run() enter/exit.
Since it should only be used to find the global "this", and not for
variable storage (that goes directly into the global object instead!),
I had to insert some short-circuiting when walking the environment
parent chain during variable lookup.

Note that this is a "stepping stone" commit, not a final design.
2020-09-27 20:26:58 +02:00
Tom
838d9fa251 Kernel: Make Thread refcounted
Similar to Process, we need to make Thread refcounted. This will solve
problems that will appear once we schedule threads on more than one
processor. This allows us to hold onto threads without necessarily
holding the scheduler lock for the entire duration.
2020-09-27 19:46:04 +02:00
Tom
079486ed7e AK: Clear previous/next link in InlineLinkList::remove 2020-09-27 19:46:04 +02:00
Luke
0f52144477 Ports: Add OpenSSH port 2020-09-27 01:02:11 +02:00
Luke
bf809226de LibC: Add SCM_RIGHTS to sockets.h and caddr_t to types.h 2020-09-27 01:02:11 +02:00
Luke
1ec59f28ce LibC: Make isalum/isalpha/etc. functions instead of macros
These are supposed to be both functions and macros. I'm not sure
how to provide the functions at the same time as the macros,
as they collide with each other and cause compile errors.

However, some ports fully expect them to be functions.
For example, OpenSSH stores them into structures as function
pointers.
2020-09-27 01:02:11 +02:00
Luke
9266006349 LibC: Add ss_family to sockaddr_storage
I'm not exactly sure if this is in the right spot in the structure,
especially since I read that this is supposed to be cast into other
structures.
2020-09-27 01:02:11 +02:00
Luke
b3be275cf7 LibELF: Validate PT_GNU_RELRO program header
I'm not sure if this is the correct validation. This is based on
it being "read-only after relocation".
2020-09-27 01:02:11 +02:00
Luke
9d8f1032b7 LibC: Add missing utmp backwards compatibility hacks and user/dead process macros
The user/dead process macros are not used anywhere in Serenity right now,
but are required for OpenSSH.
2020-09-27 01:02:11 +02:00
Luke
721788943d Kernel: Implement _SC_OPEN_MAX 2020-09-27 01:02:11 +02:00
Luke
db31452bc2 LibC: Made mbtowc return int instead of size_t 2020-09-27 01:02:11 +02:00
Luke
5fbb8f9c6a LibC: Add FIXME for vsscanf 2020-09-27 01:02:11 +02:00
Luke
7a558d16b0 LibC: Add some missing netinet macros required by OpenSSH
Not used anywhere in Serenity right now, but required for OpenSSH.
2020-09-27 01:02:11 +02:00
Luke
f2cc565670 LibC: Add SSIZE_MAX limit 2020-09-27 01:02:11 +02:00
Luke
83849f0ef3 LibC: Include cdefs.h in getopt.h
Required for __BEGIN_DECLS
2020-09-27 01:02:11 +02:00
Luke
7334f21ef7 LibC: Add EPFNOSUPPORT error number
Not used anywhere in Serenity currently, but required for OpenSSH.
2020-09-27 01:02:11 +02:00
Luke
ec136db592 Kernel: Return ENOPROTOOPT instead of asserting on unimplemented levels in getsockopt 2020-09-27 01:02:11 +02:00