Commit cb078982 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml/tests: Handle broken localStorage on native.

parent 8c0d3ae2
...@@ -4024,12 +4024,19 @@ static void test_storage_events(const char *doc_str) ...@@ -4024,12 +4024,19 @@ static void test_storage_events(const char *doc_str)
ok(hres == S_OK, "Could not get IHTMLWindow6: %08lx\n", hres); ok(hres == S_OK, "Could not get IHTMLWindow6: %08lx\n", hres);
IHTMLWindow2_Release(window); IHTMLWindow2_Release(window);
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]); 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(hres == S_OK, "get_localStorage[%u] failed: %08lx\n", i, hres);
ok(local_storage[i] != NULL, "local_storage[%u] == NULL\n", i); 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 = IHTMLDocument2_QueryInterface(doc[i], &IID_IHTMLDocument6, (void**)&doc6); hres = IHTMLDocument2_QueryInterface(doc[i], &IID_IHTMLDocument6, (void**)&doc6);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
...@@ -4125,6 +4132,9 @@ static void test_storage_events(const char *doc_str) ...@@ -4125,6 +4132,9 @@ static void test_storage_events(const char *doc_str)
pump_msgs(&called_doc1_onstoragecommit); pump_msgs(&called_doc1_onstoragecommit);
CHECK_CALLED(doc1_onstoragecommit); CHECK_CALLED(doc1_onstoragecommit);
for(i = 0; i < ARRAY_SIZE(local_storage); i++)
IHTMLStorage_Release(local_storage[i]);
/* session storage */ /* session storage */
key = SysAllocString(L"foobar"); key = SysAllocString(L"foobar");
hres = IHTMLStorage_removeItem(session_storage[0], key); hres = IHTMLStorage_removeItem(session_storage[0], key);
...@@ -4184,6 +4194,10 @@ static void test_storage_events(const char *doc_str) ...@@ -4184,6 +4194,10 @@ static void test_storage_events(const char *doc_str)
CHECK_CALLED(doc1_onstorage); CHECK_CALLED(doc1_onstorage);
if(document_mode >= 9) CHECK_CALLED(window1_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[0], FALSE);
set_client_site(doc[1], FALSE); set_client_site(doc[1], FALSE);
IHTMLDocument2_Release(doc[0]); IHTMLDocument2_Release(doc[0]);
......
...@@ -161,8 +161,14 @@ static HRESULT get_localstorage(IHTMLDocument2 *doc, IHTMLStorage **storage) ...@@ -161,8 +161,14 @@ static HRESULT get_localstorage(IHTMLDocument2 *doc, IHTMLStorage **storage)
} }
hres = IHTMLWindow6_get_localStorage(window6, 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); IHTMLWindow6_Release(window6);
return hres; return hres;
...@@ -206,7 +212,11 @@ static void test_HTMLStorage(void) ...@@ -206,7 +212,11 @@ static void test_HTMLStorage(void)
doc2 = create_doc_from_url(L"http://www.codeweavers.com/"); doc2 = create_doc_from_url(L"http://www.codeweavers.com/");
hres = get_localstorage(doc, &storage); 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); hres = get_localstorage(doc2, &storage2);
ok(hres == S_OK, "got %08lx\n", hres); ok(hres == S_OK, "got %08lx\n", hres);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment