Closed Bug 1598047 Opened 5 years ago Closed 5 years ago

r.registrationFront error causes Debugger's sources to fail loading

Categories

(DevTools :: Debugger, defect, P2)

defect

Tracking

(firefox-esr68 unaffected, firefox71 unaffected, firefox72 fixed)

RESOLVED FIXED
Firefox 72
Tracking Status
firefox-esr68 --- unaffected
firefox71 --- unaffected
firefox72 --- fixed

People

(Reporter: Harald, Assigned: jdescottes)

References

(Regression)

Details

(Keywords: regression)

Attachments

(2 files)

Attached image image.png

Happens twice when opening Debugger on https://firefox-dev.tools/debugger-examples/examples/todomvc/ . Couldn't reproduce after restart.

Debugger sources didn't load.
Console links to Debugger didn't work.

I think what happens is that we process two workers of type "service", where one doesn't have a matching registration. This means we create a "fake" service worker at :

            worker.fetch = front.fetch;

            // If a service worker registration could not be found, this means we are in
            // e10s, and registrations are not forwarded to other processes until they
            // reach the activated state. Augment the worker as a registration worker to
            // display it in aboutdebugging.
            worker.scope = front.scope;
            worker.active = false;
            result.service.push(worker);

this worker has no registrationFront, so the next time we get a worker of type service and loop on all existing "service workers", we will crash.

The code that throws is

            const { isParentInterceptEnabled } = r.registrationFront.traits;
            if (!r.newestWorkerId || !isParentInterceptEnabled) {
              return r.scope === front.scope;
            }

I think we should have made isParentInterceptEnabled a root actor trait instead of a service-worker-registration trait, but here since r.newestWorkerId should also be false in this situation, checking isParentInterceptEnabled is not needed.

Changing this code to:

            // r.registrationFront might be undefined if the service worker was just created from a worker without
            // any associated registration
            const isParentInterceptEnabled = r.registrationFront ? r.registrationFront.traits.isParentInterceptEnabled : false;
            if (!r.newestWorkerId || !isParentInterceptEnabled) {
              return r.scope === front.scope;
            }

should be enough. Might be hard to write a test for it though.

Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Regressed by: 1563607
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/82f59a83b7df
Fix js error when calling listAllWorkers with service workers missing their registration r=ladybenko
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 72
QA Whiteboard: [qa-72b-p2]
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: