
The way we've been creating DOM::Document has been pretty far from what the spec tells us to do, and this is a first big step towards getting us closer to spec. The new Document::create_and_initialize() is called by FrameLoader after loading a "text/html" resource. We create the JS Realm and the Window object when creating the Document (previously, we'd do it on first access to Document::interpreter().) The realm execution context is owned by the Environment Settings Object.
32 lines
985 B
C++
32 lines
985 B
C++
/*
|
|
* Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibWeb/HTML/Scripting/Environments.h>
|
|
#include <LibWeb/HTML/Window.h>
|
|
|
|
namespace Web::HTML {
|
|
|
|
class WindowEnvironmentSettingsObject final : public EnvironmentSettingsObject {
|
|
public:
|
|
static void setup(AK::URL const& creation_url, NonnullOwnPtr<JS::ExecutionContext>, Optional<Environment>, AK::URL top_level_creation_url, Origin top_level_origin);
|
|
|
|
virtual ~WindowEnvironmentSettingsObject() override = default;
|
|
|
|
virtual RefPtr<DOM::Document> responsible_document() override;
|
|
virtual String api_url_character_encoding() override;
|
|
virtual AK::URL api_base_url() override;
|
|
virtual Origin origin() override;
|
|
virtual CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability() override;
|
|
|
|
private:
|
|
WindowEnvironmentSettingsObject(Window&, NonnullOwnPtr<JS::ExecutionContext>);
|
|
|
|
NonnullRefPtr<Window> m_window;
|
|
};
|
|
|
|
}
|