Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp

Issue 2955573003: Set frame policy correctly in newly created renderer proxies (Closed)
Patch Set: Fix container policy replication bug in provisional frames Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1503 WebFrame* opener) { 1503 WebFrame* opener) {
1504 return WebLocalFrameImpl::Create(scope, client, interface_provider, 1504 return WebLocalFrameImpl::Create(scope, client, interface_provider,
1505 interface_registry, opener); 1505 interface_registry, opener);
1506 } 1506 }
1507 1507
1508 WebLocalFrame* WebLocalFrame::CreateProvisional( 1508 WebLocalFrame* WebLocalFrame::CreateProvisional(
1509 WebFrameClient* client, 1509 WebFrameClient* client,
1510 blink::InterfaceProvider* interface_provider, 1510 blink::InterfaceProvider* interface_provider,
1511 blink::InterfaceRegistry* interface_registry, 1511 blink::InterfaceRegistry* interface_registry,
1512 WebRemoteFrame* old_web_frame, 1512 WebRemoteFrame* old_web_frame,
1513 WebSandboxFlags flags) { 1513 WebSandboxFlags flags,
1514 return WebLocalFrameImpl::CreateProvisional( 1514 WebParsedFeaturePolicy container_policy) {
1515 client, interface_provider, interface_registry, old_web_frame, flags); 1515 return WebLocalFrameImpl::CreateProvisional(client, interface_provider,
1516 interface_registry, old_web_frame,
1517 flags, container_policy);
1516 } 1518 }
1517 1519
1518 WebLocalFrameImpl* WebLocalFrameImpl::Create( 1520 WebLocalFrameImpl* WebLocalFrameImpl::Create(
1519 WebTreeScopeType scope, 1521 WebTreeScopeType scope,
1520 WebFrameClient* client, 1522 WebFrameClient* client,
1521 blink::InterfaceProvider* interface_provider, 1523 blink::InterfaceProvider* interface_provider,
1522 blink::InterfaceRegistry* interface_registry, 1524 blink::InterfaceRegistry* interface_registry,
1523 WebFrame* opener) { 1525 WebFrame* opener) {
1524 WebLocalFrameImpl* frame = new WebLocalFrameImpl( 1526 WebLocalFrameImpl* frame = new WebLocalFrameImpl(
1525 scope, client, interface_provider, interface_registry); 1527 scope, client, interface_provider, interface_registry);
1526 frame->SetOpener(opener); 1528 frame->SetOpener(opener);
1527 return frame; 1529 return frame;
1528 } 1530 }
1529 1531
1530 WebLocalFrameImpl* WebLocalFrameImpl::CreateProvisional( 1532 WebLocalFrameImpl* WebLocalFrameImpl::CreateProvisional(
1531 WebFrameClient* client, 1533 WebFrameClient* client,
1532 blink::InterfaceProvider* interface_provider, 1534 blink::InterfaceProvider* interface_provider,
1533 blink::InterfaceRegistry* interface_registry, 1535 blink::InterfaceRegistry* interface_registry,
1534 WebRemoteFrame* old_web_frame, 1536 WebRemoteFrame* old_web_frame,
1535 WebSandboxFlags flags) { 1537 WebSandboxFlags flags,
1538 WebParsedFeaturePolicy container_policy) {
1536 DCHECK(client); 1539 DCHECK(client);
1537 WebLocalFrameImpl* web_frame = new WebLocalFrameImpl( 1540 WebLocalFrameImpl* web_frame = new WebLocalFrameImpl(
1538 old_web_frame, client, interface_provider, interface_registry); 1541 old_web_frame, client, interface_provider, interface_registry);
1539 Frame* old_frame = ToWebRemoteFrameImpl(old_web_frame)->GetFrame(); 1542 Frame* old_frame = ToWebRemoteFrameImpl(old_web_frame)->GetFrame();
1540 web_frame->SetParent(old_web_frame->Parent()); 1543 web_frame->SetParent(old_web_frame->Parent());
1541 web_frame->SetOpener(old_web_frame->Opener()); 1544 web_frame->SetOpener(old_web_frame->Opener());
1542 // Note: this *always* temporarily sets a frame owner, even for main frames! 1545 // Note: this *always* temporarily sets a frame owner, even for main frames!
1543 // When a core Frame is created with no owner, it attempts to set itself as 1546 // When a core Frame is created with no owner, it attempts to set itself as
1544 // the main frame of the Page. However, this is a provisional frame, and may 1547 // the main frame of the Page. However, this is a provisional frame, and may
1545 // disappear, so Page::m_mainFrame can't be updated just yet. 1548 // disappear, so Page::m_mainFrame can't be updated just yet.
1546 // Note 2: Becuase the dummy owner is still the owner when the initial empty 1549 // Note 2: Becuase the dummy owner is still the owner when the initial empty
1547 // document is created, the initial empty document will not inherit the 1550 // document is created, the initial empty document will not inherit the
1548 // correct sandbox flags. However, since the provisional frame is inivisible 1551 // correct sandbox flags. However, since the provisional frame is inivisible
1549 // to the rest of the page, the initial document is also invisible and 1552 // to the rest of the page, the initial document is also invisible and
1550 // unscriptable. Once the provisional frame gets properly attached and is 1553 // unscriptable. Once the provisional frame gets properly attached and is
1551 // observable, it will have the real FrameOwner, and any subsequent real 1554 // observable, it will have the real FrameOwner, and any subsequent real
1552 // documents will correctly inherit sandbox flags from the owner. 1555 // documents will correctly inherit sandbox flags from the owner.
1553 web_frame->InitializeCoreFrame(*old_frame->GetPage(), 1556 web_frame->InitializeCoreFrame(*old_frame->GetPage(),
1554 DummyFrameOwner::Create(), 1557 DummyFrameOwner::Create(),
1555 old_frame->Tree().GetName()); 1558 old_frame->Tree().GetName());
1556 1559
1557 LocalFrame* new_frame = web_frame->GetFrame(); 1560 LocalFrame* new_frame = web_frame->GetFrame();
1558 new_frame->SetOwner(old_frame->Owner()); 1561 new_frame->SetOwner(old_frame->Owner());
1559 if (new_frame->Owner() && new_frame->Owner()->IsRemote()) { 1562 if (new_frame->Owner() && new_frame->Owner()->IsRemote()) {
1560 ToRemoteFrameOwner(new_frame->Owner()) 1563 ToRemoteFrameOwner(new_frame->Owner())
1561 ->SetSandboxFlags(static_cast<SandboxFlags>(flags)); 1564 ->SetSandboxFlags(static_cast<SandboxFlags>(flags));
1565 ToRemoteFrameOwner(new_frame->Owner())
1566 ->SetContainerPolicy(container_policy);
1562 } 1567 }
1563 return web_frame; 1568 return web_frame;
1564 } 1569 }
1565 1570
1566 WebLocalFrameImpl* WebLocalFrameImpl::CreateLocalChild( 1571 WebLocalFrameImpl* WebLocalFrameImpl::CreateLocalChild(
1567 WebTreeScopeType scope, 1572 WebTreeScopeType scope,
1568 WebFrameClient* client, 1573 WebFrameClient* client,
1569 blink::InterfaceProvider* interface_provider, 1574 blink::InterfaceProvider* interface_provider,
1570 blink::InterfaceRegistry* interface_registry) { 1575 blink::InterfaceRegistry* interface_registry) {
1571 WebLocalFrameImpl* frame = new WebLocalFrameImpl( 1576 WebLocalFrameImpl* frame = new WebLocalFrameImpl(
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
2495 WebTextCheckClient* text_check_client) { 2500 WebTextCheckClient* text_check_client) {
2496 text_check_client_ = text_check_client; 2501 text_check_client_ = text_check_client;
2497 } 2502 }
2498 2503
2499 void WebLocalFrameImpl::SetSpellCheckPanelHostClient( 2504 void WebLocalFrameImpl::SetSpellCheckPanelHostClient(
2500 WebSpellCheckPanelHostClient* spell_check_panel_host_client) { 2505 WebSpellCheckPanelHostClient* spell_check_panel_host_client) {
2501 spell_check_panel_host_client_ = spell_check_panel_host_client; 2506 spell_check_panel_host_client_ = spell_check_panel_host_client;
2502 } 2507 }
2503 2508
2504 } // namespace blink 2509 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.h ('k') | third_party/WebKit/public/web/WebLocalFrame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698