Closed Bug 1132141 Opened 5 years ago Closed 5 years ago

Update storage when ServiceWorker registration fails.

Categories

(Core :: DOM: Workers, defect)

33 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla39
Tracking Status
firefox39 --- fixed

People

(Reporter: nsm, Assigned: nsm)

References

Details

Attachments

(1 file)

If register() fails, remove the registration we've persisted.
Assignee: nobody → nsm.nikhil
Status: NEW → ASSIGNED
Comment on attachment 8562929 [details] [diff] [review]
Update storage when ServiceWorker registration fails

Review of attachment 8562929 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/workers/ServiceWorkerManager.cpp
@@ +2416,5 @@
> +{
> +  MOZ_ASSERT(aRegistration);
> +  MOZ_ASSERT(!aRegistration->IsControllingDocuments());
> +  MOZ_ASSERT(mServiceWorkerRegistrationInfos.Contains(aRegistration->mScope));
> +  ServiceWorkerManager::RemoveScope(mOrderedScopes, aRegistration->mScope);

you don't need ServiceWorkerManager:: right?

@@ +2436,5 @@
> +  PrincipalInfo principalInfo;
> +  if (NS_WARN_IF(NS_FAILED(PrincipalToPrincipalInfo(reg->mPrincipal,
> +                                                    &principalInfo)))) {
> +    //XXXnsm I can't think of any other reason a stored principal would fail to
> +    //convert.

then just do:
NS_ALWAYS_TRUE(NS_SUCCEEDED(PrincipalToPrincipalInfo(...
Attachment #8562929 - Flags: review?(amarchesini) → review+
https://hg.mozilla.org/mozilla-central/rev/2ebbc5550931
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
You need to log in before you can comment on or make changes to this bug.