| Index: extensions/browser/extension_function.cc
|
| diff --git a/extensions/browser/extension_function.cc b/extensions/browser/extension_function.cc
|
| index 5995ad1a3f2cce29bb295fe64479fd96a01ca324..587a50f66c818320b392b97c8bc03fc1fd9f97f0 100644
|
| --- a/extensions/browser/extension_function.cc
|
| +++ b/extensions/browser/extension_function.cc
|
| @@ -450,11 +450,14 @@ void ExtensionFunction::SendResponseImpl(bool success) {
|
| UIThreadExtensionFunction::UIThreadExtensionFunction()
|
| : context_(nullptr),
|
| render_frame_host_(nullptr),
|
| - is_from_service_worker_(false) {}
|
| + service_worker_version_id_(extensions::kInvalidServiceWorkerVersionId) {}
|
|
|
| UIThreadExtensionFunction::~UIThreadExtensionFunction() {
|
| - if (dispatcher() && render_frame_host())
|
| - dispatcher()->OnExtensionFunctionCompleted(extension());
|
| + if (dispatcher() && (render_frame_host() || is_from_service_worker())) {
|
| + dispatcher()->OnExtensionFunctionCompleted(extension(),
|
| + is_from_service_worker());
|
| + }
|
| +
|
| // The extension function should always respond to avoid leaks in the
|
| // renderer, dangling callbacks, etc. The exception is if the system is
|
| // shutting down.
|
| @@ -503,7 +506,7 @@ void UIThreadExtensionFunction::Destruct() const {
|
| void UIThreadExtensionFunction::SetRenderFrameHost(
|
| content::RenderFrameHost* render_frame_host) {
|
| // An extension function from Service Worker does not have a RenderFrameHost.
|
| - if (is_from_service_worker_) {
|
| + if (is_from_service_worker()) {
|
| DCHECK(!render_frame_host);
|
| return;
|
| }
|
|
|