| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "content/browser/frame_host/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 3069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3080 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( | 3080 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( |
| 3081 GetProcess()->GetID(), common_params.base_url_for_data_url); | 3081 GetProcess()->GetID(), common_params.base_url_for_data_url); |
| 3082 } | 3082 } |
| 3083 } | 3083 } |
| 3084 | 3084 |
| 3085 // We may be returning to an existing NavigationEntry that had been granted | 3085 // We may be returning to an existing NavigationEntry that had been granted |
| 3086 // file access. If this is a different process, we will need to grant the | 3086 // file access. If this is a different process, we will need to grant the |
| 3087 // access again. Abuse is prevented, because the files listed in the page | 3087 // access again. Abuse is prevented, because the files listed in the page |
| 3088 // state are validated earlier, when they are received from the renderer (in | 3088 // state are validated earlier, when they are received from the renderer (in |
| 3089 // RenderFrameHostImpl::CanAccessFilesOfPageState). | 3089 // RenderFrameHostImpl::CanAccessFilesOfPageState). |
| 3090 if (request_params.page_state.IsValid()) | 3090 if (request_params.page_state.IsValid()) { |
| 3091 GrantFileAccessFromPageState(request_params.page_state); | 3091 GrantFileAccessFromPageState(request_params.page_state); |
| 3092 | 3092 |
| 3093 // Iterate over the subtree of PageStates as well, since the renderer will |
| 3094 // attempt to load each of these without asking the browser process. |
| 3095 for (const auto& iter : request_params.subtree_page_states) |
| 3096 GrantFileAccessFromPageState(iter.second); |
| 3097 } |
| 3098 |
| 3093 // We may be here after transferring navigation to a different renderer | 3099 // We may be here after transferring navigation to a different renderer |
| 3094 // process. In this case, we need to ensure that the new renderer retains | 3100 // process. In this case, we need to ensure that the new renderer retains |
| 3095 // ability to access files that the old renderer could access. Abuse is | 3101 // ability to access files that the old renderer could access. Abuse is |
| 3096 // prevented, because the files listed in ResourceRequestBody are validated | 3102 // prevented, because the files listed in ResourceRequestBody are validated |
| 3097 // earlier, when they are recieved from the renderer (in ShouldServiceRequest | 3103 // earlier, when they are recieved from the renderer (in ShouldServiceRequest |
| 3098 // called from ResourceDispatcherHostImpl::BeginRequest). | 3104 // called from ResourceDispatcherHostImpl::BeginRequest). |
| 3099 if (common_params.post_data) | 3105 if (common_params.post_data) |
| 3100 GrantFileAccessFromResourceRequestBody(*common_params.post_data); | 3106 GrantFileAccessFromResourceRequestBody(*common_params.post_data); |
| 3101 } | 3107 } |
| 3102 | 3108 |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3330 // pending_nav_entry_id. If the previous handle was a prematurely aborted | 3336 // pending_nav_entry_id. If the previous handle was a prematurely aborted |
| 3331 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. | 3337 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. |
| 3332 return NavigationHandleImpl::Create( | 3338 return NavigationHandleImpl::Create( |
| 3333 params.url, frame_tree_node_, is_renderer_initiated, | 3339 params.url, frame_tree_node_, is_renderer_initiated, |
| 3334 params.was_within_same_page, base::TimeTicks::Now(), | 3340 params.was_within_same_page, base::TimeTicks::Now(), |
| 3335 entry_id_for_data_nav, params.gesture, | 3341 entry_id_for_data_nav, params.gesture, |
| 3336 false); // started_from_context_menu | 3342 false); // started_from_context_menu |
| 3337 } | 3343 } |
| 3338 | 3344 |
| 3339 } // namespace content | 3345 } // namespace content |
| OLD | NEW |