winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
September 2011
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
996 discussions
Start a n
N
ew thread
Piotr Caban : mshtml: Added HTMLAttributeCollection_get_dispid implementation.
by Alexandre Julliard
02 Sep '11
02 Sep '11
Module: wine Branch: master Commit: fb9af4648f5eea440155ef2366101d0066c43624 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=fb9af4648f5eea440155ef236…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Fri Sep 2 14:17:40 2011 +0200 mshtml: Added HTMLAttributeCollection_get_dispid implementation. --- dlls/mshtml/htmlelem.c | 32 ++++++++++++++++++++++++++------ 1 files changed, 26 insertions(+), 6 deletions(-) diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index ff8d022..8b5b7f0 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -2269,9 +2269,10 @@ static inline HRESULT get_attr_dispid_by_name(HTMLAttributeCollection *This, BST return hres; } -static inline HRESULT get_domattr(HTMLAttributeCollection *This, DISPID id, HTMLDOMAttribute **attr) +static inline HRESULT get_domattr(HTMLAttributeCollection *This, DISPID id, LONG *list_pos, HTMLDOMAttribute **attr) { HTMLDOMAttribute *iter; + LONG pos = 0; HRESULT hres; *attr = NULL; @@ -2280,6 +2281,7 @@ static inline HRESULT get_domattr(HTMLAttributeCollection *This, DISPID id, HTML *attr = iter; break; } + pos++; } if(!*attr) { @@ -2288,12 +2290,15 @@ static inline HRESULT get_domattr(HTMLAttributeCollection *This, DISPID id, HTML return E_UNEXPECTED; } + pos++; hres = HTMLDOMAttribute_Create(This->elem, id, attr); if(FAILED(hres)) return hres; } IHTMLDOMAttribute_AddRef(&(*attr)->IHTMLDOMAttribute_iface); + if(list_pos) + *list_pos = pos; return S_OK; } @@ -2341,7 +2346,7 @@ static HRESULT WINAPI HTMLAttributeCollection_item(IHTMLAttributeCollection *ifa if(FAILED(hres)) return hres; - hres = get_domattr(This, id, &attr); + hres = get_domattr(This, id, NULL, &attr); if(FAILED(hres)) return hres; @@ -2433,7 +2438,7 @@ static HRESULT WINAPI HTMLAttributeCollection2_getNamedItem(IHTMLAttributeCollec return hres; } - hres = get_domattr(This, id, &attr); + hres = get_domattr(This, id, NULL, &attr); if(FAILED(hres)) return hres; @@ -2561,7 +2566,7 @@ static HRESULT WINAPI HTMLAttributeCollection3_item(IHTMLAttributeCollection3 *i if(FAILED(hres)) return hres; - hres = get_domattr(This, id, &attr); + hres = get_domattr(This, id, NULL, &attr); if(FAILED(hres)) return hres; @@ -2598,8 +2603,23 @@ static inline HTMLAttributeCollection *HTMLAttributeCollection_from_DispatchEx(D static HRESULT HTMLAttributeCollection_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid) { HTMLAttributeCollection *This = HTMLAttributeCollection_from_DispatchEx(dispex); - FIXME("(%p)->(%s %x %p)\n", This, debugstr_w(name), flags, dispid); - return E_NOTIMPL; + HTMLDOMAttribute *attr; + LONG pos; + HRESULT hres; + + TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(name), flags, dispid); + + hres = get_attr_dispid_by_name(This, name, dispid); + if(FAILED(hres)) + return hres; + + hres = get_domattr(This, *dispid, &pos, &attr); + if(FAILED(hres)) + return hres; + IHTMLDOMAttribute_Release(&attr->IHTMLDOMAttribute_iface); + + *dispid = MSHTML_DISPID_CUSTOM_MIN+pos; + return S_OK; } static HRESULT HTMLAttributeCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
1
0
0
0
Piotr Caban : mshtml/tests: Added IHTMLAttributeCollection tests.
by Alexandre Julliard
02 Sep '11
02 Sep '11
Module: wine Branch: master Commit: 4d74236fa29bba37c5dc07a5f64a11178df6069d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4d74236fa29bba37c5dc07a5f…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Fri Sep 2 14:17:31 2011 +0200 mshtml/tests: Added IHTMLAttributeCollection tests. --- dlls/mshtml/tests/dom.c | 112 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 112 insertions(+), 0 deletions(-) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index cf8cbd0..959bfe3 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -2413,6 +2413,113 @@ static void test_dynamic_properties(IHTMLElement *elem) SysFreeString(attr1); } +static void test_attr_collection(IHTMLElement *elem) +{ + static const WCHAR testW[] = {'t','e','s','t',0}; + + IHTMLDOMNode *node; + IDispatch *disp, *attr; + IHTMLDOMAttribute *dom_attr; + IHTMLAttributeCollection *attr_col; + BSTR name = SysAllocString(testW); + VARIANT id, val; + LONG i, len, checked; + HRESULT hres; + + hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLDOMNode, (void**)&node); + ok(hres == S_OK, "QueryInterface failed: %08x\n", hres); + + hres = IHTMLDOMNode_get_attributes(node, &disp); + ok(hres == S_OK, "get_attributes failed: %08x\n", hres); + + hres = IHTMLDOMNode_get_attributes(node, &attr); + ok(hres == S_OK, "get_attributes failed: %08x\n", hres); + ok(iface_cmp((IUnknown*)disp, (IUnknown*)attr), "disp != attr\n"); + IDispatch_Release(attr); + IHTMLDOMNode_Release(node); + + hres = IDispatch_QueryInterface(disp, &IID_IHTMLAttributeCollection, (void**)&attr_col); + ok(hres == S_OK, "QueryInterface failed: %08x\n", hres); + + hres = IHTMLAttributeCollection_get_length(attr_col, &i); + ok(hres == S_OK, "get_length failed: %08x\n", hres); + + V_VT(&val) = VT_I4; + V_I4(&val) = 1; + hres = IHTMLElement_setAttribute(elem, name, val, 0); + ok(hres == S_OK, "setAttribute failed: %08x\n", hres); + SysFreeString(name); + + hres = IHTMLAttributeCollection_get_length(attr_col, &len); + ok(hres == S_OK, "get_length failed: %08x\n", hres); + ok(len == i+1, "get_length returned %d, expected %d\n", len, i+1); + + checked = 0; + for(i=0; i<len; i++) { + V_VT(&id) = VT_I4; + V_I4(&id) = i; + hres = IHTMLAttributeCollection_item(attr_col, &id, &attr); + ok(hres == S_OK, "%d) item failed: %08x\n", i, hres); + + hres = IDispatch_QueryInterface(attr, &IID_IHTMLDOMAttribute, (void**)&dom_attr); + ok(hres == S_OK, "%d) QueryInterface failed: %08x\n", i, hres); + IDispatch_Release(attr); + + hres = IHTMLDOMAttribute_get_nodeName(dom_attr, &name); + ok(hres == S_OK, "%d) get_nodeName failed: %08x\n", i, hres); + + if(!strcmp_wa(name, "id")) { + checked++; + hres = IHTMLDOMAttribute_get_nodeValue(dom_attr, &val); + ok(hres == S_OK, "%d) get_nodeValue failed: %08x\n", i, hres); + ok(V_VT(&val) == VT_BSTR, "id: V_VT(&val) = %d\n", V_VT(&val)); + ok(!strcmp_wa(V_BSTR(&val), "attr"), "id: V_BSTR(&val) = %s\n", wine_dbgstr_w(V_BSTR(&val))); + } else if(!strcmp_wa(name, "attr1")) { + checked++; + hres = IHTMLDOMAttribute_get_nodeValue(dom_attr, &val); + ok(hres == S_OK, "%d) get_nodeValue failed: %08x\n", i, hres); + ok(V_VT(&val) == VT_BSTR, "attr1: V_VT(&val) = %d\n", V_VT(&val)); + ok(!strcmp_wa(V_BSTR(&val), "attr1"), "attr1: V_BSTR(&val) = %s\n", wine_dbgstr_w(V_BSTR(&val))); + } else if(!strcmp_wa(name, "attr2")) { + checked++; + hres = IHTMLDOMAttribute_get_nodeValue(dom_attr, &val); + ok(hres == S_OK, "%d) get_nodeValue failed: %08x\n", i, hres); + ok(V_VT(&val) == VT_BSTR, "attr2: V_VT(&val) = %d\n", V_VT(&val)); + ok(!V_BSTR(&val), "attr2: V_BSTR(&val) != NULL\n"); + } else if(!strcmp_wa(name, "attr3")) { + checked++; + hres = IHTMLDOMAttribute_get_nodeValue(dom_attr, &val); + ok(hres == S_OK, "%d) get_nodeValue failed: %08x\n", i, hres); + ok(V_VT(&val) == VT_BSTR, "attr3: V_VT(&val) = %d\n", V_VT(&val)); + ok(!strcmp_wa(V_BSTR(&val), "attr3"), "attr3: V_BSTR(&val) = %s\n", wine_dbgstr_w(V_BSTR(&val))); + } else if(!strcmp_wa(name, "test")) { + checked++; + hres = IHTMLDOMAttribute_get_nodeValue(dom_attr, &val); + ok(hres == S_OK, "%d) get_nodeValue failed: %08x\n", i, hres); + ok(V_VT(&val) == VT_I4, "test: V_VT(&val) = %d\n", V_VT(&val)); + ok(V_I4(&val) == 1, "test: V_I4(&val) = %d\n", V_I4(&val)); + } + + IHTMLDOMAttribute_Release(dom_attr); + SysFreeString(name); + VariantClear(&val); + } + ok(checked==5, "invalid number of specified attributes (%d)\n", checked); + + V_I4(&id) = len; + hres = IHTMLAttributeCollection_item(attr_col, &id, &attr); + ok(hres == E_INVALIDARG, "item failed: %08x\n", hres); + + V_VT(&id) = VT_BSTR; + V_BSTR(&id) = a2bstr("nonexisting"); + hres = IHTMLAttributeCollection_item(attr_col, &id, &attr); + ok(hres == E_INVALIDARG, "item failed: %08x\n", hres); + VariantClear(&id); + + IDispatch_Release(disp); + IHTMLAttributeCollection_Release(attr_col); +} + #define test_input_type(i,t) _test_input_type(__LINE__,i,t) static void _test_input_type(unsigned line, IHTMLInputElement *input, const char *extype) { @@ -4990,6 +5097,7 @@ static void test_elems(IHTMLDocument2 *doc) elem = get_elem_by_id(doc, "attr", TRUE); if(elem) { test_dynamic_properties(elem); + test_attr_collection(elem); IHTMLElement_Release(elem); } @@ -5074,6 +5182,10 @@ static void test_elems(IHTMLDocument2 *doc) test_node_put_value_str((IUnknown*)elem, "test text"); test_node_get_value_str((IUnknown*)node, "text test"); + hres = IHTMLDOMNode_get_attributes(node, &disp); + ok(hres == S_OK, "get_attributes failed: %08x\n", hres); + ok(!disp, "disp != NULL\n"); + IHTMLDOMNode_Release(node); }
1
0
0
0
Piotr Caban : mshtml/tests: Added attributes tests on comment node.
by Alexandre Julliard
02 Sep '11
02 Sep '11
Module: wine Branch: master Commit: 02e0d91c0e54407973ba129771719a5dfb2a4afd URL:
http://source.winehq.org/git/wine.git/?a=commit;h=02e0d91c0e54407973ba12977…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Fri Sep 2 14:17:20 2011 +0200 mshtml/tests: Added attributes tests on comment node. --- dlls/mshtml/tests/dom.c | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 7d0b048..cf8cbd0 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -1427,6 +1427,37 @@ static void _test_comment_text(unsigned line, IUnknown *unk, const char *extext) SysFreeString(text); } +#define test_comment_attrs(c) _test_comment_attrs(__LINE__,c) +static void _test_comment_attrs(unsigned line, IUnknown *unk) +{ + IHTMLCommentElement *comment = _get_comment_iface(__LINE__,unk); + IHTMLElement *elem = _get_elem_iface(__LINE__,unk); + IHTMLElement4 *elem4 = _get_elem4_iface(__LINE__,unk); + IHTMLDOMAttribute *attr; + BSTR name = a2bstr("test"); + VARIANT val; + HRESULT hres; + + hres = IHTMLElement4_getAttributeNode(elem4, name, &attr); + ok(hres == S_OK, "getAttributeNode failed: %08x\n", hres); + ok(attr == NULL, "attr != NULL\n"); + + V_VT(&val) = VT_I4; + V_I4(&val) = 1234; + hres = IHTMLElement_setAttribute(elem, name, val, 0); + ok(hres == S_OK, "setAttribute failed: %08x\n", hres); + + hres = IHTMLElement4_getAttributeNode(elem4, name, &attr); + ok(hres == S_OK, "getAttributeNode failed: %08x\n", hres); + ok(attr != NULL, "attr == NULL\n"); + + IHTMLDOMAttribute_Release(attr); + IHTMLCommentElement_Release(comment); + IHTMLElement_Release(elem); + IHTMLElement4_Release(elem); + SysFreeString(name); +} + #define test_object_vspace(u,s) _test_object_vspace(__LINE__,u,s) static void _test_object_vspace(unsigned line, IUnknown *unk, LONG exl) { @@ -5412,6 +5443,7 @@ static void test_create_elems(IHTMLDocument2 *doc) test_elem_title((IUnknown*)comment, "comment title"); test_comment_text((IUnknown*)comment, "<!--testing-->"); test_elem_outerhtml((IUnknown*)comment, "<!--testing-->"); + test_comment_attrs((IUnknown*)comment); IHTMLDOMNode_Release(comment); }
1
0
0
0
Piotr Caban : mshtml: Store attributes list in HTMLAttributeCollection.
by Alexandre Julliard
02 Sep '11
02 Sep '11
Module: wine Branch: master Commit: 13701221ee2c9dec6a597ba5d11ff10fe5b17816 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=13701221ee2c9dec6a597ba5d…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Fri Sep 2 14:17:10 2011 +0200 mshtml: Store attributes list in HTMLAttributeCollection. --- dlls/mshtml/htmlattr.c | 11 +++++- dlls/mshtml/htmlelem.c | 78 ++++++++++++++++++++++++++--------------- dlls/mshtml/htmlelem3.c | 30 +++------------- dlls/mshtml/mshtml_private.h | 2 +- 4 files changed, 66 insertions(+), 55 deletions(-) diff --git a/dlls/mshtml/htmlattr.c b/dlls/mshtml/htmlattr.c index 40b2de6..d8203fe 100644 --- a/dlls/mshtml/htmlattr.c +++ b/dlls/mshtml/htmlattr.c @@ -186,18 +186,27 @@ static dispex_static_data_t HTMLDOMAttribute_dispex = { HRESULT HTMLDOMAttribute_Create(HTMLElement *elem, DISPID dispid, HTMLDOMAttribute **attr) { + HTMLAttributeCollection *col; HTMLDOMAttribute *ret; + HRESULT hres; ret = heap_alloc_zero(sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; + hres = HTMLElement_get_attr_col(&elem->node, &col); + if(FAILED(hres)) { + heap_free(ret); + return hres; + } + IHTMLAttributeCollection_Release(&col->IHTMLAttributeCollection_iface); + ret->IHTMLDOMAttribute_iface.lpVtbl = &HTMLDOMAttributeVtbl; ret->ref = 1; ret->dispid = dispid; ret->elem = elem; - list_add_tail(&elem->attrs, &ret->entry); + list_add_tail(&elem->attrs->attrs, &ret->entry); init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLDOMAttribute_iface, &HTMLDOMAttribute_dispex); diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index b9840b1..ff8d022 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -1693,15 +1693,6 @@ HRESULT HTMLElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv) void HTMLElement_destructor(HTMLDOMNode *iface) { HTMLElement *This = impl_from_HTMLDOMNode(iface); - HTMLDOMAttribute *attr; - - while(!list_empty(&This->attrs)) { - attr = LIST_ENTRY(list_head(&This->attrs), HTMLDOMAttribute, entry); - - list_remove(&attr->entry); - attr->elem = NULL; - IHTMLDOMAttribute_Release(&attr->IHTMLDOMAttribute_iface); - } ConnectionPointContainer_Destroy(&This->cp_container); @@ -1709,6 +1700,15 @@ void HTMLElement_destructor(HTMLDOMNode *iface) nsIDOMHTMLElement_Release(This->nselem); if(This->style) IHTMLStyle_Release(&This->style->IHTMLStyle_iface); + if(This->attrs) { + HTMLDOMAttribute *attr; + + LIST_FOR_EACH_ENTRY(attr, &This->attrs->attrs, HTMLDOMAttribute, entry) + attr->elem = NULL; + + This->attrs->elem = NULL; + IHTMLAttributeCollection_Release(&This->attrs->IHTMLAttributeCollection_iface); + } HTMLDOMNode_destructor(&This->node); } @@ -1881,7 +1881,6 @@ void HTMLElement_Init(HTMLElement *This, HTMLDocumentNode *doc, nsIDOMHTMLElemen if(nselem) nsIDOMHTMLElement_AddRef(nselem); This->nselem = nselem; - list_init(&This->attrs); HTMLDOMNode_Init(doc, &This->node, (nsIDOMNode*)nselem); @@ -2170,7 +2169,14 @@ static ULONG WINAPI HTMLAttributeCollection_Release(IHTMLAttributeCollection *if TRACE("(%p) ref=%d\n", This, ref); if(!ref) { - IHTMLElement_Release(&This->elem->IHTMLElement_iface); + while(!list_empty(&This->attrs)) { + HTMLDOMAttribute *attr = LIST_ENTRY(list_head(&This->attrs), HTMLDOMAttribute, entry); + + list_remove(&attr->entry); + attr->elem = NULL; + IHTMLDOMAttribute_Release(&attr->IHTMLDOMAttribute_iface); + } + heap_free(This); } @@ -2253,18 +2259,23 @@ static inline HRESULT get_attr_dispid_by_name(HTMLAttributeCollection *This, BST } } + if(!This->elem) { + WARN("NULL elem\n"); + return E_UNEXPECTED; + } + hres = IDispatchEx_GetDispID(&This->elem->node.dispex.IDispatchEx_iface, name, fdexNameCaseInsensitive, id); return hres; } -static inline HRESULT get_domattr(HTMLElement *elem, DISPID id, HTMLDOMAttribute **attr) +static inline HRESULT get_domattr(HTMLAttributeCollection *This, DISPID id, HTMLDOMAttribute **attr) { HTMLDOMAttribute *iter; HRESULT hres; *attr = NULL; - LIST_FOR_EACH_ENTRY(iter, &elem->attrs, HTMLDOMAttribute, entry) { + LIST_FOR_EACH_ENTRY(iter, &This->attrs, HTMLDOMAttribute, entry) { if(iter->dispid == id) { *attr = iter; break; @@ -2272,7 +2283,12 @@ static inline HRESULT get_domattr(HTMLElement *elem, DISPID id, HTMLDOMAttribute } if(!*attr) { - hres = HTMLDOMAttribute_Create(elem, id, attr); + if(!This->elem) { + WARN("NULL elem\n"); + return E_UNEXPECTED; + } + + hres = HTMLDOMAttribute_Create(This->elem, id, attr); if(FAILED(hres)) return hres; } @@ -2325,7 +2341,7 @@ static HRESULT WINAPI HTMLAttributeCollection_item(IHTMLAttributeCollection *ifa if(FAILED(hres)) return hres; - hres = get_domattr(This->elem, id, &attr); + hres = get_domattr(This, id, &attr); if(FAILED(hres)) return hres; @@ -2417,7 +2433,7 @@ static HRESULT WINAPI HTMLAttributeCollection2_getNamedItem(IHTMLAttributeCollec return hres; } - hres = get_domattr(This->elem, id, &attr); + hres = get_domattr(This, id, &attr); if(FAILED(hres)) return hres; @@ -2545,7 +2561,7 @@ static HRESULT WINAPI HTMLAttributeCollection3_item(IHTMLAttributeCollection3 *i if(FAILED(hres)) return hres; - hres = get_domattr(This->elem, id, &attr); + hres = get_domattr(This, id, &attr); if(FAILED(hres)) return hres; @@ -2618,23 +2634,27 @@ static dispex_static_data_t HTMLAttributeCollection_dispex = { HRESULT HTMLElement_get_attr_col(HTMLDOMNode *iface, HTMLAttributeCollection **ac) { HTMLElement *This = impl_from_HTMLDOMNode(iface); - HTMLAttributeCollection *ret; - ret = heap_alloc_zero(sizeof(*ret)); - if(!ret) - return E_OUTOFMEMORY; + if(This->attrs) { + IHTMLAttributeCollection_AddRef(&This->attrs->IHTMLAttributeCollection_iface); + *ac = This->attrs; + return S_OK; + } - ret->IHTMLAttributeCollection_iface.lpVtbl = &HTMLAttributeCollectionVtbl; - ret->IHTMLAttributeCollection2_iface.lpVtbl = &HTMLAttributeCollection2Vtbl; - ret->IHTMLAttributeCollection3_iface.lpVtbl = &HTMLAttributeCollection3Vtbl; - ret->ref = 1; + This->attrs = heap_alloc_zero(sizeof(HTMLAttributeCollection)); + if(!This->attrs) + return E_OUTOFMEMORY; - IHTMLElement_AddRef(&This->IHTMLElement_iface); - ret->elem = This; + This->attrs->IHTMLAttributeCollection_iface.lpVtbl = &HTMLAttributeCollectionVtbl; + This->attrs->IHTMLAttributeCollection2_iface.lpVtbl = &HTMLAttributeCollection2Vtbl; + This->attrs->IHTMLAttributeCollection3_iface.lpVtbl = &HTMLAttributeCollection3Vtbl; + This->attrs->ref = 2; - init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLAttributeCollection_iface, + This->attrs->elem = This; + list_init(&This->attrs->attrs); + init_dispex(&This->attrs->dispex, (IUnknown*)&This->attrs->IHTMLAttributeCollection_iface, &HTMLAttributeCollection_dispex); - *ac = ret; + *ac = This->attrs; return S_OK; } diff --git a/dlls/mshtml/htmlelem3.c b/dlls/mshtml/htmlelem3.c index 73ca1ed..392b4e4 100644 --- a/dlls/mshtml/htmlelem3.c +++ b/dlls/mshtml/htmlelem3.c @@ -559,36 +559,18 @@ static HRESULT WINAPI HTMLElement4_normalize(IHTMLElement4 *iface) static HRESULT WINAPI HTMLElement4_getAttributeNode(IHTMLElement4 *iface, BSTR bstrname, IHTMLDOMAttribute **ppAttribute) { HTMLElement *This = impl_from_IHTMLElement4(iface); - HTMLDOMAttribute *attr = NULL, *iter; - DISPID dispid; + HTMLAttributeCollection *attrs; HRESULT hres; TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrname), ppAttribute); - hres = IDispatchEx_GetDispID(&This->node.dispex.IDispatchEx_iface, bstrname, fdexNameCaseInsensitive, &dispid); - if(hres == DISP_E_UNKNOWNNAME) { - *ppAttribute = NULL; - return S_OK; - }else if(FAILED(hres)) { + hres = HTMLElement_get_attr_col(&This->node, &attrs); + if(FAILED(hres)) return hres; - } - LIST_FOR_EACH_ENTRY(iter, &This->attrs, HTMLDOMAttribute, entry) { - if(iter->dispid == dispid) { - attr = iter; - break; - } - } - - if(!attr) { - hres = HTMLDOMAttribute_Create(This, dispid, &attr); - if(FAILED(hres)) - return hres; - } - - IHTMLDOMAttribute_AddRef(&attr->IHTMLDOMAttribute_iface); - *ppAttribute = &attr->IHTMLDOMAttribute_iface; - return S_OK; + hres = IHTMLAttributeCollection2_getNamedItem(&attrs->IHTMLAttributeCollection2_iface, bstrname, ppAttribute); + IHTMLAttributeCollection_Release(&attrs->IHTMLAttributeCollection_iface); + return hres; } static HRESULT WINAPI HTMLElement4_setAttributeNode(IHTMLElement4 *iface, IHTMLDOMAttribute *pattr, diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index aae8ffe..7b759e0 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -543,7 +543,7 @@ typedef struct { nsIDOMHTMLElement *nselem; HTMLStyle *style; - struct list attrs; + HTMLAttributeCollection *attrs; } HTMLElement; #define HTMLELEMENT_TIDS \
1
0
0
0
Piotr Caban : mshtml: Added HTMLAttributeCollection2_getNamedItem implementation.
by Alexandre Julliard
02 Sep '11
02 Sep '11
Module: wine Branch: master Commit: c7cb9f759c8eca6e8c109952f819f270a86e8875 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c7cb9f759c8eca6e8c109952f…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Fri Sep 2 14:17:02 2011 +0200 mshtml: Added HTMLAttributeCollection2_getNamedItem implementation. --- dlls/mshtml/htmlelem.c | 25 +++++++++++++++++++++---- 1 files changed, 21 insertions(+), 4 deletions(-) diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 1cd838d..b9840b1 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -2403,8 +2403,26 @@ static HRESULT WINAPI HTMLAttributeCollection2_getNamedItem(IHTMLAttributeCollec IHTMLDOMAttribute **newretNode) { HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface); - FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrName), newretNode); - return E_NOTIMPL; + HTMLDOMAttribute *attr; + DISPID id; + HRESULT hres; + + TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrName), newretNode); + + hres = get_attr_dispid_by_name(This, bstrName, &id); + if(hres == DISP_E_UNKNOWNNAME) { + *newretNode = NULL; + return S_OK; + } else if(FAILED(hres)) { + return hres; + } + + hres = get_domattr(This->elem, id, &attr); + if(FAILED(hres)) + return hres; + + *newretNode = &attr->IHTMLDOMAttribute_iface; + return S_OK; } static HRESULT WINAPI HTMLAttributeCollection2_setNamedItem(IHTMLAttributeCollection2 *iface, @@ -2493,8 +2511,7 @@ static HRESULT WINAPI HTMLAttributeCollection3_getNamedItem(IHTMLAttributeCollec IHTMLDOMAttribute **ppNodeOut) { HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface); - FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrName), ppNodeOut); - return E_NOTIMPL; + return IHTMLAttributeCollection2_getNamedItem(&This->IHTMLAttributeCollection2_iface, bstrName, ppNodeOut); } static HRESULT WINAPI HTMLAttributeCollection3_setNamedItem(IHTMLAttributeCollection3 *iface,
1
0
0
0
Piotr Caban : mshtml: Don't cache HTMLAttributesCollection results.
by Alexandre Julliard
02 Sep '11
02 Sep '11
Module: wine Branch: master Commit: 130c8342a096827cf4f7e779d34b0764e540acfa URL:
http://source.winehq.org/git/wine.git/?a=commit;h=130c8342a096827cf4f7e779d…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Fri Sep 2 14:16:40 2011 +0200 mshtml: Don't cache HTMLAttributesCollection results. --- dlls/mshtml/htmlelem.c | 77 +++++++++++++++++------------------------- dlls/mshtml/mshtml_private.h | 2 - 2 files changed, 31 insertions(+), 48 deletions(-) diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index d840d63..1cd838d 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -2171,7 +2171,6 @@ static ULONG WINAPI HTMLAttributeCollection_Release(IHTMLAttributeCollection *if if(!ref) { IHTMLElement_Release(&This->elem->IHTMLElement_iface); - heap_free(This->collection); heap_free(This); } @@ -2208,23 +2207,15 @@ static HRESULT WINAPI HTMLAttributeCollection_Invoke(IHTMLAttributeCollection *i wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); } -static HRESULT WINAPI HTMLAttributeCollection_get_length(IHTMLAttributeCollection *iface, LONG *p) +static HRESULT get_attr_dispid_by_idx(HTMLAttributeCollection *This, LONG *idx, DISPID *dispid) { - HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface); IDispatchEx *dispex = &This->elem->node.dispex.IDispatchEx_iface; - DISPID id; - LONG len; + DISPID id = DISPID_STARTENUM; + LONG len = -1; HRESULT hres; - TRACE("(%p)->(%p)\n", This, p); FIXME("filter non-enumerable attributes out\n"); - heap_free(This->collection); - This->size = 0; - This->collection = NULL; - - id = DISPID_STARTENUM; - len = 0; while(1) { hres = IDispatchEx_GetNextDispID(dispex, fdexEnumAll, id, &id); if(FAILED(hres)) @@ -2233,41 +2224,16 @@ static HRESULT WINAPI HTMLAttributeCollection_get_length(IHTMLAttributeCollectio break; len++; - } - - This->collection = heap_alloc(len*sizeof(DISPID)); - if(!This->collection) - return E_OUTOFMEMORY; - - id = DISPID_STARTENUM; - len = 0; - while(1) { - hres = IDispatchEx_GetNextDispID(dispex, fdexEnumAll, id, &id); - if(FAILED(hres)) - return hres; - else if(hres == S_FALSE) + if(len == *idx) break; - - This->collection[len++] = id; } - *p = This->size = len; - return S_OK; -} - -static HRESULT WINAPI HTMLAttributeCollection__newEnum(IHTMLAttributeCollection *iface, IUnknown **p) -{ - HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static inline HRESULT get_attr_dispid_by_idx(HTMLAttributeCollection *This, LONG index, DISPID *id) -{ - if(index<0 || index>=This->size) - return DISP_E_UNKNOWNNAME; + if(dispid) { + *dispid = id; + return *idx==len ? S_OK : DISP_E_UNKNOWNNAME; + } - *id = This->collection[index]; + *idx = len+1; return S_OK; } @@ -2281,7 +2247,7 @@ static inline HRESULT get_attr_dispid_by_name(HTMLAttributeCollection *This, BST idx = strtoulW(name, &end_ptr, 10); if(!*end_ptr) { - hres = get_attr_dispid_by_idx(This, idx, id); + hres = get_attr_dispid_by_idx(This, &idx, id); if(SUCCEEDED(hres)) return hres; } @@ -2315,6 +2281,25 @@ static inline HRESULT get_domattr(HTMLElement *elem, DISPID id, HTMLDOMAttribute return S_OK; } +static HRESULT WINAPI HTMLAttributeCollection_get_length(IHTMLAttributeCollection *iface, LONG *p) +{ + HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface); + HRESULT hres; + + TRACE("(%p)->(%p)\n", This, p); + + *p = -1; + hres = get_attr_dispid_by_idx(This, p, NULL); + return hres; +} + +static HRESULT WINAPI HTMLAttributeCollection__newEnum(IHTMLAttributeCollection *iface, IUnknown **p) +{ + HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + static HRESULT WINAPI HTMLAttributeCollection_item(IHTMLAttributeCollection *iface, VARIANT *name, IDispatch **ppItem) { HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface); @@ -2326,7 +2311,7 @@ static HRESULT WINAPI HTMLAttributeCollection_item(IHTMLAttributeCollection *ifa switch(V_VT(name)) { case VT_I4: - hres = get_attr_dispid_by_idx(This, V_I4(name), &id); + hres = get_attr_dispid_by_idx(This, &V_I4(name), &id); break; case VT_BSTR: hres = get_attr_dispid_by_name(This, V_BSTR(name), &id); @@ -2537,7 +2522,7 @@ static HRESULT WINAPI HTMLAttributeCollection3_item(IHTMLAttributeCollection3 *i TRACE("(%p)->(%d %p)\n", This, index, ppNodeOut); - hres = get_attr_dispid_by_idx(This, index, &id); + hres = get_attr_dispid_by_idx(This, &index, &id); if(hres == DISP_E_UNKNOWNNAME) return E_INVALIDARG; if(FAILED(hres)) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 8bbedd5..aae8ffe 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -727,8 +727,6 @@ struct HTMLAttributeCollection { LONG ref; HTMLElement *elem; - LONG size; - DISPID *collection; struct list attrs; };
1
0
0
0
Piotr Caban : jscript/tests: Added decodeURI tests.
by Alexandre Julliard
02 Sep '11
02 Sep '11
Module: wine Branch: master Commit: 726f003293ae5ad29319ceb826b7f7448ab7ab4a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=726f003293ae5ad29319ceb82…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Fri Sep 2 12:25:12 2011 +0200 jscript/tests: Added decodeURI tests. --- dlls/jscript/tests/api.js | 28 +++++++++++++++++++++++++++- 1 files changed, 27 insertions(+), 1 deletions(-) diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index 2416ea0..d99364f 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -101,11 +101,34 @@ tmp = encodeURI("\xffff"); ok(tmp.length === 8, "encodeURI('\\xffff').length = " + tmp.length); tmp = encodeURI("abcABC123;/?:@&=+$,-_.!~*'()"); ok(tmp === "abcABC123;/?:@&=+$,-_.!~*'()", "encodeURI('abcABC123;/?:@&=+$,-_.!~*'()') = " + tmp); +tmp = encodeURI("%"); +ok(tmp === "%25", "encodeURI('%') = " + tmp); tmp = encodeURI(); ok(tmp === "undefined", "encodeURI() = " + tmp); tmp = encodeURI("abc", "test"); ok(tmp === "abc", "encodeURI('abc') = " + tmp); +tmp = decodeURI("abc"); +ok(tmp === "abc", "decodeURI('abc') = " + tmp); +tmp = decodeURI("{abc}"); +ok(tmp === "{abc}", "decodeURI('{abc}') = " + tmp); +tmp = decodeURI(""); +ok(tmp === "", "decodeURI('') = " + tmp); +tmp = decodeURI("\01\02\03\04"); +ok(tmp === "\01\02\03\04", "decodeURI('\\01\\02\\03\\04') = " + tmp); +tmp = decodeURI(); +ok(tmp === "undefined", "decodeURI() = " + tmp); +tmp = decodeURI("abc", "test"); +ok(tmp === "abc", "decodeURI('abc') = " + tmp); +tmp = decodeURI("%7babc%7d"); +ok(tmp === "{abc}", "decodeURI('%7Babc%7D') = " + tmp); +tmp = decodeURI("%01%02%03%04"); +ok(tmp === "\01\02\03\04", "decodeURI('%01%02%03%04') = " + tmp); +tmp = decodeURI("%C2%A1%20"); +ok(tmp === "\xa1 ", "decodeURI('%C2%A1%20') = " + tmp); +tmp = decodeURI("%C3%BFff"); +ok(tmp.length === 3, "decodeURI('%C3%BFff').length = " + tmp.length); + tmp = encodeURIComponent("abc"); ok(tmp === "abc", "encodeURIComponent('abc') = " + tmp); dec = decodeURIComponent(tmp); @@ -1960,7 +1983,8 @@ var exception_array = { E_REGEXP_SYNTAX_ERROR: { type: "RegExpError", number: -2146823271 }, - E_URI_INVALID_CHAR: { type: "URIError", number: -2146823264 } + E_URI_INVALID_CHAR: { type: "URIError", number: -2146823264 }, + E_URI_INVALID_CODING: { type: "URIError", number: -2146823263 } }; function testException(func, id) { @@ -2054,6 +2078,8 @@ testException(function() {RegExp(/a/, "g");}, "E_REGEXP_SYNTAX_ERROR"); // URIError tests testException(function() {encodeURI('\udcaa');}, "E_URI_INVALID_CHAR"); testException(function() {encodeURIComponent('\udcaa');}, "E_URI_INVALID_CHAR"); +testException(function() {decodeURI('%');}, "E_URI_INVALID_CODING"); +testException(function() {decodeURI('%aaaa');}, "E_URI_INVALID_CODING"); function testThisExcept(func, e) { testException(function() {func.call(new Object())}, e);
1
0
0
0
Piotr Caban : jscript: Added decodeURI implementation.
by Alexandre Julliard
02 Sep '11
02 Sep '11
Module: wine Branch: master Commit: e4ec169fd948fad3c132532662ab51ddaa377102 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e4ec169fd948fad3c13253266…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Fri Sep 2 12:24:57 2011 +0200 jscript: Added decodeURI implementation. --- dlls/jscript/global.c | 95 +++++++++++++++++++++++++++++++++++++++++++++- dlls/jscript/jscript.h | 1 + dlls/jscript/jscript.rc | 1 + dlls/jscript/resource.h | 1 + po/ar.po | 10 +++- po/bg.po | 10 +++- po/ca.po | 10 +++- po/cs.po | 10 +++- po/da.po | 11 ++++- po/de.po | 11 ++++- po/el.po | 10 +++- po/en.po | 10 +++- po/en_US.po | 10 +++- po/eo.po | 10 +++- po/es.po | 11 ++++- po/fa.po | 10 +++- po/fi.po | 10 +++- po/fr.po | 11 ++++- po/he.po | 10 +++- po/hi.po | 10 +++- po/hu.po | 11 ++++- po/it.po | 11 ++++- po/ja.po | 11 ++++- po/ko.po | 11 ++++- po/lt.po | 11 ++++- po/ml.po | 10 +++- po/nb_NO.po | 11 ++++- po/nl.po | 11 ++++- po/or.po | 10 +++- po/pa.po | 10 +++- po/pl.po | 11 ++++- po/pt_BR.po | 11 ++++- po/pt_PT.po | 11 ++++- po/rm.po | 10 +++- po/ro.po | 11 ++++- po/ru.po | 11 ++++- po/sk.po | 10 +++- po/sl.po | 11 ++++- po/sr_RS(a)cyrillic.po | 11 ++++- po/sr_RS(a)latin.po | 11 ++++- po/sv.po | 11 ++++- po/te.po | 10 +++- po/th.po | 10 +++- po/tr.po | 10 +++- po/uk.po | 11 ++++- po/wa.po | 10 +++- po/wine.pot | 10 +++- po/zh_CN.po | 10 +++- po/zh_TW.po | 10 +++- 49 files changed, 431 insertions(+), 138 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=e4ec169fd948fad3c1325…
1
0
0
0
Piotr Caban : jscript: Throw exception on error in JSGlobal_encodeURIComponent.
by Alexandre Julliard
02 Sep '11
02 Sep '11
Module: wine Branch: master Commit: df96b7297b3963d94c7cda3975182a67baa2d2e4 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=df96b7297b3963d94c7cda397…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Fri Sep 2 12:24:45 2011 +0200 jscript: Throw exception on error in JSGlobal_encodeURIComponent. --- dlls/jscript/global.c | 3 +-- dlls/jscript/tests/api.js | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/jscript/global.c b/dlls/jscript/global.c index edc8350..6ff88ee 100644 --- a/dlls/jscript/global.c +++ b/dlls/jscript/global.c @@ -899,8 +899,7 @@ static HRESULT JSGlobal_encodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, W size = WideCharToMultiByte(CP_UTF8, 0, ptr, 1, NULL, 0, NULL, NULL); if(!size) { SysFreeString(str); - FIXME("throw Error\n"); - return E_FAIL; + return throw_uri_error(ctx, ei, JS_E_INVALID_URI_CHAR, NULL); } len += size*3; } diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index 09c3360..2416ea0 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -2053,6 +2053,7 @@ testException(function() {RegExp(/a/, "g");}, "E_REGEXP_SYNTAX_ERROR"); // URIError tests testException(function() {encodeURI('\udcaa');}, "E_URI_INVALID_CHAR"); +testException(function() {encodeURIComponent('\udcaa');}, "E_URI_INVALID_CHAR"); function testThisExcept(func, e) { testException(function() {func.call(new Object())}, e);
1
0
0
0
Piotr Caban : jscript: Limit name hash computations number.
by Alexandre Julliard
02 Sep '11
02 Sep '11
Module: wine Branch: master Commit: 65a7f475313410cd6a9184700c9bdedb02925767 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=65a7f475313410cd6a9184700…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Fri Sep 2 12:24:35 2011 +0200 jscript: Limit name hash computations number. --- dlls/jscript/dispex.c | 38 ++++++++++++++++++++------------------ 1 files changed, 20 insertions(+), 18 deletions(-) diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index b80f6f2..0d584f0 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -42,6 +42,7 @@ typedef enum { struct _dispex_prop_t { WCHAR *name; + unsigned hash; prop_type_t type; DWORD flags; @@ -139,7 +140,7 @@ static inline HRESULT resize_props(jsdisp_t *This) for(i=1; i<This->prop_cnt; i++) { props = This->props+i; - bucket = get_props_idx(This, string_hash(props->name)); + bucket = get_props_idx(This, props->hash); props->bucket_next = This->props[bucket].bucket_head; This->props[bucket].bucket_head = i; } @@ -161,8 +162,9 @@ static inline dispex_prop_t* alloc_prop(jsdisp_t *This, const WCHAR *name, prop_ return NULL; prop->type = type; prop->flags = flags; + prop->hash = string_hash(name); - bucket = get_props_idx(This, string_hash(name)); + bucket = get_props_idx(This, prop->hash); prop->bucket_next = This->props[bucket].bucket_head; This->props[bucket].bucket_head = This->prop_cnt++; return prop; @@ -180,13 +182,13 @@ static dispex_prop_t *alloc_protref(jsdisp_t *This, const WCHAR *name, DWORD ref return ret; } -static HRESULT find_prop_name(jsdisp_t *This, const WCHAR *name, dispex_prop_t **ret) +static HRESULT find_prop_name(jsdisp_t *This, unsigned hash, const WCHAR *name, dispex_prop_t **ret) { const builtin_prop_t *builtin; unsigned bucket, pos, prev = 0; dispex_prop_t *prop; - bucket = get_props_idx(This, string_hash(name)); + bucket = get_props_idx(This, hash); pos = This->props[bucket].bucket_head; while(pos != 0) { if(!strcmpW(name, This->props[pos].name)) { @@ -219,12 +221,12 @@ static HRESULT find_prop_name(jsdisp_t *This, const WCHAR *name, dispex_prop_t * return S_OK; } -static HRESULT find_prop_name_prot(jsdisp_t *This, const WCHAR *name, dispex_prop_t **ret) +static HRESULT find_prop_name_prot(jsdisp_t *This, unsigned hash, const WCHAR *name, dispex_prop_t **ret) { dispex_prop_t *prop, *del=NULL; HRESULT hres; - hres = find_prop_name(This, name, &prop); + hres = find_prop_name(This, hash, name, &prop); if(FAILED(hres)) return hres; if(prop && prop->type==PROP_DELETED) { @@ -235,7 +237,7 @@ static HRESULT find_prop_name_prot(jsdisp_t *This, const WCHAR *name, dispex_pro } if(This->prototype) { - hres = find_prop_name_prot(This->prototype, name, &prop); + hres = find_prop_name_prot(This->prototype, hash, name, &prop); if(FAILED(hres)) return hres; if(prop) { @@ -265,9 +267,9 @@ static HRESULT ensure_prop_name(jsdisp_t *This, const WCHAR *name, BOOL search_p HRESULT hres; if(search_prot) - hres = find_prop_name_prot(This, name, &prop); + hres = find_prop_name_prot(This, string_hash(name), name, &prop); else - hres = find_prop_name(This, name, &prop); + hres = find_prop_name(This, string_hash(name), name, &prop); if(SUCCEEDED(hres) && (!prop || prop->type==PROP_DELETED)) { TRACE("creating prop %s\n", debugstr_w(name)); @@ -482,7 +484,7 @@ static HRESULT fill_protrefs(jsdisp_t *This) for(iter = This->prototype->props; iter < This->prototype->props+This->prototype->prop_cnt; iter++) { if(!iter->name) continue; - hres = find_prop_name(This, iter->name, &prop); + hres = find_prop_name(This, iter->hash, iter->name, &prop); if(FAILED(hres)) return hres; if(!prop || prop->type==PROP_DELETED) { @@ -716,7 +718,7 @@ static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bst if(grfdex & ~(fdexNameCaseSensitive|fdexNameEnsure|fdexNameImplicit|FDEX_VERSION_MASK)) FIXME("Unsupported grfdex %x\n", grfdex); - hres = find_prop_name(This, bstrName, &prop); + hres = find_prop_name(This, string_hash(bstrName), bstrName, &prop); if(FAILED(hres)) return hres; if(!prop) { @@ -890,7 +892,7 @@ HRESULT init_dispex_from_constr(jsdisp_t *dispex, script_ctx_t *ctx, const built static const WCHAR constructorW[] = {'c','o','n','s','t','r','u','c','t','o','r',0}; static const WCHAR prototypeW[] = {'p','r','o','t','o','t','y','p','e',0}; - hres = find_prop_name_prot(constr, prototypeW, &prop); + hres = find_prop_name_prot(constr, string_hash(prototypeW), prototypeW, &prop); if(SUCCEEDED(hres) && prop && prop->type!=PROP_DELETED) { jsexcept_t jsexcept; VARIANT var; @@ -950,7 +952,7 @@ HRESULT jsdisp_get_id(jsdisp_t *jsdisp, const WCHAR *name, DWORD flags, DISPID * if(flags & fdexNameEnsure) hres = ensure_prop_name(jsdisp, name, TRUE, PROPF_ENUM, &prop); else - hres = find_prop_name_prot(jsdisp, name, &prop); + hres = find_prop_name_prot(jsdisp, string_hash(name), name, &prop); if(FAILED(hres)) return hres; @@ -997,7 +999,7 @@ HRESULT jsdisp_call_name(jsdisp_t *disp, const WCHAR *name, WORD flags, DISPPARA dispex_prop_t *prop; HRESULT hres; - hres = find_prop_name_prot(disp, name, &prop); + hres = find_prop_name_prot(disp, string_hash(name), name, &prop); if(FAILED(hres)) return hres; @@ -1123,7 +1125,7 @@ HRESULT jsdisp_propget_name(jsdisp_t *obj, const WCHAR *name, VARIANT *var, jsex dispex_prop_t *prop; HRESULT hres; - hres = find_prop_name_prot(obj, name, &prop); + hres = find_prop_name_prot(obj, string_hash(name), name, &prop); if(FAILED(hres)) return hres; @@ -1145,7 +1147,7 @@ HRESULT jsdisp_get_idx(jsdisp_t *obj, DWORD idx, VARIANT *var, jsexcept_t *ei, I sprintfW(name, formatW, idx); - hres = find_prop_name_prot(obj, name, &prop); + hres = find_prop_name_prot(obj, string_hash(name), name, &prop); if(FAILED(hres)) return hres; @@ -1206,7 +1208,7 @@ HRESULT jsdisp_delete_idx(jsdisp_t *obj, DWORD idx) sprintfW(buf, formatW, idx); - hres = find_prop_name(obj, buf, &prop); + hres = find_prop_name(obj, string_hash(buf), buf, &prop); if(FAILED(hres) || !prop) return hres; @@ -1218,7 +1220,7 @@ VARIANT_BOOL jsdisp_is_own_prop(jsdisp_t *obj, BSTR name) dispex_prop_t *prop; HRESULT hres; - hres = find_prop_name(obj, name, &prop); + hres = find_prop_name(obj, string_hash(name), name, &prop); if(FAILED(hres)) return VARIANT_FALSE; else if(!prop)
1
0
0
0
← Newer
1
...
91
92
93
94
95
96
97
...
100
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
Results per page:
10
25
50
100
200