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

Side by Side Diff: extensions/browser/url_request_util.cc

Issue 2249423002: Do not immediately block cross-renderer extension resource loads for non-web-triggered transitions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Skip extension-specific checks for webviews. Created 4 years, 4 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 | « no previous file | no next file » | 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 #include "extensions/browser/url_request_util.h" 5 #include "extensions/browser/url_request_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "content/public/browser/resource_request_info.h" 9 #include "content/public/browser/resource_request_info.h"
10 #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" 10 #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h"
(...skipping 22 matching lines...) Expand all
33 int owner_process_id; 33 int owner_process_id;
34 WebViewRendererState::GetInstance()->GetOwnerInfo( 34 WebViewRendererState::GetInstance()->GetOwnerInfo(
35 info->GetChildID(), &owner_process_id, &owner_extension_id); 35 info->GetChildID(), &owner_process_id, &owner_extension_id);
36 const Extension* owner_extension = 36 const Extension* owner_extension =
37 extension_info_map->extensions().GetByID(owner_extension_id); 37 extension_info_map->extensions().GetByID(owner_extension_id);
38 std::string partition_id; 38 std::string partition_id;
39 bool is_guest = WebViewRendererState::GetInstance()->GetPartitionID( 39 bool is_guest = WebViewRendererState::GetInstance()->GetPartitionID(
40 info->GetChildID(), &partition_id); 40 info->GetChildID(), &partition_id);
41 std::string resource_path = request->url().path(); 41 std::string resource_path = request->url().path();
42 42
43 // |owner_extension == extension| needs to be checked because extension 43 if (is_guest) {
44 // resources should only be accessible to WebViews owned by that extension. 44 // Extension resources should only be accessible to WebViews owned by that
45 if (is_guest && owner_extension == extension && 45 // extension.
46 WebviewInfo::IsResourceWebviewAccessible(extension, partition_id, 46 if (owner_extension != extension)
47 resource_path)) { 47 return false;
nasko 2016/08/17 16:31:44 Why this rewrite in this patch? I think the goal i
robwu 2016/08/18 08:09:58 Without this change, the following test would fail
48 *allowed = true; 48 *allowed = WebviewInfo::IsResourceWebviewAccessible(extension, partition_id,
49 resource_path);
49 return true; 50 return true;
50 } 51 }
51 52
52 if (!ui::PageTransitionIsWebTriggerable(info->GetPageTransition())) {
nasko 2016/08/17 16:31:44 As per my response in the bug, I think this should
robwu 2016/08/18 08:09:58 I restored this check and moved it to the end out
53 *allowed = false;
54 return true;
55 }
56
57 // The following checks require that we have an actual extension object. If we 53 // The following checks require that we have an actual extension object. If we
58 // don't have it, allow the request handling to continue with the rest of the 54 // don't have it, allow the request handling to continue with the rest of the
59 // checks. 55 // checks.
60 if (!extension) { 56 if (!extension) {
61 *allowed = true; 57 *allowed = true;
62 return true; 58 return true;
63 } 59 }
64 60
65 // Disallow loading of packaged resources for hosted apps. We don't allow 61 // Disallow loading of packaged resources for hosted apps. We don't allow
66 // hybrid hosted/packaged apps. The one exception is access to icons, since 62 // hybrid hosted/packaged apps. The one exception is access to icons, since
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 const content::ResourceRequestInfo* info = 122 const content::ResourceRequestInfo* info =
127 content::ResourceRequestInfo::ForRequest(request); 123 content::ResourceRequestInfo::ForRequest(request);
128 // |info| can be NULL sometimes: http://crbug.com/370070. 124 // |info| can be NULL sometimes: http://crbug.com/370070.
129 if (!info) 125 if (!info)
130 return false; 126 return false;
131 return WebViewRendererState::GetInstance()->IsGuest(info->GetChildID()); 127 return WebViewRendererState::GetInstance()->IsGuest(info->GetChildID());
132 } 128 }
133 129
134 } // namespace url_request_util 130 } // namespace url_request_util
135 } // namespace extensions 131 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698