When we encounter a '<' during HTML parsing, we now look ahead to see
if there is a full </script> coming, otherwise we treat it as text.
This makes it possible to use '<' in inline scripts. :^)
StartDownload requests for unhandled protocols (or invalid URLs) will
now refuse to load instead of asserting. A failure code is sent back
to LibProtocol and Protocol::Client::start_download() returns nullptr.
Fixes#1604.
This allows us to construct menus in a more natural way:
auto& file_menu = menubar->add_menu("File");
file_menu.add_action(...);
Instead of the old way:
auto file_menu = GUI::Menu::construct();
file_menu->add_action(...);
menubar->add_menu(file_menu);
This patch relaxes how we think about UDP packets being "for us" a bit;
the proper way to handle this would be to also check if the matched
socket has SO_BROADCAST set, but we don't have that :)
Calling save("file") in a repl saves all the typed lines so far
into the specified file. It currently does not have great support for
multilined functions since those get turned into one line.
Scripts loaded in this way will block the parser until they finish
executing. This means that they see the DOM before the whole document
has been fully parsed. This is all normal, of course.
To make this work, I changed the way we notify DOM nodes about tree
insertion. The inserted_into() callbacks are now incrementally invoked
during parse, as each node is appended to its parent.
To accomodate inline scripts and inline style sheets, we now also have
a children_changed() callback which is invoked on any parent when it
has children added/removed.
This function creates a nested event loop and runs a load() operation
inside it, returning only once the load has either succeeded or failed.
This will be used to implement blocking loads (ew!)
The event that triggered the exit from an inner event loop would always
get re-delivered in the outer event loop due to a silly off-by-one
mistake when transferring pending events between loops.
The Help application was hooking HtmlView::on_link_click, which would
get invoked before DOM event dispatch. Since we were holding on to the
clicked node with a Node*, the DOM node was gone after returning from
the on_link_click callback.
Fix this by keeping DOM nodes in RefPtrs in the event management code.
Also move DOM event dispatch before widget hook invocation, to try and
keep things sane on the LibWeb side of things.
Fixes#1605.
The Lexer and AST already have all the functionality required in place,
so this is just updating Parser::match_secondary_expression() and
Parser::parse_expression() to handle TokenType::{Ampersand,Pipe,Caret},
as well as adding some tests.
Since ByteBuffer is a Buffer, it should allow us to overwrite parts of
it that we have allocated.
This comes in useful in handling unsequenced writes like handling
fragmented ip packets :^)
With relative filenames in the executable code, the executable is basically not
relocatable. This makes out-of-source builds unneccesery hard. This patchset moves
the relative link into the filesystem: that can be handled much easier :^)
There is no such thing as a "undefined literal" in JS - undefined is
just a property on the global object with a value of undefined.
This is pretty similar to NaN.
var undefined = "foo"; is a perfectly fine AssignmentExpression :^)