diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/core/frame/frame.cc')
-rw-r--r-- | chromium/third_party/blink/renderer/core/frame/frame.cc | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/chromium/third_party/blink/renderer/core/frame/frame.cc b/chromium/third_party/blink/renderer/core/frame/frame.cc index 78b5c772007..4f85a218063 100644 --- a/chromium/third_party/blink/renderer/core/frame/frame.cc +++ b/chromium/third_party/blink/renderer/core/frame/frame.cc @@ -32,6 +32,7 @@ #include <memory> +#include "third_party/blink/public/mojom/frame/frame_owner_properties.mojom-blink.h" #include "third_party/blink/public/web/web_local_frame_client.h" #include "third_party/blink/public/web/web_remote_frame_client.h" #include "third_party/blink/renderer/bindings/core/v8/window_proxy_manager.h" @@ -40,14 +41,17 @@ #include "third_party/blink/renderer/core/dom/node_computed_style.h" #include "third_party/blink/renderer/core/execution_context/window_agent_factory.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" +#include "third_party/blink/renderer/core/frame/remote_frame_owner.h" #include "third_party/blink/renderer/core/frame/settings.h" #include "third_party/blink/renderer/core/html/html_frame_element_base.h" #include "third_party/blink/renderer/core/input/event_handler.h" #include "third_party/blink/renderer/core/layout/layout_embedded_content.h" #include "third_party/blink/renderer/core/loader/empty_clients.h" +#include "third_party/blink/renderer/core/loader/form_submission.h" #include "third_party/blink/renderer/core/page/focus_controller.h" #include "third_party/blink/renderer/core/page/page.h" #include "third_party/blink/renderer/core/probe/core_probes.h" +#include "third_party/blink/renderer/core/xmlhttprequest/main_thread_disallow_synchronous_xhr_scope.h" #include "third_party/blink/renderer/platform/instrumentation/instance_counters.h" #include "third_party/blink/renderer/platform/instrumentation/use_counter.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_error.h" @@ -61,7 +65,7 @@ Frame::~Frame() { DCHECK(IsDetached()); } -void Frame::Trace(blink::Visitor* visitor) { +void Frame::Trace(Visitor* visitor) { visitor->Trace(tree_node_); visitor->Trace(page_); visitor->Trace(owner_); @@ -77,6 +81,7 @@ void Frame::Detach(FrameDetachType type) { // Detach() can be re-entered, so this can't simply DCHECK(IsAttached()). DCHECK(!IsDetached()); lifecycle_.AdvanceTo(FrameLifecycle::kDetaching); + MainThreadDisallowSynchronousXHRScope disallow_synchronous_xhr; DetachImpl(type); @@ -128,7 +133,7 @@ bool Frame::IsMainFrame() const { return !Tree().Parent(); } -bool Frame::IsCrossOriginSubframe() const { +bool Frame::IsCrossOriginToMainFrame() const { DCHECK(GetSecurityContext()); const SecurityOrigin* security_origin = GetSecurityContext()->GetSecurityOrigin(); @@ -136,6 +141,18 @@ bool Frame::IsCrossOriginSubframe() const { Tree().Top().GetSecurityContext()->GetSecurityOrigin()); } +bool Frame::IsCrossOriginToParentFrame() const { + DCHECK(GetSecurityContext()); + if (IsMainFrame()) + return false; + Frame* parent = Tree().Parent(); + const SecurityOrigin* parent_security_origin = + parent->GetSecurityContext()->GetSecurityOrigin(); + const SecurityOrigin* security_origin = + GetSecurityContext()->GetSecurityOrigin(); + return !security_origin->CanAccess(parent_security_origin); +} + HTMLFrameOwnerElement* Frame::DeprecatedLocalOwner() const { return DynamicTo<HTMLFrameOwnerElement>(owner_.Get()); } @@ -296,6 +313,7 @@ Frame::Frame(FrameClient* client, : tree_node_(this), page_(&page), owner_(owner), + ad_frame_type_(mojom::blink::AdFrameType::kNonAd), client_(client), window_proxy_manager_(window_proxy_manager), navigation_rate_limiter_(*this), @@ -328,6 +346,33 @@ void Frame::FocusImpl() { this, false /* notify_embedder */); } +void Frame::ApplyFrameOwnerProperties( + mojom::blink::FrameOwnerPropertiesPtr properties) { + // At the moment, this is only used to replicate frame owner properties + // for frames with a remote owner. + auto* owner = To<RemoteFrameOwner>(Owner()); + + owner->SetBrowsingContextContainerName(properties->name); + owner->SetScrollbarMode(properties->scrollbar_mode); + owner->SetMarginWidth(properties->margin_width); + owner->SetMarginHeight(properties->margin_height); + owner->SetAllowFullscreen(properties->allow_fullscreen); + owner->SetAllowPaymentRequest(properties->allow_payment_request); + owner->SetIsDisplayNone(properties->is_display_none); + owner->SetRequiredCsp(properties->required_csp); +} + +void Frame::ScheduleFormSubmission(FrameScheduler* scheduler, + FormSubmission* form_submission) { + form_submit_navigation_task_ = PostCancellableTask( + *scheduler->GetTaskRunner(TaskType::kDOMManipulation), FROM_HERE, + WTF::Bind(&FormSubmission::Navigate, WrapPersistent(form_submission))); +} + +void Frame::CancelFormSubmission() { + form_submit_navigation_task_.Cancel(); +} + STATIC_ASSERT_ENUM(FrameDetachType::kRemove, WebLocalFrameClient::DetachType::kRemove); STATIC_ASSERT_ENUM(FrameDetachType::kSwap, |