Commit 0dd6dc96 authored by mlamouri's avatar mlamouri Committed by Commit bot

Fix crash when passing temporary variable as document/manifest URL.

BUG=366145

Review URL: https://codereview.chromium.org/803063003

Cr-Commit-Position: refs/heads/master@{#308386}
parent 718c02d8
......@@ -136,8 +136,8 @@ class CONTENT_EXPORT ManifestParser {
bool ParseGCMUserVisibleOnly(const base::DictionaryValue& dictionary);
const base::StringPiece& data_;
const GURL& manifest_url_;
const GURL& document_url_;
GURL manifest_url_;
GURL document_url_;
bool failed_;
Manifest manifest_;
......
......@@ -51,6 +51,18 @@ const GURL ManifestParserTest::default_document_url(
const GURL ManifestParserTest::default_manifest_url(
"http://foo.com/manifest.json");
TEST_F(ManifestParserTest, CrashTest) {
// Passing temporary variables should not crash.
ManifestParser parser("{\"start_url\": \"/\"}",
GURL("http://example.com"),
GURL("http://example.com"));
parser.Parse();
// .Parse() should have been call without crashing and succeeded.
EXPECT_EQ(0u, parser.errors().size());
EXPECT_FALSE(parser.manifest().IsEmpty());
}
TEST_F(ManifestParserTest, EmptyStringNull) {
Manifest manifest = ParseManifest("");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment