Commit 69a3377d authored by Sam McNally's avatar Sam McNally Committed by Commit Bot

Make mime handlers inherit the session storage of their embedders.

Mime handlers create a nested WebContents to contain the mime handler
extension. Currently, these run with a separate session storage
namespace, resulting in session storage being cleared if a tab recreates
a mime handler, such as due to a reload. Change mime handler WebContents
creation to inherit the session storage namespaces of their embedders so
the session storage behaves similarly to iframes within a single tab.

Bug: 819761
Change-Id: I3b4f653836190ed86572eb12cdbeef3fbc157683
Reviewed-on: https://chromium-review.googlesource.com/1116633
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570814}
parent 30184c71
......@@ -291,6 +291,12 @@ std::unique_ptr<WebContents> WebContents::CreateWithSessionStorage(
.SetSessionStorageNamespace(it->first, it->second.get());
}
if (params.guest_delegate) {
// This makes |new_contents| act as a guest.
// For more info, see comment above class BrowserPluginGuest.
BrowserPluginGuest::Create(new_contents.get(), params.guest_delegate);
}
new_contents->Init(params);
return new_contents;
}
......
......@@ -195,7 +195,11 @@ void MimeHandlerViewGuest::CreateWebContents(
params.guest_delegate = this;
// TODO(erikchen): Fix ownership semantics for guest views.
// https://crbug.com/832879.
std::move(callback).Run(WebContents::Create(params).release());
std::move(callback).Run(
WebContents::CreateWithSessionStorage(
params,
owner_web_contents()->GetController().GetSessionStorageNamespaceMap())
.release());
registry_.AddInterface(
base::Bind(&MimeHandlerServiceImpl::Create, stream_->GetWeakPtr()));
......
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