summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Loader
AgeCommit message (Collapse)Author
2022-01-15LibCore+LibIPC+Everywhere: Return Stream::LocalSocket from LocalServersin-ack
This change unfortunately cannot be atomically made without a single commit changing everything. Most of the important changes are in LibIPC/Connection.cpp, LibIPC/ServerConnection.cpp and LibCore/LocalServer.cpp. The notable changes are: - IPCCompiler now generates the decode and decode_message functions such that they take a Core::Stream::LocalSocket instead of the socket fd. - IPC::Decoder now uses the receive_fd method of LocalSocket instead of doing system calls directly on the fd. - IPC::ConnectionBase and related classes now use the Stream API functions. - IPC::ServerConnection no longer constructs the socket itself; instead, a convenience macro, IPC_CLIENT_CONNECTION, is used in place of C_OBJECT and will generate a static try_create factory function for the ServerConnection subclass. The subclass is now responsible for passing the socket constructed in this function to its ServerConnection base; the socket is passed as the first argument to the constructor (as a NonnullOwnPtr<Core::Stream::LocalServer>) before any other arguments. - The functionality regarding taking over sockets from SystemServer has been moved to LibIPC/SystemServerTakeover.cpp. The Core::LocalSocket implementation of this functionality hasn't been deleted due to my intention of removing this class in the near future and to reduce noise on this (already quite noisy) PR.
2022-01-12Base+Browser: Add Browser iconselectrikmilk
Add some missing icons to the brower.
2021-12-21LibWeb: Add a workaround to assign a proper mime type to QOI imagesLinus Groh
2021-12-04LibWeb: Stop sending "load" event twice to iframesAndreas Kling
The "completely finish loading" algorithm (from the HTML spec) is responsible for sending a "load" event to nested browsing context containers (iframes). This patch removes the old mechanism for sending "load" events, which we had mistakenly kept around, causing two events to be sent instead of one. :^)
2021-11-20LibWeb: Use the sandboxed image ImageDecoder when loading faviconsAndreas Kling
2021-11-20LibWeb: Use the sandboxed ImageDecoder when creating image documentsAndreas Kling
An image document is the synthetic DOM::Document we create to wrap an image when you open the URL of an image directly in a web view. The path that creates these documents will now also call out to the separate ImageDecoder process for the actual decoding work.
2021-11-20LibWeb: Move ImageDecoder client connection singleton to its own fileAndreas Kling
This will allow us to use it in more places around LibWeb.
2021-11-19LibWeb+LibHTTP: Support multiple Set-Cookie response headersTheFightingCatfish
2021-11-18LibWeb: Move BrowsingContext into HTML/Andreas Kling
Browsing contexts are defined by the HTML specification, so let's move them into the HTML directory. :^)
2021-11-18LibWeb: Delete CSSLoaderSam Atkins
All CSS loading is now done by the relevant classes: - CSSImportRule, which loads its linked stylesheet - HTMLStyleElement, which "loads" its contents - HTMLLinkElement, which loads its linked stylesheet
2021-11-18LibWeb: Remove redundant `@import`-handling code from CSSLoaderSam Atkins
Now that `@import` rules load themselves, we don't want to also load them here.
2021-11-11Everywhere: Pass AK::StringView by valueAndreas Kling
2021-11-08LibCore: Use ErrorOr<T> for Core::File::open()Andreas Kling
2021-11-08LibGfx: Use ErrorOr<T> for Bitmap::try_load_from_file()Andreas Kling
This was used in a lot of places, so this patch makes liberal use of ErrorOr<T>::release_value_but_fixme_should_propagate_errors().
2021-10-23AK+Everywhere: Make Base64 decoding fallibleBen Wiederhake
2021-10-06LibWeb: Resolve cyclic dependency between StyleSheet and ImportRuleBen Wiederhake
Previously: CSSImportRule::loaded_style_sheet() (and others) depend on the definition of class CSSStyleSheet. Meanwhile, CSSStyleSheet::template for_each_effective_style_rule (and others) depend on the definition of class CSSImportRule. This hasn't caused any problems so far because CSSStyleSheet.h happened to be always included after CSSImportRule.h (in part due to alphabetical ordering). However, a compilation unit that (for example) only contains #include <Userland/Libraries/LibWeb/CSSImportRule.h> would fail to compile. This patch resolves this issue by pushing the inline definition of Web::CSS::CSSStyleSheet::for_each_effective_style_rule and for_first_not_loaded_import_rule into a different file, and adding the missing headers.
2021-09-29LibWeb: Make CSSRule and CSSRuleList available to JavaScript :^)Andreas Kling
This patch makes both of these classes inherit from RefCounted and Bindings::Wrappable, plus some minimal rejigging to allow us to keep using them internally while also exposing them to web content.
2021-09-28LibWeb: Implement the dns-prefetch and preconnect link relationshipsAli Mohammad Pur
2021-09-27LibWeb: Don't try to ad-block data: urlsSam Atkins
In some cases these can be several KiB or more in size, making checking very slow, and it doesn't make sense to filter them out anyway. This change speeds up loading pages with large data: urls, which previously took up to 1ms per byte to process.
2021-09-26LibWeb: Make <link> style sheets delay the document load eventAndreas Kling
2021-09-25LibWeb: Rename HTMLDocumentParser => HTMLParserAndreas Kling
2021-09-24LibWeb: Skip decoding favicon.ico if downloaded data is emptyMandar Kulkarni
Some sites don't have favicon.ico, so we may get 404 response. In such cases, ResourceLoader still calls success_callback. For favicon loading, we are not checking response headers or payload size. This will ultimately fail in Gfx::ImageDecoder::try_create(). So avoid unnecessary work by returning early, if data is empty.
2021-09-22LibWeb: Log resource load success before invoking success callbackAndreas Kling
The success callback may trigger JavaScript execution, causing resource load times to appear much longer than they actually are. :^)
2021-09-19LibWeb: Avoid introducing a reference cycle in ResourceLoader::load()Ali Mohammad Pur
Previously we were kinda sorta resolving the reference cycle, but let's just keep the requests in a hashtable instead of relying on hard to track refcount tricks. Fixes #7314.
2021-09-16LibWeb: Don't dump full data URLs in ResourceLoader loggingAndreas Kling
Some pages use *really* large data URLs. :^)
2021-09-14AK: Make URL::m_port an Optional<u16>, Expose raw port getterIdan Horowitz
Our current way of signalling a missing port with m_port == 0 was lacking, as 0 is a valid port number in URLs.
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.
2021-09-12LibWeb: Log resource loading success, failure, and durationBrian Gianforcaro
When debugging why your website isn't loading in LibWeb the resource loader is a blind spot as we don't have much logging except on certain error paths. This can lead to confusing situations where the browser just appears to hang. This changes attempts to fix that by adding common success and failure logging handlers so all resource loading outcomes can are logged.
2021-09-12LibWeb: Start tracking elapsed time when a resource is loadedBrian Gianforcaro
2021-09-12LibWeb: Include headers HashMap in the LoadRequest::hash() calculationBrian Gianforcaro
2021-09-09LibWeb: Rename BrowsingContext::document() => active_document()Andreas Kling
This better matches the spec nomenclature. Note that we don't yet *retrieve* the active document according to spec.
2021-09-09LibWeb: Add BrowsingContext::container() to align with the specAndreas Kling
We already have a base class for frame elements that we call BrowsingContextContainer. This patch makes BrowsingContext::container() actually return one of those. This makes us match the spec names, and also solves a FIXME about having a shared base for <frame> and <iframe>. (We already had the shared base, but the pointer we had there wasn't tightly typed enough.)
2021-09-08LibWeb: Scroll viewport to (0, 0) after loading a new documentAndreas Kling
This fixes a long-standing bug where the view wouldn't update when navigating to a new page after looking at the ACID2 test. This happened because ACID2 actually scrolls the viewport far down. We didn't reset the scroll position upon navigation, and so the new page thought that we were still scrolled very far down, and this broke the invalidation rect calculations.
2021-09-06Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safeAli Mohammad Pur
2021-09-02Userland: Migrate to argument-less deferred_invokesin-ack
Only one place used this argument and it was to hold on to a strong ref for the object. Since we already do that now, there's no need to keep this argument around since this can be easily captured. This commit contains no changes.
2021-08-08Browser+LibWeb: Silence some debug spamsTheFightingCatfish
2021-08-08Browser+LibWeb: Make sure the default favicon is loadedTheFightingCatfish
Previously in Browser, when we navigate back from a page that has an icon to a page that does not have an icon, the icon does not update and the old icon is displayed because FrameLoader does not set the default favicon when the favicon cannot be loaded. This patch ensures that Browser receives a new icon bitmap every time a load takes place.
2021-08-02LibWeb: Switch to new CSS Parser :^)Sam Atkins
Change all the places that were including the deprecated parser, to include the new one instead, and then delete the old parser code. `ParentNode::query_selector[_all]()` now treat their input as a comma-separated list of selectors, instead of just one, and return elements that match any of the selectors in that list. This is according to these specs: - querySelector/querySelectorAll: https://dom.spec.whatwg.org/#ref-for-dom-parentnode-queryselector%E2%91%A0 - selector matching algorithm: https://www.w3.org/TR/selectors-4/#match-against-tree
2021-08-01LibWeb: Remove unused header includesBrian Gianforcaro
2021-07-27LibGfx: Remove Gfx::ImageDecoder::bitmap() in favor of frame(index)Andreas Kling
To transparently support multi-frame images, all decoder plugins have already been updated to return their only bitmap for frame(0). This patch completes the remaining cleanup work by removing the ImageDecoder::bitmap() API and having all clients call frame() instead.
2021-07-27LibGfx: Improve ImageDecoder constructionAndreas Kling
Previously, ImageDecoder::create() would return a NonnullRefPtr and could not "fail", although the returned decoder may be "invalid" which you then had to check anyway. The new interface looks like this: static RefPtr<Gfx::ImageDecoder> try_create(ReadonlyBytes); This simplifies ImageDecoder since it no longer has to worry about its validity. Client code gets slightly clearer as well.
2021-07-25LibGfx: Make Gfx::Bitmap::set_nonvolatile() report allocation failureAndreas Kling
Making a bitmap non-volatile after being volatile may fail to allocate physical pages after the kernel stole the old pages in a purge. This is different from the pages being purged, but reallocated. In that case, they are simply replaced with zero-fill-on-demand pages as if they were freshly allocated.
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-01LibWeb: Show "x86_64" in the user agent string on x86_64 :^)Andreas Kling
2021-06-30AK+Everywhere: Add and use static APIs for LexicalPathMax Wipfli
The LexicalPath instance methods dirname(), basename(), title() and extension() will be changed to return StringView const& in a further commit. Due to this, users creating temporary LexicalPath objects just to call one of those getters will recieve a StringView const& pointing to a possible freed buffer. To avoid this, static methods for those APIs have been added, which will return a String by value to avoid those problems. All cases where temporary LexicalPath objects have been used as described above haven been changed to use the static APIs.
2021-06-24Userland: Replace VERIFY(is<T>) with verify_cast<T>Andreas Kling
Instead of doing a VERIFY(is<T>(x)) and *then* casting it to T, we can just do the cast right away with verify_cast<T>. :^)
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-20LibWeb: Fix redirects when a response has no dataGil Mendes
This makes redirects work when the HTTP server responds with just headers and no data.
2021-06-06LibProtocol: Use URL class in RequestClient::start_request argumentMax Wipfli
This changes the RequestClient::start_request() method to take a URL object instead of a URL string as argument. All callers of the method already had a URL object anyway, and start_request() in turn parses the URL string back into a URL object. This removes this unnecessary conversion.
2021-06-01AK+LibWeb: Remove URL::to_string_encoded()Max Wipfli
This replaces URL::to_string_encoded() with to_string() and removes the former, since they are now equivalent.