Closed Bug 1876533 Opened 10 months ago Closed 10 months ago

ServiceWorker target not created when file URL contains port

Categories

(DevTools :: Framework, defect)

defect

Tracking

(firefox124 fixed)

RESOLVED FIXED
124 Branch
Tracking Status
firefox124 --- fixed

People

(Reporter: nchevobbe, Assigned: nchevobbe)

Details

Attachments

(1 file)

I was testing service worker with a simple local server, serving the files on localhost:8000 and couldn't get the service worker target to be created (devtools.debugger.features.windowless-service-workers was set to true)

This is because in https://searchfox.org/mozilla-central/rev/a2709c2f0e31b2ad1a7b6447117626a34063fe57/devtools/server/connectors/process-actor/DevToolsServiceWorkerChild.sys.mjs#363,378-379

_shouldHandleWorker(sessionData, dbg) {
...
  const workerHost = dbg.principal.host;
  return workerHost == sessionData["browser-element-host"][0];

dbg.principal.host was "localhost", butsessionData["browser-element-host"][0]was"localhost:8000"`.

The following change

-    const workerHost = dbg.principal.host;
+    const workerHost = dbg.principal.hostPort;
     return workerHost == sessionData["browser-element-host"][0];
   }

does fix the issue, as hostPort does include the port

Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6ba2007531f3 [devtools] Use principal hostPort in DevToolsServiceWorkerChild _shouldHandleWorker. r=devtools-reviewers,ochameau.
Status: ASSIGNED → RESOLVED
Closed: 10 months ago
Resolution: --- → FIXED
Target Milestone: --- → 124 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: