mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-05 00:21:52 +00:00
LibWeb/SVG: Fix crash when SVG use element is used on an external SVG
We were previously crashing when invoking 'scroll to the fragment' on such documents as it was unable to find the active document. This is as a result of our AD-HOC implementation not setting up the document fully to mark it is active before running the parser. Fixes a crash on https://tweakers.net.
This commit is contained in:
parent
ceb6348811
commit
b7512deada
Notes:
github-actions[bot]
2025-01-19 14:02:35 +00:00
Author: https://github.com/shannonbooth
Commit: b7512deada
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3299
4 changed files with 28 additions and 1 deletions
|
@ -13,6 +13,8 @@
|
|||
#include <LibWeb/HTML/NavigationParams.h>
|
||||
#include <LibWeb/HTML/Parser/HTMLParser.h>
|
||||
#include <LibWeb/HTML/TraversableNavigable.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/HTML/WindowProxy.h>
|
||||
#include <LibWeb/Layout/Viewport.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
#include <LibWeb/Painting/DisplayListPlayerSkia.h>
|
||||
|
@ -44,10 +46,12 @@ ErrorOr<GC::Ref<SVGDecodedImageData>> SVGDecodedImageData::create(JS::Realm& rea
|
|||
navigation_params->opener_policy = HTML::OpenerPolicy {};
|
||||
|
||||
// FIXME: Use Navigable::navigate() instead of manually replacing the navigable's document.
|
||||
auto document = DOM::Document::create_and_initialize(DOM::Document::Type::HTML, "text/html"_string, navigation_params).release_value_but_fixme_should_propagate_errors();
|
||||
auto document = MUST(DOM::Document::create_and_initialize(DOM::Document::Type::HTML, "text/html"_string, navigation_params));
|
||||
navigable->set_ongoing_navigation({});
|
||||
navigable->active_document()->destroy();
|
||||
navigable->active_session_history_entry()->document_state()->set_document(document);
|
||||
auto& window = verify_cast<HTML::Window>(HTML::relevant_global_object(document));
|
||||
document->browsing_context()->window_proxy()->set_window(window);
|
||||
|
||||
auto parser = HTML::HTMLParser::create_with_uncertain_encoding(document, data);
|
||||
parser->run(document->url());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue