Bug 1770485 - Make content process socket threads use a regular event loop, with a pref r=necko-reviewers,kershaw

The custom event loop is only needed in the parent process or socket
process, where it is used to interleave runnable processing with
socket response processing.
But in content processes, we don't get any data from any socket directly.

Pref added, and pref disabled for many necko xpcshell tests

Differential Revision: https://phabricator.services.mozilla.com/D147094
This commit is contained in:
Markus Stange 2022-06-09 11:59:38 +00:00
Родитель 36556574f8
Коммит 01d0f7dcc5
4 изменённых файлов: 66 добавлений и 4 удалений

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

@ -1,9 +1,11 @@
[DEFAULT]
head =
skip-if = toolkit == 'android'
skip-if = toolkit == 'android' || socketprocess_networking
support-files =
!/dom/base/test/unit/test_bug553888.js
!/dom/base/test/unit/test_xhr_document.js
[test_bug553888_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_xhr_document_ipc.js]
prefs = network.allow_raw_sockets_in_content_processes=true

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

@ -11182,6 +11182,11 @@
value: 1
mirror: always
- name: network.allow_raw_sockets_in_content_processes
type: bool
value: false
mirror: once
#---------------------------------------------------------------------------
# Prefs starting with "nglayout."
#---------------------------------------------------------------------------

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

@ -17,6 +17,7 @@
#include "mozilla/PublicSSL.h"
#include "mozilla/ReverseIterator.h"
#include "mozilla/Services.h"
#include "mozilla/StaticPrefs_network.h"
#include "mozilla/Telemetry.h"
#include "nsASocketHandler.h"
#include "nsError.h"
@ -768,9 +769,26 @@ nsSocketTransportService::Init() {
}
nsCOMPtr<nsIThread> thread;
nsresult rv =
NS_NewNamedThread("Socket Thread", getter_AddRefs(thread), this);
NS_ENSURE_SUCCESS(rv, rv);
if (!XRE_IsContentProcess() ||
StaticPrefs::network_allow_raw_sockets_in_content_processes_AtStartup()) {
nsresult rv =
NS_NewNamedThread("Socket Thread", getter_AddRefs(thread), this);
NS_ENSURE_SUCCESS(rv, rv);
} else {
// In the child process, we just want a regular nsThread with no socket
// polling. So we don't want to run the nsSocketTransportService runnable on
// it.
nsresult rv =
NS_NewNamedThread("Socket Thread", getter_AddRefs(thread), nullptr);
NS_ENSURE_SUCCESS(rv, rv);
// Set up some of the state that nsSocketTransportService::Run would set.
PRThread* prthread = nullptr;
thread->GetPRThread(&prthread);
gSocketThread = prthread;
mRawThread = thread;
}
{
MutexAutoLock lock(mLock);

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

@ -1,5 +1,6 @@
[DEFAULT]
head = head_channels_clone.js head_trr_clone.js head_http3_clone.js
skip-if = socketprocess_networking
support-files =
child_channel_id.js
!/netwerk/test/unit/test_XHR_redirects.js
@ -70,35 +71,57 @@ support-files =
[test_cookie_header_stripped.js]
[test_cacheflags_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_cache-entry-id_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_cache_jar_wrap.js]
[test_channel_close_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_cookiejars_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_dns_cancel_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_dns_service_wrap.js]
[test_duplicate_headers_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_event_sink_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_gio_protocol_wrap.js]
skip-if = (toolkit != 'gtk')
[test_head_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_headers_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_httpsuspend_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_post_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_predictor_wrap.js]
[test_progress_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_redirect-caching_canceled_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_redirect-caching_failure_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_redirect-caching_passing_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_redirect_canceled_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_redirect_failure_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
# Do not test the channel.redirectTo() API under e10s until 827269 is resolved
[test_redirect_from_script_wrap.js]
skip-if = true
[test_redirect_passing_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_redirect_different-protocol_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_reentrancy_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_resumable_channel_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_simple_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_http3_prio_disabled_wrap.js]
skip-if = os == 'android'
run-sequentially = http3server
@ -106,21 +129,35 @@ run-sequentially = http3server
skip-if = os == 'android'
run-sequentially = http3server
[test_xmlhttprequest_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_XHR_redirects.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_redirect_history_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_reply_without_content_type_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_getHost_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_alt-data_simple_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_alt-data_stream_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_alt-data_closeWithStatus_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_original_sent_received_head_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_channel_id.js]
[test_trackingProtection_annotateChannels_wrap1.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_trackingProtection_annotateChannels_wrap2.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_channel_priority_wrap.js]
[test_multipart_streamconv_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_alt-data_cross_process_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_httpcancel_wrap.js]
prefs = network.allow_raw_sockets_in_content_processes=true
[test_dns_by_type_resolve_wrap.js]
[test_trr_httpssvc_wrap.js]
skip-if = os == "android"