From cd647a4b5c4cb8a6011fcc697733e34fba6ec7a4 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/4] 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 --- .../RNTesterIntegrationTests.cpp | 1 + vnext/Shared/OInstance.cpp | 23 +++++++++++-------- 2 files changed, 14 insertions(+), 10 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 10fc8ab630a..ccd58dd3950 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 ea5ab970966ef6eab6862cdc830b4f189aa87890 Mon Sep 17 00:00:00 2001 From: "Julio C. Rocha" Date: Wed, 8 Jun 2022 17:52:53 -0700 Subject: [PATCH 2/4] Change files --- ...ative-windows-25edb5ed-0c39-46dd-a7a7-eaf51aa05c76.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/react-native-windows-25edb5ed-0c39-46dd-a7a7-eaf51aa05c76.json diff --git a/change/react-native-windows-25edb5ed-0c39-46dd-a7a7-eaf51aa05c76.json b/change/react-native-windows-25edb5ed-0c39-46dd-a7a7-eaf51aa05c76.json new file mode 100644 index 00000000000..bdc304a634d --- /dev/null +++ b/change/react-native-windows-25edb5ed-0c39-46dd-a7a7-eaf51aa05c76.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Enable Blob module with runtime option", + "packageName": "react-native-windows", + "email": "julio.rocha@microsoft.com", + "dependentChangeType": "patch" +} From 5e1392063d7dd7ee759717f269d43ecd8eeafa5b 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 3/4] 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 88a11150c104fbbd9712ec195247f0733c247c5b Mon Sep 17 00:00:00 2001 From: "Julio C. Rocha" Date: Thu, 9 Jun 2022 20:11:48 -0700 Subject: [PATCH 4/4] 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" -}