summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Bindings
AgeCommit message (Collapse)Author
2021-04-25LibWeb: Add WebSocket bindingsDexesTTP
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.
2021-04-24LibJS+LibWeb: Move exception logging and remove should_log_exceptionsLinus Groh
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.
2021-04-23LibWeb: Don't assume name is string in HTMLCollectionWrapper::get()Andreas Kling
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.
2021-04-22LibWeb+HackStudio: Use lukew@serenityos.org for my copyright headersLuke
2021-04-22LibWeb: Implement a slow but functional HTMLCollection :^)Andreas Kling
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.
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
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 *
2021-04-13LibWeb: Actually return an empty value when an exception is thrown viaAnotherTest
throw_dom_exception_if_needed() Fixes #6298.
2021-04-13LibWeb: Make ExceptionOr work with non-JS::Value typesAnotherTest
Fixes #6075.
2021-04-12LibJS: Make Errors fully spec compliantLinus Groh
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.
2021-04-12LibWeb: Add Window.parent and fix Window.top attributesLuke
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.
2021-04-10AK+Everywhere: Make StdLibExtras templates less wrapper-yAnotherTest
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. :^)
2021-04-07LibWeb: Implement window.topAndreas Kling
This simply returns the main frame's window object. If accessed inside the main frame, it will return itself.
2021-04-06LibWeb: Add ProcessingInstruction nodeLuke
Not particuarly useful right now, but is used in ensure_pre_insertion_validity. I'm not totally sure on the constructor arguments.
2021-04-04LibWeb: Remove document_setter from Window.documentLuke
It is readonly: https://html.spec.whatwg.org/multipage/window-object.html#the-window-object:dom-document-2
2021-04-04LibWeb: Implement the Screen interfaceLinus Groh
https://drafts.csswg.org/cssom-view/#the-screen-interface
2021-04-03LibWeb: Set Constructor.name and Prototype.constructor of generated interfacesLinus Groh
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 :^)
2021-03-21LibWeb: Add legacy Image factory functionLuke
2021-03-17LibJS: Rename GlobalObject::initialize() => initialize_global_object()Andreas Kling
This function was shadowing Object::initialize() which cannot be called on global objects and has a different set of parameters.
2021-03-16LibWeb: Invalidate element style after setting Element.style.fooAndreas Kling
This makes us recompute style for the element so the change actually takes effect. :^)
2021-03-16LibWeb: Add Window.innerWidth and Window.innerHeightAndreas Kling
2021-03-15LibWeb: Support named CSS properties on CSSStyleDeclaration wrapperAndreas Kling
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. :^)
2021-03-09LibWeb: Expose new CSS interfaces on the window objectLuke
2021-02-23Everywhere: Rename ASSERT => VERIFYAndreas Kling
(...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.
2021-02-20LibWeb: Move ExceptionOr bindings utils into own headerLinus Groh
2021-02-20LibWeb: Implement Window.prompt()Linus Groh
2021-02-20LibWeb: Add DOM::DOMException class and bindingsLinus Groh
2021-02-10LibWeb: Remove a whole bunch of unnecessary #includesAndreas Kling
2021-02-03LibWeb: Move main thread JavaScript VM to its own fileAndreas Kling
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().
2021-01-23LibWeb: Add XHREventTarget and ProgressEvent constructors to WindowLuke
2021-01-23LibWeb: Remove Range constructor/prototype caches from WindowObjectAndreas Kling
These are constructed on the code generator path now instead.
2021-01-23LibWeb: Generate JS bindings for Range from IDL :^)Andreas Kling
2021-01-23LibWeb: Generate JS bindings for XMLHttpRequest from IDL :^)Andreas Kling
Remove the hand-written XHR bindings in favor of generated ones.
2021-01-23LibWeb: Move XMLHttpRequest to separate XHR directoryAndreas Kling
In keeping with the one-directory-per-web-spec layout, let's move XHR into its own clubhouse.
2021-01-18LibWeb: Stub out the PerformanceTiming object from Navigation TimingAndreas Kling
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.
2021-01-18LibWeb: Add support for XMLHttpRequest request headersAndreas Kling
Implement XMLHttpRequest.setRequestHeader() and include the headers in the outgoing HTTP request.
2021-01-18LibWeb: Make the Window object "inherit" from EventTarget :^)Andreas Kling
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.
2021-01-18LibWeb: Move IDL attributes and functions to the prototypeAndreas Kling
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
2021-01-18LibWeb: Construct the IDL interface prototype chains automaticallyAndreas Kling
Have each IDL prototype trigger the construction of its own prototype.
2021-01-18LibWeb: Actually instantiate all the web constructors/prototypesAndreas Kling
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. :^)
2021-01-12Libraries: Move to Userland/Libraries/Andreas Kling