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

Unified Diff: content/renderer/manifest/manifest_manager.cc

Issue 748373003: Report errors when parsing Manifest and expose them in developer console. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/manifest/manifest_browsertest.cc ('k') | content/renderer/manifest/manifest_parser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/manifest/manifest_manager.cc
diff --git a/content/renderer/manifest/manifest_manager.cc b/content/renderer/manifest/manifest_manager.cc
index 9ccee4cb38882ca1483126b4e98fa5731bebf773..5c620c0d13644ae1d64dd331cf00bf3a295cdce1 100644
--- a/content/renderer/manifest/manifest_manager.cc
+++ b/content/renderer/manifest/manifest_manager.cc
@@ -12,6 +12,7 @@
#include "content/renderer/manifest/manifest_parser.h"
#include "content/renderer/manifest/manifest_uma_util.h"
#include "third_party/WebKit/public/platform/WebURLResponse.h"
+#include "third_party/WebKit/public/web/WebConsoleMessage.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
@@ -110,9 +111,6 @@ void ManifestManager::FetchManifest() {
}
fetcher_.reset(new ManifestFetcher(url));
-
- // TODO(mlamouri,kenneth): this is not yet taking into account manifest-src
- // CSP rule, see http://crbug.com/409996.
fetcher_->Start(render_frame()->GetWebFrame(),
base::Bind(&ManifestManager::OnManifestFetchComplete,
base::Unretained(this),
@@ -130,9 +128,27 @@ void ManifestManager::OnManifestFetchComplete(
}
ManifestUmaUtil::FetchSucceeded();
- manifest_ = ManifestParser::Parse(data, response.url(), document_url);
+
+ ManifestParser parser(data, response.url(), document_url);
+ parser.Parse();
fetcher_.reset();
+
+ for (const std::string& msg : parser.errors()) {
+ blink::WebConsoleMessage message;
+ message.level = blink::WebConsoleMessage::LevelError;
+ message.text = blink::WebString::fromUTF8(msg);
+ render_frame()->GetWebFrame()->addMessageToConsole(message);
+ }
+
+ // Having errors while parsing the manifest doesn't mean the manifest parsing
+ // failed. Some properties might have been ignored but some others kept.
+ if (parser.failed()) {
+ ResolveCallbacks(ResolveStateFailure);
+ return;
+ }
+
+ manifest_ = parser.manifest();
ResolveCallbacks(ResolveStateSuccess);
}
« no previous file with comments | « content/browser/manifest/manifest_browsertest.cc ('k') | content/renderer/manifest/manifest_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698