Bug 1873906 - DefaultURI::SetPort now throws an error if port > u16::max. r=valentin,necko-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D205123
This commit is contained in:
dylan 2024-03-20 14:43:30 +00:00
Родитель 03573054e5
Коммит 8ad6d2d634
3 изменённых файлов: 5 добавлений и 15 удалений

Просмотреть файл

@ -436,6 +436,11 @@ pub extern "C" fn mozurl_set_hostname(url: &mut MozURL, host: &nsACString) -> ns
#[no_mangle]
pub extern "C" fn mozurl_set_port_no(url: &mut MozURL, new_port: i32) -> nsresult {
debug_assert_mut!(url);
if new_port > u16::MAX as i32 {
return NS_ERROR_UNEXPECTED;
}
if url.cannot_be_a_base() {
return NS_ERROR_MALFORMED_URI;
}

Просмотреть файл

@ -25,12 +25,6 @@
[url-setters-a-area.window.html?include=mailto]
[url-setters-a-area.window.html?exclude=(file|javascript|mailto)]
[<a>: Setting <non-special://example.net:8080/path>.port = '65536' Port numbers are 16 bit integers, overflowing is an error]
expected: FAIL
[<area>: Setting <non-special://example.net:8080/path>.port = '65536' Port numbers are 16 bit integers, overflowing is an error]
expected: FAIL
[<a>: Setting <foo://somehost/some/path>.pathname = '' Non-special URLs can have their paths erased]
expected: FAIL

Просмотреть файл

@ -127,9 +127,6 @@
[URL: Setting <view-source+http://example.net/path>.port = '8080stuff2' Anything other than ASCII digit stops the port parser in a setter but is not an error]
expected: FAIL
[URL: Setting <non-special://example.net:8080/path>.port = '65536' Port numbers are 16 bit integers, overflowing is an error]
expected: FAIL
[URL: Setting <file://test/>.port = '12']
expected: FAIL
@ -429,9 +426,6 @@
[URL: Setting <non-spec:/.//p>.hostname = '']
expected: FAIL
[URL: Setting <non-special://example.net:8080/path>.port = '65536' Port numbers are 16 bit integers, overflowing is an error]
expected: FAIL
[URL: Setting <foo://somehost/some/path>.pathname = '' Non-special URLs can have their paths erased]
expected: FAIL
@ -495,9 +489,6 @@
[URL: Setting <non-spec:/.//p>.hostname = '']
expected: FAIL
[URL: Setting <non-special://example.net:8080/path>.port = '65536' Port numbers are 16 bit integers, overflowing is an error]
expected: FAIL
[URL: Setting <foo://somehost/some/path>.pathname = '' Non-special URLs can have their paths erased]
expected: FAIL