From cf3685c615d774c5937059cf093e00e41b8faf7c Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Fri, 20 Sep 2024 18:35:45 +0000 Subject: [PATCH] Bug 1912434 - Remove network.websocket.extensions.permessage-deflate pref r=necko-reviewers,kershaw Differential Revision: https://phabricator.services.mozilla.com/D222901 UltraBlame original commit: 17c2eaf697f80ce260e72db5ba3a473a705c9030 --- ...bsocket_permessage_deflate_disabled_wsh.py | 123 ------------- dom/websocket/tests/mochitest.toml | 5 - .../test_websocket_permessage_deflate.html | 81 +-------- modules/libpref/init/all.js | 16 -- .../protocol/websocket/WebSocketChannel.cpp | 161 ------------------ netwerk/protocol/websocket/WebSocketChannel.h | 5 - 6 files changed, 4 insertions(+), 387 deletions(-) delete mode 100644 dom/websocket/tests/file_websocket_permessage_deflate_disabled_wsh.py diff --git a/dom/websocket/tests/file_websocket_permessage_deflate_disabled_wsh.py b/dom/websocket/tests/file_websocket_permessage_deflate_disabled_wsh.py deleted file mode 100644 index 7b8d939e64870..0000000000000 --- a/dom/websocket/tests/file_websocket_permessage_deflate_disabled_wsh.py +++ /dev/null @@ -1,123 +0,0 @@ -from -mod_pywebsocket -import -common -msgutil -def -web_socket_do_extra_handshake -( -request -) -: - -if -request -. -ws_requested_extensions -is -not -None -: - -for -extension_request -in -request -. -ws_requested_extensions -: - -if -extension_request -. -name -( -) -= -= -" -permessage -- -deflate -" -: - -raise -ValueError -( -" -permessage -- -deflate -should -not -be -offered -" -) -def -web_socket_transfer_data -( -request -) -: - -while -True -: - -rcvd -= -msgutil -. -receive_message -( -request -) - -opcode -= -request -. -ws_stream -. -get_last_received_opcode -( -) - -if -opcode -= -= -common -. -OPCODE_BINARY -: - -msgutil -. -send_message -( -request -rcvd -binary -= -True -) - -elif -opcode -= -= -common -. -OPCODE_TEXT -: - -msgutil -. -send_message -( -request -rcvd -) diff --git a/dom/websocket/tests/mochitest.toml b/dom/websocket/tests/mochitest.toml index 47f5cfd5828fe..cad01eb2e3c20 100644 --- a/dom/websocket/tests/mochitest.toml +++ b/dom/websocket/tests/mochitest.toml @@ -52,11 +52,6 @@ file_websocket_permessage_deflate_wsh py " " -file_websocket_permessage_deflate_disabled_wsh -. -py -" -" file_websocket_permessage_deflate_rejected_wsh . py diff --git a/dom/websocket/tests/test_websocket_permessage_deflate.html b/dom/websocket/tests/test_websocket_permessage_deflate.html index 7abe075777972..b10e30e90ca9a 100644 --- a/dom/websocket/tests/test_websocket_permessage_deflate.html +++ b/dom/websocket/tests/test_websocket_permessage_deflate.html @@ -79,7 +79,7 @@ onload = " -loadDeflate +testDeflate ( ) " @@ -218,7 +218,6 @@ PMCE [ true -true " ws : @@ -243,41 +242,11 @@ ] / / -disable -PMCE -[ -false -false -" -ws -: -/ -/ -mochi -. -test -: -8888 -/ -tests -/ -dom -/ -websocket -/ -tests -/ -file_websocket_permessage_deflate_disabled -" -] -/ -/ server rejects offered PMCE [ -true false " ws @@ -311,7 +280,6 @@ handshake [ true -true " ws : @@ -478,7 +446,7 @@ testIdx ] [ -2 +1 ] ) ; @@ -497,7 +465,7 @@ testIdx ] [ -1 +0 ] ) { @@ -711,7 +679,7 @@ length ) { -loadDeflate +testDeflate ( ) ; @@ -728,47 +696,6 @@ } } } -function -loadDeflate -( -) -{ -SpecialPowers -. -pushPrefEnv -( -{ -" -set -" -: -[ -[ -' -network -. -websocket -. -extensions -. -permessage -- -deflate -' -tests -[ -testIdx -] -[ -0 -] -] -] -} -testDeflate -) -; -} SimpleTest . waitForExplicitFinish diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 9a131d7a7dfc2..79d08faa2b6e6 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -8197,22 +8197,6 @@ network . websocket . -extensions -. -permessage -- -deflate -" -true -) -; -pref -( -" -network -. -websocket -. max - connections diff --git a/netwerk/protocol/websocket/WebSocketChannel.cpp b/netwerk/protocol/websocket/WebSocketChannel.cpp index 0799498c8ebac..47f82e25b80b9 100644 --- a/netwerk/protocol/websocket/WebSocketChannel.cpp +++ b/netwerk/protocol/websocket/WebSocketChannel.cpp @@ -5766,10 +5766,6 @@ mRecvdHttpUpgradeTransport ( 0 ) -mAllowPMCE -( -1 -) mPingOutstanding ( 0 @@ -13514,47 +13510,6 @@ rv } if ( -! -mAllowPMCE -) -{ -LOG -( -( -" -WebSocketChannel -: -: -HandleExtensions -: -" -" -Recvd -permessage -- -deflate -which -wasn -' -t -offered -\ -n -" -) -) -; -AbortSession -( -NS_ERROR_ILLEGAL_VALUE -) -; -return -NS_ERROR_ILLEGAL_VALUE -; -} -if -( clientMaxWindowBits = = @@ -13720,74 +13675,6 @@ Truncate ( ) ; -nsCOMPtr -< -nsIPrefBranch -> -prefService -; -prefService -= -mozilla -: -: -components -: -: -Preferences -: -: -Service -( -) -; -if -( -prefService -) -{ -bool -boolpref -; -nsresult -rv -= -prefService -- -> -GetBoolPref -( -" -network -. -websocket -. -extensions -. -permessage -- -deflate -" -& -boolpref -) -; -if -( -NS_SUCCEEDED -( -rv -) -& -& -! -boolpref -) -{ -return -; -} -} for ( const @@ -14295,11 +14182,6 @@ rv ) ; } -if -( -mAllowPMCE -) -{ rv = mHttpChannel @@ -14332,7 +14214,6 @@ rv ) ) ; -} uint8_t * secKey @@ -17658,9 +17539,6 @@ prefService int32_t intpref ; -bool -boolpref -; rv = prefService @@ -17878,45 +17756,6 @@ rv prefService - > -GetBoolPref -( -" -network -. -websocket -. -extensions -. -permessage -- -deflate -" -& -boolpref -) -; -if -( -NS_SUCCEEDED -( -rv -) -) -{ -mAllowPMCE -= -boolpref -? -1 -: -0 -; -} -rv -= -prefService -- -> GetIntPref ( " diff --git a/netwerk/protocol/websocket/WebSocketChannel.h b/netwerk/protocol/websocket/WebSocketChannel.h index bd0bfba4d3bbb..dad38e9c4b805 100644 --- a/netwerk/protocol/websocket/WebSocketChannel.h +++ b/netwerk/protocol/websocket/WebSocketChannel.h @@ -1054,11 +1054,6 @@ mRecvdHttpUpgradeTransport 1 ; uint32_t -mAllowPMCE -: -1 -; -uint32_t : 0 ;