mshtml/tests: Handle broken localStorage on native.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
This commit is contained in:
Gabriel Ivăncescu 2022-11-07 17:35:12 +02:00 committed by Alexandre Julliard
parent 8c0d3ae2e2
commit cb078982f4
2 changed files with 30 additions and 6 deletions

View file

@ -4024,12 +4024,19 @@ static void test_storage_events(const char *doc_str)
ok(hres == S_OK, "Could not get IHTMLWindow6: %08lx\n", hres);
IHTMLWindow2_Release(window);
hres = IHTMLWindow6_get_localStorage(window6, &local_storage[i]);
/* w10pro64 testbot VM sometimes returns this for some reason */
if(hres == WININET_E_INTERNAL_ERROR) {
win_skip("localStorage is buggy and not available, skipping storage events tests\n");
goto done;
}
ok(hres == S_OK, "get_localStorage[%u] failed: %08lx\n", i, hres);
ok(local_storage[i] != NULL, "local_storage[%u] == NULL\n", i);
hres = IHTMLWindow6_get_sessionStorage(window6, &session_storage[i]);
ok(hres == S_OK, "get_sessionStorage[%u] failed: %08lx\n", i, hres);
ok(session_storage[i] != NULL, "session_storage[%u] == NULL\n", i);
hres = IHTMLWindow6_get_localStorage(window6, &local_storage[i]);
ok(hres == S_OK, "get_localStorage[%u] failed: %08lx\n", i, hres);
ok(local_storage[i] != NULL, "local_storage[%u] == NULL\n", i);
hres = IHTMLDocument2_QueryInterface(doc[i], &IID_IHTMLDocument6, (void**)&doc6);
if(SUCCEEDED(hres)) {
@ -4125,6 +4132,9 @@ static void test_storage_events(const char *doc_str)
pump_msgs(&called_doc1_onstoragecommit);
CHECK_CALLED(doc1_onstoragecommit);
for(i = 0; i < ARRAY_SIZE(local_storage); i++)
IHTMLStorage_Release(local_storage[i]);
/* session storage */
key = SysAllocString(L"foobar");
hres = IHTMLStorage_removeItem(session_storage[0], key);
@ -4184,6 +4194,10 @@ static void test_storage_events(const char *doc_str)
CHECK_CALLED(doc1_onstorage);
if(document_mode >= 9) CHECK_CALLED(window1_onstorage);
for(i = 0; i < ARRAY_SIZE(session_storage); i++)
IHTMLStorage_Release(session_storage[i]);
done:
set_client_site(doc[0], FALSE);
set_client_site(doc[1], FALSE);
IHTMLDocument2_Release(doc[0]);

View file

@ -161,8 +161,14 @@ static HRESULT get_localstorage(IHTMLDocument2 *doc, IHTMLStorage **storage)
}
hres = IHTMLWindow6_get_localStorage(window6, storage);
ok(hres == S_OK, "get_localStorage failed: %08lx\n", hres);
ok(*storage != NULL, "*storage == NULL\n");
/* w10pro64 testbot VM sometimes returns this for some reason */
if(hres == WININET_E_INTERNAL_ERROR)
win_skip("localStorage is buggy and not available, skipping tests\n");
else {
ok(hres == S_OK, "get_localStorage failed: %08lx\n", hres);
ok(*storage != NULL, "*storage == NULL\n");
}
IHTMLWindow6_Release(window6);
return hres;
@ -206,7 +212,11 @@ static void test_HTMLStorage(void)
doc2 = create_doc_from_url(L"http://www.codeweavers.com/");
hres = get_localstorage(doc, &storage);
ok(hres == S_OK, "got %08lx\n", hres);
if(hres != S_OK) {
IHTMLDocument2_Release(doc2);
IHTMLDocument2_Release(doc);
return;
}
hres = get_localstorage(doc2, &storage2);
ok(hres == S_OK, "got %08lx\n", hres);