| Index: extensions/browser/extension_function.cc
|
| diff --git a/extensions/browser/extension_function.cc b/extensions/browser/extension_function.cc
|
| index 8f737df200df1c93f460422afb50ebb1464137aa..d716ceb132ba763ac74df97f43a99c1e8b76ceb5 100644
|
| --- a/extensions/browser/extension_function.cc
|
| +++ b/extensions/browser/extension_function.cc
|
| @@ -468,11 +468,15 @@ UIThreadExtensionFunction::UIThreadExtensionFunction()
|
| : context_(nullptr),
|
| render_frame_host_(nullptr),
|
| is_from_service_worker_(false),
|
| + embedded_worker_id_(-1),
|
| delegate_(nullptr) {}
|
|
|
| UIThreadExtensionFunction::~UIThreadExtensionFunction() {
|
| - if (dispatcher() && render_frame_host())
|
| - dispatcher()->OnExtensionFunctionCompleted(extension());
|
| + if (dispatcher() && (render_frame_host() || is_from_service_worker_)) {
|
| + dispatcher()->OnExtensionFunctionCompleted(extension(),
|
| + embedded_worker_id_);
|
| + }
|
| +
|
| // The extension function should always respond to avoid leaks in the
|
| // renderer, dangling callbacks, etc. The exception is if the system is
|
| // shutting down.
|
|
|