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

Side by Side Diff: content/renderer/manifest/manifest_manager.cc

Issue 2596613002: Fix use-after-scope issues with incorrect usage of ManifestParser. (Closed)
Patch Set: Created 3 years, 12 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 | content/renderer/manifest/manifest_parser_unittest.cc » ('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 #include "content/renderer/manifest/manifest_manager.h" 5 #include "content/renderer/manifest/manifest_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/nullable_string16.h" 8 #include "base/strings/nullable_string16.h"
9 #include "content/common/manifest_manager_messages.h" 9 #include "content/common/manifest_manager_messages.h"
10 #include "content/public/renderer/render_frame.h" 10 #include "content/public/renderer/render_frame.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 const GURL& document_url, 143 const GURL& document_url,
144 const blink::WebURLResponse& response, 144 const blink::WebURLResponse& response,
145 const std::string& data) { 145 const std::string& data) {
146 if (response.isNull() && data.empty()) { 146 if (response.isNull() && data.empty()) {
147 ManifestUmaUtil::FetchFailed(ManifestUmaUtil::FETCH_UNSPECIFIED_REASON); 147 ManifestUmaUtil::FetchFailed(ManifestUmaUtil::FETCH_UNSPECIFIED_REASON);
148 ResolveCallbacks(ResolveStateFailure); 148 ResolveCallbacks(ResolveStateFailure);
149 return; 149 return;
150 } 150 }
151 151
152 ManifestUmaUtil::FetchSucceeded(); 152 ManifestUmaUtil::FetchSucceeded();
153 ManifestParser parser(data, response.url(), document_url); 153 GURL response_url = response.url();
154 base::StringPiece data_piece(data);
155 ManifestParser parser(data_piece, response_url, document_url);
154 parser.Parse(); 156 parser.Parse();
155 157
156 fetcher_.reset(); 158 fetcher_.reset();
157 manifest_debug_info_.raw_data = data; 159 manifest_debug_info_.raw_data = data;
158 parser.TakeErrors(&manifest_debug_info_.errors); 160 parser.TakeErrors(&manifest_debug_info_.errors);
159 161
160 for (const auto& error : manifest_debug_info_.errors) { 162 for (const auto& error : manifest_debug_info_.errors) {
161 blink::WebConsoleMessage message; 163 blink::WebConsoleMessage message;
162 message.level = error.critical ? blink::WebConsoleMessage::LevelError : 164 message.level = error.critical ? blink::WebConsoleMessage::LevelError :
163 blink::WebConsoleMessage::LevelWarning; 165 blink::WebConsoleMessage::LevelWarning;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 it != callbacks.end(); ++it) { 203 it != callbacks.end(); ++it) {
202 it->Run(manifest_url_, manifest_, manifest_debug_info_); 204 it->Run(manifest_url_, manifest_, manifest_debug_info_);
203 } 205 }
204 } 206 }
205 207
206 void ManifestManager::OnDestruct() { 208 void ManifestManager::OnDestruct() {
207 delete this; 209 delete this;
208 } 210 }
209 211
210 } // namespace content 212 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/manifest/manifest_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698