Commit graph

13984 commits

Author SHA1 Message Date
Linus Groh
565a26808d LibJS: Fix crashing exception in Value::ordinary_has_instance()
Two issues:

- throw_exception() with ErrorType::InstanceOfOperatorBadPrototype would
  receive rhs_prototype.to_string_without_side_effects(), which would
  ASSERT_NOT_REACHED() as to_string_without_side_effects() must not be
  called on an empty value. It should (and now does) receive the RHS
  value instead as the message is "'prototype' property of {} is not an
  object".
- Value::instance_of() was missing an exception check after calling
  has_instance_method, to_boolean() on an empty value result would crash
  as well.

Fixes #3930.
2020-11-03 19:14:13 +01:00
Andreas Kling
c538e22516 Ports: Bump GCC port to 10.2.0
Since we've already updated the toolchain, might as well update the
port as well. :^)
2020-11-03 18:08:13 +01:00
AnotherTest
0e544b8afa Spreadsheet: Enable Drag&Drop and Copy/Paste
These currently only work on the current sheet, in the current
Spreadsheet instance, but they're still freakin' cool!
2020-11-03 16:47:56 +01:00
AnotherTest
821e875bc0 Spreadsheet: Serialise Positions to URLs and add Sheet::from_uri() 2020-11-03 16:47:56 +01:00
AnotherTest
6e9c6acc87 LibGUI: Implement shift-select
shift-selecting simply toggles all indices in the range between the
cursor and the index that is being 'selected'.
2020-11-03 16:47:56 +01:00
Andreas Kling
6913e2ab99 HackStudio: Run clang-format 2020-11-03 13:40:24 +01:00
Zac
85d65b06ab HackStudio: Store and restore the scrollbar values of ProjectFiles when they are closed and reopened from the list of open files. 2020-11-03 13:34:38 +01:00
Linus Groh
39a1c9d827 LibJS: Implement 'new.target'
This adds a new MetaProperty AST node which will be used for
'new.target' and 'import.meta' meta properties. The parser now
distinguishes between "in function context" and "in arrow function
context" (which is required for this).
When encountering TokenType::New we will attempt to parse it as meta
property and resort to regular new expression parsing if that fails,
much like the parsing of labelled statements.
2020-11-02 22:40:59 +01:00
Linus Groh
e07a39c816 LibJS: Replace 'size_t line, size_t column' with 'Optional<Position>'
This is a bit nicer for two reasons:

- The absence of line number/column information isn't based on 'values
  are zero' anymore but on Optional's value
- When reporting syntax errors with position information other than the
  current token's position we had to store line and column ourselves,
  like this:

      auto foo_start_line = m_parser_state.m_current_token.line_number();
      auto foo_start_column = m_parser_state.m_current_token.line_column();
      ...
      syntax_error("...", foo_start_line, foo_start_column);

  Which now becomes:

      auto foo_start= position();
      ...
      syntax_error("...", foo_start);

  This makes it easier to report correct positions for syntax errors
  that only emerge a few tokens later :^)
2020-11-02 22:40:59 +01:00
Brendan Coles
ed5469c1c2 Applications: Use pledge and unveil 2020-11-02 22:36:27 +01:00
Joseph
9efcb5d290
LibGUI: Return early if drag_data_type is null (#3919)
If the user tries to drag an item with a null drag data type from an
AbstractView, return from the mouse event early.
2020-11-02 22:26:38 +01:00
Brendan Coles
5ed7ca3627 Applications: Use GUI::Icon::default_icon to set application icon 2020-11-02 21:06:17 +01:00
Kesse Jones
6861cb8a23 HackStudio: Removes the file from the list of open files
When a file is deleted from the project it will
also be removed from the list of open files
2020-11-02 20:58:24 +01:00
Brendan Coles
fb5ea8a212 WindowServer+LibGfx: Add Gfx::StandardCursor::Hidden cursor 2020-11-02 20:58:07 +01:00
Brendan Coles
328915a279 ChessEngine: Use pledge and unveil 2020-11-02 13:16:09 +01:00
Brendan Coles
9f8a8e07c2 Games: Use pledge and unveil 2020-11-02 13:16:01 +01:00
Brendan Coles
9faca895d3 Demos: Use pledge and unveil 2020-11-02 13:15:54 +01:00
Brendan Coles
e8ff7c895b Applications: Use GUI::CommonActions for save and save as menu options 2020-11-02 13:14:58 +01:00
Linus Groh
9e80c67608 LibJS: Fix "use strict" directive false positives
By having the "is this a use strict directive?" logic in
parse_string_literal() we would apply it to *any* string literal, which
is incorrect and would lead to false positives - e.g.:

    "use strict" + 1
    `"use strict"`
    "\123"; ({"use strict": ...})

Relevant part from the spec which is now implemented properly:

[...] and where each ExpressionStatement in the sequence consists
entirely of a StringLiteral token [...]

I also got rid of UseStrictDirectiveState which is not needed anymore.

Fixes #3903.
2020-11-02 13:13:54 +01:00
Linus Groh
21912123c4 Travis: Update host GCC to version 10
This allows us to use the latest C++20 features in programs which we
compile and run as part of Lagom.
2020-11-02 13:12:35 +01:00
Brendan Coles
88307fcb59 ls: Add colored output for set-gid files 2020-11-02 13:09:17 +01:00
Andreas Kling
5e164052f6 AK+Kernel: Escape JSON keys & values
Grab the escaping logic from JSON string value serialization and use
it for serializing all keys and values.

Fixes #3917.
2020-11-02 12:56:36 +01:00
Andreas Kling
ee21a724c7 LibGfx: Add some more assertions to Gfx::Bitmap
Let's also be paranoid about get_pixel() since we started worrying
about set_pixel(). :^)
2020-11-02 11:01:00 +01:00
Peter Nelson
23c4f1a3d4 LibGfx: assert Bitmap::set_pixel does not write out of bounds 2020-11-01 20:13:25 +01:00
Peter Nelson
5567408bab LibGfx: add bounds checking before set_pixel call in GIF decoder
This fixes a crash when a GIF frame extends beyond the limits of the
logical screen, causing writes past the end of the frame buffer
2020-11-01 20:13:25 +01:00
Andreas Kling
a28f29c82c Kernel+LibC: Don't allow a directory to become a subdirectory of itself
If you try to do this (e.g "mv directory directory"), sys$rename() will
now fail with EDIRINTOSELF.

Dr. POSIX says we should return EINVAL for this, but a custom error
code allows us to print a much more helpful error message when this
problem occurs. :^)
2020-11-01 19:21:19 +01:00
Tom
13aa3d2d62 Kernel: Flush TLB when quick-mapping PD/PT that was mapped on other CPU
If a PD/PT was quick-mapped by another CPU we still need to flush the
TLB on the current CPU.

Fixes #3885
2020-11-01 18:48:36 +01:00
Kesse Jones
8c4a2c34d3 HackStudio: Fixed opening the project by always opening the main.cpp file
Now when opening the project a search will be made for
a file with the extension cpp or js and opening it.
If not found, the first file will be opened.
2020-11-01 18:47:43 +01:00
Tom
656ffe36f2 Kernel: kmalloc_eternal should align pointers 2020-11-01 18:47:01 +01:00
AnotherTest
1aed61964a Shell: Do not leak the value of ARGV in nested function calls 2020-11-01 18:45:05 +01:00
AnotherTest
e87e580eb3 Shell: Search for variables in the last frame first
Otherwise, we'll end up overwriting another frame's variables if the
names match up.
2020-11-01 18:45:05 +01:00
AnotherTest
bedad383b5 Shell: Store LocalFrames as NonnullOwnPtr<LocalFrame> instead
As Vector<T> will relocate objects to resize, we cannot assume that the
address of a specific LocalFrame will stay constant, or that the
reference will not be dangling to begin with.
Fixes an assertion that fires when a frame push causes the Vector to
reallocate.
2020-11-01 18:45:05 +01:00
Andreas Kling
a7f4f6afc3 LibGUI: Allow dragging a previously unselected item with a single click
Views would previously require that an item be selected before it could
be dragged. This patch makes us consider initiating a drag immediately
after the view has been selected, without requiring a mouseup event in
between.
2020-11-01 15:42:09 +01:00
Andreas Kling
844c5709ac LibGUI: Views should ignore double clicks that don't hit any index 2020-11-01 15:31:18 +01:00
Andreas Kling
e499b0f161 LibGUI: Invalidate view cursor on model update
This is sad (since it would be nice to preserve the cursor+selection)
but until we implement persistent model indexes, this at least prevents
us from keeping a stale cursor index.
2020-11-01 10:39:37 +01:00
Brendan Coles
90a30f694d SoundPlayer: Optionally allow playback to loop indefinitely 2020-11-01 10:33:57 +01:00
Brendan Coles
75dec15b43 LaunchServer: Add sheets=/bin/Spreadsheet file association to config 2020-11-01 10:33:20 +01:00
JetStarBlues
e5fc0f940c
Chess: Add the 'moderna' piece set (#3896) 2020-11-01 10:31:00 +01:00
Tom
7a4fb5deef Kernel: Don't remap IOAPIC registers every time we try to read/write
Remapping these registers every time we try to read from or write to
them causes a lot of SMP broadcasts and a lot of other overhead.
This improves boot time noticeably.
2020-11-01 10:30:20 +01:00
Brendan Coles
c1bfb8cb0e Meta: lint-shell-scripts: Exit if shellcheck is not installed 2020-11-01 10:29:33 +01:00
Brendan Coles
7c5e488de2 Games: Use GUI::Icon::default_icon to set application icon 2020-11-01 10:29:27 +01:00
Brendan Coles
27ead7e2c2 Demos: Use GUI::Icon::default_icon to set application icon 2020-11-01 10:29:14 +01:00
Brendan Coles
3482b9b937 LibWeb: Enforce Same-Origin Policy (SOP) for XMLHttpRequest requests
`DOM::XMLHttpRequest` now checks if the requested URL has the same
`Origin` as the requesting `Document`. If the requested URL is in
violation of SOP the request is rejected and an "error" `DOM::Event`
is dispatched.
2020-11-01 10:23:08 +01:00
Liav A
4007ba5137 Kernel: Reduce code duplication in the PCI IO access read helpers
We just call the early helpers as they do the same thing like the IO
access helpers.
2020-11-01 10:19:17 +01:00
Liav A
6131048a5f Kernel: Map PCI devices only once during boot
Instead of mapping a 4KB region to access device configuration space
each time we call one of the PCI helpers, just map them once during
the boot process.
Then, if we request to access one of those devices, we can ask the
PCI subsystem to give us the virtual address where the device's
configuration space is mapped.
2020-11-01 10:19:17 +01:00
Linus Groh
0aeef47abd LibMarkdown: Use JS::MarkupGenerator for "js" code blocks :^) 2020-10-31 20:52:54 +01:00
Linus Groh
10c19d5207 LibMarkdown: Replace inline styles in HTML with CSS in <head> 2020-10-31 20:52:54 +01:00
Linus Groh
e5ec4d35ea LibWeb: Don't use 'font-weight: lighter' for Csilla in Default.css
Base/res/fonts/CsillaThin7x10.font was renamed to
Base/res/fonts/CsillaRegular10.font in 5abc03d, breaking the default
styles of <code> and <pre>.
The font lookup should still find a font variant when a non-existent
weight is specified, but that's another issue for another day.
2020-10-31 20:52:54 +01:00
Linus Groh
d2a2d19a86 LibJS: Handle multi-line source code in MarkupGenerator
The previous approach (keeping track of the current source position
manually) was only working for single line sources (which is fair
considering this was developed for Browser's JS console).
The new approach is much simpler: append token trivia (all whitespace
and comments since the last token), then append styled token value.
2020-10-31 20:52:54 +01:00
Andreas Kling
39c9319b6d Terminal: Run clang-format 2020-10-31 19:54:23 +01:00