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

Side by Side Diff: content/renderer/pepper/url_request_info_util.cc

Issue 23548008: Don't set the request target type to object when navigating from a Pepper plug-in. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer/pepper/url_request_info_util.h" 5 #include "content/renderer/pepper/url_request_info_util.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "content/common/fileapi/file_system_messages.h" 9 #include "content/common/fileapi/file_system_messages.h"
10 #include "content/renderer/pepper/common.h" 10 #include "content/renderer/pepper/common.h"
11 #include "content/renderer/pepper/plugin_module.h" 11 #include "content/renderer/pepper/plugin_module.h"
12 #include "content/renderer/pepper/ppb_file_ref_impl.h" 12 #include "content/renderer/pepper/ppb_file_ref_impl.h"
13 #include "content/renderer/render_thread_impl.h" 13 #include "content/renderer/render_thread_impl.h"
14 #include "net/http/http_util.h" 14 #include "net/http/http_util.h"
15 #include "ppapi/shared_impl/url_request_info_data.h" 15 #include "ppapi/shared_impl/url_request_info_data.h"
16 #include "ppapi/shared_impl/var.h" 16 #include "ppapi/shared_impl/var.h"
17 #include "ppapi/thunk/enter.h" 17 #include "ppapi/thunk/enter.h"
18 #include "third_party/WebKit/public/platform/WebData.h" 18 #include "third_party/WebKit/public/platform/WebData.h"
19 #include "third_party/WebKit/public/platform/WebHTTPBody.h" 19 #include "third_party/WebKit/public/platform/WebHTTPBody.h"
20 #include "third_party/WebKit/public/platform/WebURL.h" 20 #include "third_party/WebKit/public/platform/WebURL.h"
21 #include "third_party/WebKit/public/platform/WebURLRequest.h"
22 #include "third_party/WebKit/public/web/WebDocument.h" 21 #include "third_party/WebKit/public/web/WebDocument.h"
23 #include "third_party/WebKit/public/web/WebFrame.h" 22 #include "third_party/WebKit/public/web/WebFrame.h"
24 #include "url/gurl.h" 23 #include "url/gurl.h"
25 #include "url/url_util.h" 24 #include "url/url_util.h"
26 #include "webkit/child/weburlrequest_extradata_impl.h" 25 #include "webkit/child/weburlrequest_extradata_impl.h"
27 26
28 using ppapi::URLRequestInfoData; 27 using ppapi::URLRequestInfoData;
29 using ppapi::Resource; 28 using ppapi::Resource;
30 using ppapi::thunk::EnterResourceNoLock; 29 using ppapi::thunk::EnterResourceNoLock;
31 using ppapi::thunk::PPB_FileRef_API; 30 using ppapi::thunk::PPB_FileRef_API;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 return false; 107 return false;
109 item.file_ref = enter.resource(); 108 item.file_ref = enter.resource();
110 } 109 }
111 } 110 }
112 return true; 111 return true;
113 } 112 }
114 113
115 } // namespace 114 } // namespace
116 115
117 bool CreateWebURLRequest(ppapi::URLRequestInfoData* data, 116 bool CreateWebURLRequest(ppapi::URLRequestInfoData* data,
117 WebURLRequest::TargetType target_type,
118 WebFrame* frame, 118 WebFrame* frame,
119 WebURLRequest* dest) { 119 WebURLRequest* dest) {
120 // In the out-of-process case, we've received the URLRequestInfoData 120 // In the out-of-process case, we've received the URLRequestInfoData
121 // from the untrusted plugin and done no validation on it. We need to be 121 // from the untrusted plugin and done no validation on it. We need to be
122 // sure it's not being malicious by checking everything for consistency. 122 // sure it's not being malicious by checking everything for consistency.
123 if (!ValidateURLRequestData(*data) || !EnsureFileRefObjectsPopulated(data)) 123 if (!ValidateURLRequestData(*data) || !EnsureFileRefObjectsPopulated(data))
124 return false; 124 return false;
125 125
126 dest->initialize(); 126 dest->initialize();
127 dest->setTargetType(WebURLRequest::TargetIsObject); 127 dest->setTargetType(target_type);
128 dest->setURL(frame->document().completeURL(WebString::fromUTF8( 128 dest->setURL(frame->document().completeURL(WebString::fromUTF8(
129 data->url))); 129 data->url)));
130 dest->setDownloadToFile(data->stream_to_file); 130 dest->setDownloadToFile(data->stream_to_file);
131 dest->setReportUploadProgress(data->record_upload_progress); 131 dest->setReportUploadProgress(data->record_upload_progress);
132 132
133 if (!data->method.empty()) 133 if (!data->method.empty())
134 dest->setHTTPMethod(WebString::fromUTF8(data->method)); 134 dest->setHTTPMethod(WebString::fromUTF8(data->method));
135 135
136 dest->setFirstPartyForCookies(frame->document().firstPartyForCookies()); 136 dest->setFirstPartyForCookies(frame->document().firstPartyForCookies());
137 137
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 192
193 bool URLRequestRequiresUniversalAccess(const ppapi::URLRequestInfoData& data) { 193 bool URLRequestRequiresUniversalAccess(const ppapi::URLRequestInfoData& data) {
194 return 194 return
195 data.has_custom_referrer_url || 195 data.has_custom_referrer_url ||
196 data.has_custom_content_transfer_encoding || 196 data.has_custom_content_transfer_encoding ||
197 data.has_custom_user_agent || 197 data.has_custom_user_agent ||
198 url_util::FindAndCompareScheme(data.url, "javascript", NULL); 198 url_util::FindAndCompareScheme(data.url, "javascript", NULL);
199 } 199 }
200 200
201 } // namespace content 201 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698