Bug 1314341 - Missing check for baseURI in ServiceWorkerManager::Register, r=bkelly
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 01 Nov 2016 21:46:24 +0100
changeset 347308 cd3745be744588e6cbd802def770a96e425fe6f1
parent 347307 59d33178b0cd6f7f2beb630a6cc70c8b299b8939
child 347309 6c32452df00e86d86e65b5097ea253f488816067
push id10298
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:33:03 +0000
treeherdermozilla-aurora@7e29173b1641 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbkelly
bugs1314341
milestone52.0a1
Bug 1314341 - Missing check for baseURI in ServiceWorkerManager::Register, r=bkelly
dom/workers/ServiceWorkerContainer.cpp
--- a/dom/workers/ServiceWorkerContainer.cpp
+++ b/dom/workers/ServiceWorkerContainer.cpp
@@ -188,18 +188,19 @@ ServiceWorkerContainer::Register(const n
       aRv.ThrowTypeError<MSG_INVALID_SCOPE>(defaultScope, wSpec);
       return nullptr;
     }
   } else {
     // Step 5. Parse against entry settings object's base URL.
     rv = NS_NewURI(getter_AddRefs(scopeURI), aOptions.mScope.Value(),
                    nullptr, baseURI);
     if (NS_WARN_IF(NS_FAILED(rv))) {
+      nsIURI* uri = baseURI ? baseURI : scriptURI;
       nsAutoCString spec;
-      baseURI->GetSpec(spec);
+      uri->GetSpec(spec);
       NS_ConvertUTF8toUTF16 wSpec(spec);
       aRv.ThrowTypeError<MSG_INVALID_SCOPE>(aOptions.mScope.Value(), wSpec);
       return nullptr;
     }
 
     aRv = CheckForSlashEscapedCharsInPath(scopeURI);
     if (NS_WARN_IF(aRv.Failed())) {
       return nullptr;