mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 07:28:11 +00:00
LibWeb: Bring browsing context creation closer to spec
This patch implements the "create a new browsing context" function from the HTML spec and replaces our existing logic with it. The big difference is that browsing contexts now initially navigate to "about:blank" instead of starting out in a strange "empty" state. This makes it possible for websites to create a new iframe and start scripting inside it right away, without having to load an URL into it.
This commit is contained in:
parent
73f77969a6
commit
2a7924f96c
8 changed files with 242 additions and 5 deletions
|
@ -25,6 +25,7 @@
|
|||
#include <LibWeb/DOM/ExceptionOr.h>
|
||||
#include <LibWeb/DOM/NonElementParentNode.h>
|
||||
#include <LibWeb/DOM/ParentNode.h>
|
||||
#include <LibWeb/HTML/CrossOrigin/CrossOriginOpenerPolicy.h>
|
||||
#include <LibWeb/HTML/DocumentReadyState.h>
|
||||
#include <LibWeb/HTML/HTMLScriptElement.h>
|
||||
#include <LibWeb/HTML/History.h>
|
||||
|
@ -82,6 +83,9 @@ public:
|
|||
HTML::Origin origin() const;
|
||||
void set_origin(HTML::Origin const& origin);
|
||||
|
||||
HTML::CrossOriginOpenerPolicy const& cross_origin_opener_policy() const { return m_cross_origin_opener_policy; }
|
||||
void set_cross_origin_opener_policy(HTML::CrossOriginOpenerPolicy policy) { m_cross_origin_opener_policy = move(policy); }
|
||||
|
||||
AK::URL parse_url(String const&) const;
|
||||
|
||||
CSS::StyleComputer& style_computer() { return *m_style_computer; }
|
||||
|
@ -263,6 +267,8 @@ public:
|
|||
HTML::Window& window() { return *m_window; }
|
||||
HTML::Window const& window() const { return *m_window; }
|
||||
|
||||
void set_window(Badge<HTML::BrowsingContext>, HTML::Window&);
|
||||
|
||||
ExceptionOr<void> write(Vector<String> const& strings);
|
||||
ExceptionOr<void> writeln(Vector<String> const& strings);
|
||||
|
||||
|
@ -484,6 +490,9 @@ private:
|
|||
// https://html.spec.whatwg.org/multipage/dom.html#is-initial-about:blank
|
||||
bool m_is_initial_about_blank { false };
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#concept-document-coop
|
||||
HTML::CrossOriginOpenerPolicy m_cross_origin_opener_policy;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#the-document's-referrer
|
||||
String m_referrer { "" };
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue