Truly independent web browser
Find a file
Emanuele Torre be1a5bf3f7 LibJS: Add ConsoleMessage concept
A ConsoleMessage is a struct cointaining:
 * AK::String text;         represents the text of the message sent
                             to the console.
 * ConsoleMessageKind kind; represents the kind of JS `console` function
                             from which the message was sent.

Now, Javascript `console` functions only send a ConsoleMessage to the
Interpreter's Console instead of printing text directly to stdout.
The Console then stores the recived ConsoleMessage in
Console::m_messages; the Console does not print to stdout by default.

You can set Console::on_new_message to a void(ConsoleMessage&); this
function will get call everytime a new message is added to the Console's
messages and can be used, for example, to print ConsoleMessages to
stdout or to color the output based on the kind of ConsoleMessage.

In this patch, I also:
  * Re-implement all the previously implemented functions in the
     JavaScript ConsoleObject, as wrappers around Console functions
     that add new message to the Console.
  * Implement console.clear() like so:
    - m_messages get cleared;
    - a new_message with kind set ConsoleMessageKind::Clear gets added
       to m_messages, its text is an empty AK::String;
  * Give credit to linusg in Console.cpp since I used his
     console.trace() algorithm in Console::trace().

I think that having this abstration will help us in the implementation
of a browser console or a JS debugger. We could also add more MetaData
to ConsoleMessage, e.g. Object IDs of the arguments passed to console
functions in order to make hyperlinks, Timestamps, ecc.; which could be
interesting to see.

This will also help in implementing a `/bin/js` option to make, for
example, return a ConsoleMessageWrapper to console functions instead of
undefined. This will be useful to make tests for functions like
console.count() and console.countClear(). :^)
2020-05-02 11:41:35 +02:00
.github Meta: Add GitHub Sponsors to funding options 2019-11-02 23:32:34 +01:00
AK AK: Make Checked.h work with Clang 2020-05-01 17:30:47 +02:00
Applications Applications: TextEditor INI file syntax highlighter 2020-05-01 16:58:18 +02:00
Base Base: Tweak MessageBox icons a tiny bit 2020-05-02 01:29:55 +02:00
Demos Screensaver: Draw screen before first timer iteration and seed srand() 2020-04-28 09:36:28 +02:00
DevTools IPCCompiler: Add support for Vector<i32> 2020-05-02 01:29:55 +02:00
Documentation Documentation: Add section about structs vs. classes to CodingStyle.md 2020-04-18 11:14:05 +02:00
Games LibGUI: Make it easier to create checkable GUI::Actions 2020-04-21 17:21:28 +02:00
Kernel AK: Add ALWAYS_INLINE, NEVER_INLINE and FLATTEN macros 2020-04-30 11:43:25 +02:00
Libraries LibJS: Add ConsoleMessage concept 2020-05-02 11:41:35 +02:00
MenuApplets MenuApplets: Support memory usage and custom colors in ResourceGraph 2020-04-11 10:03:12 +02:00
Meta Meta: Build Lagom js and run LibJS tests on Travis 2020-04-20 22:44:13 +02:00
Ports Ports: Add neofetch 2020-04-28 10:18:58 +02:00
Servers WindowServer+LibGUI: Automatically close child windows with parent 2020-05-02 01:29:55 +02:00
Shell Shell: Provide the correct invariant length to the line editor 2020-04-30 10:47:22 +02:00
Tests Tests: Add test case for pthread_cond_timedwait with a timeout. 2020-04-26 21:31:52 +02:00
Toolchain Toolchain: Don't create repository for patches if not necessary 2020-04-27 17:59:33 +02:00
Userland LibJS: Implement (no-op) debugger statement 2020-05-01 22:07:13 +02:00
.clang-format Meta: Update .clang-format to not indent nested namespaces 2020-03-14 10:10:21 +01:00
.gitignore Meta: Add Lagom CMake dir to .gitignore 2020-04-13 23:15:05 +02:00
.travis.yml Meta: Build Lagom js and run LibJS tests on Travis 2020-04-20 22:44:13 +02:00
CODE_OF_CONDUCT.md Meta: Move code of conduct (lol) to a separate file 2019-10-23 10:05:06 +02:00
CONTRIBUTING.md Meta: Add feature policy to contribution guidelines 2020-03-28 10:57:09 +01:00
INSTALL.md Meta: Update link to build instructions in INSTALL.md 2020-01-01 17:33:32 +01:00
LICENSE Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
Makefile Build: Use ccache if it's available (#1315) 2020-02-27 11:44:29 +01:00
Makefile.common Build: Use the GCC port if building on "SerenityOS" :^) 2020-04-20 19:52:35 +02:00
Makefile.subdir Build: wrap make invocations with flock(1) 2019-12-28 21:09:33 +01:00
ReadMe.md Meta: Add supercomputer7 to contributor list in ReadMe 2020-04-10 14:06:29 +02:00

SerenityOS

Graphical Unix-like operating system for x86 computers.

Travis CI status

About

SerenityOS is a love letter to '90s user interfaces with a custom Unix-like core. It flatters with sincerity by stealing beautiful ideas from various other systems.

Roughly speaking, the goal is a marriage between the aesthetic of late-1990s productivity software and the power-user accessibility of late-2000s *nix. This is a system by us, for us, based on the things we like.

I (Andreas) regularly post raw hacking sessions and demos on my YouTube channel.

Sometimes I write about the system on my github.io blog.

I'm also on Patreon and GitHub Sponsors if you would like to show some support that way.

Screenshot

Screenshot as of 1133aca

Kernel features

  • x86 (32-bit) kernel with pre-emptive multi-threading
  • Hardware protections (SMEP, SMAP, UMIP, NX, WP, TSD, ...)
  • IPv4 stack with ARP, TCP, UDP and ICMP protocols
  • ext2 filesystem
  • POSIX signals
  • Purgeable memory
  • /proc filesystem
  • Pseudoterminals (with /dev/pts filesystem)
  • Filesystem notifications
  • CPU and memory profiling
  • SoundBlaster 16 driver
  • VMWare/QEMU mouse integration

System services

  • Launch/session daemon (SystemServer)
  • Compositing window server (WindowServer)
  • Text console manager (TTYServer)
  • DNS client (LookupServer)
  • Network protocols server (ProtocolServer)
  • Software-mixing sound daemon (AudioServer)
  • Desktop notifications (NotificationServer)
  • HTTP server (WebServer)
  • Telnet server (TelnetServer)

Libraries

  • C++ templates and containers (AK)
  • Event loop and utilities (LibCore)
  • 2D graphics library (LibGfx)
  • GUI toolkit (LibGUI)
  • Cross-process communication library (LibIPC)
  • HTML/CSS engine (LibWeb)
  • JavaScript engine (LibJS)
  • Markdown (LibMarkdown)
  • Audio (LibAudio)
  • PCI database (LibPCIDB)
  • Terminal emulation (LibVT)
  • Network protocols (HTTP) (LibProtocol)
  • Mathematical functions (LibM)
  • ELF file handing (LibELF)
  • POSIX threading (LibPthread)
  • Higher-level threading (LibThread)

Userland features

  • Unix-like libc and userland
  • Shell with pipes and I/O redirection
  • On-line help system (both terminal and GUI variants)
  • Web browser (Browser)
  • C++ IDE (HackStudio)
  • IRC client
  • Desktop synthesizer (Piano)
  • Various desktop apps & games
  • Color themes

How do I build and run this?

See the SerenityOS build instructions

Wanna chat?

Come hang out with us in #serenityos on the Freenode IRC network.

Author

Contributors

(And many more!) Feel free to append yourself here if you've made some sweet contributions. :)

License

SerenityOS is licensed under a 2-clause BSD license.