summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp
AgeCommit message (Collapse)Author
2023-05-12LibWeb: Implement fetching classic scripts using Fetch infrastructureTimothy Flynn
2023-05-12LibWeb: Change the script fetch completion callback to accept any scriptTimothy Flynn
The completion callback currently only accepts a JavaScriptModuleScript. The same callback will need to be used for ClassicScript scripts as well so allow the callback to accept any Script type. The single existing outside caller already stores the result as a Script.
2023-04-07LibWeb: Port {Mouse,UI,Wheel,}Event to new StringKenneth Myhra
This ports MouseEvent, UIEvent, WheelEvent, and Event to new String. They all had a dependency to T::create() in WebDriverConnection::fire_an_event() and therefore had to be ported in the same commit.
2023-04-06LibWeb: Port {HTML,UIEvents,XHR}::EventNames to new StringKenneth Myhra
2023-03-10LibWeb: Implement Range.createContextualFragment()Andreas Kling
2023-03-06LibWeb: Fix a few const-ness issuesMatthew Olsson
2023-02-19LibTextCodec+Everywhere: Port Decoders to new StringsSam Atkins
2023-02-19LibTextCodec+Everywhere: Return Optional<Decoder&> from `decoder_for()`Sam Atkins
2023-02-19LibWeb: Use is_ascii_case_insensitive_match() where the spec says toSam Atkins
2023-02-18LibWeb: Make factory methods of DOM::Event fallibleKenneth Myhra
Because of interdependencies between DOM::Event and UIEvents::MouseEvent to template function fire_an_event() in WebDriverConnection.cpp, the commit: 'LibWeb: Make factory methods of UIEvents::MouseEvent fallible' have been squashed into this commit.
2023-01-29LibJS+Everywhere: Allow Cell::initialize overrides to throw OOM errorsTimothy Flynn
Note that as of this commit, there aren't any such throwers, and the call site in Heap::allocate will drop exceptions on the floor. This commit only serves to change the declaration of the overrides, make sure they return an empty value, and to propagate OOM errors frm their base initialize invocations.
2023-01-10LibWeb: Move setting of Web object prototypes to initialize()Timothy Flynn
This needs to happen before prototype/constructor intitialization can be made lazy. Otherwise, GC could run during the C++ constructor and try to collect the object currently being created.
2022-12-06Everywhere: Rename to_{string => deprecated_string}() where applicableLinus Groh
This will make it easier to support both string types at the same time while we convert code, and tracking down remaining uses. One big exception is Value::to_string() in LibJS, where the name is dictated by the ToString AO.
2022-12-06AK+Everywhere: Rename String to DeprecatedStringLinus Groh
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
2022-11-21LibWeb: Don't implement bogus assertion in prepare-the-script-elementAndreas Kling
The HTML spec is asking us to make a possibly-bogus assertion, so let's disable it for now. Spec bug: https://github.com/whatwg/html/issues/8534
2022-11-21LibWeb: Update HTMLScriptElement prepare and execute to latest HTML specAndreas Kling
The net result is some nice simplification of the prepare algorithm and a bit of initial scaffolding for import maps support.
2022-11-21LibWeb: Rename HTMLScriptElement "non-blocking" to "force async"Andreas Kling
This has been renamed in the spec, so let's do it here too.
2022-10-06LibWeb: Use DOM manipulation task source for <script> src parsing errorsLuke Wilde
See: https://github.com/whatwg/html/commit/5d34cb8 We were already using queue_an_element_task here.
2022-10-06LibWeb: Add support for type module in HTMLScriptElementnetworkException
This patch adds support for script elements with the type attribute set to "module". As a first cut the changes are mainly focused around inline scripts. Co-authored-by: davidot <davidot@serenityos.org>
2022-10-06LibWeb: Implement more close to spec javascript mime type checkingnetworkException
Previously we would simply check the an input string against a list of mime type essences, ignoring that the input might not be a valid mime type or contain parameters. This patch moves the helpers into the MimeSniff namespace and properly parses an input string before comparing the essence.
2022-10-02LibWeb: Replace incorrect uses of String::trim_whitespace()Linus Groh
2022-10-01LibWeb: Cleanup unecessary uses and includes of HTML::WindowAndrew Kaster
The big global refactor left some stragglers behind for atomicity. Clean up the rest, and remove a ton of includes of LibWeb/HTML/Window.h
2022-10-01LibWeb: Remove unecessary dependence on Window from HTML classesAndrew Kaster
These classes only needed Window to get at its realm. Pass a realm directly to construct HTML classes.
2022-09-17LibWeb: Handle JavaScript source code with non-UTF-8 encodingAndreas Kling
When fetching scripts in HTMLScriptElement's "prepare a script" algorithm, we now re-encode the script sources to UTF-8.
2022-09-17LibWeb: Add "scripts to execute in order as soon as possible"Andreas Kling
Previously, we had accidentally conflated this set with the similar-but-distinct "scripts to execute as soon as possible".
2022-09-06LibJS+LibWeb: Make HTML::Script GC-allocatedAndreas Kling
This allows the garbage collector to keep HTML::Script objects alive and fixes a bug where a HTMLScriptElement could get GC'd while its code was executing.
2022-09-06LibWeb: Use cached_web_prototype() as much as possibleAndreas Kling
Unlike ensure_web_prototype<T>(), the cached version doesn't require the prototype type to be fully formed, so we can use it without including the FooPrototype.h header. It's also a bit less verbose. :^)
2022-09-06LibWeb+LibJS: Make the EventTarget hierarchy (incl. DOM) GC-allocatedAndreas Kling
This is a monster patch that turns all EventTargets into GC-allocated PlatformObjects. Their C++ wrapper classes are removed, and the LibJS garbage collector is now responsible for their lifetimes. There's a fair amount of hacks and band-aids in this patch, and we'll have a lot of cleanup to do after this.
2022-09-06LibWeb: Make DOM::Event and all its subclasses GC-allocatedAndreas Kling
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-03-28LibWeb: Load X(HT)ML documents and transform them into HTML DOMAli Mohammad Pur
2022-03-26LibWeb: Remove debug spam about not executing empty script elementsAndreas Kling
2022-03-19LibWeb: Only delay "load" event for script elements that load somethingAndreas Kling
We shouldn't delay the load event for scripts that we're completely refusing to run anyway. Also, for scripts that have inline text content, we don't need to delay them either, as they will become ready before returning from "prepare script". This makes the "load" event finally fire on lots of websites, including Wikipedia. :^)
2022-03-19LibWeb: Don't delay document "load" event for unclosed script tagsAndreas Kling
We previously had a bug where markup with unclosed script tags caused the document load event to be delayed indefinitely. Fix this by only marking script elements as delaying the load event once we encounter the script end tag.
2022-03-17Libraries: Use default constructors/destructors in LibWebLenny Maiorani
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules "The compiler is more likely to get the default semantics right and you cannot implement these functions better than the compiler."
2022-03-14LibWeb: Use inline script tag source line as javascript line offsetIdan Horowitz
This makes JS exception line numbers meaningful for inline script tags.
2022-03-08LibWeb: Move Window from DOM directory & namespace to HTMLLinus Groh
The Window object is part of the HTML spec. :^) https://html.spec.whatwg.org/multipage/window-object.html
2022-02-19LibWeb: Move QualifiedName into the Web::DOM namespaceAndreas Kling
2022-02-08LibWeb: Introduce the Environment Settings ObjectLuke Wilde
The environment settings object is effectively the context a piece of script is running under, for example, it contains the origin, responsible document, realm, global object and event loop for the current context. This effectively replaces ScriptExecutionContext, but it cannot be removed in this commit as EventTarget still depends on it. https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object
2021-12-21LibWeb: Capture <script> element's node document on executionLuke Wilde
Step 1 of the spec is to capture the <script> element's node document into a local variable. When I originally implemented this, I thought this was not necessary. However, I realised that the script that runs can adopt the current script element into a different document, meaning step 5.4 and 6 then operate on the incorrect document. Covered by this WPT: https://github.com/web-platform-tests/wpt/blob/7b0ebaccc62b566a1965396e5be7bb2bc06f841f/html/semantics/scripting-1/the-script-element/moving-between-documents-during-evaluation.html
2021-12-05LibWeb: Cast unused smart-pointer return values to voidSam Atkins
2021-09-26LibWeb: Remove nonsensical assignment in script-became-ready callbackAndreas Kling
We don't need to set m_script_ready in the callback that gets invoked precisely because m_script_ready has been set. :^)
2021-09-26LibWeb: Make parser <script> elements delay the document load eventAndreas Kling
2021-09-26LibWeb: Remove some unused includes and a member in HTMLScriptElementAndreas Kling
2021-09-25LibWeb: Rename HTMLDocumentParser => HTMLParserAndreas Kling
2021-09-20LibWeb: Implement <script src> execution for non-blocking scriptsAndreas Kling
2021-09-20LibWeb: Make <script src> loads partially async (by following the spec)Andreas Kling
Instead of firing up a network request and synchronously blocking for it to finish via a nested event loop, we now start an asynchronous request when encountering <script src>. Once the script load finishes (or fails), it gets executed at one of the synchronization points in the HTML parser. This solves some long-standing issues with random unexpected events getting dispatched in the middle of parsing.
2021-09-20LibWeb: Use Document::realm() in HTMLScriptElement::prepare_script()Andreas Kling
2021-09-13LibWeb: Add the Web::URL namespace and move URLEncoder to itIdan Horowitz
This namespace will be used for all interfaces defined in the URL specification, like URL and URLSearchParams. This has the unfortunate side-effect of requiring us to use the fully qualified AK::URL name whenever we want to refer to the AK class, so this commit also fixes all such references.