Commit 2faf5ef9 authored by mlamouri's avatar mlamouri Committed by Commit bot

[Manifest] Update a RenderFrame's Manifest when navigated.

BUG=454457

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

Cr-Commit-Position: refs/heads/master@{#314534}
parent 6c5c867d
......@@ -281,4 +281,32 @@ IN_PROC_BROWSER_TEST_F(ManifestBrowserTest, ParsingErrorsManifest) {
EXPECT_EQ(6u, console_error_count());
}
// If a page has a manifest and the page is navigated to a page without a
// manifest, the page's manifest should be updated.
IN_PROC_BROWSER_TEST_F(ManifestBrowserTest, Navigation) {
{
GURL test_url = GetTestUrl("manifest", "dummy-manifest.html");
TestNavigationObserver navigation_observer(shell()->web_contents(), 1);
shell()->LoadURL(test_url);
navigation_observer.Wait();
GetManifestAndWait();
EXPECT_FALSE(manifest().IsEmpty());
EXPECT_EQ(0u, console_error_count());
}
{
GURL test_url = GetTestUrl("manifest", "no-manifest.html");
TestNavigationObserver navigation_observer(shell()->web_contents(), 1);
shell()->LoadURL(test_url);
navigation_observer.Wait();
GetManifestAndWait();
EXPECT_TRUE(manifest().IsEmpty());
EXPECT_EQ(0u, console_error_count());
}
}
} // namespace content
......@@ -101,6 +101,11 @@ void ManifestManager::DidChangeManifest() {
manifest_dirty_ = true;
}
void ManifestManager::DidCommitProvisionalLoad(bool is_new_navigation) {
may_have_manifest_ = false;
manifest_dirty_ = true;
}
void ManifestManager::FetchManifest() {
GURL url(render_frame()->GetWebFrame()->document().manifestURL());
......
......@@ -42,6 +42,7 @@ class ManifestManager : public RenderFrameObserver {
// RenderFrameObserver implementation.
bool OnMessageReceived(const IPC::Message& message) override;
void DidChangeManifest() override;
void DidCommitProvisionalLoad(bool is_new_navigation) override;
private:
enum ResolveState {
......
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