Jacek Caban : mshtml: Fixed attribute object caching logic.
Alexandre Julliard
julliard at winehq.org
Mon Oct 22 13:42:45 CDT 2012
Module: wine
Branch: master
Commit: 8b04ab10b9dc36fe5f8b1a74eb7866b465d5cd5d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8b04ab10b9dc36fe5f8b1a74eb7866b465d5cd5d
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Oct 22 11:59:10 2012 +0200
mshtml: Fixed attribute object caching logic.
---
dlls/mshtml/htmlelem.c | 21 +++++++++++----------
dlls/mshtml/tests/jstest.html | 10 ++++++++++
2 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c
index d11ebbc..753bbcb 100644
--- a/dlls/mshtml/htmlelem.c
+++ b/dlls/mshtml/htmlelem.c
@@ -2254,7 +2254,6 @@ static inline HRESULT get_domattr(HTMLAttributeCollection *This, DISPID id, LONG
return E_UNEXPECTED;
}
- pos++;
hres = HTMLDOMAttribute_Create(This->elem, id, attr);
if(FAILED(hres))
return hres;
@@ -2596,20 +2595,22 @@ static HRESULT HTMLAttributeCollection_invoke(DispatchEx *dispex, DISPID id, LCI
switch(flags) {
case DISPATCH_PROPERTYGET: {
HTMLDOMAttribute *iter;
+ DWORD pos;
- id = id-MSHTML_DISPID_CUSTOM_MIN+1;
+ pos = id-MSHTML_DISPID_CUSTOM_MIN;
LIST_FOR_EACH_ENTRY(iter, &This->attrs, HTMLDOMAttribute, entry) {
- if(!(--id))
- break;
+ if(!pos) {
+ IHTMLDOMAttribute_AddRef(&iter->IHTMLDOMAttribute_iface);
+ V_VT(res) = VT_DISPATCH;
+ V_DISPATCH(res) = (IDispatch*)&iter->IHTMLDOMAttribute_iface;
+ return S_OK;
+ }
+ pos--;
}
- if(id)
- return E_INVALIDARG;
- IHTMLDOMAttribute_AddRef(&iter->IHTMLDOMAttribute_iface);
- V_VT(res) = VT_DISPATCH;
- V_DISPATCH(res) = (IDispatch*)&iter->IHTMLDOMAttribute_iface;
- return S_OK;
+ WARN("invalid arg\n");
+ return E_INVALIDARG;
}
default:
diff --git a/dlls/mshtml/tests/jstest.html b/dlls/mshtml/tests/jstest.html
index 70478e4..7fa9565 100644
--- a/dlls/mshtml/tests/jstest.html
+++ b/dlls/mshtml/tests/jstest.html
@@ -113,7 +113,16 @@ function test_setAttribute() {
input.setAttribute("checked", "");
ok(input.checked === false, "input.checked = " + input.checked);
+}
+
+function test_attribute_collection() {
+ var div, attr;
+
+ document.body.innerHTML = '<div id="divid" class="test"></div>';
+ div = document.getElementById("divid");
+ attr = div.attributes["dir"];
+ ok(attr === div.attributes["dir"], "attr !== div.attributes['dir']");
}
function test_getter_call() {
@@ -166,6 +175,7 @@ function runTests() {
test_remove_style_attribute();
test_getter_call();
test_setAttribute();
+ test_attribute_collection();
test_override_functions();
var r = window.execScript("globalVar = true;");
More information about the wine-cvs
mailing list