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
bbb46e81
Commit
bbb46e81
authored
Mar 26, 2021
by
Jacek Caban
Committed by
Alexandre Julliard
Mar 26, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Report user agent matching current compat mode.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5d111046
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
12 deletions
+37
-12
omnavigator.c
dlls/mshtml/omnavigator.c
+23
-2
documentmode.js
dlls/mshtml/tests/documentmode.js
+12
-0
dom.c
dlls/mshtml/tests/dom.c
+2
-10
No files found.
dlls/mshtml/omnavigator.c
View file @
bbb46e81
...
...
@@ -1157,6 +1157,27 @@ static HRESULT WINAPI OmNavigator_get_appName(IOmNavigator *iface, BSTR *p)
return
S_OK
;
}
static
unsigned
int
get_ua_version
(
OmNavigator
*
navigator
)
{
switch
(
dispex_compat_mode
(
&
navigator
->
dispex
))
{
case
COMPAT_MODE_QUIRKS
:
return
UAS_EXACTLEGACY
|
7
;
case
COMPAT_MODE_IE5
:
case
COMPAT_MODE_IE7
:
return
7
;
case
COMPAT_MODE_IE8
:
return
8
;
case
COMPAT_MODE_IE9
:
return
9
;
case
COMPAT_MODE_IE10
:
return
10
;
case
COMPAT_MODE_IE11
:
return
11
;
}
assert
(
0
);
return
0
;
}
static
HRESULT
WINAPI
OmNavigator_get_appVersion
(
IOmNavigator
*
iface
,
BSTR
*
p
)
{
OmNavigator
*
This
=
impl_from_IOmNavigator
(
iface
);
...
...
@@ -1169,7 +1190,7 @@ static HRESULT WINAPI OmNavigator_get_appVersion(IOmNavigator *iface, BSTR *p)
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
p
);
size
=
sizeof
(
user_agent
);
hres
=
ObtainUserAgentString
(
0
,
user_agent
,
&
size
);
hres
=
ObtainUserAgentString
(
get_ua_version
(
This
)
,
user_agent
,
&
size
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -1197,7 +1218,7 @@ static HRESULT WINAPI OmNavigator_get_userAgent(IOmNavigator *iface, BSTR *p)
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
p
);
size
=
sizeof
(
user_agent
);
hres
=
ObtainUserAgentString
(
0
,
user_agent
,
&
size
);
hres
=
ObtainUserAgentString
(
get_ua_version
(
This
)
,
user_agent
,
&
size
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
dlls/mshtml/tests/documentmode.js
View file @
bbb46e81
...
...
@@ -360,3 +360,15 @@ async_test("script_load", function() {
elem
.
src
=
"jsstream.php?simple"
;
external
.
writeStream
(
"simple"
,
"ready_states += 'exec,';"
);
});
sync_test
(
"navigator"
,
function
()
{
var
v
=
document
.
documentMode
,
re
;
var
app
=
navigator
.
appVersion
;
ok
(
navigator
.
userAgent
===
"Mozilla/"
+
app
,
"userAgent = "
+
navigator
.
userAgent
+
" appVersion = "
+
app
);
re
=
v
<
11
?
"^"
+
(
v
<
9
?
"4"
:
"5"
)
+
"
\\
.0
\\
(compatible; MSIE "
+
(
v
<
7
?
7
:
v
)
+
"
\\
.0; Windows NT [^
\\
)]*
\\
)$"
:
"^5.0
\\
(Windows NT [0-9].[0-9]; .*Trident/[678]
\\
.0.*rv:11.0
\\
) like Gecko$"
;
ok
(
new
RegExp
(
re
).
test
(
app
),
"appVersion = "
+
app
);
});
dlls/mshtml/tests/dom.c
View file @
bbb46e81
...
...
@@ -6383,25 +6383,17 @@ static void test_navigator(IHTMLDocument2 *doc)
bstr
=
NULL
;
hres
=
IOmNavigator_get_userAgent
(
navigator
,
&
bstr
);
ok
(
hres
==
S_OK
,
"get_userAgent failed: %08x
\n
"
,
hres
);
todo_wine
ok
(
!
lstrcmpW
(
bstr
,
buf
),
"userAgent returned %s, expected
\"
%s
\"\n
"
,
wine_dbgstr_w
(
bstr
),
wine_dbgstr_w
(
buf
));
SysFreeString
(
bstr
);
if
(
!
wcsncmp
(
buf
,
L"Mozilla/"
,
8
))
{
bstr
=
NULL
;
hres
=
IOmNavigator_get_appVersion
(
navigator
,
&
bstr
);
ok
(
hres
==
S_OK
,
"get_appVersion failed: %08x
\n
"
,
hres
);
ok
(
!
lstrcmpW
(
bstr
,
buf
+
8
),
"appVersion returned %s, expected
\"
%s
\"\n
"
,
wine_dbgstr_w
(
bstr
),
wine_dbgstr_w
(
buf
+
8
));
SysFreeString
(
bstr
);
}
else
{
skip
(
"nonstandard user agent
\n
"
);
}
hres
=
UrlMkSetSessionOption
(
URLMON_OPTION_USERAGENT
,
ua
,
sizeof
(
ua
),
0
);
ok
(
hres
==
S_OK
,
"UrlMkSetSessionOption failed: %08x
\n
"
,
hres
);
MultiByteToWideChar
(
CP_ACP
,
0
,
ua
,
-
1
,
buf
,
ARRAY_SIZE
(
buf
));
hres
=
IOmNavigator_get_appVersion
(
navigator
,
&
bstr
);
ok
(
hres
==
S_OK
,
"get_appVersion failed: %08x
\n
"
,
hres
);
todo_wine
ok
(
!
lstrcmpW
(
bstr
,
buf
+
8
),
"appVersion returned %s, expected
\"
%s
\"\n
"
,
wine_dbgstr_w
(
bstr
),
wine_dbgstr_w
(
buf
+
8
));
SysFreeString
(
bstr
);
...
...
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