Commit graph

17776 commits

Author SHA1 Message Date
Idan Horowitz
f532421c9c LibCompress: Make the Zlib decompressor fail gracefuly
This commit adds a verify-less try_create method to the Zlib
decompressor to allow for graceful failures of parsing the
Zlib headers.
2021-03-15 21:35:48 +01:00
Andreas Kling
a7b5a58509 Kernel: Fix sys$select() not marking fd's after blocking was avoided
In case multiple file descriptors in the `fd_set` were already readable
and/or writable when calling Thread::block<SelectBlocker>(), we would
only mark the first fd in the output sets instead of all relevant fd's.

The short-circuit code path when blocking isn't necessary must ensure
that unblock flags are collected for all file descriptors, not just the
first one encountered.

Fixes #5795.
2021-03-15 21:21:52 +01:00
Andreas Kling
8cafdf8985 LibWeb: Make sure <script> elements get prepared when connected
There's a bit more nuance to how this should really work, but let's at
least make sure we execute <script> elements if you insert them into
the document.
2021-03-15 21:20:33 +01:00
Andreas Kling
d434ae71b3 LibWeb: Add CanvasRenderingContext2D.clearRect()
Similar to fillRect, except this API fills with transparent black.
2021-03-15 21:20:33 +01:00
Andreas Kling
4559faf8d8 LibWeb: Support named CSS properties on CSSStyleDeclaration wrapper
Use the new CustomGet/CustomPut wrapper mechansim to intercept gets and
puts on CSSStyleDeclaration objects. This allows content to get and set
individual CSS properties from JavaScript. :^)
2021-03-15 21:20:33 +01:00
Andreas Kling
ab23ef92b6 LibWeb: Allow JS wrappers to customize get() and put()
You can now set the CustomGet and/or CustomPut extended attributes on
an interface. This allows you to override JS::Object::get/put in the
wrapper class.
2021-03-15 21:20:33 +01:00
Andreas Kling
c7d1f73990 LibWeb: Make <option> elements display:none in the default CSS for now 2021-03-15 21:20:33 +01:00
Andreas Kling
8062fc711c LibJS: Add arguments.callee to our hack arguments object
arguments.callee refers to the currently executing function.
2021-03-15 21:20:33 +01:00
Andreas Kling
093331df06 LibJS: Add Date.prototype.toGMTString() 2021-03-15 21:20:33 +01:00
Andreas Kling
36ea9fbd9e LibWeb: Stub out Document.cookie
We don't get/set anything, but at least scripts that access document
cookies can now progress further. :^)
2021-03-15 21:20:33 +01:00
Andreas Kling
3596c42deb LibJS: Partial support for Date.prototype.setFullYear() 2021-03-15 21:20:33 +01:00
Andreas Kling
4da3e5d91f LibJS: Add naive implementation of eval() :^)
This parses and executes a code string in the caller's lexical scope.
2021-03-15 21:20:33 +01:00
Andreas Kling
64cb04996f AK: Make ByteBuffer::slice(0, size()) a freebie
If you want the whole buffer, we can just give you the buffer itself.
2021-03-15 18:01:11 +01:00
Elie Donadio
3a5a9a683f Apply suggestions from code review
Small adjustments, as suggested by linus.

Co-authored-by: Linus Groh <mail@linusgroh.de>
2021-03-15 16:08:31 +01:00
ElDonad
f4f12982ff bt: add source file number integration 2021-03-15 16:08:31 +01:00
ElDonad
a0c0d781e8 LaunchServer: added additional file parameters
This small commit should allow to specify additionnal parameters in the
form of URL queries, when opening a file via a "file://" url through the
LaunchServer.
2021-03-15 16:08:31 +01:00
Idan Horowitz
c9f25bca04 LibTextCodec: Make UTF16BEDecoder read only up to an even offset
Reading up to the end of the input string of odd length results in
an out-of-bounds read
2021-03-15 16:08:12 +01:00
Brendan Coles
7156b61d57 UserspaceEmulator: downgrade TODO to dbgln for invalid fcntl cmd arg 2021-03-15 16:07:31 +01:00
Luke
7276511833 Kernel/Storage: Add SATA error disambiguation 2021-03-15 09:57:27 +01:00
Andreas Kling
a166a65eff Kernel: Don't return -EFOO when return type is KResultOr<...> 2021-03-15 09:09:04 +01:00
Cesar Torres
2b269b27e7 LibGUI: Fix crash when text_in_range() was called on an empty document 2021-03-15 09:08:15 +01:00
Cesar Torres
4f34a78337 TextEditor: Add charcount info about selected text to the statusbar 2021-03-15 09:08:15 +01:00
Tom Needham
daf2e5d335 Ports: Do not call ./package.sh from a subshell in ./build_all.sh
This patch ensures that ./package.sh is run in the same shell
This solves compiling issues when building certain ports.

This fix was suggested by linusg in
https://github.com/SerenityOS/serenity/issues/5783#issuecomment-798906817
2021-03-15 09:07:17 +01:00
Tom Needham
26d72d3048 Ports: Allow verbose argument in build_all.sh
This patch allows for a verbose argument to be passed
so that the build output of the individual builds
is printed to stdout instead of /dev/null to help with diagnosing errors

If the verbose argument is not passed the old behaviour is preserved
and the build output is printed to /dev/null
2021-03-15 09:07:17 +01:00
Liav A
3c35ea30cc Kernel: Return 0 to indicate EOF when reading from end-of-file of device
If we happen to read with offset that is after the end of file of a
device, return 0 to indicate EOF. If we return a negative value,
userspace will think that something bad happened when it's really not
the case.
2021-03-15 09:06:41 +01:00
Tom
5ccc3637e3 Kernel: Fix race conditions processing async device requests 2021-03-15 09:06:41 +01:00
Tom
8177f2474b Kernel: Fix race condition completing IDEChannel async request 2021-03-15 09:06:41 +01:00
Liav A
a66c9fc593 Kernel: When writing to device node, use can_write for checking
Instead of can_read which is wrong, use can_write.
2021-03-15 09:06:41 +01:00
AnotherTest
125be2923c Shell: Consume the username when parsing '~user'
Otherwise it will stay there and be parsed as a juxtaposition.
Fixes #5798.
2021-03-15 09:06:21 +01:00
Linus Groh
f59d58cb76 LibELF+LibTest: Fix serenity_install_sources() paths
Currently we end up with the following:

    serenity/
        AK/
            ...
        Kernel/
            ...
        Libraries/
            LibELF/
            LibTest/
        Userland/
            Libraries/
                <all other libs>
            ...
2021-03-15 09:06:10 +01:00
Magnus Alvestad
a3b03eef01
Keymap: Added no-latin1.json for Norwegian pc105 keyboards (#5794) 2021-03-15 08:48:26 +01:00
Mițca Dumitru
32b9437c13 LibM: Add remainder{f, l}
These just forward their arguments to fmod, but I think that should be
fine.
2021-03-14 21:43:08 +01:00
Mițca Dumitru
e4197b7854 LibM: Define HUGE_VAL{F,L} in terms of compiler builtins 2021-03-14 21:43:08 +01:00
Mițca Dumitru
e9533da0e7 LibM: Define MAXFLOAT
Looks like a POSIX extension
2021-03-14 21:43:08 +01:00
Mițca Dumitru
86ee9211be LibM: Define FLT_EVAL_METHOD, float_t and double_t 2021-03-14 21:43:08 +01:00
Mițca Dumitru
1f1a4f488f LibM: Declare ldexpl in math.h
It was already defined, but it wasn't declared in the header
2021-03-14 21:43:08 +01:00
Mițca Dumitru
93c554f6bd LibM: Add the gamma family of functions 2021-03-14 21:43:08 +01:00
Mițca Dumitru
7aac174bc8 LibM: Organise math.h so it is less of a wall of functions
The categories are the same categories used by cppreference on its page
for numeric functions.
2021-03-14 21:43:08 +01:00
Mițca Dumitru
c9601cdee3 LibM: Implement the missing parts of the round family 2021-03-14 21:43:08 +01:00
Mițca Dumitru
03b2d30836 LibM: Add missing float and long double function variants 2021-03-14 21:43:08 +01:00
Brendan Coles
eecaa3bed6 test-compress: Initialize byte buffer with random data 2021-03-14 21:37:29 +01:00
Brendan Coles
81cbb2676e readelf: Tweak section headers output column padding 2021-03-14 21:36:54 +01:00
Brendan Coles
1eccd78e3a UserspaceEmulator: Add SC_rmdir syscall 2021-03-14 21:36:36 +01:00
Linus Groh
202f855055 LibJS: Change non-ScriptFunction source string to "[native code]"
https://tc39.es/ecma262/#sec-function.prototype.tostring - this is how
the spec wants us to do it. :^)

Also change the function name behaviour to only provide a name for
NativeFunctions, which matches other engines - presumably to not expose
Proxy objects, and to prevent "function bound foo() { [native code] }".
2021-03-14 19:22:16 +01:00
Linus Groh
f9287fca1e LibJS: Don't try to derive function source from ProxyObject
There are three JS::Function types that are not ScriptFunction:
NativeFunction, BoundFunction and ProxyObject. We were only checking for
the first two when determining whether to reconstruct the function's
source code, which was leading to a bad cast to ScriptFunction.

Since only ScriptFunction has the [[SourceText]] internal slot, I simply
swapped the branches here.

Fixes #5775.
2021-03-14 19:22:16 +01:00
Idan Horowitz
02b4cb96f8 LibCompress: Decrease CanonicalCode's size on stack
This commit stores the bit codes as u16s instead of u32s as the
maximum code bit length in DEFLATE is 15.
2021-03-14 14:52:21 +01:00
Brendan Coles
ab9f66a069 UserspaceEmulator: Increase stack size from 64 * KiB to 1 * MiB 2021-03-14 13:55:29 +01:00
Brendan Coles
6bc01909b7 readelf: Add support for core notes and relocations 2021-03-14 13:55:07 +01:00
Linus Groh
304e193836 LibJS: Fix some issues in RegExp.prototype[@@match]
- We were not passing the to_string()'d argument to the exec function
  but the original argument
- We were leaking an empty value in two cases, which almost certainly
  will crash something down the line
- We were not checking for exceptions after to_string() and get(), which
  both may throw. If the getter is an accessor, it'll assert upon being
  called with the VM already storing an exception.
2021-03-14 12:24:57 +01:00
Linus Groh
b68509569e LibJS: Fix String.prototype.match() for non-string argument
This is supposed to pass the to_string()'d argument to @@match, not the
this value.
2021-03-14 12:24:57 +01:00