mshtml: Added IHTMLDocument3::uniqueID implementation.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2016-01-06 18:39:39 +01:00 committed by Alexandre Julliard
parent fef68e1af9
commit 8f6097a99b
3 changed files with 44 additions and 4 deletions

View File

@ -2018,11 +2018,18 @@ static HRESULT WINAPI HTMLDocument3_get_documentElement(IHTMLDocument3 *iface, I
return hres;
}
static HRESULT WINAPI HTMLDocument3_uniqueID(IHTMLDocument3 *iface, BSTR *p)
static HRESULT WINAPI HTMLDocument3_get_uniqueID(IHTMLDocument3 *iface, BSTR *p)
{
HTMLDocument *This = impl_from_IHTMLDocument3(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
WCHAR buf[32];
static const WCHAR formatW[] = {'m','s','_','_','i','d','%','u',0};
TRACE("(%p)->(%p)\n", This, p);
sprintfW(buf, formatW, ++This->doc_node->unique_id);
*p = SysAllocString(buf);
return *p ? S_OK : E_OUTOFMEMORY;
}
static HRESULT WINAPI HTMLDocument3_attachEvent(IHTMLDocument3 *iface, BSTR event,
@ -2428,7 +2435,7 @@ static const IHTMLDocument3Vtbl HTMLDocument3Vtbl = {
HTMLDocument3_recalc,
HTMLDocument3_createTextNode,
HTMLDocument3_get_documentElement,
HTMLDocument3_uniqueID,
HTMLDocument3_get_uniqueID,
HTMLDocument3_attachEvent,
HTMLDocument3_detachEvent,
HTMLDocument3_put_onrowsdelete,

View File

@ -776,6 +776,8 @@ struct HTMLDocumentNode {
UINT charset;
unsigned unique_id;
struct list selection_list;
struct list range_list;
struct list plugin_hosts;

View File

@ -6208,6 +6208,35 @@ static void test_default_selection(IHTMLDocument2 *doc)
IHTMLTxtRange_Release(range);
}
static void test_unique_id(IHTMLDocument2 *doc)
{
IHTMLDocument3 *doc3 = get_doc3_iface(doc);
BSTR id, id2;
HRESULT hres;
static const WCHAR prefixW[] = {'m','s','_','_','i','d',0};
hres = IHTMLDocument3_get_uniqueID(doc3, &id);
ok(hres == S_OK, "get_uniqueID failed: %08x\n", hres);
ok(SysStringLen(id) >= sizeof(prefixW)/sizeof(*prefixW), "id %s too short\n", wine_dbgstr_w(id));
hres = IHTMLDocument3_get_uniqueID(doc3, &id2);
ok(hres == S_OK, "get_uniqueID failed: %08x\n", hres);
ok(SysStringLen(id2) >= sizeof(prefixW)/sizeof(*prefixW), "id %s too short\n", wine_dbgstr_w(id2));
ok(lstrcmpW(id, id2), "same unique ids %s\n", wine_dbgstr_w(id));
id[sizeof(prefixW)/sizeof(*prefixW)-1] = 0;
ok(!lstrcmpW(id, prefixW), "unexpected prefix %s\n", wine_dbgstr_w(id));
id2[sizeof(prefixW)/sizeof(*prefixW)-1] = 0;
ok(!lstrcmpW(id2, prefixW), "unexpected prefix %s\n", wine_dbgstr_w(id2));
SysFreeString(id);
SysFreeString(id2);
IHTMLDocument3_Release(doc3);
}
static void test_doc_elem(IHTMLDocument2 *doc)
{
IHTMLDocument2 *doc_node, *owner_doc;
@ -6244,6 +6273,8 @@ static void test_doc_elem(IHTMLDocument2 *doc)
test_elem_client_rect((IUnknown*)elem);
IHTMLElement_Release(elem);
test_unique_id(doc);
}
static void test_default_body(IHTMLBodyElement *body)