WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
180329
Implement self.skipWaiting() inside service workers
https://bugs.webkit.org/show_bug.cgi?id=180329
Summary
Implement self.skipWaiting() inside service workers
Chris Dumez
Reported
2017-12-02 23:23:45 PST
Implement self.skipWaiting() inside service workers.
Attachments
Patch
(24.43 KB, patch)
2017-12-02 23:53 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(24.54 KB, patch)
2017-12-02 23:56 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Chris Dumez
Comment 1
2017-12-02 23:53:41 PST
Created
attachment 328285
[details]
Patch
Chris Dumez
Comment 2
2017-12-02 23:56:54 PST
Created
attachment 328286
[details]
Patch
WebKit Commit Bot
Comment 3
2017-12-03 12:33:01 PST
Comment on
attachment 328286
[details]
Patch Clearing flags on attachment: 328286 Committed
r225460
: <
https://trac.webkit.org/changeset/225460
>
WebKit Commit Bot
Comment 4
2017-12-03 12:33:03 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 5
2017-12-03 12:34:19 PST
<
rdar://problem/35820007
>
youenn fablet
Comment 6
2017-12-03 14:08:53 PST
View in context:
https://bugs.webkit.org/attachment.cgi?id=328286&action=review
> Source/WebCore/workers/service/ServiceWorkerGlobalScope.cpp:56 > + thread().runLoop().postTask([promise = WTFMove(promise), protectedThis = WTFMove(protectedThis)](auto&) {
I wonder what ensures thread() to be valid at that point. Is there anything that prevents the worker to be terminated and the run loop to be stopped?
Chris Dumez
Comment 7
2017-12-03 14:41:46 PST
(In reply to youenn fablet from
comment #6
)
> View in context: >
https://bugs.webkit.org/attachment.cgi?id=328286&action=review
> > > Source/WebCore/workers/service/ServiceWorkerGlobalScope.cpp:56 > > + thread().runLoop().postTask([promise = WTFMove(promise), protectedThis = WTFMove(protectedThis)](auto&) { > > I wonder what ensures thread() to be valid at that point. > Is there anything that prevents the worker to be terminated and the run loop > to be stopped?
The WorkerThread stays alive longer that the WorkerGlobalScope, which is why WorkerGlobalScope::m_thread is a WorkerThread&. I do ref the WorkerGlobalScope here so if accessing thread() should be safe AFAICT.
youenn fablet
Comment 8
2017-12-03 21:01:02 PST
(In reply to Chris Dumez from
comment #7
)
> (In reply to youenn fablet from
comment #6
) > > View in context: > >
https://bugs.webkit.org/attachment.cgi?id=328286&action=review
> > > > > Source/WebCore/workers/service/ServiceWorkerGlobalScope.cpp:56 > > > + thread().runLoop().postTask([promise = WTFMove(promise), protectedThis = WTFMove(protectedThis)](auto&) { > > > > I wonder what ensures thread() to be valid at that point. > > Is there anything that prevents the worker to be terminated and the run loop > > to be stopped? > > The WorkerThread stays alive longer that the WorkerGlobalScope, which is why > WorkerGlobalScope::m_thread is a WorkerThread&. I do ref the > WorkerGlobalScope here so if accessing thread() should be safe AFAICT.
I might be missing something here. I am not sure how we can guarantee that WorkerThread always stays alive longer than WorkerGlobalScope. They have different refcounts. Also, even if not destroyed, it seems feasible with the patch that we will post a task on a closed worker thread/message queue. In that case, I would guess that the task will not be executed/destroyed on the worker thread. I haven't looked at how postTask/messageQueue works precisely so maybe I am misunderstanding something here. Let's discuss this in person tomorrow.
Chris Dumez
Comment 9
2017-12-04 13:23:45 PST
(In reply to youenn fablet from
comment #8
)
> (In reply to Chris Dumez from
comment #7
) > > (In reply to youenn fablet from
comment #6
) > > > View in context: > > >
https://bugs.webkit.org/attachment.cgi?id=328286&action=review
> > > > > > > Source/WebCore/workers/service/ServiceWorkerGlobalScope.cpp:56 > > > > + thread().runLoop().postTask([promise = WTFMove(promise), protectedThis = WTFMove(protectedThis)](auto&) { > > > > > > I wonder what ensures thread() to be valid at that point. > > > Is there anything that prevents the worker to be terminated and the run loop > > > to be stopped? > > > > The WorkerThread stays alive longer that the WorkerGlobalScope, which is why > > WorkerGlobalScope::m_thread is a WorkerThread&. I do ref the > > WorkerGlobalScope here so if accessing thread() should be safe AFAICT. > > I might be missing something here. > I am not sure how we can guarantee that WorkerThread always stays alive > longer than WorkerGlobalScope. > They have different refcounts. > > Also, even if not destroyed, it seems feasible with the patch that we will > post a task on a closed worker thread/message queue. > In that case, I would guess that the task will not be executed/destroyed on > the worker thread. I haven't looked at how postTask/messageQueue works > precisely so maybe I am misunderstanding something here. Let's discuss this > in person tomorrow.
Filed
https://bugs.webkit.org/show_bug.cgi?id=180372
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug