[PATCH v3 0/4] MR10741: Draft: msxml3: Support for max-element-depth property.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> -- v3: msxml3: Add support for MaxElementDepth property in the DOM parser. msxml3/sax: Add support for max-element-depth property. msxml3/tests: Extend MaxElementDepth tests. msxml3/tests: Add some tests for max-element-depth property. https://gitlab.winehq.org/wine/wine/-/merge_requests/10741
From: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> --- dlls/msxml3/tests/saxreader.c | 73 +++++++++++++++++++++++++++++++++++ dlls/msxml6/tests/saxreader.c | 73 +++++++++++++++++++++++++++++++++++ 2 files changed, 146 insertions(+) diff --git a/dlls/msxml3/tests/saxreader.c b/dlls/msxml3/tests/saxreader.c index 55273818fc8..6f16f32a3d9 100644 --- a/dlls/msxml3/tests/saxreader.c +++ b/dlls/msxml3/tests/saxreader.c @@ -6487,6 +6487,78 @@ static void test_saxreader_parse_input(void) ISAXXMLReader_Release(reader); } +static void test_saxreader_max_element_depth(void) +{ + ISAXXMLReader *reader; + HRESULT hr; + VARIANT v; + + hr = CoCreateInstance(&CLSID_SAXXMLReader30, NULL, CLSCTX_INPROC_SERVER, &IID_ISAXXMLReader, (void **)&reader); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + memset(&v, 0, sizeof(v)); + hr = ISAXXMLReader_getProperty(reader, _bstr_("max-element-depth"), &v); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine + ok(V_VT(&v) == VT_I4, "Unexpected type %d.\n", V_VT(&v)); + todo_wine + ok(V_I4(&v) == 5000, "Unexpected value %ld.\n", V_I4(&v)); + + V_UI4(&v) = 2147483648; + hr = ISAXXMLReader_putProperty(reader, _bstr_("max-element-depth"), v); + todo_wine + ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); + + V_I4(&v) = 2147483647; + hr = ISAXXMLReader_putProperty(reader, _bstr_("max-element-depth"), v); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = ISAXXMLReader_getProperty(reader, _bstr_("max-element-depth"), &v); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine + ok(V_VT(&v) == VT_I4, "Unexpected type %d.\n", V_VT(&v)); + ok(V_I4(&v) == 2147483647, "Unexpected value %ld.\n", V_I4(&v)); + + V_I4(&v) = 0; + hr = ISAXXMLReader_putProperty(reader, _bstr_("max-element-depth"), v); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = ISAXXMLReader_getProperty(reader, _bstr_("max-element-depth"), &v); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(V_I4(&v) == 0, "Unexpected value %ld.\n", V_I4(&v)); + + V_I4(&v) = 1; + hr = ISAXXMLReader_putProperty(reader, _bstr_("max-element-depth"), v); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + V_VT(&v) = VT_BSTR; + V_BSTR(&v) = SysAllocString(L"<a>text</a>"); + hr = ISAXXMLReader_parse(reader, v); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + VariantClear(&v); + + V_VT(&v) = VT_BSTR; + V_BSTR(&v) = SysAllocString(L"<a>text<!-- comment --></a>"); + hr = ISAXXMLReader_parse(reader, v); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + VariantClear(&v); + + V_VT(&v) = VT_BSTR; + V_BSTR(&v) = SysAllocString(L"<a>text<!-- comment --><b/></a>"); + hr = ISAXXMLReader_parse(reader, v); + todo_wine + ok(hr == E_ABORT, "Unexpected hr %#lx.\n", hr); + VariantClear(&v); + + ISAXXMLReader_Release(reader); +} + START_TEST(saxreader) { ISAXXMLReader *reader; @@ -6524,6 +6596,7 @@ START_TEST(saxreader) test_saxreader_characters(); test_saxreader_dtd(); test_saxreader_parse_input(); + test_saxreader_max_element_depth(); /* MXXMLWriter tests */ get_class_support_data(mxwriter_support_data, &IID_IMXWriter); diff --git a/dlls/msxml6/tests/saxreader.c b/dlls/msxml6/tests/saxreader.c index 3b850d775ce..9e48cd4c156 100644 --- a/dlls/msxml6/tests/saxreader.c +++ b/dlls/msxml6/tests/saxreader.c @@ -5312,6 +5312,78 @@ static void test_saxreader_max_xml_size(void) IStream_Release(stream); } +static void test_saxreader_max_element_depth(void) +{ + ISAXXMLReader *reader; + HRESULT hr; + VARIANT v; + + hr = CoCreateInstance(&CLSID_SAXXMLReader60, NULL, CLSCTX_INPROC_SERVER, &IID_ISAXXMLReader, (void **)&reader); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + memset(&v, 0, sizeof(v)); + hr = ISAXXMLReader_getProperty(reader, _bstr_("max-element-depth"), &v); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine + ok(V_VT(&v) == VT_I4, "Unexpected type %d.\n", V_VT(&v)); + todo_wine + ok(V_I4(&v) == 256, "Unexpected value %ld.\n", V_I4(&v)); + + V_UI4(&v) = 2147483648; + hr = ISAXXMLReader_putProperty(reader, _bstr_("max-element-depth"), v); + todo_wine + ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); + + V_I4(&v) = 2147483647; + hr = ISAXXMLReader_putProperty(reader, _bstr_("max-element-depth"), v); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = ISAXXMLReader_getProperty(reader, _bstr_("max-element-depth"), &v); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine + ok(V_VT(&v) == VT_I4, "Unexpected type %d.\n", V_VT(&v)); + ok(V_I4(&v) == 2147483647, "Unexpected value %ld.\n", V_I4(&v)); + + V_I4(&v) = 0; + hr = ISAXXMLReader_putProperty(reader, _bstr_("max-element-depth"), v); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = ISAXXMLReader_getProperty(reader, _bstr_("max-element-depth"), &v); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(V_I4(&v) == 0, "Unexpected value %ld.\n", V_I4(&v)); + + V_I4(&v) = 1; + hr = ISAXXMLReader_putProperty(reader, _bstr_("max-element-depth"), v); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + V_VT(&v) = VT_BSTR; + V_BSTR(&v) = SysAllocString(L"<a>text</a>"); + hr = ISAXXMLReader_parse(reader, v); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + VariantClear(&v); + + V_VT(&v) = VT_BSTR; + V_BSTR(&v) = SysAllocString(L"<a>text<!-- comment --></a>"); + hr = ISAXXMLReader_parse(reader, v); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + VariantClear(&v); + + V_VT(&v) = VT_BSTR; + V_BSTR(&v) = SysAllocString(L"<a>text<!-- comment --><b/></a>"); + hr = ISAXXMLReader_parse(reader, v); + todo_wine + ok(hr == 0xc00cee92, "Unexpected hr %#lx.\n", hr); + VariantClear(&v); + + ISAXXMLReader_Release(reader); +} + START_TEST(saxreader) { HRESULT hr; @@ -5337,6 +5409,7 @@ START_TEST(saxreader) test_saxreader_cdata(); test_saxreader_characters(); test_saxreader_pi(); + test_saxreader_max_element_depth(); } if (is_class_supported(&CLSID_MXXMLWriter60)) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10741
From: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> --- dlls/msxml3/tests/domdoc.c | 102 ++++++++++++++++++++++++++++--------- dlls/msxml6/tests/domdoc.c | 90 ++++++++++++++++++++++++++++++++ 2 files changed, 167 insertions(+), 25 deletions(-) diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index 5cec139b9fe..ea03c6e5142 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -13969,38 +13969,90 @@ static void test_transformNodeToObject(void) static void test_max_element_depth_values(void) { - IXMLDOMDocument2 *doc; + static const CLSID *classes[] = { &CLSID_DOMDocument, &CLSID_DOMDocument2, &CLSID_DOMDocument30 }; + IXMLDOMParseError *parse_error; + IXMLDOMDocument2 *doc, *doc3; + IXMLDOMDocument *doc2; VARIANT var; HRESULT hr; + LONG code; - doc = create_document_version(60, &IID_IXMLDOMDocument2); + for (int i = 0; i < ARRAYSIZE(classes); ++i) + { + hr = CoCreateInstance(classes[i], NULL, CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument2, (void **)&doc); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - /* The default max element depth value should be 256. */ - V_VT(&var) = VT_UI4; - V_UI4(&var) = 0xdeadbeef; - hr = IXMLDOMDocument2_getProperty(doc, _bstr_("MaxElementDepth"), &var); -todo_wine { - ok(hr == S_OK, "Failed to get property value, hr %#lx.\n", hr); - ok(V_VT(&var) == VT_I4, "Unexpected property value type, vt %d.\n", V_VT(&var)); - ok(V_I4(&var) == 256, "Unexpected property value.\n"); -} + /* The default max element depth value should be 256. */ + V_VT(&var) = VT_UI4; + V_UI4(&var) = 0xdeadbeef; + hr = IXMLDOMDocument2_getProperty(doc, _bstr_("MaxElementDepth"), &var); + todo_wine { + ok(hr == S_OK, "Failed to get property value, hr %#lx.\n", hr); + ok(V_VT(&var) == VT_I4, "Unexpected property value type, vt %d.\n", V_VT(&var)); + ok(V_I4(&var) == 5000, "Unexpected property value %ld.\n", V_I4(&var)); + } + /* Changes to the depth value should be observable when subsequently retrieved. */ + V_VT(&var) = VT_I4; + V_I4(&var) = 32; + hr = IXMLDOMDocument2_setProperty(doc, _bstr_("MaxElementDepth"), var); + ok(hr == S_OK, "Failed to set property, hr %#lx.\n", hr); + + V_VT(&var) = VT_UI4; + V_UI4(&var) = 0xdeadbeef; + hr = IXMLDOMDocument2_getProperty(doc, _bstr_("MaxElementDepth"), &var); + todo_wine { + ok(hr == S_OK, "Failed to get property value, hr %#lx.\n", hr); + ok(V_VT(&var) == VT_I4, "Unexpected property value type, vt %d.\n", V_VT(&var)); + ok(V_I4(&var) == 32, "Unexpected property value.\n"); + } + hr = IXMLDOMDocument2_cloneNode(doc, VARIANT_FALSE, (IXMLDOMNode **)&doc2); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IXMLDOMDocument_QueryInterface(doc2, &IID_IXMLDOMDocument2, (void **)&doc3); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + V_VT(&var) = VT_UI4; + V_UI4(&var) = 0xdeadbeef; + hr = IXMLDOMDocument2_getProperty(doc3, _bstr_("MaxElementDepth"), &var); + todo_wine { + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(V_VT(&var) == VT_I4, "Unexpected property value type, vt %d.\n", V_VT(&var)); + ok(V_I4(&var) == 32, "Unexpected property value.\n"); + } + IXMLDOMDocument2_Release(doc3); + IXMLDOMDocument_Release(doc2); - /* Changes to the depth value should be observable when subsequently retrieved. */ - V_VT(&var) = VT_I4; - V_I4(&var) = 32; - hr = IXMLDOMDocument2_setProperty(doc, _bstr_("MaxElementDepth"), var); - ok(hr == S_OK, "Failed to set property, hr %#lx.\n", hr); + V_VT(&var) = VT_I4; + V_I4(&var) = -1; + hr = IXMLDOMDocument2_setProperty(doc, _bstr_("MaxElementDepth"), var); + todo_wine + ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); - V_VT(&var) = VT_UI4; - V_UI4(&var) = 0xdeadbeef; - hr = IXMLDOMDocument2_getProperty(doc, _bstr_("MaxElementDepth"), &var); -todo_wine { - ok(hr == S_OK, "Failed to get property value, hr %#lx.\n", hr); - ok(V_VT(&var) == VT_I4, "Unexpected property value type, vt %d.\n", V_VT(&var)); - ok(V_I4(&var) == 32, "Unexpected property value.\n"); -} + V_VT(&var) = VT_UI4; + V_UI4(&var) = 2147483648; + hr = IXMLDOMDocument2_setProperty(doc, _bstr_("MaxElementDepth"), var); + todo_wine + ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); - IXMLDOMDocument2_Release(doc); + V_VT(&var) = VT_I4; + V_I4(&var) = 1; + hr = IXMLDOMDocument2_setProperty(doc, _bstr_("MaxElementDepth"), var); + hr = IXMLDOMDocument2_loadXML(doc, _bstr_("<a>text<!-- comment --></a>"), NULL); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IXMLDOMDocument2_loadXML(doc, _bstr_("<a>text<!-- comment --><b/></a>"), NULL); + todo_wine + ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr); + hr = IXMLDOMDocument2_get_parseError(doc, &parse_error); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IXMLDOMParseError_get_errorCode(parse_error, &code); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine + ok(code == E_ABORT, "Unexpected error code %#lx.\n", code); + IXMLDOMParseError_Release(parse_error); + + IXMLDOMDocument2_Release(doc); + free_bstrs(); + } } typedef struct _namespace_as_attribute_t { diff --git a/dlls/msxml6/tests/domdoc.c b/dlls/msxml6/tests/domdoc.c index f000e63a2da..a75e6572e34 100644 --- a/dlls/msxml6/tests/domdoc.c +++ b/dlls/msxml6/tests/domdoc.c @@ -1134,6 +1134,95 @@ static void test_dtd_validation(void) free_bstrs(); } +static void test_max_element_depth_values(void) +{ + IXMLDOMParseError *parse_error; + IXMLDOMDocument2 *doc, *doc3; + IXMLDOMDocument *doc2; + VARIANT var; + HRESULT hr; + LONG code; + + hr = CoCreateInstance(&CLSID_DOMDocument60, NULL, CLSCTX_INPROC_SERVER, + &IID_IXMLDOMDocument2, (void **)&doc); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + /* The default max element depth value should be 256. */ + V_VT(&var) = VT_UI4; + V_UI4(&var) = 0xdeadbeef; + hr = IXMLDOMDocument2_getProperty(doc, _bstr_(L"MaxElementDepth"), &var); +todo_wine { + ok(hr == S_OK, "Failed to get property value, hr %#lx.\n", hr); + ok(V_VT(&var) == VT_I4, "Unexpected property value type, vt %d.\n", V_VT(&var)); + ok(V_I4(&var) == 256, "Unexpected property value.\n"); +} + + /* Changes to the depth value should be observable when subsequently retrieved. */ + V_VT(&var) = VT_I4; + V_I4(&var) = 32; + hr = IXMLDOMDocument2_setProperty(doc, _bstr_(L"MaxElementDepth"), var); + ok(hr == S_OK, "Failed to set property, hr %#lx.\n", hr); + + V_VT(&var) = VT_UI4; + V_UI4(&var) = 0xdeadbeef; + hr = IXMLDOMDocument2_getProperty(doc, _bstr_(L"MaxElementDepth"), &var); +todo_wine { + ok(hr == S_OK, "Failed to get property value, hr %#lx.\n", hr); + ok(V_VT(&var) == VT_I4, "Unexpected property value type, vt %d.\n", V_VT(&var)); + ok(V_I4(&var) == 32, "Unexpected property value.\n"); +} + + hr = IXMLDOMDocument2_cloneNode(doc, VARIANT_FALSE, (IXMLDOMNode **)&doc2); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IXMLDOMDocument_QueryInterface(doc2, &IID_IXMLDOMDocument2, (void **)&doc3); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + V_VT(&var) = VT_UI4; + V_UI4(&var) = 0xdeadbeef; + hr = IXMLDOMDocument2_getProperty(doc3, _bstr_(L"MaxElementDepth"), &var); +todo_wine { + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(V_VT(&var) == VT_I4, "Unexpected property value type, vt %d.\n", V_VT(&var)); + ok(V_I4(&var) == 32, "Unexpected property value.\n"); +} + IXMLDOMDocument2_Release(doc3); + IXMLDOMDocument_Release(doc2); + + V_VT(&var) = VT_I4; + V_I4(&var) = -1; + hr = IXMLDOMDocument2_setProperty(doc, _bstr_(L"MaxElementDepth"), var); + todo_wine + ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); + + V_VT(&var) = VT_UI4; + V_UI4(&var) = 2147483648; + hr = IXMLDOMDocument2_setProperty(doc, _bstr_(L"MaxElementDepth"), var); + todo_wine + ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); + + V_VT(&var) = VT_I4; + V_I4(&var) = 1; + hr = IXMLDOMDocument2_setProperty(doc, _bstr_(L"MaxElementDepth"), var); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IXMLDOMDocument2_loadXML(doc, _bstr_(L"<a>text<!-- comment --></a>"), NULL); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IXMLDOMDocument2_loadXML(doc, _bstr_(L"<a>text<!-- comment --><b/></a>"), NULL); + todo_wine + ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr); + hr = IXMLDOMDocument2_get_parseError(doc, &parse_error); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IXMLDOMParseError_get_errorCode(parse_error, &code); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine + ok(code == 0xc00ce586, "Unexpected error code %#lx.\n", code); + IXMLDOMParseError_Release(parse_error); + + IXMLDOMDocument2_Release(doc); + free_bstrs(); +} + START_TEST(domdoc) { HRESULT hr; @@ -1159,6 +1248,7 @@ START_TEST(domdoc) test_prohibitdtd(); test_interfaces(); test_dtd_validation(); + test_max_element_depth_values(); CoUninitialize(); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10741
From: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> --- dlls/msxml3/saxreader.c | 34 ++++++++++++++++++++++++++++++---- dlls/msxml3/tests/saxreader.c | 11 ----------- dlls/msxml6/tests/saxreader.c | 11 ----------- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/dlls/msxml3/saxreader.c b/dlls/msxml3/saxreader.c index bfb84b9cea4..fd207c5cec4 100644 --- a/dlls/msxml3/saxreader.c +++ b/dlls/msxml3/saxreader.c @@ -209,6 +209,8 @@ enum error_codes E_SAX_BADXMLCASE = 0xc00ce576, E_SAX_INVALID_STANDALONE = 0xc00ce579, E_SAX_INVALID_VERSION = 0xc00ce57f, + + E_SAX_MAX_ELEMENT_DEPTH = 0xc00cee92, }; enum attdef_type @@ -465,6 +467,7 @@ struct saxreader BSTR xmldecl_standalone; BSTR xmldecl_encoding; int max_xml_size; + int max_element_depth; BSTR empty_bstr; MSXML_VERSION version; }; @@ -886,6 +889,7 @@ struct saxlocator bool vbInterface; struct list elements; enum saxreader_state state; + int depth; ISequentialStream *stream; bool eos; @@ -2378,19 +2382,25 @@ static void saxlocator_start_element(struct saxlocator *locator, const struct te struct element *element) { struct saxcontenthandler_iface *handler = saxreader_get_contenthandler(locator->saxreader); + int max_depth = locator->saxreader->max_element_depth; + MSXML_VERSION version = locator->saxreader->version; BSTR uri = NULL, local = NULL; HRESULT hr; if (locator->status != S_OK) return; + ++locator->depth; + if (max_depth && locator->depth > max_depth) + return saxreader_set_error(locator, version < MSXML6 ? E_ABORT : E_SAX_MAX_ELEMENT_DEPTH); + if (!saxreader_has_handler(locator, SAXContentHandler)) return; locator->line = position->line; locator->column = position->column; /* Point to the closing '>' */ - if (locator->saxreader->version >= MSXML4) + if (version >= MSXML4) --locator->column; if (is_namespaces_enabled(locator->saxreader)) @@ -2446,6 +2456,7 @@ static void saxlocator_end_element(struct saxlocator *locator, const struct text if (locator->status != S_OK) return; + --locator->depth; locator->line = position->line; /* Point to the closing '>' */ if (locator->saxreader->version >= MSXML4) @@ -5840,9 +5851,16 @@ static HRESULT saxreader_put_property(struct saxreader *reader, const WCHAR *pro if (!wcscmp(prop, L"max-element-depth")) { - if (V_VT(v) == VT_I4 && V_I4(v) == 0) return S_OK; - FIXME("(%p)->(%s): max-element-depth unsupported\n", reader, debugstr_variant(v)); - return E_NOTIMPL; + int depth; + + if (FAILED(saxreader_get_int_property(&value, &depth))) + return E_FAIL; + + if (depth < 0) + return E_INVALIDARG; + + reader->max_element_depth = depth; + return S_OK; } FIXME("(%p)->(%s:%s): unsupported property\n", reader, debugstr_w(prop), debugstr_variant(v)); @@ -5914,6 +5932,13 @@ static HRESULT saxreader_get_property(const struct saxreader *reader, const WCHA return S_OK; } + if (!wcscmp(prop, L"max-element-depth")) + { + V_VT(value) = VT_I4; + V_I4(value) = reader->max_element_depth; + return S_OK; + } + FIXME("(%p)->(%s) unsupported property\n", reader, debugstr_w(prop)); return E_NOTIMPL; @@ -6438,6 +6463,7 @@ static HRESULT saxreader_create(MSXML_VERSION version, struct saxreader **reader object->features = Namespaces | NamespacePrefixes | NormalizeLineBreaks; object->version = version; object->empty_bstr = SysAllocString(L""); + object->max_element_depth = version > MSXML3 ? 256 : 5000; init_dispex(&object->dispex, (IUnknown *)&object->IVBSAXXMLReader_iface, &saxreader_dispex); diff --git a/dlls/msxml3/tests/saxreader.c b/dlls/msxml3/tests/saxreader.c index 6f16f32a3d9..8a3d87401cb 100644 --- a/dlls/msxml3/tests/saxreader.c +++ b/dlls/msxml3/tests/saxreader.c @@ -6498,43 +6498,33 @@ static void test_saxreader_max_element_depth(void) memset(&v, 0, sizeof(v)); hr = ISAXXMLReader_getProperty(reader, _bstr_("max-element-depth"), &v); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(V_VT(&v) == VT_I4, "Unexpected type %d.\n", V_VT(&v)); - todo_wine ok(V_I4(&v) == 5000, "Unexpected value %ld.\n", V_I4(&v)); V_UI4(&v) = 2147483648; hr = ISAXXMLReader_putProperty(reader, _bstr_("max-element-depth"), v); - todo_wine ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); V_I4(&v) = 2147483647; hr = ISAXXMLReader_putProperty(reader, _bstr_("max-element-depth"), v); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = ISAXXMLReader_getProperty(reader, _bstr_("max-element-depth"), &v); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(V_VT(&v) == VT_I4, "Unexpected type %d.\n", V_VT(&v)); ok(V_I4(&v) == 2147483647, "Unexpected value %ld.\n", V_I4(&v)); V_I4(&v) = 0; hr = ISAXXMLReader_putProperty(reader, _bstr_("max-element-depth"), v); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = ISAXXMLReader_getProperty(reader, _bstr_("max-element-depth"), &v); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(V_I4(&v) == 0, "Unexpected value %ld.\n", V_I4(&v)); V_I4(&v) = 1; hr = ISAXXMLReader_putProperty(reader, _bstr_("max-element-depth"), v); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); V_VT(&v) = VT_BSTR; @@ -6552,7 +6542,6 @@ static void test_saxreader_max_element_depth(void) V_VT(&v) = VT_BSTR; V_BSTR(&v) = SysAllocString(L"<a>text<!-- comment --><b/></a>"); hr = ISAXXMLReader_parse(reader, v); - todo_wine ok(hr == E_ABORT, "Unexpected hr %#lx.\n", hr); VariantClear(&v); diff --git a/dlls/msxml6/tests/saxreader.c b/dlls/msxml6/tests/saxreader.c index 9e48cd4c156..ad11ea29945 100644 --- a/dlls/msxml6/tests/saxreader.c +++ b/dlls/msxml6/tests/saxreader.c @@ -5323,43 +5323,33 @@ static void test_saxreader_max_element_depth(void) memset(&v, 0, sizeof(v)); hr = ISAXXMLReader_getProperty(reader, _bstr_("max-element-depth"), &v); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(V_VT(&v) == VT_I4, "Unexpected type %d.\n", V_VT(&v)); - todo_wine ok(V_I4(&v) == 256, "Unexpected value %ld.\n", V_I4(&v)); V_UI4(&v) = 2147483648; hr = ISAXXMLReader_putProperty(reader, _bstr_("max-element-depth"), v); - todo_wine ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); V_I4(&v) = 2147483647; hr = ISAXXMLReader_putProperty(reader, _bstr_("max-element-depth"), v); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = ISAXXMLReader_getProperty(reader, _bstr_("max-element-depth"), &v); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(V_VT(&v) == VT_I4, "Unexpected type %d.\n", V_VT(&v)); ok(V_I4(&v) == 2147483647, "Unexpected value %ld.\n", V_I4(&v)); V_I4(&v) = 0; hr = ISAXXMLReader_putProperty(reader, _bstr_("max-element-depth"), v); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = ISAXXMLReader_getProperty(reader, _bstr_("max-element-depth"), &v); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(V_I4(&v) == 0, "Unexpected value %ld.\n", V_I4(&v)); V_I4(&v) = 1; hr = ISAXXMLReader_putProperty(reader, _bstr_("max-element-depth"), v); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); V_VT(&v) = VT_BSTR; @@ -5377,7 +5367,6 @@ static void test_saxreader_max_element_depth(void) V_VT(&v) = VT_BSTR; V_BSTR(&v) = SysAllocString(L"<a>text<!-- comment --><b/></a>"); hr = ISAXXMLReader_parse(reader, v); - todo_wine ok(hr == 0xc00cee92, "Unexpected hr %#lx.\n", hr); VariantClear(&v); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10741
From: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> --- dlls/msxml3/domdoc.c | 22 +++++++++++++- dlls/msxml3/msxml_private.h | 59 ++++++++++++++++++++++++++++++++++++ dlls/msxml3/node.c | 16 ++++++++++ dlls/msxml3/saxreader.c | 60 ++----------------------------------- dlls/msxml3/tests/domdoc.c | 17 ++++------- dlls/msxml6/tests/domdoc.c | 15 +++------- 6 files changed, 109 insertions(+), 80 deletions(-) diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c index 70488d26e10..5159d717b04 100644 --- a/dlls/msxml3/domdoc.c +++ b/dlls/msxml3/domdoc.c @@ -1984,7 +1984,6 @@ static HRESULT WINAPI domdoc_setProperty(IXMLDOMDocument3 *iface, BSTR p, VARIAN wcsicmp(p, L"AllowXsltScript") == 0 || wcsicmp(p, L"NormalizeAttributeValues") == 0 || wcsicmp(p, L"AllowDocumentFunction") == 0 || - wcsicmp(p, L"MaxElementDepth") == 0 || wcsicmp(p, L"UseInlineSchema") == 0) { /* Ignore */ @@ -2005,6 +2004,20 @@ static HRESULT WINAPI domdoc_setProperty(IXMLDOMDocument3 *iface, BSTR p, VARIAN return S_OK; } + if (!wcscmp(p, L"MaxElementDepth")) + { + int depth; + + if (FAILED(variant_get_int_property(&value, &depth))) + return E_FAIL; + + if (depth < 0) + return E_INVALIDARG; + + properties->max_element_depth = depth; + return S_OK; + } + FIXME("Unknown property %s\n", debugstr_w(p)); return E_FAIL; } @@ -2079,6 +2092,13 @@ static HRESULT WINAPI domdoc_getProperty(IXMLDOMDocument3 *iface, BSTR p, VARIAN return S_OK; } + if (!wcscmp(p, L"MaxElementDepth")) + { + V_VT(var) = VT_I4; + V_I4(var) = properties->max_element_depth; + return S_OK; + } + FIXME("Unknown property %s\n", debugstr_w(p)); return E_FAIL; } diff --git a/dlls/msxml3/msxml_private.h b/dlls/msxml3/msxml_private.h index 804d52ec49e..4a2d9da7d32 100644 --- a/dlls/msxml3/msxml_private.h +++ b/dlls/msxml3/msxml_private.h @@ -33,6 +33,62 @@ extern const CLSID * DOMDocument_version(MSXML_VERSION v); +enum error_codes +{ + E_SAX_UNDEFINEDREF = 0xc00ce002, + E_SAX_INFINITEREFLOOP = 0xc00ce003, + E_SAX_UNPARSEDENTITYREF = 0xc00ce006, + E_SAX_CONTAINSCOLON = 0xc00ce00c, + E_SAX_UNDECLAREDPREFIX = 0xc00ce01d, + + E_SAX_MISSINGEQUALS = 0xc00ce501, + E_SAX_MISSINGQUOTE = 0xc00ce502, + E_SAX_COMMENTSYNTAX = 0xc00ce503, + E_SAX_BADSTARTNAMECHAR = 0xc00ce504, + E_SAX_BADNAMECHAR = 0xc00ce505, + E_SAX_BADCHARINSTRING = 0xc00ce506, + E_SAX_XMLDECLSYNTAX = 0xc00ce507, + E_SAX_MISSINGWHITESPACE = 0xc00ce509, + E_SAX_EXPECTINGTAGEND = 0xc00ce50a, + E_SAX_BADCHARINDTD = 0xc00ce50b, + E_SAX_MISSINGSEMICOLON = 0xc00ce50d, + E_SAX_BADCHARINENTREF = 0xc00ce50e, + E_SAX_BADCHARINMIXEDMODEL = 0xc00ce515, + E_SAX_MISSING_STAR = 0xc00ce516, + E_SAX_MISSING_PAREN = 0xc00ce518, + E_SAX_BADCHARINENUMERATION = 0xc00ce519, + E_SAX_PIDECLSYNTAX = 0xc00ce51a, + E_SAX_EXPECTINGCLOSEQUOTE = 0xc00ce51b, + E_SAX_MULTIPLE_COLONS = 0xc00ce51c, + E_SAX_INVALID_UNICODE = 0xc00ce51f, + E_SAX_WHITESPACEORQUESTIONMARK = 0xc00ce520, + E_SAX_UNEXPECTEDENDTAG = 0xc00ce552, + E_SAX_DUPLICATEATTRIBUTE = 0xc00ce554, + E_SAX_INVALIDATROOTLEVEL = 0xc00ce556, + E_SAX_BAD_XMLDECL = 0xc00ce557, + E_SAX_MISSINGROOT = 0xc00ce558, + E_SAX_UNEXPECTED_EOF = 0xc00ce559, + E_SAX_INVALID_CDATACLOSINGTAG = 0xc00ce55c, + E_SAX_UNCLOSEDPI = 0xc00ce55d, + E_SAX_UNCLOSEDENDTAG = 0xc00ce55f, + E_SAX_UNCLOSEDCDATA = 0xc00ce564, + E_SAX_BADDECLNAME = 0xc00ce565, + E_SAX_RESERVEDNAMESPACE = 0xc00ce568, + E_SAX_UNEXPECTED_ATTRIBUTE = 0xc00ce56c, + E_SAX_ENDTAGMISMATCH = 0xc00ce56d, + E_SAX_INVALIDENCODING = 0xc00ce56e, + E_SAX_INVALIDSWITCH = 0xc00ce56f, + E_SAX_INVALID_MODEL = 0xc00ce571, + E_SAX_INVALID_TYPE = 0xc00ce572, + E_SAX_BADXMLCASE = 0xc00ce576, + E_SAX_INVALID_STANDALONE = 0xc00ce579, + E_SAX_INVALID_VERSION = 0xc00ce57f, + E_DOM_MAX_ELEMENT_DEPTH = 0xc00ce586, + + E_SAX_MAX_ELEMENT_DEPTH = 0xc00cee92, +}; + + static inline bool array_reserve(void **elements, size_t *capacity, size_t count, size_t size) { size_t new_capacity, max_capacity; @@ -158,6 +214,7 @@ struct domdoc_properties LONG selectNsStr_len; bool XPath; bool prohibit_dtd; + int max_element_depth; IUri *uri; }; @@ -349,6 +406,8 @@ extern const char* debugstr_dt(XDR_DT dt); extern OLECHAR const* dt_to_bstr(XDR_DT dt); extern HRESULT dt_validate(XDR_DT dt, const WCHAR *content); +extern HRESULT variant_get_int_property(const VARIANT *v, int *ret); + #include <libxslt/documents.h> extern xmlDocPtr xslt_doc_default_loader(const xmlChar *uri, xmlDictPtr dict, int options, void *_ctxt, xsltLoadType type); diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c index 72fbe1861ab..bec00576f2e 100644 --- a/dlls/msxml3/node.c +++ b/dlls/msxml3/node.c @@ -1254,6 +1254,7 @@ struct domdoc_properties *domdoc_create_properties(MSXML_VERSION version) properties->version = version; properties->XPath = (version == MSXML4 || version == MSXML6); properties->prohibit_dtd = version == MSXML6; + properties->max_element_depth = version > MSXML3 ? 256 : 5000; /* document uri */ properties->uri = NULL; @@ -1290,6 +1291,7 @@ static struct domdoc_properties* domdoc_properties_clone(struct domdoc_propertie if (pcopy->schemaCache) IXMLDOMSchemaCollection2_AddRef(pcopy->schemaCache); pcopy->XPath = properties->XPath; + pcopy->max_element_depth = properties->max_element_depth; pcopy->selectNsStr_len = properties->selectNsStr_len; list_init( &pcopy->selectNsList ); pcopy->selectNsStr = malloc(len); @@ -3568,7 +3570,10 @@ struct parse_context /* Parsed output */ struct domnode *root; + MSXML_VERSION version; HRESULT status; + int max_depth; + int depth; }; static void parse_context_node_create(struct parse_context *context, DOMNodeType type, @@ -3743,9 +3748,14 @@ static HRESULT WINAPI parse_content_handler_startElement(ISAXContentHandler *ifa { struct parse_context *c = impl_from_ISAXContentHandler(iface); struct domnode *element, *attr; + int max_depth = c->max_depth; int count, length; const WCHAR *str; + ++c->depth; + if (max_depth && c->depth > max_depth) + return c->version < MSXML6 ? E_ABORT : E_DOM_MAX_ELEMENT_DEPTH; + parse_context_create_text_node(c, NODE_TEXT); parse_context_node_create(c, NODE_ELEMENT, qname, qname_len, uri, uri_len, c->root, &element); parse_context_append_child(c, c->node, element); @@ -3781,6 +3791,7 @@ static HRESULT WINAPI parse_content_handler_endElement(ISAXContentHandler *iface { struct parse_context *c = impl_from_ISAXContentHandler(iface); + --c->depth; parse_context_create_text_node(c, NODE_TEXT); c->node = c->node->parent; @@ -4032,6 +4043,8 @@ static HRESULT parse_context_init(struct parse_context *c, const struct domdoc_p c->extension_handler.lpVtbl = &parse_extension_handler_vtbl; c->lexical_handler.lpVtbl = &parse_lexical_handler_vtbl; c->buffer.status = &c->status; + c->max_depth = properties->max_element_depth; + c->version = properties->version; if (FAILED(hr = SAXXMLReader_create(MSXML3, (void **)&unk))) return hr; @@ -4050,6 +4063,9 @@ static HRESULT parse_context_init(struct parse_context *c, const struct domdoc_p V_UNKNOWN(&v) = (IUnknown *)&c->extension_handler; ISAXXMLReader_putProperty(c->reader, L"http://winehq.org/sax/properties/extension-handler", v); + V_VT(&v) = VT_I4; + V_I4(&v) = 0; + ISAXXMLReader_putProperty(c->reader, L"max-element-depth", v); ISAXXMLReader_putFeature(c->reader, L"prohibit-dtd", properties->prohibit_dtd ? VARIANT_TRUE : VARIANT_FALSE); domnode_create(NODE_DOCUMENT, NULL, 0, NULL, 0, NULL, &c->root); diff --git a/dlls/msxml3/saxreader.c b/dlls/msxml3/saxreader.c index fd207c5cec4..7bd6f5fa0d9 100644 --- a/dlls/msxml3/saxreader.c +++ b/dlls/msxml3/saxreader.c @@ -159,60 +159,6 @@ HRESULT stream_wrapper_create(const void *buffer, DWORD size, ISequentialStream return S_OK; } -enum error_codes -{ - E_SAX_UNDEFINEDREF = 0xc00ce002, - E_SAX_INFINITEREFLOOP = 0xc00ce003, - E_SAX_UNPARSEDENTITYREF = 0xc00ce006, - E_SAX_CONTAINSCOLON = 0xc00ce00c, - E_SAX_UNDECLAREDPREFIX = 0xc00ce01d, - - E_SAX_MISSINGEQUALS = 0xc00ce501, - E_SAX_MISSINGQUOTE = 0xc00ce502, - E_SAX_COMMENTSYNTAX = 0xc00ce503, - E_SAX_BADSTARTNAMECHAR = 0xc00ce504, - E_SAX_BADNAMECHAR = 0xc00ce505, - E_SAX_BADCHARINSTRING = 0xc00ce506, - E_SAX_XMLDECLSYNTAX = 0xc00ce507, - E_SAX_MISSINGWHITESPACE = 0xc00ce509, - E_SAX_EXPECTINGTAGEND = 0xc00ce50a, - E_SAX_BADCHARINDTD = 0xc00ce50b, - E_SAX_MISSINGSEMICOLON = 0xc00ce50d, - E_SAX_BADCHARINENTREF = 0xc00ce50e, - E_SAX_BADCHARINMIXEDMODEL = 0xc00ce515, - E_SAX_MISSING_STAR = 0xc00ce516, - E_SAX_MISSING_PAREN = 0xc00ce518, - E_SAX_BADCHARINENUMERATION = 0xc00ce519, - E_SAX_PIDECLSYNTAX = 0xc00ce51a, - E_SAX_EXPECTINGCLOSEQUOTE = 0xc00ce51b, - E_SAX_MULTIPLE_COLONS = 0xc00ce51c, - E_SAX_INVALID_UNICODE = 0xc00ce51f, - E_SAX_WHITESPACEORQUESTIONMARK = 0xc00ce520, - E_SAX_UNEXPECTEDENDTAG = 0xc00ce552, - E_SAX_DUPLICATEATTRIBUTE = 0xc00ce554, - E_SAX_INVALIDATROOTLEVEL = 0xc00ce556, - E_SAX_BAD_XMLDECL = 0xc00ce557, - E_SAX_MISSINGROOT = 0xc00ce558, - E_SAX_UNEXPECTED_EOF = 0xc00ce559, - E_SAX_INVALID_CDATACLOSINGTAG = 0xc00ce55c, - E_SAX_UNCLOSEDPI = 0xc00ce55d, - E_SAX_UNCLOSEDENDTAG = 0xc00ce55f, - E_SAX_UNCLOSEDCDATA = 0xc00ce564, - E_SAX_BADDECLNAME = 0xc00ce565, - E_SAX_RESERVEDNAMESPACE = 0xc00ce568, - E_SAX_UNEXPECTED_ATTRIBUTE = 0xc00ce56c, - E_SAX_ENDTAGMISMATCH = 0xc00ce56d, - E_SAX_INVALIDENCODING = 0xc00ce56e, - E_SAX_INVALIDSWITCH = 0xc00ce56f, - E_SAX_INVALID_MODEL = 0xc00ce571, - E_SAX_INVALID_TYPE = 0xc00ce572, - E_SAX_BADXMLCASE = 0xc00ce576, - E_SAX_INVALID_STANDALONE = 0xc00ce579, - E_SAX_INVALID_VERSION = 0xc00ce57f, - - E_SAX_MAX_ELEMENT_DEPTH = 0xc00cee92, -}; - enum attdef_type { ATTDEF_TYPE_INVALID = 0, @@ -5799,7 +5745,7 @@ static HRESULT saxreader_put_handler_from_variant(struct saxreader *reader, enum return S_OK; } -static HRESULT saxreader_get_int_property(const VARIANT *v, int *ret) +HRESULT variant_get_int_property(const VARIANT *v, int *ret) { VARIANT dest; @@ -5834,7 +5780,7 @@ static HRESULT saxreader_put_property(struct saxreader *reader, const WCHAR *pro { int size; - if (FAILED(saxreader_get_int_property(&value, &size))) + if (FAILED(variant_get_int_property(&value, &size))) return E_FAIL; if (size < 0) @@ -5853,7 +5799,7 @@ static HRESULT saxreader_put_property(struct saxreader *reader, const WCHAR *pro { int depth; - if (FAILED(saxreader_get_int_property(&value, &depth))) + if (FAILED(variant_get_int_property(&value, &depth))) return E_FAIL; if (depth < 0) diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index ea03c6e5142..15655a7b04e 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -13982,15 +13982,17 @@ static void test_max_element_depth_values(void) hr = CoCreateInstance(classes[i], NULL, CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument2, (void **)&doc); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IXMLDOMDocument2_getProperty(doc, _bstr_("maxElementDepth"), &var); + ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr); + /* The default max element depth value should be 256. */ V_VT(&var) = VT_UI4; V_UI4(&var) = 0xdeadbeef; hr = IXMLDOMDocument2_getProperty(doc, _bstr_("MaxElementDepth"), &var); - todo_wine { ok(hr == S_OK, "Failed to get property value, hr %#lx.\n", hr); ok(V_VT(&var) == VT_I4, "Unexpected property value type, vt %d.\n", V_VT(&var)); ok(V_I4(&var) == 5000, "Unexpected property value %ld.\n", V_I4(&var)); - } + /* Changes to the depth value should be observable when subsequently retrieved. */ V_VT(&var) = VT_I4; V_I4(&var) = 32; @@ -14000,11 +14002,10 @@ static void test_max_element_depth_values(void) V_VT(&var) = VT_UI4; V_UI4(&var) = 0xdeadbeef; hr = IXMLDOMDocument2_getProperty(doc, _bstr_("MaxElementDepth"), &var); - todo_wine { ok(hr == S_OK, "Failed to get property value, hr %#lx.\n", hr); ok(V_VT(&var) == VT_I4, "Unexpected property value type, vt %d.\n", V_VT(&var)); ok(V_I4(&var) == 32, "Unexpected property value.\n"); - } + hr = IXMLDOMDocument2_cloneNode(doc, VARIANT_FALSE, (IXMLDOMNode **)&doc2); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IXMLDOMDocument_QueryInterface(doc2, &IID_IXMLDOMDocument2, (void **)&doc3); @@ -14012,24 +14013,21 @@ static void test_max_element_depth_values(void) V_VT(&var) = VT_UI4; V_UI4(&var) = 0xdeadbeef; hr = IXMLDOMDocument2_getProperty(doc3, _bstr_("MaxElementDepth"), &var); - todo_wine { ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(V_VT(&var) == VT_I4, "Unexpected property value type, vt %d.\n", V_VT(&var)); ok(V_I4(&var) == 32, "Unexpected property value.\n"); - } + IXMLDOMDocument2_Release(doc3); IXMLDOMDocument_Release(doc2); V_VT(&var) = VT_I4; V_I4(&var) = -1; hr = IXMLDOMDocument2_setProperty(doc, _bstr_("MaxElementDepth"), var); - todo_wine ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); V_VT(&var) = VT_UI4; V_UI4(&var) = 2147483648; hr = IXMLDOMDocument2_setProperty(doc, _bstr_("MaxElementDepth"), var); - todo_wine ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); V_VT(&var) = VT_I4; @@ -14039,14 +14037,11 @@ static void test_max_element_depth_values(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IXMLDOMDocument2_loadXML(doc, _bstr_("<a>text<!-- comment --><b/></a>"), NULL); - todo_wine ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr); hr = IXMLDOMDocument2_get_parseError(doc, &parse_error); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IXMLDOMParseError_get_errorCode(parse_error, &code); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(code == E_ABORT, "Unexpected error code %#lx.\n", code); IXMLDOMParseError_Release(parse_error); diff --git a/dlls/msxml6/tests/domdoc.c b/dlls/msxml6/tests/domdoc.c index a75e6572e34..91740990aa2 100644 --- a/dlls/msxml6/tests/domdoc.c +++ b/dlls/msxml6/tests/domdoc.c @@ -1147,15 +1147,16 @@ static void test_max_element_depth_values(void) &IID_IXMLDOMDocument2, (void **)&doc); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IXMLDOMDocument2_getProperty(doc, _bstr_(L"maxElementDepth"), &var); + ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr); + /* The default max element depth value should be 256. */ V_VT(&var) = VT_UI4; V_UI4(&var) = 0xdeadbeef; hr = IXMLDOMDocument2_getProperty(doc, _bstr_(L"MaxElementDepth"), &var); -todo_wine { ok(hr == S_OK, "Failed to get property value, hr %#lx.\n", hr); ok(V_VT(&var) == VT_I4, "Unexpected property value type, vt %d.\n", V_VT(&var)); ok(V_I4(&var) == 256, "Unexpected property value.\n"); -} /* Changes to the depth value should be observable when subsequently retrieved. */ V_VT(&var) = VT_I4; @@ -1166,11 +1167,9 @@ todo_wine { V_VT(&var) = VT_UI4; V_UI4(&var) = 0xdeadbeef; hr = IXMLDOMDocument2_getProperty(doc, _bstr_(L"MaxElementDepth"), &var); -todo_wine { ok(hr == S_OK, "Failed to get property value, hr %#lx.\n", hr); ok(V_VT(&var) == VT_I4, "Unexpected property value type, vt %d.\n", V_VT(&var)); ok(V_I4(&var) == 32, "Unexpected property value.\n"); -} hr = IXMLDOMDocument2_cloneNode(doc, VARIANT_FALSE, (IXMLDOMNode **)&doc2); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); @@ -1179,24 +1178,21 @@ todo_wine { V_VT(&var) = VT_UI4; V_UI4(&var) = 0xdeadbeef; hr = IXMLDOMDocument2_getProperty(doc3, _bstr_(L"MaxElementDepth"), &var); -todo_wine { ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(V_VT(&var) == VT_I4, "Unexpected property value type, vt %d.\n", V_VT(&var)); ok(V_I4(&var) == 32, "Unexpected property value.\n"); -} + IXMLDOMDocument2_Release(doc3); IXMLDOMDocument_Release(doc2); V_VT(&var) = VT_I4; V_I4(&var) = -1; hr = IXMLDOMDocument2_setProperty(doc, _bstr_(L"MaxElementDepth"), var); - todo_wine ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); V_VT(&var) = VT_UI4; V_UI4(&var) = 2147483648; hr = IXMLDOMDocument2_setProperty(doc, _bstr_(L"MaxElementDepth"), var); - todo_wine ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); V_VT(&var) = VT_I4; @@ -1208,14 +1204,11 @@ todo_wine { ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IXMLDOMDocument2_loadXML(doc, _bstr_(L"<a>text<!-- comment --><b/></a>"), NULL); - todo_wine ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr); hr = IXMLDOMDocument2_get_parseError(doc, &parse_error); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IXMLDOMParseError_get_errorCode(parse_error, &code); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(code == 0xc00ce586, "Unexpected error code %#lx.\n", code); IXMLDOMParseError_Release(parse_error); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10741
participants (2)
-
Nikolay Sivov -
Nikolay Sivov (@nsivov)