mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-22 23:55:12 +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:
committed by
Alexander Kalenik
parent
ceb6348811
commit
b7512deada
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user