On 26/11/2021 17:37, Jacek Caban wrote:
On 11/26/21 12:52 PM, Gabriel Ivăncescu wrote:
On 25/11/2021 22:11, Jacek Caban wrote:
Hi Gabriel,
On 11/25/21 3:00 PM, Gabriel Ivăncescu wrote:
diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 08fcde4..c2fd8bd 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -1136,7 +1136,6 @@ sync_test("elem_attr", function() { ok(r === (v < 8 ? arr : (v < 9 ? "arrval" : null)), "testattr with custom valueOf = " + r); elem.setAttribute("testattr", arr); r = elem.getAttribute("testattr"); - todo_wine_if(v >= 10). ok(r === (v < 8 ? arr : (v < 10 ? "arrval" : "42")), "testattr after setAttribute with custom valueOf = " + r); ok(elem.testattr === arr, "elem.testattr after setAttribute with custom valueOf = " + elem.testattr); r = elem.removeAttribute("testattr");
This test seems too little to back such change. For example, another likely explanation for the observed behaviour is that setAttribute does explicit conversion to string with proper hints.
How should I do that? Looking up toString like I had originally, or something else? Or do I need an internal interface? (in which case, I'll have to integrate it somehow to the proxy patches...)
As I suggested earlier, look at IVariantChangeType. change_type() should already do what you need. The only problem is that you don't have a caller context in setAttribute(). It's, however, available to hooks, so maybe we could do the conversion in a hook.
Thanks,
Jacek
Ah, I see now, thanks for the pointer, that makes sense.
For the rest of the series, I think I'll postpone the patches that use the generic hooks though, I've discovered some interesting things with quirks/compat constructors and prototypes (which aren't in jscript but aim to "emulate" it somehow), and I believe now that those behaviors are some side-effect of that.
I'm not sure yet if it works that way, but it might make the implementation cleaner, so I'll refactor it after the proxy patches. I'll try to see if I can just get the other parts in (like the stringifying for get/setAttribute) without breaking existing tests, to avoid piling too many...