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

Side by Side Diff: content/common/frame_replication_state.h

Issue 1098763003: Send origin updates to frame proxies when a frame navigates to new origin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Charlie's nits Created 5 years, 8 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
« no previous file with comments | « content/common/frame_messages.h ('k') | content/renderer/render_frame_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_COMMON_FRAME_REPLICATION_STATE_H_ 5 #ifndef CONTENT_COMMON_FRAME_REPLICATION_STATE_H_
6 #define CONTENT_COMMON_FRAME_REPLICATION_STATE_H_ 6 #define CONTENT_COMMON_FRAME_REPLICATION_STATE_H_
7 7
8 #include "content/common/content_export.h" 8 #include "content/common/content_export.h"
9 #include "url/origin.h" 9 #include "url/origin.h"
10 10
(...skipping 25 matching lines...) Expand all
36 inline SandboxFlags operator&(SandboxFlags a, SandboxFlags b) { 36 inline SandboxFlags operator&(SandboxFlags a, SandboxFlags b) {
37 return static_cast<SandboxFlags>(static_cast<int>(a) & static_cast<int>(b)); 37 return static_cast<SandboxFlags>(static_cast<int>(a) & static_cast<int>(b));
38 } 38 }
39 39
40 inline SandboxFlags operator~(SandboxFlags flags) { 40 inline SandboxFlags operator~(SandboxFlags flags) {
41 return static_cast<SandboxFlags>(~static_cast<int>(flags)); 41 return static_cast<SandboxFlags>(~static_cast<int>(flags));
42 } 42 }
43 43
44 // This structure holds information that needs to be replicated between a 44 // This structure holds information that needs to be replicated between a
45 // RenderFrame and any of its associated RenderFrameProxies. 45 // RenderFrame and any of its associated RenderFrameProxies.
46 //
47 // |origin| is updated whenever a frame navigation commits. |name| is
Charlie Reis 2015/04/22 23:41:25 These look great, but maybe it would help to put t
alexmos 2015/04/23 00:07:44 Done.
48 // set when a new child frame is created, using the value of the <iframe>
49 // element's "name" attribute (see RenderFrameHostImpl::OnCreateChildFrame),
50 // and it is updated dynamically whenever a frame sets its window.name.
51 // |sandbox_flags| are initialized for new child frames using the value of the
52 // <iframe>'s "sandbox" attribute. They are updated dynamically whenever a
53 // parent frame updates an <iframe>'s sandbox attribute via JavaScript.
54 //
55 // When |name| is updated dynamically, updates are immediately sent to all
56 // frame proxies (when in --site-per-process mode). This is needed since other
57 // frames may attempt to lookup or navigate a frame using its updated name
58 // (e.g., using window.open(url, frame_name)).
59 //
60 // Updates to |sandbox_flags| are sent to proxies only after a subsequent
61 // navigation of the (sandboxed) frame, since the flags only take effect on
62 // navigation. The proxies need updated flags so that they can be inherited
63 // properly if a proxy ever becomes a parent of a local frame.
64 //
65 // TODO(alexmos): For now, |origin| updates are also immediately sent to all
66 // proxies with --site-per-process. This isn't ideal, since Blink typically
67 // needs a proxy's origin only when performing security checks on the ancestors
68 // of a local frame. So, as a future improvement, we could delay sending
69 // origin updates to proxies until they have a local descendant (if ever).
70 // This would reduce leaking a user's browsing history into a compromized
71 // renderer.
46 struct CONTENT_EXPORT FrameReplicationState { 72 struct CONTENT_EXPORT FrameReplicationState {
47 FrameReplicationState(); 73 FrameReplicationState();
48 FrameReplicationState(const std::string& name); 74 FrameReplicationState(const std::string& name);
49 ~FrameReplicationState(); 75 ~FrameReplicationState();
50 76
51 // Current serialized security origin of the frame. Unique origins are 77 // Current serialized security origin of the frame. Unique origins are
52 // represented as the string "null" per RFC 6454. 78 // represented as the string "null" per RFC 6454.
53 url::Origin origin; 79 url::Origin origin;
54 80
55 // Current sandbox flags of the frame. 81 // Current sandbox flags of the frame.
56 SandboxFlags sandbox_flags; 82 SandboxFlags sandbox_flags;
57 83
58 // The assigned name of the frame. This name can be empty, unlike the unique 84 // The assigned name of the frame. This name can be empty, unlike the unique
59 // name generated internally in the DOM tree. 85 // name generated internally in the DOM tree.
60 std::string name; 86 std::string name;
61 87
62 // TODO(alexmos): Eventually, this structure can also hold other state that 88 // TODO(alexmos): Eventually, this structure can also hold other state that
63 // needs to be replicated, such as frame sizing info. 89 // needs to be replicated, such as frame sizing info.
64 }; 90 };
65 91
66 } // namespace content 92 } // namespace content
67 93
68 #endif // CONTENT_COMMON_FRAME_REPLICATION_STATE_H_ 94 #endif // CONTENT_COMMON_FRAME_REPLICATION_STATE_H_
OLDNEW
« no previous file with comments | « content/common/frame_messages.h ('k') | content/renderer/render_frame_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698