From d972129b33b0f24b49caded982fefa4ba5b6524f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julio=20C=C3=A9sar=20Rocha?= Date: Wed, 8 Jun 2022 17:34:31 -0700 Subject: [PATCH 1/5] Do not use Blob/FileReader modules in UWP (#10079) * Do not use Blob/FileReader modules on UWP * Change files * Upgrade packages.lock.json * Use runtime option Blob.EnableModule to condition instantiation --- ...-d4179584-e159-44b9-b6fe-c1f4c00e8004.json | 7 ++++++ .../RNTesterIntegrationTests.cpp | 1 + .../packages.lock.json | 8 +++---- .../packages.lock.json | 8 +++---- vnext/Shared/OInstance.cpp | 23 +++++++++++-------- 5 files changed, 29 insertions(+), 18 deletions(-) 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" +} 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/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" } }, diff --git a/vnext/Shared/OInstance.cpp b/vnext/Shared/OInstance.cpp index ffa1442c700..17adb928611 100644 --- a/vnext/Shared/OInstance.cpp +++ b/vnext/Shared/OInstance.cpp @@ -619,17 +619,20 @@ std::vector> InstanceImpl::GetDefaultNativeModules []() { return std::make_unique(); }, nativeQueue)); - 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)); + modules.push_back(std::make_unique( + m_innerInstance, + Microsoft::React::GetFileReaderModuleName(), + [transitionalProps]() { return Microsoft::React::CreateFileReaderModule(transitionalProps); }, + nativeQueue)); + } return modules; } From ce8fb4e3b741e6814af7415e27da1933e166582d Mon Sep 17 00:00:00 2001 From: "Julio C. Rocha" Date: Wed, 8 Jun 2022 17:39:20 -0700 Subject: [PATCH 2/5] Remove change file --- ...ative-windows-d4179584-e159-44b9-b6fe-c1f4c00e8004.json | 7 ------- 1 file changed, 7 deletions(-) delete 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 deleted file mode 100644 index 46cdd680667..00000000000 --- a/change/react-native-windows-d4179584-e159-44b9-b6fe-c1f4c00e8004.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "prerelease", - "comment": "Do not use Blob/FileReader modules on UWP", - "packageName": "react-native-windows", - "email": "julio.rocha@microsoft.com", - "dependentChangeType": "patch" -} From 28f6b891fd4f350347a6d750e169ae49487af57c Mon Sep 17 00:00:00 2001 From: "Julio C. Rocha" Date: Wed, 8 Jun 2022 17:52:44 -0700 Subject: [PATCH 3/5] Change files --- ...ative-windows-0521218e-04c4-4409-8cb0-62e95a3e74a2.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/react-native-windows-0521218e-04c4-4409-8cb0-62e95a3e74a2.json diff --git a/change/react-native-windows-0521218e-04c4-4409-8cb0-62e95a3e74a2.json b/change/react-native-windows-0521218e-04c4-4409-8cb0-62e95a3e74a2.json new file mode 100644 index 00000000000..84734eab582 --- /dev/null +++ b/change/react-native-windows-0521218e-04c4-4409-8cb0-62e95a3e74a2.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Enable Blob module with runtime option", + "packageName": "react-native-windows", + "email": "julio.rocha@microsoft.com", + "dependentChangeType": "patch" +} From cd9446a8785aa307dd2b00e030264f4fec178639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julio=20C=C3=A9sar=20Rocha?= Date: Thu, 9 Jun 2022 20:07:37 -0700 Subject: [PATCH 4/5] Use logical OR to assert HTTP responseType (#10095) * update yarn.lock * Use logical OR to assert HTTP responseType * Change files --- ...ative-windows-1653495d-e9db-497e-a6e2-bb5fbcc05317.json | 7 +++++++ vnext/Shared/Networking/WinRTHttpResource.cpp | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 change/react-native-windows-1653495d-e9db-497e-a6e2-bb5fbcc05317.json diff --git a/change/react-native-windows-1653495d-e9db-497e-a6e2-bb5fbcc05317.json b/change/react-native-windows-1653495d-e9db-497e-a6e2-bb5fbcc05317.json new file mode 100644 index 00000000000..e825cb14dcb --- /dev/null +++ b/change/react-native-windows-1653495d-e9db-497e-a6e2-bb5fbcc05317.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Use logical OR to assert HTTP responseType", + "packageName": "react-native-windows", + "email": "julio.rocha@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/vnext/Shared/Networking/WinRTHttpResource.cpp b/vnext/Shared/Networking/WinRTHttpResource.cpp index 388d75e8c89..a496186d769 100644 --- a/vnext/Shared/Networking/WinRTHttpResource.cpp +++ b/vnext/Shared/Networking/WinRTHttpResource.cpp @@ -68,7 +68,7 @@ void WinRTHttpResource::SendRequest( bool withCredentials, std::function &&callback) noexcept /*override*/ { // Enforce supported args - assert(responseType == "text" || responseType == "base64" | responseType == "blob"); + assert(responseType == "text" || responseType == "base64" || responseType == "blob"); if (callback) { callback(requestId); From 10d5a18f716ed5489d599873bf3f8ce875b30b7c Mon Sep 17 00:00:00 2001 From: "Julio C. Rocha" Date: Thu, 9 Jun 2022 20:11:04 -0700 Subject: [PATCH 5/5] rm change file --- ...ative-windows-1653495d-e9db-497e-a6e2-bb5fbcc05317.json | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 change/react-native-windows-1653495d-e9db-497e-a6e2-bb5fbcc05317.json diff --git a/change/react-native-windows-1653495d-e9db-497e-a6e2-bb5fbcc05317.json b/change/react-native-windows-1653495d-e9db-497e-a6e2-bb5fbcc05317.json deleted file mode 100644 index e825cb14dcb..00000000000 --- a/change/react-native-windows-1653495d-e9db-497e-a6e2-bb5fbcc05317.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "prerelease", - "comment": "Use logical OR to assert HTTP responseType", - "packageName": "react-native-windows", - "email": "julio.rocha@microsoft.com", - "dependentChangeType": "patch" -}