Closed Bug 1253738 Opened 9 years ago Closed 9 years ago

ServiceWorkerManager stores a single RegistrationDataPerPrincipal for all principals with same origin attributes

Categories

(Core :: DOM: Service Workers, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla48
Tracking Status
firefox47 --- affected
firefox48 --- fixed

People

(Reporter: bkelly, Assigned: bkelly)

References

Details

Attachments

(3 files, 2 obsolete files)

While investigating another bug I found that we are not actually storing separate RegistrationDataPerPrincipal structures for each principal. Instead we are storing a single struct for all principals with the same extended origin attributes. In desktop this mean nearly all principals end up with a single struct. This will mostly work, but it means all domains are sharing job queues, etc. We also have much slower lookup of registrations by scope since its O(n) across all registrations in the system.
Try is looking pretty green: https://treeherder.mozilla.org/#/jobs?repo=try&revision=a7c9f05f070e I'm going to clean up the patch for review.
In preparation for using something other than origin attributes for the scope key, require all clients to pass a full nsIPrincipal when looking up a registration.
Attachment #8727547 - Attachment is obsolete: true
Attachment #8727607 - Flags: review?(amarchesini)
Also rename variable to use the "scope key" terminology instead of referencing the origin suffix. I stopped short of creating an opaque ScopeKey type because its nice to be able to just pass strings around.
Attachment #8727608 - Flags: review?(amarchesini)
Change PrincipalToScopeKey() to use nsIPrincipal::GetOrigin(). This ensures that the hash table keys for different principals do not collide. The origin string produced by nsIPrincipal is guaranteed to contain the suffix if present. Also assert that we are not setting empty scope keys in the future.
Attachment #8727609 - Flags: review?(amarchesini)
Attachment #8727607 - Flags: review?(amarchesini) → review+
Attachment #8727608 - Flags: review?(amarchesini) → review+
Attachment #8727609 - Flags: review?(amarchesini) → review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: