summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dom/base/Location.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/dom/base/Location.cpp b/dom/base/Location.cpp
index 5f8738298..35da1cb8e 100644
--- a/dom/base/Location.cpp
+++ b/dom/base/Location.cpp
@@ -33,6 +33,7 @@
#include "nsCycleCollectionParticipant.h"
#include "nsNullPrincipal.h"
#include "ScriptSettings.h"
+#include "mozilla/Unused.h"
#include "mozilla/dom/LocationBinding.h"
namespace mozilla {
@@ -716,7 +717,13 @@ Location::SetProtocol(const nsAString& aProtocol)
return rv;
}
- rv = uri->SetScheme(NS_ConvertUTF16toUTF8(aProtocol));
+ nsAString::const_iterator start, end;
+ aProtocol.BeginReading(start);
+ aProtocol.EndReading(end);
+ nsAString::const_iterator iter(start);
+ Unused << FindCharInReadable(':', iter, end);
+
+ rv = uri->SetScheme(NS_ConvertUTF16toUTF8(Substring(start, iter)));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}