Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
97b509ea
Commit
97b509ea
authored
Jan 26, 2023
by
Gabriel Ivăncescu
Committed by
Alexandre Julliard
Jan 27, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Implement location props when there's no URI.
Signed-off-by:
Gabriel Ivăncescu
<
gabrielopcode@gmail.com
>
parent
9b38ae99
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
53 deletions
+63
-53
htmldoc.c
dlls/mshtml/htmldoc.c
+3
-0
htmllocation.c
dlls/mshtml/htmllocation.c
+16
-22
htmllocation.c
dlls/mshtml/tests/htmllocation.c
+44
-31
No files found.
dlls/mshtml/htmldoc.c
View file @
97b509ea
...
...
@@ -1159,6 +1159,9 @@ static HRESULT WINAPI HTMLDocument_get_domain(IHTMLDocument2 *iface, BSTR *p)
return
E_NOTIMPL
;
}
if
(
This
->
outer_window
&&
!
This
->
outer_window
->
uri
)
return
E_FAIL
;
nsAString_Init
(
&
nsstr
,
NULL
);
nsres
=
nsIDOMHTMLDocument_GetDomain
(
This
->
html_document
,
&
nsstr
);
if
(
NS_SUCCEEDED
(
nsres
)
&&
This
->
outer_window
&&
This
->
outer_window
->
uri
)
{
...
...
dlls/mshtml/htmllocation.c
View file @
97b509ea
...
...
@@ -38,12 +38,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
static
HRESULT
get_url
(
HTMLLocation
*
This
,
const
WCHAR
**
ret
)
{
if
(
!
This
->
window
||
!
This
->
window
->
base
.
outer_window
||
!
This
->
window
->
base
.
outer_window
->
url
)
{
FIXME
(
"No current URL
\n
"
);
return
E_NOTIMPL
;
}
*
ret
=
This
->
window
->
base
.
outer_window
->
url
;
if
(
!
This
->
window
||
!
This
->
window
->
base
.
outer_window
||
!
This
->
window
->
base
.
outer_window
->
url
)
*
ret
=
L"about:blank"
;
else
*
ret
=
This
->
window
->
base
.
outer_window
->
url
;
return
S_OK
;
}
...
...
@@ -295,10 +293,8 @@ static HRESULT WINAPI HTMLLocation_get_protocol(IHTMLLocation *iface, BSTR *p)
if
(
!
p
)
return
E_POINTER
;
if
(
!
(
uri
=
get_uri
(
This
)))
{
FIXME
(
"No current URI
\n
"
);
return
E_NOTIMPL
;
}
if
(
!
(
uri
=
get_uri
(
This
)))
return
(
*
p
=
SysAllocString
(
L"about:"
))
?
S_OK
:
E_OUTOFMEMORY
;
hres
=
IUri_GetSchemeName
(
uri
,
&
protocol
);
if
(
FAILED
(
hres
))
...
...
@@ -388,8 +384,8 @@ static HRESULT WINAPI HTMLLocation_get_hostname(IHTMLLocation *iface, BSTR *p)
return
E_POINTER
;
if
(
!
(
uri
=
get_uri
(
This
)))
{
FIXME
(
"No current URI
\n
"
)
;
return
E_NOTIMPL
;
*
p
=
NULL
;
return
S_OK
;
}
hres
=
IUri_GetHost
(
uri
,
&
hostname
);
...
...
@@ -425,8 +421,8 @@ static HRESULT WINAPI HTMLLocation_get_port(IHTMLLocation *iface, BSTR *p)
return
E_POINTER
;
if
(
!
(
uri
=
get_uri
(
This
)))
{
FIXME
(
"No current URI
\n
"
)
;
return
E_NOTIMPL
;
*
p
=
NULL
;
return
S_OK
;
}
hres
=
IUri_GetPort
(
uri
,
&
port
);
...
...
@@ -466,10 +462,8 @@ static HRESULT WINAPI HTMLLocation_get_pathname(IHTMLLocation *iface, BSTR *p)
if
(
!
p
)
return
E_POINTER
;
if
(
!
(
uri
=
get_uri
(
This
)))
{
FIXME
(
"No current URI
\n
"
);
return
E_NOTIMPL
;
}
if
(
!
(
uri
=
get_uri
(
This
)))
return
(
*
p
=
SysAllocString
(
L"blank"
))
?
S_OK
:
E_OUTOFMEMORY
;
hres
=
IUri_GetPath
(
uri
,
&
path
);
if
(
FAILED
(
hres
))
...
...
@@ -504,8 +498,8 @@ static HRESULT WINAPI HTMLLocation_get_search(IHTMLLocation *iface, BSTR *p)
return
E_POINTER
;
if
(
!
(
uri
=
get_uri
(
This
)))
{
FIXME
(
"No current URI
\n
"
)
;
return
E_NOTIMPL
;
*
p
=
NULL
;
return
S_OK
;
}
hres
=
IUri_GetQuery
(
uri
,
&
query
);
...
...
@@ -562,8 +556,8 @@ static HRESULT WINAPI HTMLLocation_get_hash(IHTMLLocation *iface, BSTR *p)
return
E_POINTER
;
if
(
!
(
uri
=
get_uri
(
This
)))
{
FIXME
(
"No current URI
\n
"
)
;
return
E_NOTIMPL
;
*
p
=
NULL
;
return
S_OK
;
}
hres
=
IUri_GetFragment
(
uri
,
&
hash
);
...
...
dlls/mshtml/tests/htmllocation.c
View file @
97b509ea
...
...
@@ -40,6 +40,18 @@ struct location_test {
static
const
struct
location_test
location_tests
[]
=
{
{
"Empty"
,
NULL
,
"about:blank"
,
"about:"
,
NULL
,
NULL
,
NULL
,
"blank"
,
NULL
,
NULL
},
{
"HTTP"
,
"http://www.winehq.org?search#hash"
,
"http://www.winehq.org/?search#hash"
,
...
...
@@ -187,7 +199,7 @@ static void test_hostname(IHTMLLocation *loc, IHTMLDocument2 *doc, const struct
SysFreeString
(
str
);
hres
=
IHTMLDocument2_get_domain
(
doc
,
&
str
);
ok
(
hres
==
S_OK
,
"%s: get_domain failed: 0x%08lx
\n
"
,
test
->
name
,
hres
);
ok
(
hres
==
(
test
->
url
?
S_OK
:
E_FAIL
)
,
"%s: get_domain failed: 0x%08lx
\n
"
,
test
->
name
,
hres
);
if
(
hres
==
S_OK
)
ok
(
str_eq_wa
(
str
,
test
->
hostname
?
test
->
hostname
:
""
),
"%s: expected retrieved domain to be L
\"
%s
\"
, was: %s
\n
"
,
...
...
@@ -280,7 +292,7 @@ static void perform_test(const struct location_test* test)
WCHAR
url
[
INTERNET_MAX_URL_LENGTH
];
HRESULT
hres
;
IBindCtx
*
bc
;
IMoniker
*
url_mon
;
IMoniker
*
url_mon
=
NULL
;
IPersistMoniker
*
persist_mon
;
IHTMLDocument2
*
doc
;
IHTMLDocument6
*
doc6
;
...
...
@@ -291,12 +303,14 @@ static void perform_test(const struct location_test* test)
if
(
FAILED
(
hres
))
return
;
MultiByteToWideChar
(
CP_ACP
,
0
,
test
->
url
,
-
1
,
url
,
ARRAY_SIZE
(
url
));
hres
=
CreateURLMoniker
(
NULL
,
url
,
&
url_mon
);
ok
(
hres
==
S_OK
,
"%s: CreateURLMoniker failed: 0x%08lx
\n
"
,
test
->
name
,
hres
);
if
(
FAILED
(
hres
)){
IBindCtx_Release
(
bc
);
return
;
if
(
test
->
url
)
{
MultiByteToWideChar
(
CP_ACP
,
0
,
test
->
url
,
-
1
,
url
,
ARRAY_SIZE
(
url
));
hres
=
CreateURLMoniker
(
NULL
,
url
,
&
url_mon
);
ok
(
hres
==
S_OK
,
"%s: CreateURLMoniker failed: 0x%08lx
\n
"
,
test
->
name
,
hres
);
if
(
FAILED
(
hres
)){
IBindCtx_Release
(
bc
);
return
;
}
}
hres
=
CoCreateInstance
(
&
CLSID_HTMLDocument
,
NULL
,
...
...
@@ -307,7 +321,7 @@ static void perform_test(const struct location_test* test)
#endif
ok
(
hres
==
S_OK
,
"%s: CoCreateInstance failed: 0x%08lx
\n
"
,
test
->
name
,
hres
);
if
(
FAILED
(
hres
)){
IMoniker_Release
(
url_mon
);
if
(
url_mon
)
IMoniker_Release
(
url_mon
);
IBindCtx_Release
(
bc
);
return
;
}
...
...
@@ -317,38 +331,39 @@ static void perform_test(const struct location_test* test)
IHTMLDocument6_Release
(
doc6
);
}
else
{
win_skip
(
"%s: Could not get IHTMLDocument6, probably too old IE. Requires IE 8+
\n
"
,
test
->
name
);
IMoniker_Release
(
url_mon
);
if
(
url_mon
)
IMoniker_Release
(
url_mon
);
IBindCtx_Release
(
bc
);
return
;
}
hres
=
IHTMLDocument2_QueryInterface
(
doc
,
&
IID_IPersistMoniker
,
(
void
**
)
&
persist_mon
);
ok
(
hres
==
S_OK
,
"%s: IHTMlDocument2_QueryInterface failed: 0x%08lx
\n
"
,
test
->
name
,
hres
);
if
(
FAILED
(
hres
)){
IHTMLDocument2_Release
(
doc
);
IMoniker_Release
(
url_mon
);
IBindCtx_Release
(
bc
);
return
;
}
hres
=
IPersistMoniker_Load
(
persist_mon
,
FALSE
,
url_mon
,
bc
,
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
);
ok
(
hres
==
S_OK
,
"%s: IPersistMoniker_Load failed: 0x%08lx
\n
"
,
test
->
name
,
hres
);
if
(
FAILED
(
hres
)){
if
(
url_mon
)
{
hres
=
IHTMLDocument2_QueryInterface
(
doc
,
&
IID_IPersistMoniker
,
(
void
**
)
&
persist_mon
);
ok
(
hres
==
S_OK
,
"%s: IHTMlDocument2_QueryInterface failed: 0x%08lx
\n
"
,
test
->
name
,
hres
);
if
(
FAILED
(
hres
)){
IHTMLDocument2_Release
(
doc
);
IMoniker_Release
(
url_mon
);
IBindCtx_Release
(
bc
)
;
return
;
}
hres
=
IPersistMoniker_Load
(
persist_mon
,
FALSE
,
url_mon
,
bc
,
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
);
ok
(
hres
==
S_OK
,
"%s: IPersistMoniker_Load failed: 0x%08lx
\n
"
,
test
->
name
,
hres
);
IPersistMoniker_Release
(
persist_mon
);
IHTMLDocument2_Release
(
doc
);
IMoniker_Release
(
url_mon
);
IBindCtx_Release
(
bc
);
return
;
if
(
FAILED
(
hres
)){
IHTMLDocument2_Release
(
doc
);
IBindCtx_Release
(
bc
);
return
;
}
}
hres
=
IHTMLDocument2_get_location
(
doc
,
&
location
);
ok
(
hres
==
S_OK
,
"%s: IHTMLDocument2_get_location failed: 0x%08lx
\n
"
,
test
->
name
,
hres
);
if
(
FAILED
(
hres
)){
IPersistMoniker_Release
(
persist_mon
);
IHTMLDocument2_Release
(
doc
);
IMoniker_Release
(
url_mon
);
IBindCtx_Release
(
bc
);
return
;
}
...
...
@@ -363,9 +378,7 @@ static void perform_test(const struct location_test* test)
test_hash
(
location
,
test
);
IHTMLLocation_Release
(
location
);
IPersistMoniker_Release
(
persist_mon
);
IHTMLDocument2_Release
(
doc
);
IMoniker_Release
(
url_mon
);
IBindCtx_Release
(
bc
);
}
...
...
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