From: Qian Hong Subject: [PATCH] mshtml: Implemented numeral parsing in get_frame_by_name (try 2). Message-Id: <533B1CA7.6050504@codeweavers.com> Date: Wed, 02 Apr 2014 04:08:07 +0800 Try 2: - Fixed a typo, kudos to Andre. - Superseded patch 103603 Hi all, When passing a numeral like string as array index to the window object, native IE correctly parses the string into an integer value while Wine doesn't. This patch fix the problem. Here is one simply test case: Testcase: 1 2 3 4 9 In theory this patch need some more tests, because the above test case is far from perfect, fortunately we have the open source ECMAScript 3 Conformance Test Suite ver. 0.2: http://kangax.github.io/sputniktests-webrunner/ Before this patch, Wine builtin iexplore hangs on the first test case of the ECMAScript 3 Conformance Test Suite, after the patch, the Conformance Test Suite begin to run. Guess how far does it gone? To everyone's surprise, now Wine builtin iexplore passes all 5228 tests in the test case: Current test: 15_Native_ECMA_Script_Objects/15.11_Error_Objects/15.11.4_Properties_of_the_Error_Prototype_Object/S15.11.4_A4 Tests completed: 5228 Total errors: 0 Total failures: 0 Elapsed time: 7:40 Status: Completed. Final score (errors + failures; less is better): 0 This is definitely a great step of our Wine buitin iexplore, now our version beats Microsoft IE7 a lot. Since now all ECMAScript 3 conformance tests passed, it is safe to assume that this patch is absolutely correct and no extra test cases needed, so I'm not going to contribute any C test case for it into our test framework because it is just duplicate work and waste of time - What can you worry if even the whole test suite passed? I appreciate for any comments on the coding side part of my patch, but please don't comment on the correctness part before actually running the test suite with the patch, thanks a lot. While I understand this patch is valuable, I promise I won't apply patent for this patch, really. --- dlls/mshtml/htmlwindow.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index a57dfba..3d6323c 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -379,6 +379,20 @@ HRESULT get_frame_by_name(HTMLOuterWindow *This, const WCHAR *name, BOOL deep, H UINT32 length, i; nsresult nsres; HRESULT hres = S_OK; + VARIANT v, idx; + + V_VT(&v) = VT_BSTR; + V_BSTR(&v) = SysAllocString(name); + VariantInit(&idx); + hres = VariantChangeType(&idx, &v, VARIANT_LOCALBOOL, VT_I4); + VariantClear(&v); + if (SUCCEEDED(hres)) + { + hres = get_frame_by_index(This, V_I4(&idx), ret); + VariantClear(&idx); + return hres; + } + VariantClear(&idx); nsres = nsIDOMWindow_GetFrames(This->nswindow, &nsframes); if(NS_FAILED(nsres)) {