Bug 180566

Summary: Service Worker should use a correct user agent
Product: WebKit Reporter: youenn fablet <youennf>
Component: Service WorkersAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, beidson, cdumez, commit-queue, dbates, ews-watchlist, ggaren, japhet, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Addendum none

youenn fablet
Reported 2017-12-07 19:05:45 PST
Currently, it is the empty string
Attachments
Patch (27.00 KB, patch)
2017-12-08 13:26 PST, youenn fablet
no flags
Patch (26.84 KB, patch)
2017-12-08 14:31 PST, youenn fablet
no flags
Patch (27.96 KB, patch)
2017-12-08 15:20 PST, youenn fablet
no flags
Patch (27.73 KB, patch)
2017-12-08 16:18 PST, youenn fablet
no flags
Addendum (1.89 KB, patch)
2017-12-08 21:04 PST, youenn fablet
no flags
Radar WebKit Bug Importer
Comment 1 2017-12-07 19:06:02 PST
youenn fablet
Comment 2 2017-12-08 13:26:25 PST
EWS Watchlist
Comment 3 2017-12-08 13:28:36 PST
Attachment 328861 [details] did not pass style-queue: ERROR: Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h:91: The parameter name "userAgent" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/WebCore/workers/service/context/ServiceWorkerThread.cpp:74: Missing spaces around : [whitespace/init] [4] Total errors found: 2 in 19 files If any of these errors are false positives, please file a bug against check-webkit-style.
youenn fablet
Comment 4 2017-12-08 14:31:34 PST
EWS Watchlist
Comment 5 2017-12-08 14:34:35 PST
Attachment 328870 [details] did not pass style-queue: ERROR: Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h:90: The parameter name "userAgent" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/WebCore/workers/service/context/ServiceWorkerThread.cpp:74: Missing spaces around : [whitespace/init] [4] Total errors found: 2 in 19 files If any of these errors are false positives, please file a bug against check-webkit-style.
youenn fablet
Comment 6 2017-12-08 15:20:37 PST
EWS Watchlist
Comment 7 2017-12-08 15:21:50 PST
Attachment 328877 [details] did not pass style-queue: ERROR: Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h:90: The parameter name "userAgent" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/WebCore/workers/service/context/ServiceWorkerThread.cpp:74: Missing spaces around : [whitespace/init] [4] Total errors found: 2 in 20 files If any of these errors are false positives, please file a bug against check-webkit-style.
Chris Dumez
Comment 8 2017-12-08 15:24:53 PST
Comment on attachment 328870 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=328870&action=review > Source/WebKit/UIProcess/WebPageProxy.cpp:2355 > + process().processPool().updateServiceWorkerUserAgent(userAgent()); Seems like it would be more robust if this were in WebPageProxy::setUserAgent(), no? Also, this looks hackish so I think it deserves a FIXME comment. > Source/WebKit/UIProcess/WebProcessPool.cpp:1030 > + updateServiceWorkerUserAgent(pageProxy->userAgent()); Won't this temporarily reset the SW user agent to some default one until WebPageProxy::setUserAgent() gets called with the proper one? Given that the SW process is shared between all pages, I slightly worry about frequent changes to the SW process user agent (especially with sometimes a wrong user agent). A ServiceWorker may get spawned at any time, and one it is spawned, its user agent persists. Therefore, if it ended up using a bad user agent (bad luck), it is stuck with this bad user agent.
youenn fablet
Comment 9 2017-12-08 16:18:11 PST
EWS Watchlist
Comment 10 2017-12-08 16:20:27 PST
Attachment 328882 [details] did not pass style-queue: ERROR: Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h:90: The parameter name "userAgent" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/WebCore/workers/service/context/ServiceWorkerThread.cpp:74: Missing spaces around : [whitespace/init] [4] Total errors found: 2 in 20 files If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Commit Bot
Comment 11 2017-12-08 17:06:02 PST
Comment on attachment 328882 [details] Patch Clearing flags on attachment: 328882 Committed r225716: <https://trac.webkit.org/changeset/225716>
WebKit Commit Bot
Comment 12 2017-12-08 17:06:04 PST
All reviewed patches have been landed. Closing bug.
youenn fablet
Comment 13 2017-12-08 21:04:30 PST
Reopening to attach new patch.
youenn fablet
Comment 14 2017-12-08 21:04:32 PST
Created attachment 328901 [details] Addendum
youenn fablet
Comment 15 2017-12-08 21:05:28 PST
(In reply to youenn fablet from comment #14) > Created attachment 328901 [details] > Addendum We actually need to set the user agent when starting the SW for Safari.
WebKit Commit Bot
Comment 16 2017-12-08 21:36:40 PST
Comment on attachment 328901 [details] Addendum Clearing flags on attachment: 328901 Committed r225720: <https://trac.webkit.org/changeset/225720>
WebKit Commit Bot
Comment 17 2017-12-08 21:36:42 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.