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

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

Issue 1571633002: Pass Manifest JSON paser error line and column number to console. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comments Created 4 years, 11 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 | « base/json/json_reader.cc ('k') | content/renderer/manifest/manifest_parser.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 #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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 return; 153 return;
154 } 154 }
155 155
156 ManifestUmaUtil::FetchSucceeded(); 156 ManifestUmaUtil::FetchSucceeded();
157 157
158 ManifestParser parser(data, response.url(), document_url); 158 ManifestParser parser(data, response.url(), document_url);
159 parser.Parse(); 159 parser.Parse();
160 160
161 fetcher_.reset(); 161 fetcher_.reset();
162 162
163 for (const std::string& msg : parser.errors()) { 163 for (const scoped_ptr<ManifestParser::ErrorInfo>& error_info :
164 parser.errors()) {
164 blink::WebConsoleMessage message; 165 blink::WebConsoleMessage message;
165 message.level = blink::WebConsoleMessage::LevelError; 166 message.level = blink::WebConsoleMessage::LevelError;
166 message.text = blink::WebString::fromUTF8(msg); 167 message.text = blink::WebString::fromUTF8(error_info->error_msg);
167 message.url = 168 message.url =
168 render_frame()->GetWebFrame()->document().manifestURL().string(); 169 render_frame()->GetWebFrame()->document().manifestURL().string();
170 message.lineNumber = error_info->error_line;
171 message.columnNumber = error_info->error_column;
169 render_frame()->GetWebFrame()->addMessageToConsole(message); 172 render_frame()->GetWebFrame()->addMessageToConsole(message);
170 } 173 }
171 174
172 // Having errors while parsing the manifest doesn't mean the manifest parsing 175 // Having errors while parsing the manifest doesn't mean the manifest parsing
173 // failed. Some properties might have been ignored but some others kept. 176 // failed. Some properties might have been ignored but some others kept.
174 if (parser.failed()) { 177 if (parser.failed()) {
175 ResolveCallbacks(ResolveStateFailure); 178 ResolveCallbacks(ResolveStateFailure);
176 return; 179 return;
177 } 180 }
178 181
(...skipping 12 matching lines...) Expand all
191 194
192 pending_callbacks_.clear(); 195 pending_callbacks_.clear();
193 196
194 for (std::list<GetManifestCallback>::const_iterator it = callbacks.begin(); 197 for (std::list<GetManifestCallback>::const_iterator it = callbacks.begin();
195 it != callbacks.end(); ++it) { 198 it != callbacks.end(); ++it) {
196 it->Run(manifest); 199 it->Run(manifest);
197 } 200 }
198 } 201 }
199 202
200 } // namespace content 203 } // namespace content
OLDNEW
« no previous file with comments | « base/json/json_reader.cc ('k') | content/renderer/manifest/manifest_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698