summaryrefslogtreecommitdiff
path: root/dom/base/Location.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-12-16 14:35:55 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-12-16 14:37:40 +0100
commitb67dccac91beac61d8124737a707ff8980d55ac7 (patch)
tree00bbf03be10d6c5bd89f4ef19f0f05b1e2e64004 /dom/base/Location.cpp
parent5f2365cc3582137e31a2564c55351911eedea9d4 (diff)
downloadaura-central-b67dccac91beac61d8124737a707ff8980d55ac7.tar.gz
Issue mcp-graveyard/UXP%910 part 2. Strip ':' and anything following it from the string passed to the location.protocol setter.
Diffstat (limited to 'dom/base/Location.cpp')
-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;
}