Commit Graph

17807 Commits

Author SHA1 Message Date
Dan MacDonald
3dfa3d2d9d
Ports: Add Hatari Atari ST/STE/TT/Falcon emulator (#5812) 2021-03-16 21:53:13 +01:00
Idan Horowitz
211031e4f4 LibGfx: Fail gracefuly on invalid interlace method in PNGLoader
This fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29791
2021-03-16 21:52:05 +01:00
AnotherTest
80d21f120f LibLine: Make the DSR response parser a bit more robust
At the cost of using more read() syscalls, process the DSR response
character-by-character.
This avoids blocking forever waiting for an 'R' that will never come :P
2021-03-16 21:51:49 +01:00
Brendan Coles
fe97aec8c3 UserspaceEmulator: Print PID in mmap nullptr with MAP_FIXED reportln() 2021-03-16 21:48:29 +01:00
Andreas Kling
cad4cc9a2a LibWeb: Invalidate element style after setting Element.style.foo
This makes us recompute style for the element so the change actually
takes effect. :^)
2021-03-16 19:00:42 +01:00
Linus Groh
6c8185151e LibCpp: Return empty TranslationUnit from Parser::parse() if no tokens exist
Fixes #5704.
Fixes #5825.
Fixes #5827.
2021-03-16 18:59:19 +01:00
Linus Groh
8e84ca6b16 LibJS: Don't apply arguments object hack to global execution context
Checking for the existence of a call frame is not enough to check if
we're in a function call, as the global execution context is a regular
call frame as well.

Found by OSS-Fuzz, where simply accessing "arguments" in the global
scope would crash due to call_frame().callee being an empty value
(https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32115).
2021-03-16 18:48:25 +01:00
Idan Horowitz
00f1cb924b LibAudio: decrease WavLoader's size limit to a more reasonable size
A 4 GiB wav (current size limit) is very unreasonable, and larger
than oss-fuzz's 2.5 GiB per-process memory limit.
2021-03-16 18:40:42 +01:00
Andreas Kling
efc6060df0 LibWeb: Dispatch "resize" events on the Window object
It's a little awkward that we do this in two places, but IPWV and OOPWV
currently implement resizing a little differently from each other so we
need to cover both paths.
2021-03-16 18:10:21 +01:00
thankyouverycool
d2d69f3efb LibGUI: Remove has_visible_list members from TextEditor
This was a kludge to paint ComboBox editors before the advent of
accessory windows, isn't being used anymore, and was inadvertently
letting two ComboBoxes paint as if both had focus.
2021-03-16 17:58:24 +01:00
Andreas Kling
906cccbf7f LibWeb: Add Window.innerWidth and Window.innerHeight 2021-03-16 17:22:59 +01:00
Roi
72501775a7
Base: Change path to both modload and modunload (#5804) 2021-03-16 16:05:42 +01:00
Idan Horowitz
eb343296ce LibCompress: Handle and propagate stream errors in GzipDecompressor
This commit makes read short-circuit if its input stream errored,
as well as propagate error handling to wrapped sub streams, similarly
to DeflateDecompressor.
2021-03-16 14:56:50 +01:00
Idan Horowitz
ea5f83616e LibCompress+AK: Dont short-circuit error handling propagation
In the case that both the stream and the wrapped substream had errors
to be handled only one of the two would be resolved due to boolean
short circuiting. this commit ensures both are handled irregardless
of one another.
2021-03-16 14:56:50 +01:00
Andreas Kling
c684af1f83 LibWeb: Use Gfx::Bitmap::RGBA8888 for ImageData bitmaps
This makes the colors show up correctly when using putImageData() to
draw an ImageData onto a CanvasRenderingContext2D. :^)
2021-03-16 12:10:31 +01:00
Andreas Kling
fe861512c8 LibGfx: Add BitmapFormat::RGBA8888
This will be used by ImageData objects in LibWeb since the web spec
says these store colors in RGBA8888 order.

The only thing you can do with this format right now is blitting it
onto a BGRA8888 bitmap.
2021-03-16 12:09:15 +01:00
Andreas Kling
5023331726 LibGfx: Rename 32-bit bitmap StorageFormats to BGRA8888 and BGRx8888 2021-03-16 12:00:43 +01:00
Andreas Kling
e0f32626bc LibGfx: Rename 32-bit BitmapFormats to BGRA8888 and BGRx888x
The previous names (RGBA32 and RGB32) were misleading since that's not
the actual byte order in memory. The new names reflect exactly how the
color values get laid out in bitmap data.
2021-03-16 11:50:03 +01:00
Andreas Kling
0bfdf95af6 LibJS: Make an RAII helper for entering/exiting AST nodes 2021-03-16 10:51:55 +01:00
Linus Groh
c499239137 LibJS: Implement non-value-producing statements properly
For various statements the spec states:

    Return NormalCompletion(empty).

In those cases we have been returning undefined so far, which is
incorrect.

In other cases it states:

    Return Completion(UpdateEmpty(stmtCompletion, undefined)).

Which essentially means a statement is evaluated and its completion
value returned if non-empty, and undefined otherwise.

While not actually noticeable in normal scripts as the VM's "last value"
can't be accessed from JS code directly (with the exception of eval(),
see below), it provided an inconsistent experience in the REPL:

    > if (true) 42;
    42
    > if (true) { 42; }
    undefined

This also fixes the case where eval() would return undefined if the last
executed statement is not a value-producing one:

    eval("1;;;;;")
    eval("1;{}")
    eval("1;var a;")

As a consequence of the changes outlined above, these now all correctly
return 1.

See https://tc39.es/ecma262/#sec-block-runtime-semantics-evaluation,
"NOTE 2".

Fixes #3609.
2021-03-16 10:08:07 +01:00
Linus Groh
dadf2e8251 LibJS: Make Interpreter::run() a void function
With one small exception, this is how we've been using this API already,
and it makes sense: a Program is just a ScopeNode with any number of
statements, which are executed one by one. There's no explicit return
value at the end, only a completion value of the last value-producing
statement, which we then access using VM::last_value() if needed (e.g.
in the REPL).
2021-03-16 10:08:07 +01:00
AnotherTest
ef3679f9c3 Shell: Avoid unnecessarily taking control of the standard streams
As of a0506cb39e, this is no longer
needed to write to stdout.
Fixes #5776.
2021-03-16 09:41:37 +01:00
Linus Groh
18a5ddfadd LibGfx: Draw window frame icon scaled to title_bar_icon_rect()
Partially fixes #5806.
2021-03-15 22:47:05 +01:00
Oleg Sikorskiy
33bd18f308 QuickShow: Do not reset the panning on 100% zoom. 2021-03-15 22:46:53 +01:00
Oleg Sikorskiy
ee64c814c6 QuickShow: Use a better formula for zooming.
Now the pixel under the cursor doesn't move, which is more consistent
with other image viewers (e.g. GwenView and IrfanView). Also switch
m_pan_origin to use window space to have less space transformations.
2021-03-15 22:46:53 +01:00
Linus Groh
d6239b691f LibJS: Throw SyntaxError in eval() when parser has error(s) 2021-03-15 22:43:27 +01:00
Mițca Dumitru
01a49dda85 LibM: Implement fmin/fmax 2021-03-15 22:02:38 +01:00
Mițca Dumitru
987cc904c2 LibM: Make the gamma family of functions more accurate and conformant
This patch makes tgamma use an approximation that is more accurate with
regards to floating point arithmetic, and fixes some issues when tgamma
was called with positive integer values.

It also makes lgamma set signgam to the correct value, and makes its
return value be more inline with what the C standard defines.
2021-03-15 22:02:38 +01:00
Mițca Dumitru
2d0f334e5d LibM: Declare rintl in math.h 2021-03-15 22:02:38 +01:00
Andreas Kling
45e6b5e601 LibJS: Make eval() return the last value from the executed statement
This is kinda awkward but since the statement we're executing is
actually a JS::Program, we have to get the result via VM::last_value().
2021-03-15 21:43:40 +01:00
Idan Horowitz
a955fd4156 LibCompress+AK: Propagate error handling to wrapped streams
This ensures that when a DeflateCompressor stream is cleared of any
errors its underlying wrapped streams (InputBitStream/InputMemoryStream)
will be cleared as well and wont fail a VERIFY on destruction.
2021-03-15 21:35:48 +01:00
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