Commit graph

7827 commits

Author SHA1 Message Date
Andreas Kling 0d2fb306af LibJS: Check for exceptions in a lot more places 2020-03-27 15:36:00 +01:00
Emanuel Sprung c9059c12dc Browser: Let the user add/remove bookmarks to the bookmarks bar
This patchset adds a Button to the toolbar (right next to the location field)
with a star icon. The star is white if the currently visited url is not yet
bookmarked and yellow if a bookmark for the url exists.

After adding or removing a bookmark, the bookmark json file is synced to disk.
Therefore, some new pledge/unveil's have been added.
2020-03-27 14:12:18 +01:00
Emanuel Sprung 4d50398f02 LibGUI: Add store(), add() and remove() methods to JsonArrayModel
This patchset adds the methods to alter an JSON model and store it back
to the disk.
2020-03-27 14:12:18 +01:00
Emanuel Sprung 337ade9e4c Browser: Add bookmarks bar
This patchset adds a bookmark bar that is backed by a json file backend.
The json file is loaded and checked for the format. According to the
format, the bookmarks bar is populated with the bookmark items.

If the bookmarks do not fit into one line, an expader button is shown
that brings up a menu containing the missing bookmark items.

There is currently no way to add or remove bookmarks. A hover over a
bookmark is also not yet showing the url in the statusbar.
2020-03-27 14:12:18 +01:00
Emanuel Sprung a9e943ae4c Browser: Add empty, toogleable bookmarks bar 2020-03-27 14:12:18 +01:00
Andreas Kling 6a5cd32205 LibJS: The global isNaN() should coerce to number before testing NaN
For stricter NaN checking, we'll have to implement Number.isNaN().
2020-03-27 12:59:41 +01:00
Andreas Kling c60dc84a33 LibJS: Allow function calls with missing arguments
We were interpreting "undefined" as a variable lookup failure in some
cases and throwing a ReferenceError exception instead of treating it
as the valid value "undefined".

This patch wraps the result of variable lookup in Optional<>, which
allows us to only throw ReferenceError when lookup actually fails.
2020-03-27 12:56:05 +01:00
Andreas Kling 04ced9e24a LibJS: Add global isNaN() function 2020-03-27 12:45:36 +01:00
Andreas Kling 9a78b4af2c LibJS: Basic NaN support
This patch adds js_nan() for constructing a NaN value. You can check
if a Value is NaN with Value::is_nan().
2020-03-27 12:40:22 +01:00
Andreas Kling 23c5323a70 js: Publish the global object as "global" 2020-03-27 12:24:58 +01:00
Andreas Kling 9494865f99 LibJS: Actually pop frames off of the scope stack when exiting a scope 2020-03-27 11:34:58 +01:00
Andreas Kling d52c5a94b4 IRCClient: Use the IRCClient app icon in notifications :^) 2020-03-26 20:39:36 +01:00
Andreas Kling faedb763ca NotificationServer: Allow showing an icon in notifications
We currently use icon paths for this because I didn't want to deal with
implementing icon bitmap sharing right now. In the future it would be
better to post a bitmap somehow instead of a path.
2020-03-26 20:38:28 +01:00
Andreas Kling 3c29818048 IRCClient: Only notify about channel messages containing our nickname 2020-03-26 20:18:22 +01:00
Andreas Kling 163812df97 IRCClient: Post desktop notifications when messaged while inactive
If you receive a channel or query message while the app is inactive,
or while the channel/query is inactive, we now post a desktop
notification so you can learn that something is happening. :^)
2020-03-26 20:11:23 +01:00
Andreas Kling 96c7e2cd6d LibGUI: Make a new connection to NotificationServer each time
Since NotificationServer is a spawn-on-demand + die-when-not-used type
of service, we can't expect a singleton connection to it to remain open
and useful.

We solve this for now by making a new IPC connection for every new
notification sent. Maybe there's a better solution for this.
2020-03-26 20:10:03 +01:00
Andreas Kling bc7a9097a7 js: Tweak pretty-printing of functions and null 2020-03-26 14:54:43 +01:00
Andreas Kling 97d3809a17 js: Fix build on Linux
Apparently ESUCCESS is not a thing on my host machine.
2020-03-26 14:46:00 +01:00
Andreas Kling 4802413f71 LibJS: Say "return {}" instead of "return js_undefined()" in AST nodes
This looks a bit nicer somehow.
2020-03-26 12:36:52 +01:00
Andreas Kling ad6ede7ee4 LibJS: Make FunctionDeclaration return undefined
FunctionExpression returns a JS::Function, while FunctionDeclaration
declares one in the relevant scope.
2020-03-26 12:27:15 +01:00
Andreas Kling 6e6495fdf9 js: Implement some modest pretty-printing of values 2020-03-26 12:26:11 +01:00
Andreas Kling 68dec2801d LibJS: Add Object::own_properties() convenience accessor 2020-03-26 12:19:01 +01:00
Andreas Kling d7073b9f3e LibJS: Add Value::is_array() 2020-03-26 12:02:18 +01:00
Andreas Kling f3c245fb96 Kernel: Make ^W and ^U actually erase characters
This is quite hackish but it makes using the js REPL a lot nicer. :^)
2020-03-26 08:18:47 +01:00
Sergey Bugaev 5ba8247cbb LibC: Fix getline() forgetting to null-terminate on EOF 2020-03-26 08:18:08 +01:00
Sergey Bugaev db4da68618 Base: Add a man page for js(1)
This also changes --ast-dump to --dump-ast, because I like it better
and that is what the variable is actually called.
2020-03-26 08:18:08 +01:00
Sergey Bugaev ccdfb077d8 Userland: Implement JS REPL
If you invoke `js` without a script path, it will now enter REPL mode,
where you input commands one by one and immediately get each one
interpreted in one shared interpreter. We support multi-line commands
in case we detect you have unclosed braces or parens or brackets.
2020-03-26 08:01:45 +01:00
Sergey Bugaev 5bb18bf548 AK: Use print_string() for %c formatting
Instead of simply outputting the character. This way, we get proper padding
support and other niceties strings enjoy.
2020-03-26 08:01:16 +01:00
Elisée Maurer d01b97b50a
Base: Replace <!DOCTYPE> with <!DOCTYPE html> in a few files (#1511)
<!DOCTYPE> by itself is not a valid document type declaration.
2020-03-26 07:37:12 +01:00
Andreas Kling 68b04d5c78 LibWeb: Implement getting and setting element.innerHTML
Getting the innerHTML property will recurse through the subtree inside
the element and serialize it into a string as it goes.

Setting it will parse the set value as an HTML fragment. It will then
remove all current children of the element and replace them with all
the children inside the parsed fragment.

Setting element.innerHTML will currently force a complete rebuild of
the document's layout tree.

This is pretty neat! :^)
2020-03-25 18:53:20 +01:00
Andreas Kling 632cc53e2c LibWeb: Add ParentNode::remove_all_children()
This safely removes all children from a Node.
2020-03-25 18:52:03 +01:00
Andreas Kling 1146ab0fae LibWeb: Add Document::invalidate_layout()
This function allows you to throw away the entire layout tree if that's
something you want to do.

It's certainly not super cheap to reconstruct, but hey, who am I to
tell you what to do? :^)
2020-03-25 18:51:04 +01:00
Andreas Kling 90a53b3520 LibWeb: Commit uncommitted text at the end of HTML parse
If there's any text left in the parse buffer at the end of HTML parsing
we now commit it as a Text node.
2020-03-25 18:50:10 +01:00
Andreas Kling 5b87043221 LibWeb: Make dump_tree() look okay for DocumentFragments 2020-03-25 18:49:29 +01:00
Andreas Kling a32f3b29a3 LibWeb: Detach any LayoutNode from its parent if present in ~Node() 2020-03-25 18:48:32 +01:00
Andreas Kling 3ad1e7d6b7 LibWeb: Node::is_parent_node() should return true for DocumentFragments 2020-03-25 18:48:10 +01:00
Andreas Kling faa3bf195a Meta: Ignore the LibJS test runner script when linting
Making this work in the absence of bash is more cumbersome than simply
skipping it at the moment.
2020-03-25 16:30:58 +01:00
Alex Muscar fefc2665d6
WindowServer: Don't ignore mouse events after showing modal window (#1495)
Fixes #1464
2020-03-25 16:26:33 +01:00
redoste 30649ed93f Keymap: Add FR keymap layout
This adds the standard French "AZERTY" keyboard layout. Some keys are unmapped
because some characters are not supported : ²éèçà°€¨£¤ùµ§
2020-03-25 16:24:38 +01:00
Andreas Kling fac6f62cf7 Build: Oops, LibJS tests were meant to go in /home/anon/js-tests 2020-03-25 16:16:04 +01:00
Andreas Kling 6c9d2cfa5e LibJS: Handle "for" statements with empty initializer and updater 2020-03-25 16:14:51 +01:00
Andreas Kling 30d24af54a LibJS: Add a basic test for the "throw" keyword 2020-03-25 16:09:23 +01:00
Andreas Kling 9e8d3d6287 LibJS: Rename some tests
"feature-basic" is a bit more logical than having a ton of
"basic-feature" (when it comes to the visual overview of it all.)
2020-03-25 15:57:18 +01:00
Andreas Kling f5418f40cc Ports/bash: Make a /bin/bash symlink to /usr/local/bin/bash
I've added a post_install step to the system that allows you to run
arbitrary commands after the regular install step.

This allows scripts that start with "#!/bin/bash" to work in Serenity.
2020-03-25 15:55:28 +01:00
Andreas Kling 202055a72a Build: Copy LibJS/Tests into /home/anon/js-tests
The test runner currently depends on the bash port being installed.
If you have it, you can run the LibJS test suite inside Serenity
by simply entering /home/anon/js-tests and doing ./run-tests :^)
2020-03-25 15:53:47 +01:00
Andreas Kling 78923d986e LibJS: Tweak run-tests output a bit 2020-03-25 15:52:17 +01:00
Andreas Kling efbcdd6d34 uname: Remove trailing space character 2020-03-25 15:48:35 +01:00
Andreas Kling 45488401b1 LibJS: Add a very basic test runner (shell script) + some tests 2020-03-25 15:32:17 +01:00
Andreas Kling a94a150df0 LibJS: Remove unnecessary space character at the end of console.log() 2020-03-25 14:08:47 +01:00
Andreas Kling 05311782d7 LibWeb: Remove debug spam about getting a 2D canvas context 2020-03-25 09:54:46 +01:00