diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-12-16 14:35:55 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-12-16 14:37:40 +0100 |
commit | 871c1d78cea69802a2584cbe76fbaf19962bc443 (patch) | |
tree | 00bbf03be10d6c5bd89f4ef19f0f05b1e2e64004 | |
parent | aa130641c261789528d81c5bc34b2da7a90bdc40 (diff) | |
download | UXP-871c1d78cea69802a2584cbe76fbaf19962bc443.tar UXP-871c1d78cea69802a2584cbe76fbaf19962bc443.tar.gz UXP-871c1d78cea69802a2584cbe76fbaf19962bc443.tar.lz UXP-871c1d78cea69802a2584cbe76fbaf19962bc443.tar.xz UXP-871c1d78cea69802a2584cbe76fbaf19962bc443.zip |
Issue #910 part 2. Strip ':' and anything following it from the string passed to the location.protocol setter.
-rw-r--r-- | dom/base/Location.cpp | 9 |
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; } |