Commit bf24e5ea authored by horo's avatar horo Committed by Commit bot

[ServiceWorker] Fix RenderFrameImpl::isControlledByServiceWorker()

In current code, we check the main frame's data_source in RenderFrameImpl.
But even if the main frame is not controlled by the ServiceWorker the iframe on it could be controlled by the ServiceWorker.
So we must check their own frame_'s data_source.

BUG=411151

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

Cr-Commit-Position: refs/heads/master@{#297394}
parent f6a69f4e
...@@ -3181,12 +3181,12 @@ blink::WebScreenOrientationClient* ...@@ -3181,12 +3181,12 @@ blink::WebScreenOrientationClient*
bool RenderFrameImpl::isControlledByServiceWorker() { bool RenderFrameImpl::isControlledByServiceWorker() {
// If we're in the middle of committing a load, the data source we need // If we're in the middle of committing a load, the data source we need
// will still be provisional. // will still be provisional.
WebFrame* main_frame = render_view_->webview()->mainFrame(); DCHECK(frame_);
WebDataSource* data_source = NULL; WebDataSource* data_source = NULL;
if (main_frame->provisionalDataSource()) if (frame_->provisionalDataSource())
data_source = main_frame->provisionalDataSource(); data_source = frame_->provisionalDataSource();
else else
data_source = main_frame->dataSource(); data_source = frame_->dataSource();
ServiceWorkerNetworkProvider* provider = ServiceWorkerNetworkProvider* provider =
ServiceWorkerNetworkProvider::FromDocumentState( ServiceWorkerNetworkProvider::FromDocumentState(
DocumentState::FromDataSource(data_source)); DocumentState::FromDataSource(data_source));
......
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