Bug 1194562 - Pass wide strings to ThrowTypeError. r=mccr8, a=dveditz
authorNikhil Marathe <nsm.nikhil@gmail.com>
Tue, 18 Aug 2015 12:59:44 -0700
changeset 288852 f42fa2b6cc429a235ad8cffe905f9cdf06273f59
parent 288851 b6460380ae8c6c56609f636f42a260c61a4c6f7c
child 288853 f973a86d54b17c2b11aced5489542fa0c20c0511
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8, dveditz
bugs1194562
milestone42.0a2
Bug 1194562 - Pass wide strings to ThrowTypeError. r=mccr8, a=dveditz
dom/workers/ServiceWorkerContainer.cpp
--- a/dom/workers/ServiceWorkerContainer.cpp
+++ b/dom/workers/ServiceWorkerContainer.cpp
@@ -132,29 +132,31 @@ ServiceWorkerContainer::Register(const n
   // Step 4. If none passed, parse against script's URL
   if (!aOptions.mScope.WasPassed()) {
     NS_NAMED_LITERAL_STRING(defaultScope, "./");
     rv = NS_NewURI(getter_AddRefs(scopeURI), defaultScope,
                    nullptr, scriptURI);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       nsAutoCString spec;
       scriptURI->GetSpec(spec);
-      aRv.ThrowTypeError(MSG_INVALID_SCOPE, &defaultScope, &spec);
+      NS_ConvertUTF8toUTF16 wSpec(spec);
+      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, window->GetDocBaseURI());
     if (NS_WARN_IF(NS_FAILED(rv))) {
       nsAutoCString spec;
       if (window->GetDocBaseURI()) {
         window->GetDocBaseURI()->GetSpec(spec);
       }
-      aRv.ThrowTypeError(MSG_INVALID_SCOPE, &aOptions.mScope.Value(), &spec);
+      NS_ConvertUTF8toUTF16 wSpec(spec);
+      aRv.ThrowTypeError(MSG_INVALID_SCOPE, &aOptions.mScope.Value(), &wSpec);
       return nullptr;
     }
   }
 
   aRv = swm->Register(window, scopeURI, scriptURI, getter_AddRefs(promise));
   if (aRv.Failed()) {
     return nullptr;
   }