feat: service worker preload scripts for improved extensions support (#44411)
* feat: preload scripts for service workers * feat: service worker IPC * test: service worker preload scripts and ipc
This commit is contained in:
parent
bc22ee7897
commit
26da3c5d6e
67 changed files with 2103 additions and 298 deletions
|
@ -27,8 +27,9 @@ describe('session.serviceWorkers', () => {
|
|||
const uuid = v4();
|
||||
|
||||
server = http.createServer((req, res) => {
|
||||
const url = new URL(req.url!, `http://${req.headers.host}`);
|
||||
// /{uuid}/{file}
|
||||
const file = req.url!.split('/')[2]!;
|
||||
const file = url.pathname!.split('/')[2]!;
|
||||
|
||||
if (file.endsWith('.js')) {
|
||||
res.setHeader('Content-Type', 'application/javascript');
|
||||
|
@ -76,7 +77,7 @@ describe('session.serviceWorkers', () => {
|
|||
describe('console-message event', () => {
|
||||
it('should correctly keep the source, message and level', async () => {
|
||||
const messages: Record<string, Electron.MessageDetails> = {};
|
||||
w.loadURL(`${baseUrl}/logs.html`);
|
||||
w.loadURL(`${baseUrl}/index.html?scriptUrl=sw-logs.js`);
|
||||
for await (const [, details] of on(ses.serviceWorkers, 'console-message')) {
|
||||
messages[details.message] = details;
|
||||
expect(details).to.have.property('source', 'console-api');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue