Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LibWeb: rename 'cross-origin opener policy' to 'opener policy' #1399

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Userland/Libraries/LibWeb/DOM/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ JS_DEFINE_ALLOCATOR(Document);
static JS::NonnullGCPtr<HTML::BrowsingContext> obtain_a_browsing_context_to_use_for_a_navigation_response(
HTML::BrowsingContext& browsing_context,
HTML::SandboxingFlagSet sandbox_flags,
HTML::CrossOriginOpenerPolicy navigation_coop,
HTML::CrossOriginOpenerPolicyEnforcementResult coop_enforcement_result)
HTML::OpenerPolicy navigation_coop,
HTML::OpenerPolicyEnforcementResult coop_enforcement_result)
{
// 1. If browsingContext is not a top-level browsing context, return browsingContext.
if (!browsing_context.is_top_level())
Expand All @@ -168,7 +168,7 @@ static JS::NonnullGCPtr<HTML::BrowsingContext> obtain_a_browsing_context_to_use_
// 5. If sandboxFlags is not empty, then:
if (!is_empty(sandbox_flags)) {
// 1. Assert navigationCOOP's value is "unsafe-none".
VERIFY(navigation_coop.value == HTML::CrossOriginOpenerPolicyValue::UnsafeNone);
VERIFY(navigation_coop.value == HTML::OpenerPolicyValue::UnsafeNone);

// 2. Assert: newBrowsingContext's popup sandboxing flag set is empty.

Expand All @@ -186,11 +186,11 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Document>> Document::create_and_initialize(
auto browsing_context = navigation_params.navigable->active_browsing_context();

// 2. Set browsingContext to the result of the obtaining a browsing context to use for a navigation response given browsingContext, navigationParams's final sandboxing flag set,
// navigationParams's cross-origin opener policy, and navigationParams's COOP enforcement result.
// navigationParams's opener policy, and navigationParams's COOP enforcement result.
browsing_context = obtain_a_browsing_context_to_use_for_a_navigation_response(
*browsing_context,
navigation_params.final_sandboxing_flag_set,
navigation_params.cross_origin_opener_policy,
navigation_params.opener_policy,
navigation_params.coop_enforcement_result);

// FIXME: 3. Let permissionsPolicy be the result of creating a permissions policy from a response
Expand Down Expand Up @@ -288,7 +288,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Document>> Document::create_and_initialize(
// policy container: navigationParams's policy container
// FIXME: permissions policy: permissionsPolicy
// active sandboxing flag set: navigationParams's final sandboxing flag set
// FIXME: cross-origin opener policy: navigationParams's cross-origin opener policy
// FIXME: opener policy: navigationParams's opener policy
// FIXME: load timing info: loadTimingInfo
// FIXME: was created via cross-origin redirects: navigationParams's response's has cross-origin redirects
// during-loading navigation ID for WebDriver BiDi: navigationParams's id
Expand Down
8 changes: 4 additions & 4 deletions Userland/Libraries/LibWeb/DOM/Document.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <LibWeb/DOM/NonElementParentNode.h>
#include <LibWeb/DOM/ParentNode.h>
#include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/HTML/CrossOrigin/CrossOriginOpenerPolicy.h>
#include <LibWeb/HTML/CrossOrigin/OpenerPolicy.h>
#include <LibWeb/HTML/DocumentReadyState.h>
#include <LibWeb/HTML/HTMLScriptElement.h>
#include <LibWeb/HTML/History.h>
Expand Down Expand Up @@ -151,8 +151,8 @@ class Document
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); }
HTML::OpenerPolicy const& opener_policy() const { return m_opener_policy; }
void set_opener_policy(HTML::OpenerPolicy policy) { m_opener_policy = move(policy); }

URL::URL parse_url(StringView) const;

Expand Down Expand Up @@ -866,7 +866,7 @@ class Document
Optional<URL::URL> m_about_base_url;

// https://html.spec.whatwg.org/multipage/dom.html#concept-document-coop
HTML::CrossOriginOpenerPolicy m_cross_origin_opener_policy;
HTML::OpenerPolicy m_opener_policy;

// https://html.spec.whatwg.org/multipage/dom.html#the-document's-referrer
String m_referrer;
Expand Down
16 changes: 8 additions & 8 deletions Userland/Libraries/LibWeb/DOM/DocumentLoading.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ JS::NonnullGCPtr<DOM::Document> create_document_for_inline_content(JS::GCPtr<HTM
// 1. Let origin be a new opaque origin.
HTML::Origin origin {};

// 2. Let coop be a new cross-origin opener policy.
auto coop = HTML::CrossOriginOpenerPolicy {};
// 2. Let coop be a new opener policy.
auto coop = HTML::OpenerPolicy {};

// 3. Let coopEnforcementResult be a new cross-origin opener policy enforcement result with
// 3. Let coopEnforcementResult be a new opener policy enforcement result with
// url: response's URL
// origin: origin
// cross-origin opener policy: coop
HTML::CrossOriginOpenerPolicyEnforcementResult coop_enforcement_result {
// opener policy: coop
HTML::OpenerPolicyEnforcementResult coop_enforcement_result {
.url = URL::URL("about:error"), // AD-HOC
.origin = origin,
.cross_origin_opener_policy = coop
.opener_policy = coop
};

// 4. Let navigationParams be a new navigation params with
Expand All @@ -50,7 +50,7 @@ JS::NonnullGCPtr<DOM::Document> create_document_for_inline_content(JS::GCPtr<HTM
// reserved environment: null
// policy container: a new policy container
// final sandboxing flag set: an empty set
// cross-origin opener policy: coop
// opener policy: coop
// FIXME: navigation timing type: navTimingType
// about base URL: null
auto response = Fetch::Infrastructure::Response::create(vm);
Expand All @@ -67,7 +67,7 @@ JS::NonnullGCPtr<DOM::Document> create_document_for_inline_content(JS::GCPtr<HTM
navigation_params->origin = move(origin);
navigation_params->policy_container = HTML::PolicyContainer {};
navigation_params->final_sandboxing_flag_set = HTML::SandboxingFlagSet {};
navigation_params->cross_origin_opener_policy = move(coop);
navigation_params->opener_policy = move(coop);
navigation_params->about_base_url = {};

// 5. Let document be the result of creating and initializing a Document object given "html", "text/html", and navigationParams.
Expand Down
4 changes: 2 additions & 2 deletions Userland/Libraries/LibWeb/Forward.h
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,8 @@ enum class AllowMultipleFiles;
enum class MediaSeekMode;
enum class SandboxingFlagSet;

struct CrossOriginOpenerPolicy;
struct CrossOriginOpenerPolicyEnforcementResult;
struct OpenerPolicy;
struct OpenerPolicyEnforcementResult;
struct Environment;
struct EnvironmentSettingsObject;
struct NavigationParams;
Expand Down
6 changes: 3 additions & 3 deletions Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <LibWeb/DOMURL/DOMURL.h>
#include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/HTML/BrowsingContextGroup.h>
#include <LibWeb/HTML/CrossOrigin/CrossOriginOpenerPolicy.h>
#include <LibWeb/HTML/CrossOrigin/OpenerPolicy.h>
#include <LibWeb/HTML/DocumentState.h>
#include <LibWeb/HTML/HTMLAnchorElement.h>
#include <LibWeb/HTML/HTMLDocument.h>
Expand Down Expand Up @@ -259,10 +259,10 @@ WebIDL::ExceptionOr<BrowsingContext::BrowsingContextAndDocument> BrowsingContext

// 3. If creator's origin is same origin with creator's relevant settings object's top-level origin,
if (creator->origin().is_same_origin(creator->relevant_settings_object().top_level_origin)) {
// then set document's cross-origin opener policy to creator's browsing context's top-level browsing context's active document's cross-origin opener policy.
// then set document's opener policy to creator's browsing context's top-level browsing context's active document's opener policy.
VERIFY(creator->browsing_context());
VERIFY(creator->browsing_context()->top_level_browsing_context()->active_document());
document->set_cross_origin_opener_policy(creator->browsing_context()->top_level_browsing_context()->active_document()->cross_origin_opener_policy());
document->set_opener_policy(creator->browsing_context()->top_level_browsing_context()->active_document()->opener_policy());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@
namespace Web::HTML {

// https://html.spec.whatwg.org/multipage/origin.html#cross-origin-opener-policy-value
enum class CrossOriginOpenerPolicyValue {
enum class OpenerPolicyValue {
UnsafeNone,
SameOriginAllowPopups,
SameOrigin,
SameOriginPlusCOEP,
};

// https://html.spec.whatwg.org/multipage/origin.html#cross-origin-opener-policy
struct CrossOriginOpenerPolicy {
// A value, which is a cross-origin opener policy value, initially "unsafe-none".
CrossOriginOpenerPolicyValue value { CrossOriginOpenerPolicyValue::UnsafeNone };
struct OpenerPolicy {
// A value, which is an opener policy value, initially "unsafe-none".
OpenerPolicyValue value { OpenerPolicyValue::UnsafeNone };

// A reporting endpoint, which is string or null, initially null.
Optional<String> reporting_endpoint;

// A report-only value, which is a cross-origin opener policy value, initially "unsafe-none".
CrossOriginOpenerPolicyValue report_only_value { CrossOriginOpenerPolicyValue::UnsafeNone };
// A report-only value, which is an opener policy value, initially "unsafe-none".
OpenerPolicyValue report_only_value { OpenerPolicyValue::UnsafeNone };

// A report-only reporting endpoint, which is a string or null, initially null.
Optional<String> report_only_reporting_endpoint;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
#pragma once

#include <LibURL/URL.h>
#include <LibWeb/HTML/CrossOrigin/CrossOriginOpenerPolicy.h>
#include <LibWeb/HTML/CrossOrigin/OpenerPolicy.h>
#include <LibWeb/HTML/Origin.h>

namespace Web::HTML {

// https://html.spec.whatwg.org/multipage/origin.html#coop-enforcement-result
struct CrossOriginOpenerPolicyEnforcementResult {
struct OpenerPolicyEnforcementResult {
// A boolean needs a browsing context group switch, initially false.
bool needs_a_browsing_context_group_switch { false };

Expand All @@ -26,8 +26,8 @@ struct CrossOriginOpenerPolicyEnforcementResult {
// An origin origin.
Origin origin;

// A cross-origin opener policy cross-origin opener policy.
CrossOriginOpenerPolicy cross_origin_opener_policy;
// An opener policy.
0xkon1 marked this conversation as resolved.
Show resolved Hide resolved
OpenerPolicy opener_policy;

// A boolean current context is navigation source.
bool current_context_is_navigation_source { false };
Expand Down
2 changes: 1 addition & 1 deletion Userland/Libraries/LibWeb/HTML/CrossOrigin/Reporting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void check_if_access_between_two_browsing_contexts_should_be_reported(
if (accessed->is_ancestor_of(*accessor.top_level_browsing_context()->opener_browsing_context()))
accessor_accessed_relationship = AccessorAccessedRelationship::AccessorIsOpener;

// 12. Queue violation reports for accesses, given accessorAccessedRelationship, accessorTopDocument's cross-origin opener policy, accessedTopDocument's cross-origin opener policy, accessor's active document's URL, accessed's active document's URL, accessor's top-level browsing context's initial URL, accessed's top-level browsing context's initial URL, accessor's active document's origin, accessed's active document's origin, accessor's top-level browsing context's opener origin at creation, accessed's top-level browsing context's opener origin at creation, accessorTopDocument's referrer, accessedTopDocument's referrer, propertyKey, and environment.
// 12. Queue violation reports for accesses, given accessorAccessedRelationship, accessorTopDocument's opener policy, accessedTopDocument's opener policy, accessor's active document's URL, accessed's active document's URL, accessor's top-level browsing context's initial URL, accessed's top-level browsing context's initial URL, accessor's active document's origin, accessed's active document's origin, accessor's top-level browsing context's opener origin at creation, accessed's top-level browsing context's opener origin at creation, accessorTopDocument's referrer, accessedTopDocument's referrer, propertyKey, and environment.
(void)environment;
(void)accessor_accessed_relationship;
}
Expand Down
Loading
Loading