Jacek Caban : mshtml: Add IHTMLWindow6::get_localStorage implementation.

Alexandre Julliard julliard at winehq.org
Fri Mar 22 16:06:19 CDT 2019


Module: wine
Branch: master
Commit: 64b5d6b3e5944b6f4b4d6bcd0df2f8b6bb32b584
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=64b5d6b3e5944b6f4b4d6bcd0df2f8b6bb32b584

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Mar 22 15:16:28 2019 +0100

mshtml: Add IHTMLWindow6::get_localStorage implementation.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mshtml/htmlwindow.c      | 20 +++++++++++++++++---
 dlls/mshtml/mshtml_private.h  |  1 +
 dlls/mshtml/tests/elements.js | 11 ++++++++++-
 3 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index 92b0537..926ebb9 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -295,6 +295,8 @@ static void release_inner_window(HTMLInnerWindow *This)
 
     if(This->session_storage)
         IHTMLStorage_Release(This->session_storage);
+    if(This->local_storage)
+        IHTMLStorage_Release(This->local_storage);
 
     if(This->mon)
         IMoniker_Release(This->mon);
@@ -2123,7 +2125,7 @@ static HRESULT WINAPI HTMLWindow6_get_sessionStorage(IHTMLWindow6 *iface, IHTMLS
 {
     HTMLWindow *This = impl_from_IHTMLWindow6(iface);
 
-    FIXME("(%p)->(%p)\n", This, p);
+    TRACE("(%p)->(%p)\n", This, p);
 
     if(!This->inner_window->session_storage) {
         HRESULT hres;
@@ -2141,8 +2143,20 @@ static HRESULT WINAPI HTMLWindow6_get_sessionStorage(IHTMLWindow6 *iface, IHTMLS
 static HRESULT WINAPI HTMLWindow6_get_localStorage(IHTMLWindow6 *iface, IHTMLStorage **p)
 {
     HTMLWindow *This = impl_from_IHTMLWindow6(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    if(!This->inner_window->local_storage) {
+        HRESULT hres;
+
+        hres = create_storage(&This->inner_window->local_storage);
+        if(FAILED(hres))
+            return hres;
+    }
+
+    IHTMLStorage_AddRef(This->inner_window->local_storage);
+    *p = This->inner_window->local_storage;
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLWindow6_put_onhashchange(IHTMLWindow6 *iface, VARIANT v)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index f2939da..14cc561 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -515,6 +515,7 @@ struct HTMLInnerWindow {
     IHTMLScreen *screen;
     OmHistory *history;
     IHTMLStorage *session_storage;
+    IHTMLStorage *local_storage;
 
     BOOL performance_initialized;
     VARIANT performance;
diff --git a/dlls/mshtml/tests/elements.js b/dlls/mshtml/tests/elements.js
index 7213388..b23f5c1 100644
--- a/dlls/mshtml/tests/elements.js
+++ b/dlls/mshtml/tests/elements.js
@@ -290,6 +290,14 @@ function test_style_properties() {
     next_test();
 }
 
+function test_storage() {
+    ok(typeof(window.sessionStorage) === "object",
+       "typeof(window.sessionStorage) = " + typeof(window.sessionStorage));
+    ok(typeof(window.localStorage) === "object",
+       "typeof(window.localStorage) = " + typeof(window.localStorage));
+    next_test();
+}
+
 var tests = [
     test_input_selection,
     test_textContent,
@@ -301,5 +309,6 @@ var tests = [
     test_query_selector,
     test_compare_position,
     test_document_owner,
-    test_style_properties
+    test_style_properties,
+    test_storage
 ];




More information about the wine-cvs mailing list