From e6cfee6ef8fce9ce5678769dc72a85ab18df21ba Mon Sep 17 00:00:00 2001 From: "Julio C. Rocha" Date: Tue, 7 Jun 2022 14:10:33 -0700 Subject: [PATCH 1/4] Do not use Blob/FileReader modules on UWP --- vnext/Shared/OInstance.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vnext/Shared/OInstance.cpp b/vnext/Shared/OInstance.cpp index fc40263f557..49b1b41a8e8 100644 --- a/vnext/Shared/OInstance.cpp +++ b/vnext/Shared/OInstance.cpp @@ -618,6 +618,8 @@ std::vector> InstanceImpl::GetDefaultNativeModules []() { return std::make_unique(); }, nativeQueue)); +// #10036 - Blob module not supported in UWP. Need to define property bag lifetime and onwership. +#if (defined(_MSC_VER) && !defined(WINRT)) modules.push_back(std::make_unique( m_innerInstance, Microsoft::React::GetBlobModuleName(), @@ -629,6 +631,7 @@ std::vector> InstanceImpl::GetDefaultNativeModules Microsoft::React::GetFileReaderModuleName(), [transitionalProps]() { return Microsoft::React::CreateFileReaderModule(transitionalProps); }, nativeQueue)); +#endif return modules; } From ac40e3727bbaff9b369899e5ee2d77dabbeacc63 Mon Sep 17 00:00:00 2001 From: "Julio C. Rocha" Date: Tue, 7 Jun 2022 14:11:13 -0700 Subject: [PATCH 2/4] Change files --- ...ative-windows-d4179584-e159-44b9-b6fe-c1f4c00e8004.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/react-native-windows-d4179584-e159-44b9-b6fe-c1f4c00e8004.json diff --git a/change/react-native-windows-d4179584-e159-44b9-b6fe-c1f4c00e8004.json b/change/react-native-windows-d4179584-e159-44b9-b6fe-c1f4c00e8004.json new file mode 100644 index 00000000000..46cdd680667 --- /dev/null +++ b/change/react-native-windows-d4179584-e159-44b9-b6fe-c1f4c00e8004.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Do not use Blob/FileReader modules on UWP", + "packageName": "react-native-windows", + "email": "julio.rocha@microsoft.com", + "dependentChangeType": "patch" +} From 552a6a55679f0fa0a92a4c603cb2ac164ea0fe53 Mon Sep 17 00:00:00 2001 From: "Julio C. Rocha" Date: Tue, 7 Jun 2022 14:33:54 -0700 Subject: [PATCH 3/4] Upgrade packages.lock.json --- .../packages.lock.json | 8 ++++---- vnext/Microsoft.ReactNative.Managed/packages.lock.json | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/vnext/Microsoft.ReactNative.Managed.UnitTests/packages.lock.json b/vnext/Microsoft.ReactNative.Managed.UnitTests/packages.lock.json index 0f5ab5eac44..e0b9ceaacbe 100644 --- a/vnext/Microsoft.ReactNative.Managed.UnitTests/packages.lock.json +++ b/vnext/Microsoft.ReactNative.Managed.UnitTests/packages.lock.json @@ -92,7 +92,7 @@ "NETStandard.Library": { "type": "Transitive", "resolved": "2.0.3", - "contentHash": "548M6mnBSJWxsIlkQHfbzoYxpiYFXZZSL00p4GHYv8PkiqFBnnT68mW5mGEsA/ch9fDO9GkPgkFQpWiXZN7mAQ==", + "contentHash": "st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==", "dependencies": { "Microsoft.NETCore.Platforms": "1.1.0" } @@ -104,8 +104,8 @@ }, "ReactNative.Hermes.Windows": { "type": "Transitive", - "resolved": "0.11.0-ms.6", - "contentHash": "WAVLsSZBV4p/3hNC3W67su7xu3f/ZMSKxu0ON7g2GaKRbkJmH0Qyif1IlzcJwtvR48kuOdfgPu7Bgtz3AY+gqg==" + "resolved": "0.12.1", + "contentHash": "0yjt0Y2pNfqw7qUiV5Q3W8hZ2HuS3HiS135c/ILLXeRXLpQMmfq1NS3oBZ1oMZy94gSfgP9QZ/862T3qUTES1A==" }, "runtime.win10-arm.Microsoft.Net.Native.Compiler": { "type": "Transitive", @@ -315,7 +315,7 @@ "Microsoft.Windows.CppWinRT": "2.0.211028.7", "Microsoft.Windows.SDK.BuildTools": "10.0.22000.194", "ReactCommon": "1.0.0", - "ReactNative.Hermes.Windows": "0.11.0-ms.6", + "ReactNative.Hermes.Windows": "0.12.1", "boost": "1.76.0" } }, diff --git a/vnext/Microsoft.ReactNative.Managed/packages.lock.json b/vnext/Microsoft.ReactNative.Managed/packages.lock.json index decd73cbdce..2b88ab73c5f 100644 --- a/vnext/Microsoft.ReactNative.Managed/packages.lock.json +++ b/vnext/Microsoft.ReactNative.Managed/packages.lock.json @@ -83,15 +83,15 @@ "NETStandard.Library": { "type": "Transitive", "resolved": "2.0.3", - "contentHash": "548M6mnBSJWxsIlkQHfbzoYxpiYFXZZSL00p4GHYv8PkiqFBnnT68mW5mGEsA/ch9fDO9GkPgkFQpWiXZN7mAQ==", + "contentHash": "st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==", "dependencies": { "Microsoft.NETCore.Platforms": "1.1.0" } }, "ReactNative.Hermes.Windows": { "type": "Transitive", - "resolved": "0.11.0-ms.6", - "contentHash": "WAVLsSZBV4p/3hNC3W67su7xu3f/ZMSKxu0ON7g2GaKRbkJmH0Qyif1IlzcJwtvR48kuOdfgPu7Bgtz3AY+gqg==" + "resolved": "0.12.1", + "contentHash": "0yjt0Y2pNfqw7qUiV5Q3W8hZ2HuS3HiS135c/ILLXeRXLpQMmfq1NS3oBZ1oMZy94gSfgP9QZ/862T3qUTES1A==" }, "runtime.win10-arm.Microsoft.Net.Native.Compiler": { "type": "Transitive", @@ -182,7 +182,7 @@ "Microsoft.Windows.CppWinRT": "2.0.211028.7", "Microsoft.Windows.SDK.BuildTools": "10.0.22000.194", "ReactCommon": "1.0.0", - "ReactNative.Hermes.Windows": "0.11.0-ms.6", + "ReactNative.Hermes.Windows": "0.12.1", "boost": "1.76.0" } }, From 08e828fd7c2f6fd3446e2fb7025cd97ca435c3ba Mon Sep 17 00:00:00 2001 From: "Julio C. Rocha" Date: Wed, 8 Jun 2022 15:58:33 -0700 Subject: [PATCH 4/4] Use runtime option Blob.EnableModule to condition instantiation --- .../RNTesterIntegrationTests.cpp | 1 + vnext/Shared/OInstance.cpp | 26 +++++++++---------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/vnext/Desktop.IntegrationTests/RNTesterIntegrationTests.cpp b/vnext/Desktop.IntegrationTests/RNTesterIntegrationTests.cpp index ea1183a6a96..0813355bf0a 100644 --- a/vnext/Desktop.IntegrationTests/RNTesterIntegrationTests.cpp +++ b/vnext/Desktop.IntegrationTests/RNTesterIntegrationTests.cpp @@ -28,6 +28,7 @@ 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. SetRuntimeOptionBool("RNTester.UseWebDebugger", false); diff --git a/vnext/Shared/OInstance.cpp b/vnext/Shared/OInstance.cpp index 49b1b41a8e8..c3357669ee6 100644 --- a/vnext/Shared/OInstance.cpp +++ b/vnext/Shared/OInstance.cpp @@ -618,20 +618,20 @@ std::vector> InstanceImpl::GetDefaultNativeModules []() { return std::make_unique(); }, nativeQueue)); -// #10036 - Blob module not supported in UWP. Need to define property bag lifetime and onwership. -#if (defined(_MSC_VER) && !defined(WINRT)) - modules.push_back(std::make_unique( - m_innerInstance, - Microsoft::React::GetBlobModuleName(), - [transitionalProps]() { return Microsoft::React::CreateBlobModule(transitionalProps); }, - nativeQueue)); + // #10036 - Blob module not supported in UWP. Need to define property bag lifetime and onwership. + if (Microsoft::React::GetRuntimeOptionBool("Blob.EnableModule")) { + modules.push_back(std::make_unique( + m_innerInstance, + Microsoft::React::GetBlobModuleName(), + [transitionalProps]() { return Microsoft::React::CreateBlobModule(transitionalProps); }, + nativeQueue)); - modules.push_back(std::make_unique( - m_innerInstance, - Microsoft::React::GetFileReaderModuleName(), - [transitionalProps]() { return Microsoft::React::CreateFileReaderModule(transitionalProps); }, - nativeQueue)); -#endif + modules.push_back(std::make_unique( + m_innerInstance, + Microsoft::React::GetFileReaderModuleName(), + [transitionalProps]() { return Microsoft::React::CreateFileReaderModule(transitionalProps); }, + nativeQueue)); + } return modules; }