Age | Commit message (Collapse) | Author |
|
The WebSocket bindings match the original specification from the
WHATWG living standard, but do not match the later update of the
standard that involves FETCH. The FETCH update will be handled later
since the changes would also affect XMLHttpRequest.
|
|
LibWeb is now responsible for logging unhandled exceptions itself,
which means set_should_log_exceptions() is no longer used and can be
removed. It turned out to be not the best option for web page exception
logging, as we would have no indication regarding whether the exception
was later handled of not.
|
|
If the property name is not a string (symbol or integer), we should
just defer to the base class instead of trying to handle it.
Fixes #6575.
|
|
|
|
HTMLCollection is an awkward legacy interface from the DOM spec.
It provides a live view of a DOM subtree, with some kind of filtering
that determines which elements are part of the collection.
We now return HTMLCollection objects from these APIs:
- getElementsByClassName()
- getElementsByName()
- getElementsByTagName()
This initial implementation does not do any kind of caching, since that
is quite a tricky problem, and there will be plenty of time for tricky
problems later on when the engine is more mature.
|
|
SPDX License Identifiers are a more compact / standardized
way of representing file license information.
See: https://spdx.dev/resources/use/#identifiers
This was done with the `ambr` search and replace tool.
ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
|
|
throw_dom_exception_if_needed()
Fixes #6298.
|
|
Fixes #6075.
|
|
The previous handling of the name and message properties specifically
was breaking websites that created their own error types and relied on
the error prototype working correctly - not assuming an JS::Error this
object, that is.
The way it works now, and it is supposed to work, is:
- Error.prototype.name and Error.prototype.message just have initial
string values and are no longer getters/setters
- When constructing an error with a message, we create a regular
property on the newly created object, so a lookup of the message
property will either get it from the object directly or go though the
prototype chain
- Internal m_name/m_message properties are no longer needed and removed
This makes printing errors slightly more complicated, as we can no
longer rely on the (safe) internal properties, and cannot trust a
property lookup either - get_without_side_effects() is used to solve
this, it's not perfect but something we can revisit later.
I did some refactoring along the way, there was some really old stuff in
there - accessing vm.call_frame().arguments[0] is not something we (have
to) do anymore :^)
Fixes #6245.
|
|
This returns the parent frame of the current frame. If it's the
main frame, it returns itself.
Also fixes the attributes of Window.top, as they were accidentally
being passed in as the setter.
Required by Web Platform Tests.
|
|
This commit makes the user-facing StdLibExtras templates and utilities
arguably more nice-looking by removing the need to reach into the
wrapper structs generated by them to get the value/type needed.
The C++ standard library had to invent `_v` and `_t` variants (likely
because of backwards compat), but we don't need to cater to any codebase
except our own, so might as well have good things for free. :^)
|
|
This simply returns the main frame's window object. If accessed inside
the main frame, it will return itself.
|
|
Not particuarly useful right now, but is used in
ensure_pre_insertion_validity.
I'm not totally sure on the constructor arguments.
|
|
It is readonly: https://html.spec.whatwg.org/multipage/window-object.html#the-window-object:dom-document-2
|
|
https://drafts.csswg.org/cssom-view/#the-screen-interface
|
|
Object introspection in the Browser's JS console is still not great, but
this makes it a lot easier to find out the exact type of an object by
checking its 'constructor' property.
It also fixes all the things that rely on these properties being set, of
course :^)
|
|
|
|
This function was shadowing Object::initialize() which cannot be called
on global objects and has a different set of parameters.
|
|
This makes us recompute style for the element so the change actually
takes effect. :^)
|
|
|
|
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. :^)
|
|
|
|
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED)
Since all of these checks are done in release builds as well,
let's rename them to VERIFY to prevent confusion, as everyone is
used to assertions being compiled out in release.
We can introduce a new ASSERT macro that is specifically for debug
checks, but I'm doing this wholesale conversion first since we've
accumulated thousands of these already, and it's not immediately
obvious which ones are suitable for ASSERT.
|
|
|
|
|
|
|
|
|
|
Instead of being a weird little global function in DOM/Document.cpp,
you can now get the main thread JS VM via Bindings::main_thread_vm().
|
|
|
|
These are constructed on the code generator path now instead.
|
|
|
|
Remove the hand-written XHR bindings in favor of generated ones.
|
|
In keeping with the one-directory-per-web-spec layout, let's move XHR
into its own clubhouse.
|
|
Just have all the timing functions return 0 for now.
We can now run the Shynet JS on https://linus.dev/ although the XHR
is rejected by our same-origin policy.
|
|
Implement XMLHttpRequest.setRequestHeader() and include the headers in
the outgoing HTTP request.
|
|
Since Web::Bindings::WindowObject inherits from JS::GlobalObject, it
cannot also inherit from Web::Bindings::EventTargetWrapper.
However, that's not actually necessary. Instead, we simply set the
Window object's prototype to the EventTargetPrototype, and add a little
extra branch in the impl_from() function that turns the JS "this" value
into a DOM::EventTarget*.
With this, you can now call window.addEventListener()! Very cool :^)
Fixes #4758.
|
|
Instead of each IDL interface wrapper having its own set of all the
attributes and functions, they are moved to the prototype. This matches
what we already do in LibJS.
Also, this should be spec compliant with the web as well, though there
may be *some* content out there that expects some things to be directly
on the wrapper since that's how things used to work in major browsers
a long time ago. But let's just not worry about that for now.
More work towards #4789
|
|
Have each IDL prototype trigger the construction of its own prototype.
|
|
We now instantiate all the generated web API constructors and expose
them on the window object. We also set the generated prototypes on
instantiated wrappers.
Also, we should obviously find a way to generate this code. :^)
|
|
|