summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Bindings
AgeCommit message (Collapse)Author
2021-07-11LibWeb: Add context to new CSS parser, and deprecate the old oneSam Atkins
The new one is the same as the old one, just in the new Parser's source files. This isn't the most elegant solution but it seemed like the best option. And it's all temporary, after all.
2021-07-06LibJS: Remove the default length & attributes from define_native_*Idan Horowitz
These are usually incorrect, and people sometimes forget to add the correct values as a result of them being optional, so they should just be specified explicitly.
2021-07-06LibJS: Add define_direct_property and remove the define_property helperIdan Horowitz
This removes all usages of the non-standard define_property helper method and replaces all it's usages with the specification required alternative or with define_direct_property where appropriate.
2021-07-05LibWeb: Replace usage of native properties with accessors in WindowIdan Horowitz
This is required by the WebIDL specification.
2021-07-05LibWeb: Replace usage of native properties with accessors in NavigatorIdan Horowitz
This is required by the WebIDL specification.
2021-07-05LibWeb: Replace usage of native properties with accessors in LocationIdan Horowitz
This is required by the WebIDL specification.
2021-07-05LibWeb: Add DOMParserLuke
This allows you to invoke the HTML document parser and retrieve a document as though it was loaded as a web page, minus any scripting ability. This does not currently support XML parsing. This is used by YouTube (or more accurately, Web Components Polyfills) to polyfill templates.
2021-07-04LibJS: Rewrite most of Object for spec compliance :^)Linus Groh
This is a huge patch, I know. In hindsight this perhaps could've been done slightly more incremental, but I started and then fixed everything until it worked, and here we are. I tried splitting of some completely unrelated changes into separate commits, however. Anyway. This is a rewrite of most of Object, and by extension large parts of Array, Proxy, Reflect, String, TypedArray, and some other things. What we already had worked fine for about 90% of things, but getting the last 10% right proved to be increasingly difficult with the current code that sort of grew organically and is only very loosely based on the spec - this became especially obvious when we started fixing a large number of test262 failures. Key changes include: - 1:1 matching function names and parameters of all object-related functions, to avoid ambiguity. Previously we had things like put(), which the spec doesn't have - as a result it wasn't always clear which need to be used. - Better separation between object abstract operations and internal methods - the former are always the same, the latter can be overridden (and are therefore virtual). The internal methods (i.e. [[Foo]] in the spec) are now prefixed with 'internal_' for clarity - again, it was previously not always clear which AO a certain method represents, get() could've been both Get and [[Get]] (I don't know which one it was closer to right now). Note that some of the old names have been kept until all code relying on them is updated, but they are now simple wrappers around the closest matching standard abstract operation. - Simplifications of the storage layer: functions that write values to storage are now prefixed with 'storage_' to make their purpose clear, and as they are not part of the spec they should not contain any steps specified by it. Much functionality is now covered by the layers above it and was removed (e.g. handling of accessors, attribute checks). - PropertyAttributes has been greatly simplified, and is being replaced by PropertyDescriptor - a concept similar to the current implementation, but more aligned with the actual spec. See the commit message of the previous commit where it was introduced for details. - As a bonus, and since I had to look at the spec a whole lot anyway, I introduced more inline comments with the exact steps from the spec - this makes it super easy to verify correctness. - East-const all the things. As a result of all of this, things are much more correct but a bit slower now. Retaining speed wasn't a consideration at all, I have done no profiling of the new code - there might be low hanging fruits, which we can then harvest separately. Special thanks to Idan for helping me with this by tracking down bugs, updating everything outside of LibJS to work with these changes (LibWeb, Spreadsheet, HackStudio), as well as providing countless patches to fix regressions I introduced - there still are very few (we got it down to 5), but we also get many new passing test262 tests in return. :^) Co-authored-by: Idan Horowitz <idan.horowitz@gmail.com>
2021-07-04LibJS: Bring ArrayCreate and ArrayConstructor closer to specIdan Horowitz
Specifically, this now explicitly takes the length, adds missing exceptions checks to calls with user-supplied lengths, takes and uses the prototype argument, and fixes some spec non-conformance in ArrayConstructor and its native functions around the use of ArrayCreate
2021-06-27LibJS: Rename Function => FunctionObjectAndreas Kling
2021-06-27LibWeb: Make ExceptionOr capable of holding all error types in the specAli Mohammad Pur
The WebIDL spec specifies a few "simple" exception types in addition to the DOMException type, let's support all of those. This allows functions returning ExceptionOr<T> to throw regular javascript exceptions (as limited by the webidl spec) by returning a `DOM::SimpleException { DOM::SimpleExceptionType::T, "error message" }` which is pretty damn cool :^)
2021-06-24AK: Rename downcast<T> => verify_cast<T>Andreas Kling
This makes it much clearer what this cast actually does: it will VERIFY that the thing we're casting is a T (using is<T>()).
2021-06-17LibJS: Replace boolean without_side_effects parameters with an enumIdan Horowitz
2021-06-16LibJS: Respect Object::get's without_side_effects parameter for numbersIdan Horowitz
2021-06-09LibJS: Add the Set built-in objectIdan Horowitz
2021-05-31LibWeb: Return null in Window.{top,parent} if browsing context is nullLuke
We were asserting that it exists, but the spec says to return null in this case. Top: https://html.spec.whatwg.org/multipage/browsers.html#dom-top Parent: https://html.spec.whatwg.org/multipage/browsers.html#dom-parent
2021-05-30LibWeb: Rename Web::Frame to Web::BrowsingContextAndreas Kling
Our "frame" concept very closely matches what the web specs call a "browsing context", so let's rename it to that. :^) The "main frame" becomes the "top-level browsing context", and "sub-frames" are now "nested browsing contexts".
2021-05-26LibWeb: Implement a very basic WebAssembly JS APIAli Mohammad Pur
This impl is *extremely* simple, and is missing a lot of things, it's also not particularly spec-compliant in some places, but it's definitely a start :^)
2021-05-07LibWeb: Convert StringBuilder::appendf() => AK::FormatAndreas Kling
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