Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Issue 396963002: ServiceWorker: Bypass resolving a promise when ExecutionContext is gone (Closed)

Created:
6 years, 5 months ago by nhiroki
Modified:
6 years, 4 months ago
CC:
blink-reviews, michaeln, jsbell+serviceworker_chromium.org, tzik, serviceworker-reviews, kinuko+serviceworker, horo+watch_chromium.org, alecflett+watch_chromium.org, kouhei (in TOK)
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Project:
blink
Visibility:
Public.

Description

ServiceWorker: Bypass resolving a promise when ExecutionContext is gone This change makes CallbackPromiseAdapter bypass resolving/rejecting a promise if ExecutionContext is gone and calls WebType::dispose() to clean up passed WebType instance. BUG=385906, 386501 TEST=run_webkit_tests.py --debug --enable-leak-detection http/tests/serviceworker/chromium/resolve-after-window-close.html TEST=run_webkit_tests.py --debug --enable-leak-detection push_messaging/push-messaging-resolve-after-detached.html TEST=manual (run crash.html in the issue) Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=179043

Patch Set 1 #

Patch Set 2 : handle ownership of WebServiceWorker #

Total comments: 3

Patch Set 3 : remake (add WebType::dispose()) #

Total comments: 4

Patch Set 4 : address yhirano's comments #

Patch Set 5 : rebase #

Total comments: 6

Patch Set 6 : fix for push messaging #

Patch Set 7 : add a test for push messaging #

Patch Set 8 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+105 lines, -18 lines) Patch
A + LayoutTests/http/tests/serviceworker/chromium/resolve-after-window-close.html View 1 2 2 chunks +3 lines, -5 lines 0 comments Download
A + LayoutTests/http/tests/serviceworker/chromium/resolve-after-window-close-expected.txt View 1 2 1 chunk +1 line, -1 line 0 comments Download
A + LayoutTests/http/tests/serviceworker/chromium/resources/empty-worker.js View 1 2 0 chunks +-1 lines, --1 lines 0 comments Download
A + LayoutTests/http/tests/serviceworker/chromium/resources/resolve-after-window-close.html View 1 2 1 chunk +0 lines, -4 lines 0 comments Download
A LayoutTests/push_messaging/push-messaging-resolve-after-detached.html View 1 2 3 4 5 6 1 chunk +28 lines, -0 lines 0 comments Download
A + LayoutTests/push_messaging/push-messaging-resolve-after-detached-expected.txt View 1 2 3 4 5 6 1 chunk +1 line, -2 lines 0 comments Download
A LayoutTests/push_messaging/resources/push-messaging-resolve-after-detached.html View 1 2 3 4 5 6 1 chunk +8 lines, -0 lines 0 comments Download
M Source/bindings/core/v8/CallbackPromiseAdapter.h View 1 2 3 4 2 chunks +18 lines, -0 lines 0 comments Download
M Source/modules/push_messaging/PushError.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M Source/modules/push_messaging/PushError.cpp View 1 2 3 4 1 chunk +5 lines, -0 lines 0 comments Download
M Source/modules/push_messaging/PushRegistration.h View 1 2 3 4 5 2 chunks +2 lines, -6 lines 0 comments Download
M Source/modules/push_messaging/PushRegistration.cpp View 1 2 3 4 5 1 chunk +13 lines, -0 lines 0 comments Download
M Source/modules/serviceworkers/ServiceWorker.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M Source/modules/serviceworkers/ServiceWorker.cpp View 1 2 3 4 5 6 7 1 chunk +6 lines, -0 lines 0 comments Download
M Source/modules/serviceworkers/ServiceWorkerClients.cpp View 1 2 3 4 1 chunk +4 lines, -0 lines 0 comments Download
M Source/modules/serviceworkers/ServiceWorkerContainer.cpp View 1 2 3 4 5 6 7 2 chunks +4 lines, -1 line 0 comments Download
M Source/modules/serviceworkers/ServiceWorkerError.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M Source/modules/serviceworkers/ServiceWorkerError.cpp View 1 2 3 4 1 chunk +6 lines, -0 lines 0 comments Download
M Source/modules/serviceworkers/ServiceWorkerRegistration.cpp View 1 2 3 4 5 6 7 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 33 (0 generated)
nhiroki
Ptal, thanks!
6 years, 5 months ago (2014-07-16 09:17:32 UTC) #1
yhirano1
+haraken Should we suppress resolution / rejection in CallbackPromiseAdapter when the context is empty? I ...
6 years, 5 months ago (2014-07-17 01:45:00 UTC) #2
haraken
On 2014/07/17 01:45:00, yhirano1 wrote: > +haraken > > Should we suppress resolution / rejection ...
6 years, 5 months ago (2014-07-17 01:51:33 UTC) #3
nhiroki
Thank you for your comments! I chatted with yhirano1@ and we decided to take his ...
6 years, 5 months ago (2014-07-17 04:06:00 UTC) #4
nhiroki
Hmmm... apparently we cannot skip calling from() in CallbackPromiseAdapter even when the context is gone ...
6 years, 5 months ago (2014-07-17 05:57:52 UTC) #5
nhiroki
falken@: can you take a look? I have only a little confidence in this memory ...
6 years, 5 months ago (2014-07-17 05:59:00 UTC) #6
yhirano
Sorry for the confusion. lgtm of fixing the issue in ServiceWorker::from.
6 years, 5 months ago (2014-07-17 06:20:48 UTC) #7
falken
Can a test be added? On 2014/07/17 05:59:00, nhiroki wrote: > falken@: can you take ...
6 years, 5 months ago (2014-07-17 07:49:57 UTC) #8
haraken
https://codereview.chromium.org/396963002/diff/20001/Source/modules/serviceworkers/ServiceWorker.cpp File Source/modules/serviceworkers/ServiceWorker.cpp (right): https://codereview.chromium.org/396963002/diff/20001/Source/modules/serviceworkers/ServiceWorker.cpp#newcode159 Source/modules/serviceworkers/ServiceWorker.cpp:159: if (resolver->scriptState()->contextIsEmpty()) { Shouldn't this check be if(!resolver->scriptState->executionContext()) ? ...
6 years, 5 months ago (2014-07-17 07:53:36 UTC) #9
haraken
On 2014/07/17 07:49:57, falken wrote: > Can a test be added? > > On 2014/07/17 ...
6 years, 5 months ago (2014-07-17 07:55:26 UTC) #10
falken
You're right, it's inconsistent. ServiceWorker::from(resolver) is different since it's only called by CallbackPromiseAdapter. To make ...
6 years, 5 months ago (2014-07-17 08:26:14 UTC) #11
nhiroki
https://codereview.chromium.org/396963002/diff/20001/Source/modules/serviceworkers/ServiceWorker.cpp File Source/modules/serviceworkers/ServiceWorker.cpp (right): https://codereview.chromium.org/396963002/diff/20001/Source/modules/serviceworkers/ServiceWorker.cpp#newcode159 Source/modules/serviceworkers/ServiceWorker.cpp:159: if (resolver->scriptState()->contextIsEmpty()) { On 2014/07/17 07:53:36, haraken wrote: > ...
6 years, 5 months ago (2014-07-17 08:30:02 UTC) #12
yhirano1
ScriptPromiseResolver is an ActiveDOMObject, so you can get the ExecutionContext from it.
6 years, 5 months ago (2014-07-17 08:32:03 UTC) #13
haraken
> ScriptPromiseResolver is an ActiveDOMObject, so you can get the ExecutionContext > from it. Yeah, ...
6 years, 5 months ago (2014-07-17 08:34:39 UTC) #14
nhiroki
On 2014/07/17 08:34:39, haraken wrote: > > ScriptPromiseResolver is an ActiveDOMObject, so you can get ...
6 years, 5 months ago (2014-07-17 08:49:07 UTC) #15
nhiroki
On 2014/07/17 08:26:14, falken wrote: > You're right, it's inconsistent. > > ServiceWorker::from(resolver) is different ...
6 years, 5 months ago (2014-07-17 08:51:22 UTC) #16
nhiroki
Hi, I remade this CL based on the discussion with yhirano1@ and falken@. Can you ...
6 years, 5 months ago (2014-07-18 07:11:03 UTC) #17
yhirano
https://codereview.chromium.org/396963002/diff/40001/Source/bindings/core/v8/CallbackPromiseAdapter.h File Source/bindings/core/v8/CallbackPromiseAdapter.h (right): https://codereview.chromium.org/396963002/diff/40001/Source/bindings/core/v8/CallbackPromiseAdapter.h#newcode89 Source/bindings/core/v8/CallbackPromiseAdapter.h:89: if (!m_resolver || !m_resolver->executionContext()) { m_resolver cannot be null ...
6 years, 5 months ago (2014-07-18 09:00:02 UTC) #18
nhiroki
https://codereview.chromium.org/396963002/diff/40001/Source/bindings/core/v8/CallbackPromiseAdapter.h File Source/bindings/core/v8/CallbackPromiseAdapter.h (right): https://codereview.chromium.org/396963002/diff/40001/Source/bindings/core/v8/CallbackPromiseAdapter.h#newcode89 Source/bindings/core/v8/CallbackPromiseAdapter.h:89: if (!m_resolver || !m_resolver->executionContext()) { On 2014/07/18 09:00:02, yhirano ...
6 years, 5 months ago (2014-07-18 10:28:56 UTC) #19
yhirano
lgtm
6 years, 5 months ago (2014-07-22 05:56:22 UTC) #20
dominicc (has gone to gerrit)
LGTM
6 years, 5 months ago (2014-07-22 07:05:24 UTC) #21
nhiroki
+mvanouwerkerk@, could you review Source/modules/push_messaging/* as an OWNER? Thanks.
6 years, 5 months ago (2014-07-23 00:00:35 UTC) #22
nhiroki
On 2014/07/23 00:00:35, nhiroki wrote: > +mvanouwerkerk@, could you review Source/modules/push_messaging/* as an OWNER? > ...
6 years, 5 months ago (2014-07-24 13:06:20 UTC) #23
Michael van Ouwerkerk
Thanks for fixing this! https://codereview.chromium.org/396963002/diff/80001/LayoutTests/http/tests/serviceworker/chromium/resolve-after-window-close.html File LayoutTests/http/tests/serviceworker/chromium/resolve-after-window-close.html (right): https://codereview.chromium.org/396963002/diff/80001/LayoutTests/http/tests/serviceworker/chromium/resolve-after-window-close.html#newcode6 LayoutTests/http/tests/serviceworker/chromium/resolve-after-window-close.html:6: description('Test that resolving a promise ...
6 years, 5 months ago (2014-07-24 14:38:51 UTC) #24
nhiroki
Thank you for reviewing! https://codereview.chromium.org/396963002/diff/80001/LayoutTests/http/tests/serviceworker/chromium/resolve-after-window-close.html File LayoutTests/http/tests/serviceworker/chromium/resolve-after-window-close.html (right): https://codereview.chromium.org/396963002/diff/80001/LayoutTests/http/tests/serviceworker/chromium/resolve-after-window-close.html#newcode6 LayoutTests/http/tests/serviceworker/chromium/resolve-after-window-close.html:6: description('Test that resolving a promise ...
6 years, 5 months ago (2014-07-24 15:52:32 UTC) #25
nhiroki
https://codereview.chromium.org/396963002/diff/80001/LayoutTests/http/tests/serviceworker/chromium/resolve-after-window-close.html File LayoutTests/http/tests/serviceworker/chromium/resolve-after-window-close.html (right): https://codereview.chromium.org/396963002/diff/80001/LayoutTests/http/tests/serviceworker/chromium/resolve-after-window-close.html#newcode6 LayoutTests/http/tests/serviceworker/chromium/resolve-after-window-close.html:6: description('Test that resolving a promise after the window gets ...
6 years, 5 months ago (2014-07-24 15:55:33 UTC) #26
nhiroki
mvanouwerkerk@: Could you take another look?
6 years, 5 months ago (2014-07-24 16:35:39 UTC) #27
nhiroki
https://codereview.chromium.org/396963002/diff/80001/LayoutTests/http/tests/serviceworker/chromium/resolve-after-window-close.html File LayoutTests/http/tests/serviceworker/chromium/resolve-after-window-close.html (right): https://codereview.chromium.org/396963002/diff/80001/LayoutTests/http/tests/serviceworker/chromium/resolve-after-window-close.html#newcode6 LayoutTests/http/tests/serviceworker/chromium/resolve-after-window-close.html:6: description('Test that resolving a promise after the window gets ...
6 years, 5 months ago (2014-07-24 16:35:52 UTC) #28
nhiroki
mvanouwerkerk@: Friendly ping. I'd like to commit this since some issues to be fixed by ...
6 years, 4 months ago (2014-07-28 09:34:00 UTC) #29
Michael van Ouwerkerk
lgtm thanks!
6 years, 4 months ago (2014-07-28 10:42:55 UTC) #30
nhiroki
The CQ bit was checked by nhiroki@chromium.org
6 years, 4 months ago (2014-07-28 14:46:19 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/nhiroki@chromium.org/396963002/140001
6 years, 4 months ago (2014-07-28 14:47:07 UTC) #32
commit-bot: I haz the power
6 years, 4 months ago (2014-07-28 15:58:14 UTC) #33
Message was sent while issue was closed.
Change committed as 179043

Powered by Google App Engine
This is Rietveld 408576698