Closed Bug 1314341 Opened 3 years ago Closed 3 years ago

Missing check for baseURI in ServiceWorkerManager::Register

Categories

(Core :: DOM: Service Workers, defect)

50 Branch
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox52 --- fixed

People

(Reporter: baku, Assigned: baku)

Details

Attachments

(1 file)

Attached patch sw.patchSplinter Review
I found this writing a browser mochitest. Probably this cannot be reproduced in 'normal' content pages.
Attachment #8806440 - Flags: review?(bkelly)
Comment on attachment 8806440 [details] [diff] [review]
sw.patch

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

::: dom/workers/ServiceWorkerContainer.cpp
@@ +202,5 @@
> +        nsAutoCString spec;
> +        scriptURI->GetSpec(spec);
> +        NS_ConvertUTF8toUTF16 wSpec(spec);
> +        aRv.ThrowTypeError<MSG_INVALID_SCOPE>(aOptions.mScope.Value(), wSpec);
> +      }

nit: Can you use ternary to set the URI pointer and then avoid duplicating the rest here?  Like:

  nsIURI* uri = baseURI ? baseURI : scriptURI;
  nsAutoCString spec;
  uri->GetSpec(spec);
  // etc
Attachment #8806440 - Flags: review?(bkelly) → review+
Pushed by amarchesini@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/cd3745be7445
Missing check for baseURI in ServiceWorkerManager::Register, r=bkelly
https://hg.mozilla.org/mozilla-central/rev/cd3745be7445
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
You need to log in before you can comment on or make changes to this bug.