From 5cac07bd67afe397f1b2d9787246a06a87189c19 Mon Sep 17 00:00:00 2001 From: "Julio C. Rocha" Date: Mon, 7 Nov 2022 16:27:51 -0800 Subject: [PATCH 1/3] Always instantiate Blob module inUWP --- .../RNTesterIntegrationTests.cpp | 1 - .../Base/CoreNativeModules.cpp | 33 +++++-------------- vnext/Shared/OInstance.cpp | 9 ++--- vnext/Shared/Shared.vcxitems | 4 ++- 4 files changed, 13 insertions(+), 34 deletions(-) diff --git a/vnext/Desktop.IntegrationTests/RNTesterIntegrationTests.cpp b/vnext/Desktop.IntegrationTests/RNTesterIntegrationTests.cpp index 0813355bf0a..4ed441749b3 100644 --- a/vnext/Desktop.IntegrationTests/RNTesterIntegrationTests.cpp +++ b/vnext/Desktop.IntegrationTests/RNTesterIntegrationTests.cpp @@ -27,7 +27,6 @@ TEST_MODULE_INITIALIZE(InitModule) { SetRuntimeOptionBool("WebSocket.AcceptSelfSigned", true); SetRuntimeOptionBool("UseBeastWebSocket", false); - SetRuntimeOptionBool("Http.UseMonolithicModule", false); SetRuntimeOptionBool("Blob.EnableModule", true); // WebSocketJSExecutor can't register native log hooks. diff --git a/vnext/Microsoft.ReactNative/Base/CoreNativeModules.cpp b/vnext/Microsoft.ReactNative/Base/CoreNativeModules.cpp index c1e1d6dfa9a..bf56183b8e7 100644 --- a/vnext/Microsoft.ReactNative/Base/CoreNativeModules.cpp +++ b/vnext/Microsoft.ReactNative/Base/CoreNativeModules.cpp @@ -18,21 +18,6 @@ namespace Microsoft::ReactNative { -using winrt::Microsoft::ReactNative::ReactPropertyBag; - -namespace { - -using winrt::Microsoft::ReactNative::ReactPropertyId; - -ReactPropertyId HttpUseMonolithicModuleProperty() noexcept { - static ReactPropertyId propId{ - L"ReactNative.Http" - L"UseMonolithicModule"}; - return propId; -} - -} // namespace - std::vector GetCoreModules( const std::shared_ptr &batchingUIMessageQueue, const std::shared_ptr @@ -45,17 +30,15 @@ std::vector GetCoreModules( [props = context->Properties()]() { return Microsoft::React::CreateHttpModule(props); }, jsMessageQueue); - if (!ReactPropertyBag(context->Properties()).Get(HttpUseMonolithicModuleProperty())) { - modules.emplace_back( - Microsoft::React::GetBlobModuleName(), - [props = context->Properties()]() { return Microsoft::React::CreateBlobModule(props); }, - batchingUIMessageQueue); + modules.emplace_back( + Microsoft::React::GetBlobModuleName(), + [props = context->Properties()]() { return Microsoft::React::CreateBlobModule(props); }, + batchingUIMessageQueue); - modules.emplace_back( - Microsoft::React::GetFileReaderModuleName(), - [props = context->Properties()]() { return Microsoft::React::CreateFileReaderModule(props); }, - batchingUIMessageQueue); - } + modules.emplace_back( + Microsoft::React::GetFileReaderModuleName(), + [props = context->Properties()]() { return Microsoft::React::CreateFileReaderModule(props); }, + batchingUIMessageQueue); // AsyncStorageModule doesn't work without package identity (it indirectly depends on // Windows.Storage.StorageFile), so check for package identity before adding it. diff --git a/vnext/Shared/OInstance.cpp b/vnext/Shared/OInstance.cpp index 5a93e1bc1e8..4e87d089031 100644 --- a/vnext/Shared/OInstance.cpp +++ b/vnext/Shared/OInstance.cpp @@ -75,11 +75,7 @@ namespace Microsoft::React { /*extern*/ std::unique_ptr CreateHttpModule( winrt::Windows::Foundation::IInspectable const &inspectableProperties) noexcept { - if (GetRuntimeOptionBool("Http.UseMonolithicModule")) { - return std::make_unique(); - } else { - return std::make_unique(inspectableProperties); - } + return std::make_unique(inspectableProperties); } } // namespace Microsoft::React @@ -643,8 +639,7 @@ std::vector> InstanceImpl::GetDefaultNativeModules // If this code is enabled, we will have unused module instances. // Also, MSRN has a different property bag mechanism incompatible with this method's transitionalProps variable. #if (defined(_MSC_VER) && !defined(WINRT)) - if (Microsoft::React::GetRuntimeOptionBool("Blob.EnableModule") && - !Microsoft::React::GetRuntimeOptionBool("Http.UseMonolithicModule")) { + if (Microsoft::React::GetRuntimeOptionBool("Blob.EnableModule")) { modules.push_back(std::make_unique( m_innerInstance, Microsoft::React::GetBlobModuleName(), diff --git a/vnext/Shared/Shared.vcxitems b/vnext/Shared/Shared.vcxitems index 8788faecf59..a7eff112749 100644 --- a/vnext/Shared/Shared.vcxitems +++ b/vnext/Shared/Shared.vcxitems @@ -50,7 +50,9 @@ - + + true + From 28b17c22d1d12b19f5d60340299ea85ce531e8ec Mon Sep 17 00:00:00 2001 From: "Julio C. Rocha" Date: Mon, 7 Nov 2022 16:28:17 -0800 Subject: [PATCH 2/3] Change files --- ...ative-windows-3ee0cf72-a448-421f-a738-e2aac37a7883.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/react-native-windows-3ee0cf72-a448-421f-a738-e2aac37a7883.json diff --git a/change/react-native-windows-3ee0cf72-a448-421f-a738-e2aac37a7883.json b/change/react-native-windows-3ee0cf72-a448-421f-a738-e2aac37a7883.json new file mode 100644 index 00000000000..c1e69744372 --- /dev/null +++ b/change/react-native-windows-3ee0cf72-a448-421f-a738-e2aac37a7883.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Always instantiate Blob module inUWP", + "packageName": "react-native-windows", + "email": "julio.rocha@microsoft.com", + "dependentChangeType": "patch" +} From d6314bde2cb6711b181a2ccca6177e2babef8143 Mon Sep 17 00:00:00 2001 From: "Julio C. Rocha" Date: Mon, 7 Nov 2022 18:45:07 -0800 Subject: [PATCH 3/3] Remove legacy HTTP module from DLL boundary --- vnext/Desktop.DLL/react-native-win32.x64.def | 1 - vnext/Desktop.DLL/react-native-win32.x86.def | 1 - vnext/Shared/OInstance.cpp | 1 - 3 files changed, 3 deletions(-) diff --git a/vnext/Desktop.DLL/react-native-win32.x64.def b/vnext/Desktop.DLL/react-native-win32.x64.def index f8d5742909f..eec2862ff77 100644 --- a/vnext/Desktop.DLL/react-native-win32.x64.def +++ b/vnext/Desktop.DLL/react-native-win32.x64.def @@ -56,7 +56,6 @@ EXPORTS ?makeChakraRuntime@JSI@Microsoft@@YA?AV?$unique_ptr@VRuntime@jsi@facebook@@U?$default_delete@VRuntime@jsi@facebook@@@std@@@std@@$$QEAUChakraRuntimeArgs@12@@Z ?Make@IHttpResource@Networking@React@Microsoft@@SA?AV?$shared_ptr@UIHttpResource@Networking@React@Microsoft@@@std@@XZ ?CreateTimingModule@react@facebook@@YA?AV?$unique_ptr@VCxxModule@module@xplat@facebook@@U?$default_delete@VCxxModule@module@xplat@facebook@@@std@@@std@@AEBV?$shared_ptr@VMessageQueueThread@react@facebook@@@4@@Z -??0NetworkingModule@React@Microsoft@@QEAA@XZ ?MakeJSQueueThread@ReactNative@Microsoft@@YA?AV?$shared_ptr@VMessageQueueThread@react@facebook@@@std@@XZ ?Hash128@SpookyHashV2@hash@folly@@SAXPEBX_KPEA_K2@Z ??1Instance@react@facebook@@QEAA@XZ diff --git a/vnext/Desktop.DLL/react-native-win32.x86.def b/vnext/Desktop.DLL/react-native-win32.x86.def index d899f933715..f9b316cb1b0 100644 --- a/vnext/Desktop.DLL/react-native-win32.x86.def +++ b/vnext/Desktop.DLL/react-native-win32.x86.def @@ -52,7 +52,6 @@ EXPORTS ?makeChakraRuntime@JSI@Microsoft@@YG?AV?$unique_ptr@VRuntime@jsi@facebook@@U?$default_delete@VRuntime@jsi@facebook@@@std@@@std@@$$QAUChakraRuntimeArgs@12@@Z ?CreateTimingModule@react@facebook@@YG?AV?$unique_ptr@VCxxModule@module@xplat@facebook@@U?$default_delete@VCxxModule@module@xplat@facebook@@@std@@@std@@ABV?$shared_ptr@VMessageQueueThread@react@facebook@@@4@@Z ?Make@IHttpResource@Networking@React@Microsoft@@SG?AV?$shared_ptr@UIHttpResource@Networking@React@Microsoft@@@std@@XZ -??0NetworkingModule@React@Microsoft@@QAE@XZ ?MakeJSQueueThread@ReactNative@Microsoft@@YG?AV?$shared_ptr@VMessageQueueThread@react@facebook@@@std@@XZ ?Hash128@SpookyHashV2@hash@folly@@SGXPBXIPA_K1@Z ?assertionFailure@detail@folly@@YGXPBD00I0H@Z diff --git a/vnext/Shared/OInstance.cpp b/vnext/Shared/OInstance.cpp index 4e87d089031..d1bb5661a18 100644 --- a/vnext/Shared/OInstance.cpp +++ b/vnext/Shared/OInstance.cpp @@ -27,7 +27,6 @@ #include #include -#include #include #include #include