Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
1a5cddc1
Commit
1a5cddc1
authored
Aug 26, 2022
by
Gabriel Ivăncescu
Committed by
Alexandre Julliard
Aug 27, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Implement getItem() for sessionStorage.
Signed-off-by:
Gabriel Ivăncescu
<
gabrielopcode@gmail.com
>
parent
3ba9c760
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
136 additions
and
5 deletions
+136
-5
htmlstorage.c
dlls/mshtml/htmlstorage.c
+12
-3
misc.c
dlls/mshtml/tests/misc.c
+124
-2
No files found.
dlls/mshtml/htmlstorage.c
View file @
1a5cddc1
...
...
@@ -443,6 +443,7 @@ done:
static
HRESULT
WINAPI
HTMLStorage_getItem
(
IHTMLStorage
*
iface
,
BSTR
bstrKey
,
VARIANT
*
value
)
{
HTMLStorage
*
This
=
impl_from_IHTMLStorage
(
iface
);
struct
session_entry
*
session_entry
;
HRESULT
hres
;
TRACE
(
"(%p)->(%s %p)
\n
"
,
This
,
debugstr_w
(
bstrKey
),
value
);
...
...
@@ -451,9 +452,17 @@ static HRESULT WINAPI HTMLStorage_getItem(IHTMLStorage *iface, BSTR bstrKey, VAR
return
E_POINTER
;
if
(
!
This
->
filename
)
{
FIXME
(
"session storage not supported
\n
"
);
V_VT
(
value
)
=
VT_NULL
;
return
S_OK
;
hres
=
get_session_entry
(
This
->
session_storage
,
bstrKey
,
FALSE
,
&
session_entry
);
if
(
SUCCEEDED
(
hres
))
{
if
(
!
session_entry
||
!
session_entry
->
value
)
V_VT
(
value
)
=
VT_NULL
;
else
{
V_VT
(
value
)
=
VT_BSTR
;
V_BSTR
(
value
)
=
SysAllocStringLen
(
session_entry
->
value
,
SysStringLen
(
session_entry
->
value
));
hres
=
V_BSTR
(
value
)
?
S_OK
:
E_OUTOFMEMORY
;
}
}
return
hres
;
}
WaitForSingleObject
(
This
->
mutex
,
INFINITE
);
...
...
dlls/mshtml/tests/misc.c
View file @
1a5cddc1
...
...
@@ -324,11 +324,32 @@ static void test_HTMLStorage(void)
hres
=
get_sessionstorage
(
doc2
,
&
storage2
);
ok
(
hres
==
S_OK
,
"got %08lx
\n
"
,
hres
);
key
=
SysAllocString
(
L""
);
V_VT
(
&
var
)
=
0xdead
;
hres
=
IHTMLStorage_getItem
(
storage
,
key
,
&
var
);
ok
(
hres
==
S_OK
,
"getItem failed: %08lx
\n
"
,
hres
);
ok
(
V_VT
(
&
var
)
==
VT_NULL
,
"got %d
\n
"
,
V_VT
(
&
var
));
SysFreeString
(
key
);
key
=
SysAllocString
(
L"undefined"
);
value
=
SysAllocString
(
L"null"
);
hres
=
IHTMLStorage_setItem
(
storage
,
key
,
value
);
ok
(
hres
==
S_OK
,
"setItem failed: %08lx
\n
"
,
hres
);
SysFreeString
(
value
);
V_VT
(
&
var
)
=
0xdead
;
hres
=
IHTMLStorage_getItem
(
storage
,
key
,
&
var
);
ok
(
hres
==
S_OK
,
"getItem failed: %08lx
\n
"
,
hres
);
ok
(
V_VT
(
&
var
)
==
VT_BSTR
,
"got %d
\n
"
,
V_VT
(
&
var
));
ok
(
!
wcscmp
(
V_BSTR
(
&
var
),
L"null"
),
"got %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
var
)));
VariantClear
(
&
var
);
V_VT
(
&
var
)
=
0xdead
;
hres
=
IHTMLStorage_getItem
(
storage2
,
key
,
&
var
);
ok
(
hres
==
S_OK
,
"getItem failed: %08lx
\n
"
,
hres
);
ok
(
V_VT
(
&
var
)
==
VT_BSTR
,
"got %d
\n
"
,
V_VT
(
&
var
));
ok
(
!
wcscmp
(
V_BSTR
(
&
var
),
L"null"
),
"got %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
var
)));
VariantClear
(
&
var
);
SysFreeString
(
key
);
value
=
SysAllocString
(
L"asdf"
);
...
...
@@ -336,9 +357,32 @@ static void test_HTMLStorage(void)
ok
(
hres
==
S_OK
,
"setItem failed: %08lx
\n
"
,
hres
);
SysFreeString
(
value
);
V_VT
(
&
var
)
=
0xdead
;
hres
=
IHTMLStorage_getItem
(
storage2
,
NULL
,
&
var
);
ok
(
hres
==
S_OK
,
"getItem failed: %08lx
\n
"
,
hres
);
ok
(
V_VT
(
&
var
)
==
VT_BSTR
,
"got %d
\n
"
,
V_VT
(
&
var
));
ok
(
!
wcscmp
(
V_BSTR
(
&
var
),
L"asdf"
),
"got %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
var
)));
VariantClear
(
&
var
);
V_VT
(
&
var
)
=
0xdead
;
key
=
SysAllocString
(
L""
);
hres
=
IHTMLStorage_getItem
(
storage2
,
key
,
&
var
);
ok
(
hres
==
S_OK
,
"getItem failed: %08lx
\n
"
,
hres
);
ok
(
V_VT
(
&
var
)
==
VT_BSTR
,
"got %d
\n
"
,
V_VT
(
&
var
));
ok
(
!
wcscmp
(
V_BSTR
(
&
var
),
L"asdf"
),
"got %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
var
)));
VariantClear
(
&
var
);
SysFreeString
(
key
);
key
=
SysAllocString
(
L"null-value"
);
hres
=
IHTMLStorage_setItem
(
storage
,
key
,
NULL
);
ok
(
hres
==
S_OK
,
"setItem failed: %08lx
\n
"
,
hres
);
V_VT
(
&
var
)
=
0xdead
;
hres
=
IHTMLStorage_getItem
(
storage2
,
key
,
&
var
);
ok
(
hres
==
S_OK
,
"getItem failed: %08lx
\n
"
,
hres
);
ok
(
V_VT
(
&
var
)
==
VT_BSTR
,
"got %d
\n
"
,
V_VT
(
&
var
));
ok
(
!
wcscmp
(
V_BSTR
(
&
var
),
L""
),
"got %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
var
)));
VariantClear
(
&
var
);
SysFreeString
(
key
);
key
=
SysAllocString
(
L"aaaa"
);
...
...
@@ -346,19 +390,97 @@ static void test_HTMLStorage(void)
hres
=
IHTMLStorage_setItem
(
storage2
,
key
,
value
);
ok
(
hres
==
S_OK
,
"setItem failed: %08lx
\n
"
,
hres
);
SysFreeString
(
value
);
V_VT
(
&
var
)
=
0xdead
;
hres
=
IHTMLStorage_getItem
(
storage
,
key
,
&
var
);
ok
(
hres
==
S_OK
,
"getItem failed: %08lx
\n
"
,
hres
);
ok
(
V_VT
(
&
var
)
==
VT_BSTR
,
"got %d
\n
"
,
V_VT
(
&
var
));
ok
(
!
wcscmp
(
V_BSTR
(
&
var
),
L"bbbb"
),
"got %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
var
)));
VariantClear
(
&
var
);
SysFreeString
(
key
);
key
=
SysAllocString
(
L"foo"
);
value
=
SysAllocString
(
L"bar"
);
hres
=
IHTMLStorage_setItem
(
storage
,
key
,
value
);
ok
(
hres
==
S_OK
,
"setItem failed: %08lx
\n
"
,
hres
);
SysFreeString
(
value
);
SysFreeString
(
key
);
IHTMLStorage_Release
(
storage2
);
IHTMLDocument2_Release
(
doc2
);
/* Case insensitive domain */
doc2
=
create_doc_from_url
(
L"htTp://www.CodeWeavers.com/"
);
hres
=
get_sessionstorage
(
doc2
,
&
storage2
);
ok
(
hres
==
S_OK
,
"got %08lx
\n
"
,
hres
);
V_VT
(
&
var
)
=
0xdead
;
hres
=
IHTMLStorage_getItem
(
storage2
,
key
,
&
var
);
ok
(
hres
==
S_OK
,
"getItem failed: %08lx
\n
"
,
hres
);
ok
(
V_VT
(
&
var
)
==
VT_BSTR
,
"got %d
\n
"
,
V_VT
(
&
var
));
ok
(
!
wcscmp
(
V_BSTR
(
&
var
),
L"bar"
),
"got %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
var
)));
VariantClear
(
&
var
);
IHTMLStorage_Release
(
storage2
);
IHTMLDocument2_Release
(
doc2
);
/* Different schemes */
doc2
=
create_doc_from_url
(
L"https://www.codeweavers.com/"
);
hres
=
get_sessionstorage
(
doc2
,
&
storage2
);
ok
(
hres
==
S_OK
,
"got %08lx
\n
"
,
hres
);
V_VT
(
&
var
)
=
0xdead
;
hres
=
IHTMLStorage_getItem
(
storage2
,
key
,
&
var
);
ok
(
hres
==
S_OK
,
"getItem failed: %08lx
\n
"
,
hres
);
ok
(
V_VT
(
&
var
)
==
VT_BSTR
,
"got %d
\n
"
,
V_VT
(
&
var
));
ok
(
!
wcscmp
(
V_BSTR
(
&
var
),
L"bar"
),
"got %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
var
)));
VariantClear
(
&
var
);
IHTMLStorage_Release
(
storage2
);
IHTMLDocument2_Release
(
doc2
);
doc2
=
create_doc_from_url
(
L"ftp://www.codeweavers.com/"
);
hres
=
get_sessionstorage
(
doc2
,
&
storage2
);
ok
(
hres
==
S_OK
,
"got %08lx
\n
"
,
hres
);
V_VT
(
&
var
)
=
0xdead
;
hres
=
IHTMLStorage_getItem
(
storage2
,
key
,
&
var
);
ok
(
hres
==
S_OK
,
"getItem failed: %08lx
\n
"
,
hres
);
ok
(
V_VT
(
&
var
)
==
VT_NULL
,
"got %d
\n
"
,
V_VT
(
&
var
));
hres
=
IHTMLStorage_setItem
(
storage2
,
key
,
value
);
ok
(
hres
==
S_OK
,
"setItem failed: %08lx
\n
"
,
hres
);
V_VT
(
&
var
)
=
0xdead
;
hres
=
IHTMLStorage_getItem
(
storage2
,
key
,
&
var
);
ok
(
hres
==
S_OK
,
"getItem failed: %08lx
\n
"
,
hres
);
ok
(
V_VT
(
&
var
)
==
VT_BSTR
,
"got %d
\n
"
,
V_VT
(
&
var
));
ok
(
!
wcscmp
(
V_BSTR
(
&
var
),
L"bar"
),
"got %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
var
)));
VariantClear
(
&
var
);
IHTMLStorage_Release
(
storage2
);
IHTMLDocument2_Release
(
doc2
);
/* Different domain */
doc2
=
create_doc_from_url
(
L"https://www.winehq.org/"
);
hres
=
get_sessionstorage
(
doc2
,
&
storage2
);
ok
(
hres
==
S_OK
,
"got %08lx
\n
"
,
hres
);
V_VT
(
&
var
)
=
0xdead
;
hres
=
IHTMLStorage_getItem
(
storage
,
key
,
&
var
);
ok
(
hres
==
S_OK
,
"getItem failed: %08lx
\n
"
,
hres
);
ok
(
V_VT
(
&
var
)
==
VT_BSTR
,
"got %d
\n
"
,
V_VT
(
&
var
));
ok
(
!
wcscmp
(
V_BSTR
(
&
var
),
L"bar"
),
"got %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
var
)));
VariantClear
(
&
var
);
V_VT
(
&
var
)
=
0xdead
;
hres
=
IHTMLStorage_getItem
(
storage2
,
key
,
&
var
);
ok
(
hres
==
S_OK
,
"getItem failed: %08lx
\n
"
,
hres
);
ok
(
V_VT
(
&
var
)
==
VT_NULL
,
"got %d
\n
"
,
V_VT
(
&
var
));
IHTMLStorage_Release
(
storage2
);
IHTMLStorage_Release
(
storage
);
IHTMLDocument2_Release
(
doc2
);
IHTMLDocument2_Release
(
doc
);
SysFreeString
(
value
);
SysFreeString
(
key
);
}
START_TEST
(
misc
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment