summaryrefslogtreecommitdiff
path: root/dom/base
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
commit26a0ca5051067acac4794266b63f13b3abf1a564 (patch)
tree6a29fa2bfa80edef17bcbb9392a3bdd257952446 /dom/base
parent45e70aba07a535edad21e33dec1cb0bb41f32961 (diff)
downloaduxp-26a0ca5051067acac4794266b63f13b3abf1a564.tar.gz
Issue mcp-graveyard/UXP#910 part 3. Throw SyntaxError from Location::SetProtocol on URI parse failures.
Diffstat (limited to 'dom/base')
-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 35da1cb8e4..e312cffe00 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;
}