From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/tests/documentmode.js | 36 +++++++++++++++++++++++++++++-- dlls/mshtml/tests/dom.js | 2 ++ dlls/mshtml/tests/events.c | 23 +++++++++++++++++++- 3 files changed, 58 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 13dd172fec1..ce887068a95 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -379,6 +379,12 @@ sync_test("builtin_obj", function() { window.toString.call(null); ok(false, "expected exception calling window.toString with null context"); }catch(ex) {} + }else { + ok(Object.getPrototypeOf(f) === Function.prototype, "unexpected document.createElement prototype"); + e = window.toString.call(null); + ok(e === "[object Window]", "window.toString with null context = " + e); + e = window.toString.call(external.nullDisp); + ok(e === "[object Window]", "window.toString with nullDisp context = " + e); }
e = 0; @@ -422,6 +428,15 @@ sync_test("builtin_obj", function() { ok(false, "exception expected"); }catch(ex) {}
+ e = 0; + try { + new f(); + }catch(ex) { + e = ex.number; + } + todo_wine_if(v < 9). + ok(e === (v < 9 ? 0xa01b6 : 0x0ffff) - 0x80000000, "[new f()] e = " + e); + if(v < 9) { ok(!("call" in f.call), "call in f.call"); ok(!("apply" in f.call), "apply in f.call"); @@ -459,6 +474,24 @@ sync_test("builtin_obj", function() { ok(enum_elem === elem2, "enum_elem = " + enum_elem); enumerator.moveNext(); ok(enumerator.atEnd(), "enumerator not at end"); + }else { + elem = f.call.call(f, document, "div"); + f = f.bind(document); + elem = f.apply(null, ["style"]); + document.body.appendChild(elem); + + try { + var enumerator = new Enumerator(document.getElementsByTagName("style")); + }catch(ex) { + e = ex.number; + } + todo_wine. + ok(e === 0xa01c3 - 0x80000000, "[style Enumerator] e = " + e); + + f.apply = 0; + f.call = function() { }; + ok(f.apply === 0, "changed f.apply = ", f.apply); + ok(f.call instanceof Function, "changed f.call not instance of Function"); } });
@@ -2175,11 +2208,10 @@ sync_test("elem_attr", function() { var func = elem.setAttribute; try { func("testattr", arr); - todo_wine_if(v >= 9). ok(v < 9, "expected exception setting testattr via func"); }catch(ex) { ok(v >= 9, "did not expect exception setting testattr via func"); - elem.setAttribute("testattr", arr); + func.call(elem, "testattr", arr); } r = elem.getAttribute("testattr"); ok(r === (v < 8 ? arr : (v < 10 ? "arrval" : "42")), "testattr after setAttribute (as func) = " + r); diff --git a/dlls/mshtml/tests/dom.js b/dlls/mshtml/tests/dom.js index b26280e00d6..628ed3d9703 100644 --- a/dlls/mshtml/tests/dom.js +++ b/dlls/mshtml/tests/dom.js @@ -572,6 +572,7 @@ sync_test("storage", function() {
sessionStorage.setItem("foobar", 42); ok("foobar" in sessionStorage, "foobar not in sessionStorage"); + ok(Object.prototype.hasOwnProperty.call(sessionStorage, "foobar"), "foobar not prop of sessionStorage"); item = sessionStorage.getItem("foobar"); ok(item === "42", "'foobar' item = " + item); item = sessionStorage["foobar"]; @@ -582,6 +583,7 @@ sync_test("storage", function() {
sessionStorage["barfoo"] = true; ok("barfoo" in sessionStorage, "barfoo not in sessionStorage"); + ok(Object.prototype.hasOwnProperty.call(sessionStorage, "barfoo"), "barfoo not prop of sessionStorage"); item = sessionStorage["barfoo"]; ok(item === "true", "[barfoo] item = " + item); item = sessionStorage.getItem("barfoo"); diff --git a/dlls/mshtml/tests/events.c b/dlls/mshtml/tests/events.c index 69488001fb2..6950c1e2a08 100644 --- a/dlls/mshtml/tests/events.c +++ b/dlls/mshtml/tests/events.c @@ -1602,8 +1602,10 @@ EVENT_HANDLER_FUNC_OBJ(onmessage); static HRESULT WINAPI onvisibilitychange(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller) { + DISPPARAMS dp = {0}; IDispatchEx *dispex; HRESULT hres; + VARIANT res; BSTR bstr;
CHECK_EXPECT(visibilitychange); @@ -1614,10 +1616,15 @@ static HRESULT WINAPI onvisibilitychange(IDispatchEx *iface, DISPID id, LCID lci
bstr = SysAllocString(L"toString"); hres = IDispatchEx_GetDispID(dispex, bstr, 0, &id); - todo_wine ok(hres == S_OK, "GetDispID("toString") failed: %08lx\n", hres); SysFreeString(bstr);
+ hres = IDispatchEx_InvokeEx(dispex, id, LOCALE_NEUTRAL, INVOKE_FUNC, &dp, &res, NULL, NULL); + ok(hres == S_OK, "InvokeEx("toString") failed: %08lx\n", hres); + ok(V_VT(&res) == VT_BSTR, "V_VT("toString") = %d\n", V_VT(&res)); + ok(!wcscmp(V_BSTR(&res), L"[object Event]"), "toString = %s\n", wine_dbgstr_w(V_BSTR(&res))); + VariantClear(&res); + return S_OK; }
@@ -4652,8 +4659,10 @@ static void test_storage_event(DISPPARAMS *params, BOOL doc_onstorage) IHTMLEventObj *event_obj; IDOMStorageEvent *event; IDispatchEx *dispex; + DISPPARAMS dp = {0}; IDispatch *disp; HRESULT hres; + VARIANT res; unsigned i; DISPID id; BSTR bstr; @@ -4669,6 +4678,18 @@ static void test_storage_event(DISPPARAMS *params, BOOL doc_onstorage) hres = IDispatch_QueryInterface(V_DISPATCH(¶ms->rgvarg[1]), &IID_IDispatchEx, (void**)&dispex); ok_(__FILE__,line)(hres == S_OK, "Could not get IDispatchEx: %08lx\n", hres);
+ bstr = SysAllocString(L"toString"); + hres = IDispatchEx_GetDispID(dispex, bstr, 0, &id); + ok_(__FILE__,line)(hres == S_OK, "GetDispID("toString") failed: %08lx\n", hres); + SysFreeString(bstr); + + hres = IDispatchEx_InvokeEx(dispex, id, LOCALE_NEUTRAL, INVOKE_FUNC, &dp, &res, NULL, NULL); + ok_(__FILE__,line)(hres == S_OK, "InvokeEx("toString") failed: %08lx\n", hres); + ok_(__FILE__,line)(V_VT(&res) == VT_BSTR, "V_VT("toString") = %d\n", V_VT(&res)); + ok_(__FILE__,line)(!wcscmp(V_BSTR(&res), doc_onstorage ? L"[object MSEventObj]" : L"[object StorageEvent]"), + "toString = %s\n", wine_dbgstr_w(V_BSTR(&res))); + VariantClear(&res); + hres = IDispatchEx_QueryInterface(dispex, &IID_IDOMStorageEvent, (void**)&event); if(doc_onstorage) { static const WCHAR *props[] = { L"key", L"oldValue", L"newValue", L"storageArea" };