Bug 1873940 - added port check to mozurl_host_port. r=necko-reviewers,valentin

Differential Revision: https://phabricator.services.mozilla.com/D205368
This commit is contained in:
dylan 2024-03-21 22:26:08 +00:00
parent 59f4317ecf
commit 57d0a7080a
4 changed files with 4 additions and 145 deletions

View File

@ -214,7 +214,10 @@ pub extern "C" fn mozurl_real_port(url: &MozURL) -> i32 {
#[no_mangle]
pub extern "C" fn mozurl_host_port(url: &MozURL) -> SpecSlice {
(&url[Position::BeforeHost..Position::BeforePath]).into()
if url.port().is_some() {
return (&url[Position::BeforeHost..Position::BeforePath]).into();
}
url.host_str().unwrap_or("").into()
}
#[no_mangle]

View File

@ -983,42 +983,6 @@
[Parsing: <http://!"$&'()*+,-.;=_`{}~/> against <about:blank>]
expected: FAIL
[Parsing: <non-spec:/.//> against <about:blank>]
expected: FAIL
[Parsing: <non-spec:/..//> against <about:blank>]
expected: FAIL
[Parsing: <non-spec:/a/..//> against <about:blank>]
expected: FAIL
[Parsing: <non-spec:/.//path> against <about:blank>]
expected: FAIL
[Parsing: <non-spec:/..//path> against <about:blank>]
expected: FAIL
[Parsing: <non-spec:/a/..//path> against <about:blank>]
expected: FAIL
[Parsing: </.//path> against <non-spec:/p>]
expected: FAIL
[Parsing: </..//path> against <non-spec:/p>]
expected: FAIL
[Parsing: <..//path> against <non-spec:/p>]
expected: FAIL
[Parsing: <a/..//path> against <non-spec:/p>]
expected: FAIL
[Parsing: <> against <non-spec:/..//p>]
expected: FAIL
[Parsing: <path> against <non-spec:/..//p>]
expected: FAIL
[Parsing: <wss://!"$&'()*+,-.;=_`{}~/> against <about:blank>]
expected: FAIL

View File

@ -1012,42 +1012,6 @@
[Parsing: <http://!"$&'()*+,-.;=_`{}~/> against <about:blank>]
expected: FAIL
[Parsing: <non-spec:/.//> against <about:blank>]
expected: FAIL
[Parsing: <non-spec:/..//> against <about:blank>]
expected: FAIL
[Parsing: <non-spec:/a/..//> against <about:blank>]
expected: FAIL
[Parsing: <non-spec:/.//path> against <about:blank>]
expected: FAIL
[Parsing: <non-spec:/..//path> against <about:blank>]
expected: FAIL
[Parsing: <non-spec:/a/..//path> against <about:blank>]
expected: FAIL
[Parsing: </.//path> against <non-spec:/p>]
expected: FAIL
[Parsing: </..//path> against <non-spec:/p>]
expected: FAIL
[Parsing: <..//path> against <non-spec:/p>]
expected: FAIL
[Parsing: <a/..//path> against <non-spec:/p>]
expected: FAIL
[Parsing: <> against <non-spec:/..//p>]
expected: FAIL
[Parsing: <path> against <non-spec:/..//p>]
expected: FAIL
[Parsing: <wss://!"$&'()*+,-.;=_`{}~/> against <about:blank>]
expected: FAIL

View File

@ -1203,24 +1203,6 @@
[url-constructor.any.worker.html?exclude=(file|javascript|mailto)]
[Parsing: </.//path> against <non-spec:/p>]
expected: FAIL
[Parsing: </..//path> against <non-spec:/p>]
expected: FAIL
[Parsing: <..//path> against <non-spec:/p>]
expected: FAIL
[Parsing: <a/..//path> against <non-spec:/p>]
expected: FAIL
[Parsing: <> against <non-spec:/..//p>]
expected: FAIL
[Parsing: <path> against <non-spec:/..//p>]
expected: FAIL
[Parsing: <http://example.com/foo/%2e> without base]
expected: FAIL
@ -1230,24 +1212,6 @@
[Parsing: <http://!"$&'()*+,-.;=_`{}~/> without base]
expected: FAIL
[Parsing: <non-spec:/.//> without base]
expected: FAIL
[Parsing: <non-spec:/..//> without base]
expected: FAIL
[Parsing: <non-spec:/a/..//> without base]
expected: FAIL
[Parsing: <non-spec:/.//path> without base]
expected: FAIL
[Parsing: <non-spec:/..//path> without base]
expected: FAIL
[Parsing: <non-spec:/a/..//path> without base]
expected: FAIL
[Parsing: <wss://!"$&'()*+,-.;=_`{}~/> without base]
expected: FAIL
@ -1590,24 +1554,6 @@
[url-constructor.any.html?exclude=(file|javascript|mailto)]
[Parsing: </.//path> against <non-spec:/p>]
expected: FAIL
[Parsing: </..//path> against <non-spec:/p>]
expected: FAIL
[Parsing: <..//path> against <non-spec:/p>]
expected: FAIL
[Parsing: <a/..//path> against <non-spec:/p>]
expected: FAIL
[Parsing: <> against <non-spec:/..//p>]
expected: FAIL
[Parsing: <path> against <non-spec:/..//p>]
expected: FAIL
[Parsing: <http://example.com/foo/%2e> without base]
expected: FAIL
@ -1617,24 +1563,6 @@
[Parsing: <http://!"$&'()*+,-.;=_`{}~/> without base]
expected: FAIL
[Parsing: <non-spec:/.//> without base]
expected: FAIL
[Parsing: <non-spec:/..//> without base]
expected: FAIL
[Parsing: <non-spec:/a/..//> without base]
expected: FAIL
[Parsing: <non-spec:/.//path> without base]
expected: FAIL
[Parsing: <non-spec:/..//path> without base]
expected: FAIL
[Parsing: <non-spec:/a/..//path> without base]
expected: FAIL
[Parsing: <wss://!"$&'()*+,-.;=_`{}~/> without base]
expected: FAIL