[PATCH v3 0/1] MR7494: msxml3: IXMLDOMDocument3::preserveWhiteSpace fix for a non VARIANT_BOOL value.
0024:trace:msxml:domdoc_put_preserveWhiteSpace (068F0520)->(1) Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=21940 -- v3: msxml3: IXMLDOMDocument3::preserveWhiteSpace fix for a non VARIANT_BOOL value. https://gitlab.winehq.org/wine/wine/-/merge_requests/7494
From: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> 0024:trace:msxml:domdoc_put_preserveWhiteSpace (068F0520)->(1) Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=21940 --- dlls/msxml3/domdoc.c | 2 +- dlls/msxml3/tests/domdoc.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c index 8407f914c4f..e1e8e6c803f 100644 --- a/dlls/msxml3/domdoc.c +++ b/dlls/msxml3/domdoc.c @@ -2746,7 +2746,7 @@ static HRESULT WINAPI domdoc_put_preserveWhiteSpace( { domdoc *This = impl_from_IXMLDOMDocument3( iface ); TRACE("(%p)->(%d)\n", This, isPreserving); - This->properties->preserving = isPreserving; + This->properties->preserving = isPreserving == VARIANT_TRUE ? VARIANT_TRUE : VARIANT_FALSE; return S_OK; } diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index 76f0c827c2a..93201724ffd 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -4859,6 +4859,16 @@ static void test_whitespace(void) check_ws_ignored(class_ptr->name, doc3, NULL); check_ws_preserved(class_ptr->name, doc4, NULL); + hr = IXMLDOMDocument2_put_preserveWhiteSpace(doc4, 1); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IXMLDOMDocument2_get_preserveWhiteSpace(doc4, &b); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(b == VARIANT_FALSE, "expected true\n"); + check_ws_ignored(class_ptr->name, doc3, NULL); + + hr = IXMLDOMDocument2_put_preserveWhiteSpace(doc4, VARIANT_TRUE); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + /* setting after loading xml affects trimming of leading/trailing ws only */ hr = IXMLDOMDocument2_put_preserveWhiteSpace(doc1, VARIANT_TRUE); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); @@ -4925,6 +4935,17 @@ static void test_whitespace(void) IXMLDOMNodeList_Release(list); IXMLDOMElement_Release(root); + hr = IXMLDOMDocument2_put_preserveWhiteSpace(doc1, VARIANT_TRUE); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IXMLDOMDocument2_get_preserveWhiteSpace(doc1, &b); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(b == VARIANT_TRUE, "expected true %d\n", b); + hr = IXMLDOMDocument2_put_preserveWhiteSpace(doc1, 1); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IXMLDOMDocument2_get_preserveWhiteSpace(doc1, &b); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(b == VARIANT_FALSE, "expected true %d\n", b); + IXMLDOMDocument2_Release(doc1); free_bstrs(); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/7494
Nikolay Sivov (@nsivov) commented about dlls/msxml3/tests/domdoc.c:
check_ws_ignored(class_ptr->name, doc3, NULL); check_ws_preserved(class_ptr->name, doc4, NULL);
+ hr = IXMLDOMDocument2_put_preserveWhiteSpace(doc4, 1); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IXMLDOMDocument2_get_preserveWhiteSpace(doc4, &b); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(b == VARIANT_FALSE, "expected true\n"); + check_ws_ignored(class_ptr->name, doc3, NULL);
Sorry, my diff was wrong. This line should be using `doc4`. And once you do that both check_ws_ignored() and check_ws_preserved() fail. So setting it to invalid value in terms of VARIANT_BOOL produces third result. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/7494#note_97067
On Fri Mar 7 08:13:42 2025 +0000, Nikolay Sivov wrote:
Sorry, my diff was wrong. This line should be using `doc4`. And once you do that both check_ws_ignored() and check_ws_preserved() fail. So setting it to invalid value in terms of VARIANT_BOOL produces third result. So, what would you suggest?
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/7494#note_97173
On Sat Mar 8 09:07:38 2025 +0000, Alistair Leslie-Hughes wrote:
So, what would you suggest? I suggest to figure out what's different in this case, and see if we can support that.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/7494#note_97174
participants (3)
-
Alistair Leslie-Hughes -
Alistair Leslie-Hughes (@alesliehughes) -
Nikolay Sivov (@nsivov)