summaryrefslogtreecommitdiffstats
path: root/dom
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-12-16 14:50:28 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-12-16 14:50:28 +0100
commitd0b9276f20ad59bd3b336e41ff575a37064cf283 (patch)
tree6a29fa2bfa80edef17bcbb9392a3bdd257952446 /dom
parent871c1d78cea69802a2584cbe76fbaf19962bc443 (diff)
downloadUXP-d0b9276f20ad59bd3b336e41ff575a37064cf283.tar
UXP-d0b9276f20ad59bd3b336e41ff575a37064cf283.tar.gz
UXP-d0b9276f20ad59bd3b336e41ff575a37064cf283.tar.lz
UXP-d0b9276f20ad59bd3b336e41ff575a37064cf283.tar.xz
UXP-d0b9276f20ad59bd3b336e41ff575a37064cf283.zip
Issue #910 part 3. Throw SyntaxError from Location::SetProtocol on URI parse failures.
Diffstat (limited to 'dom')
-rw-r--r--dom/base/Location.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/dom/base/Location.cpp b/dom/base/Location.cpp
index 35da1cb8e..e312cffe0 100644
--- a/dom/base/Location.cpp
+++ b/dom/base/Location.cpp
@@ -725,7 +725,7 @@ Location::SetProtocol(const nsAString& aProtocol)
rv = uri->SetScheme(NS_ConvertUTF16toUTF8(Substring(start, iter)));
if (NS_WARN_IF(NS_FAILED(rv))) {
- return rv;
+ return NS_ERROR_DOM_SYNTAX_ERR;
}
nsAutoCString newSpec;
rv = uri->GetSpec(newSpec);
@@ -735,6 +735,9 @@ Location::SetProtocol(const nsAString& aProtocol)
// We may want a new URI class for the new URI, so recreate it:
rv = NS_NewURI(getter_AddRefs(uri), newSpec);
if (NS_FAILED(rv)) {
+ if (rv == NS_ERROR_MALFORMED_URI) {
+ rv = NS_ERROR_DOM_SYNTAX_ERR;
+ }
return rv;
}