-
Notifications
You must be signed in to change notification settings - Fork 15.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add API for receiving logs from service workers #20624
Conversation
@MarshallOfSound Is |
@MarshallOfSound should we also deprecate |
@miniak |
e5d35cc
to
46bc01f
Compare
Removing WIP as this is ready for code review. I'll work on tests shortly 👍 |
46bc01f
to
ebd981c
Compare
|
||
namespace { | ||
|
||
std::string MessageSourceToString( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gin converter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, please add tests.
fc0a70d
to
4a0ec9c
Compare
|
||
* `scriptUrl` String - The full URL to the script that this service worker runs | ||
* `scope` String - The base URL that this service worker is active for. | ||
* `renderProcessId` Number - The virtual ID of the process that this service worker is running in. This is not an OS level PID. This aligns with the ID set used for `webContents.getProcessId()`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we wanted to add e.g. methods for killing / restarting service workers, would they go on this object? e.g.
session.defaultSession.serviceWorkers.getAllRunning().forEach(sw => sw.shutdown())
or something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either that, or have serviceWorkers.stopByVersionId(versionid)
Co-Authored-By: Jeremy Apthorp <jeremya@chromium.org>
9599b43
to
770c164
Compare
Release Notes Persisted
|
I have automatically backported this PR to "9-x-y", please check out #22313 |
Pretty simple API here, plans are for the following
console-message
event. Vaguely equivalent to theconsole-message
event on thewebContents
API so that apps can capture logs from their service workers.getWorkerInfoFromID()
Get service worker scope and script url for a given IDgetRunningWorkerInfos()
Get service worker scope, script url and id for all active workersThe second two APIs are blocked on a Chromium roll hence
WIP
, the event is already implemented.TODO:
console-message
getAll()
getFromVersionId()
Notes: Added
session.serviceWorkerContext
API to access basic service worker info and receive console logs from service workers.