| Index: extensions/browser/extension_function.cc
|
| diff --git a/extensions/browser/extension_function.cc b/extensions/browser/extension_function.cc
|
| index d47493e814ff5dbe8000bea2ff868bc5a2ddc1eb..d3eab1348732427c2b4abb66ae461a44566cf240 100644
|
| --- a/extensions/browser/extension_function.cc
|
| +++ b/extensions/browser/extension_function.cc
|
| @@ -454,11 +454,14 @@ void ExtensionFunction::SendResponseImpl(bool success) {
|
| UIThreadExtensionFunction::UIThreadExtensionFunction()
|
| : context_(nullptr),
|
| render_frame_host_(nullptr),
|
| - is_from_service_worker_(false) {}
|
| + service_worker_version_id_(content::kInvalidServiceWorkerVersionId) {}
|
|
|
| UIThreadExtensionFunction::~UIThreadExtensionFunction() {
|
| - if (dispatcher() && render_frame_host())
|
| - dispatcher()->OnExtensionFunctionCompleted(extension());
|
| + if (dispatcher() && (render_frame_host() || is_from_service_worker())) {
|
| + dispatcher()->OnExtensionFunctionCompleted(extension(),
|
| + service_worker_version_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.
|
| @@ -507,7 +510,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;
|
| }
|
|
|