mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 23:08:39 +09:00
Issue #910 part 3. Throw SyntaxError from Location::SetProtocol on URI parse failures.
This commit is contained in:
parent
a6eab2d84e
commit
4aacec4782
1 changed files with 4 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue