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
a0624a7e
Commit
a0624a7e
authored
Jan 29, 2024
by
Gabriel Ivăncescu
Committed by
Alexandre Julliard
Jan 30, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Implement IActiveScriptSite service.
With IOleCommandTarget stub, since it's the interface used. Signed-off-by:
Gabriel Ivăncescu
<
gabrielopcode@gmail.com
>
parent
370a3390
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
258 additions
and
11 deletions
+258
-11
htmlscript.h
dlls/mshtml/htmlscript.h
+3
-0
script.c
dlls/mshtml/script.c
+66
-0
service.c
dlls/mshtml/service.c
+16
-0
events.c
dlls/mshtml/tests/events.c
+29
-2
htmldoc.c
dlls/mshtml/tests/htmldoc.c
+52
-0
script.c
dlls/mshtml/tests/script.c
+92
-9
No files found.
dlls/mshtml/htmlscript.h
View file @
a0624a7e
...
...
@@ -16,6 +16,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "activscp.h"
struct
HTMLScriptElement
{
HTMLElement
element
;
...
...
@@ -47,3 +49,4 @@ HRESULT exec_script(HTMLInnerWindow*,const WCHAR*,const WCHAR*,VARIANT*);
void
update_browser_script_mode
(
GeckoBrowser
*
,
IUri
*
);
BOOL
find_global_prop
(
HTMLInnerWindow
*
,
BSTR
,
DWORD
,
ScriptHost
**
,
DISPID
*
);
IDispatch
*
get_script_disp
(
ScriptHost
*
);
IActiveScriptSite
*
get_first_script_site
(
HTMLInnerWindow
*
);
dlls/mshtml/script.c
View file @
a0624a7e
...
...
@@ -74,6 +74,7 @@ struct ScriptHost {
IActiveScriptSiteUIControl
IActiveScriptSiteUIControl_iface
;
IActiveScriptSiteDebug
IActiveScriptSiteDebug_iface
;
IServiceProvider
IServiceProvider_iface
;
IOleCommandTarget
IOleCommandTarget_iface
;
LONG
ref
;
...
...
@@ -308,6 +309,9 @@ static HRESULT WINAPI ActiveScriptSite_QueryInterface(IActiveScriptSite *iface,
}
else
if
(
IsEqualGUID
(
&
IID_IServiceProvider
,
riid
))
{
TRACE
(
"(%p)->(IID_IServiceProvider %p)
\n
"
,
This
,
ppv
);
*
ppv
=
&
This
->
IServiceProvider_iface
;
}
else
if
(
IsEqualGUID
(
&
IID_IOleCommandTarget
,
riid
))
{
TRACE
(
"(%p)->(IID_IOleCommandTarget %p)
\n
"
,
This
,
ppv
);
*
ppv
=
&
This
->
IOleCommandTarget_iface
;
}
else
if
(
IsEqualGUID
(
&
IID_ICanHandleException
,
riid
))
{
TRACE
(
"(%p)->(IID_ICanHandleException not supported %p)
\n
"
,
This
,
ppv
);
return
E_NOINTERFACE
;
...
...
@@ -688,6 +692,57 @@ static const IServiceProviderVtbl ASServiceProviderVtbl = {
ASServiceProvider_QueryService
};
static
inline
ScriptHost
*
impl_from_IOleCommandTarget
(
IOleCommandTarget
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
ScriptHost
,
IOleCommandTarget_iface
);
}
static
HRESULT
WINAPI
OleCommandTarget_QueryInterface
(
IOleCommandTarget
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
ScriptHost
*
This
=
impl_from_IOleCommandTarget
(
iface
);
return
IActiveScriptSite_QueryInterface
(
&
This
->
IActiveScriptSite_iface
,
riid
,
ppv
);
}
static
ULONG
WINAPI
OleCommandTarget_AddRef
(
IOleCommandTarget
*
iface
)
{
ScriptHost
*
This
=
impl_from_IOleCommandTarget
(
iface
);
return
IActiveScriptSite_AddRef
(
&
This
->
IActiveScriptSite_iface
);
}
static
ULONG
WINAPI
OleCommandTarget_Release
(
IOleCommandTarget
*
iface
)
{
ScriptHost
*
This
=
impl_from_IOleCommandTarget
(
iface
);
return
IActiveScriptSite_Release
(
&
This
->
IActiveScriptSite_iface
);
}
static
HRESULT
WINAPI
OleCommandTarget_QueryStatus
(
IOleCommandTarget
*
iface
,
const
GUID
*
pguidCmdGroup
,
ULONG
cCmds
,
OLECMD
prgCmds
[],
OLECMDTEXT
*
pCmdText
)
{
ScriptHost
*
This
=
impl_from_IOleCommandTarget
(
iface
);
FIXME
(
"(%p)->(%s %ld %p %p)
\n
"
,
This
,
debugstr_guid
(
pguidCmdGroup
),
cCmds
,
prgCmds
,
pCmdText
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
OleCommandTarget_Exec
(
IOleCommandTarget
*
iface
,
const
GUID
*
pguidCmdGroup
,
DWORD
nCmdID
,
DWORD
nCmdexecopt
,
VARIANT
*
pvaIn
,
VARIANT
*
pvaOut
)
{
ScriptHost
*
This
=
impl_from_IOleCommandTarget
(
iface
);
FIXME
(
"(%p)->(%s %ld %ld %s %p)
\n
"
,
This
,
debugstr_guid
(
pguidCmdGroup
),
nCmdID
,
nCmdexecopt
,
wine_dbgstr_variant
(
pvaIn
),
pvaOut
);
return
E_NOTIMPL
;
}
static
const
IOleCommandTargetVtbl
OleCommandTargetVtbl
=
{
OleCommandTarget_QueryInterface
,
OleCommandTarget_AddRef
,
OleCommandTarget_Release
,
OleCommandTarget_QueryStatus
,
OleCommandTarget_Exec
};
static
ScriptHost
*
create_script_host
(
HTMLInnerWindow
*
window
,
const
GUID
*
guid
)
{
IActiveScript
*
script
;
...
...
@@ -704,6 +759,7 @@ static ScriptHost *create_script_host(HTMLInnerWindow *window, const GUID *guid)
ret
->
IActiveScriptSiteUIControl_iface
.
lpVtbl
=
&
ActiveScriptSiteUIControlVtbl
;
ret
->
IActiveScriptSiteDebug_iface
.
lpVtbl
=
&
ActiveScriptSiteDebugVtbl
;
ret
->
IServiceProvider_iface
.
lpVtbl
=
&
ASServiceProviderVtbl
;
ret
->
IOleCommandTarget_iface
.
lpVtbl
=
&
OleCommandTargetVtbl
;
ret
->
ref
=
1
;
ret
->
window
=
window
;
ret
->
script_state
=
SCRIPTSTATE_UNINITIALIZED
;
...
...
@@ -1457,6 +1513,16 @@ IDispatch *get_script_disp(ScriptHost *script_host)
return
disp
;
}
IActiveScriptSite
*
get_first_script_site
(
HTMLInnerWindow
*
window
)
{
if
(
list_empty
(
&
window
->
script_hosts
))
{
ScriptHost
*
script_host
=
create_script_host
(
window
,
&
CLSID_JScript
);
if
(
!
script_host
)
return
NULL
;
}
return
&
LIST_ENTRY
(
list_head
(
&
window
->
script_hosts
),
ScriptHost
,
entry
)
->
IActiveScriptSite_iface
;
}
static
EventTarget
*
find_event_target
(
HTMLDocumentNode
*
doc
,
HTMLScriptElement
*
script_elem
)
{
EventTarget
*
event_target
=
NULL
;
...
...
dlls/mshtml/service.c
View file @
a0624a7e
...
...
@@ -29,6 +29,7 @@
#include "wine/debug.h"
#include "mshtml_private.h"
#include "htmlscript.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
mshtml
);
...
...
@@ -360,6 +361,21 @@ static HRESULT WINAPI DocNodeServiceProvider_QueryService(IServiceProvider *ifac
{
HTMLDocumentNode
*
This
=
HTMLDocumentNode_from_IServiceProvider
(
iface
);
if
(
IsEqualGUID
(
&
IID_IActiveScriptSite
,
guidService
))
{
IActiveScriptSite
*
site
;
TRACE
(
"IID_IActiveScriptSite
\n
"
);
if
(
!
This
->
window
)
{
FIXME
(
"No window
\n
"
);
return
E_NOTIMPL
;
}
if
(
!
(
site
=
get_first_script_site
(
This
->
window
)))
return
E_OUTOFMEMORY
;
return
IActiveScriptSite_QueryInterface
(
site
,
riid
,
ppv
);
}
if
(
IsEqualGUID
(
&
SID_SInternetHostSecurityManager
,
guidService
))
{
TRACE
(
"SID_SInternetHostSecurityManager
\n
"
);
return
IInternetHostSecurityManager_QueryInterface
(
&
This
->
IInternetHostSecurityManager_iface
,
riid
,
ppv
);
...
...
dlls/mshtml/tests/events.c
View file @
a0624a7e
...
...
@@ -35,6 +35,8 @@
#include "shdeprecated.h"
#include "dispex.h"
extern
const
IID
IID_IActiveScriptSite
;
#define DEFINE_EXPECT(func) \
static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
...
...
@@ -3398,12 +3400,15 @@ static void test_doc_obj(IHTMLDocument2 *doc)
IHTMLPerformance
*
perf
,
*
perf2
;
IOmHistory
*
history
,
*
history2
;
IHTMLScreen
*
screen
,
*
screen2
;
IOleCommandTarget
*
cmdtarget
;
IHTMLWindow2
*
self
,
*
window2
;
IEventTarget
*
event_target
;
IUnknown
*
site
,
*
site2
;
DISPPARAMS
dp
=
{
0
};
IHTMLWindow7
*
window7
;
IHTMLWindow6
*
window6
;
IHTMLWindow5
*
window5
;
IServiceProvider
*
sp
;
IDispatchEx
*
dispex
;
IHTMLElement
*
body
;
VARIANT
res
,
arg
;
...
...
@@ -3565,6 +3570,16 @@ static void test_doc_obj(IHTMLDocument2 *doc)
ok
(
hres
==
S_OK
,
"get_self failed: %08lx
\n
"
,
hres
);
ok
(
self
!=
NULL
,
"self == NULL
\n
"
);
/* And script sites */
hres
=
IHTMLDocument2_QueryInterface
(
doc_node
,
&
IID_IServiceProvider
,
(
void
**
)
&
sp
);
ok
(
hres
==
S_OK
,
"Could not get IServiceProvider iface: %08lx
\n
"
,
hres
);
hres
=
IServiceProvider_QueryService
(
sp
,
&
IID_IActiveScriptSite
,
&
IID_IOleCommandTarget
,
(
void
**
)
&
cmdtarget
);
ok
(
hres
==
S_OK
,
"QueryService(IID_IActiveScriptSite->IID_IOleCommandTarget) failed: %08lx
\n
"
,
hres
);
hres
=
IOleCommandTarget_QueryInterface
(
cmdtarget
,
&
IID_IActiveScriptSite
,
(
void
**
)
&
site
);
ok
(
hres
==
S_OK
,
"Command Target QI for IActiveScriptSite failed: %08lx
\n
"
,
hres
);
IOleCommandTarget_Release
(
cmdtarget
);
IServiceProvider_Release
(
sp
);
/* Add props to location, since it gets lost on navigation, despite being same object */
bstr
=
SysAllocString
(
L"wineTestProp"
);
hres
=
IHTMLLocation_QueryInterface
(
location
,
&
IID_IDispatchEx
,
(
void
**
)
&
dispex
);
...
...
@@ -3631,16 +3646,28 @@ static void test_doc_obj(IHTMLDocument2 *doc)
hres
=
IHTMLWindow2_get_document
(
window
,
&
doc_node2
);
ok
(
hres
==
S_OK
,
"get_document failed: %08lx
\n
"
,
hres
);
ok
(
doc_node
!=
doc_node2
,
"doc_node == doc_node2
\n
"
);
IHTMLDocument2_Release
(
doc_node2
);
hres
=
IHTMLDocument2_get_parentWindow
(
doc_node
,
&
window2
);
todo_wine
ok
(
hres
==
S_OK
,
"get_parentWindow failed: %08lx
\n
"
,
hres
);
todo_wine
ok
(
window
==
window2
,
"window != window2
\n
"
);
IHTMLDocument2_Release
(
doc_node
);
if
(
hres
==
S_OK
)
IHTMLWindow2_Release
(
window2
);
hres
=
IHTMLDocument2_QueryInterface
(
doc_node2
,
&
IID_IServiceProvider
,
(
void
**
)
&
sp
);
ok
(
hres
==
S_OK
,
"Could not get IServiceProvider iface: %08lx
\n
"
,
hres
);
hres
=
IServiceProvider_QueryService
(
sp
,
&
IID_IActiveScriptSite
,
&
IID_IOleCommandTarget
,
(
void
**
)
&
cmdtarget
);
ok
(
hres
==
S_OK
,
"QueryService(IID_IActiveScriptSite->IID_IOleCommandTarget) failed: %08lx
\n
"
,
hres
);
hres
=
IOleCommandTarget_QueryInterface
(
cmdtarget
,
&
IID_IActiveScriptSite
,
(
void
**
)
&
site2
);
ok
(
hres
==
S_OK
,
"Command Target QI for IActiveScriptSite failed: %08lx
\n
"
,
hres
);
ok
(
site
!=
site2
,
"site == site2
\n
"
);
IOleCommandTarget_Release
(
cmdtarget
);
IHTMLDocument2_Release
(
doc_node2
);
IHTMLDocument2_Release
(
doc_node
);
IServiceProvider_Release
(
sp
);
IUnknown_Release
(
site2
);
IUnknown_Release
(
site
);
hres
=
IHTMLWindow2_get_location
(
window
,
&
location2
);
ok
(
hres
==
S_OK
,
"get_location failed: %08lx
\n
"
,
hres
);
ok
(
location
==
location2
,
"location != location2
\n
"
);
...
...
dlls/mshtml/tests/htmldoc.c
View file @
a0624a7e
...
...
@@ -53,6 +53,7 @@ DEFINE_GUID(IID_IProxyManager,0x00000008,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,
DEFINE_OLEGUID
(
CGID_DocHostCmdPriv
,
0x000214D4L
,
0
,
0
);
DEFINE_GUID
(
SID_SContainerDispatch
,
0xb722be00
,
0x4e68
,
0x101b
,
0xa2
,
0xbc
,
0x00
,
0xaa
,
0x00
,
0x40
,
0x47
,
0x70
);
DEFINE_GUID
(
outer_test_iid
,
0xabcabc00
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0x66
);
extern
const
IID
IID_IActiveScriptSite
;
#define DEFINE_EXPECT(func) \
static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
...
...
@@ -8730,8 +8731,11 @@ static void test_submit(void)
static
void
test_QueryService
(
IHTMLDocument2
*
doc
,
BOOL
success
)
{
IHTMLWindow2
*
window
,
*
sp_window
;
IOleCommandTarget
*
cmdtarget
;
IHTMLDocument2
*
doc_node
;
IServiceProvider
*
sp
;
IHlinkFrame
*
hf
;
IUnknown
*
unk
;
HRESULT
hres
;
hres
=
IHTMLDocument2_QueryInterface
(
doc
,
&
IID_IServiceProvider
,
(
void
**
)
&
sp
);
...
...
@@ -8748,6 +8752,9 @@ static void test_QueryService(IHTMLDocument2 *doc, BOOL success)
ok
(
hf
==
&
HlinkFrame
,
"hf != HlinkFrame
\n
"
);
IHlinkFrame_Release
(
hf
);
hres
=
IServiceProvider_QueryService
(
sp
,
&
IID_IActiveScriptSite
,
&
IID_IOleCommandTarget
,
(
void
**
)
&
cmdtarget
);
ok
(
hres
==
E_NOINTERFACE
,
"QueryService(IID_IActiveScriptSite->IID_IOleCommandTarget) returned: %08lx
\n
"
,
hres
);
IServiceProvider_Release
(
sp
);
hres
=
IHTMLDocument2_get_parentWindow
(
doc
,
&
window
);
...
...
@@ -8766,8 +8773,28 @@ static void test_QueryService(IHTMLDocument2 *doc, BOOL success)
ok
(
hf
==
&
HlinkFrame
,
"hf != HlinkFrame
\n
"
);
IHlinkFrame_Release
(
hf
);
hres
=
IServiceProvider_QueryService
(
sp
,
&
IID_IActiveScriptSite
,
&
IID_IOleCommandTarget
,
(
void
**
)
&
cmdtarget
);
ok
(
hres
==
E_NOINTERFACE
,
"QueryService(IID_IActiveScriptSite->IID_IOleCommandTarget) returned: %08lx
\n
"
,
hres
);
IServiceProvider_Release
(
sp
);
hres
=
IHTMLWindow2_get_document
(
window
,
&
doc_node
);
ok
(
hres
==
S_OK
,
"get_document failed: %08lx
\n
"
,
hres
);
IHTMLWindow2_Release
(
window
);
hres
=
IHTMLDocument2_QueryInterface
(
doc_node
,
&
IID_IServiceProvider
,
(
void
**
)
&
sp
);
ok
(
hres
==
S_OK
,
"Could not get IServiceProvider iface: %08lx
\n
"
,
hres
);
IHTMLDocument2_Release
(
doc_node
);
hres
=
IServiceProvider_QueryService
(
sp
,
&
IID_IActiveScriptSite
,
&
IID_IOleCommandTarget
,
(
void
**
)
&
cmdtarget
);
ok
(
hres
==
S_OK
,
"QueryService(IID_IActiveScriptSite->IID_IOleCommandTarget) failed: %08lx
\n
"
,
hres
);
ok
(
cmdtarget
!=
NULL
,
"cmdtarget == NULL
\n
"
);
hres
=
IOleCommandTarget_QueryInterface
(
cmdtarget
,
&
IID_IActiveScriptSite
,
(
void
**
)
&
unk
);
ok
(
hres
==
S_OK
,
"Command Target QI for IActiveScriptSite failed: %08lx
\n
"
,
hres
);
IUnknown_Release
(
unk
);
IOleCommandTarget_Release
(
cmdtarget
);
IServiceProvider_Release
(
sp
);
}
static
void
test_HTMLDocument_StreamLoad
(
void
)
...
...
@@ -9281,8 +9308,10 @@ static BOOL check_ie(void)
static
void
test_ServiceProvider
(
void
)
{
IHTMLDocument3
*
doc3
,
*
doc3_2
;
IOleCommandTarget
*
cmdtarget
;
IServiceProvider
*
provider
;
IHTMLDocument2
*
doc
,
*
doc2
;
IHTMLWindow2
*
window
;
IUnknown
*
unk
;
HRESULT
hres
;
...
...
@@ -9318,6 +9347,29 @@ static void test_ServiceProvider(void)
ok
(
hres
==
S_OK
,
"QueryService(HTMLEditServices) failed: %08lx
\n
"
,
hres
);
IUnknown_Release
(
unk
);
hres
=
IServiceProvider_QueryService
(
provider
,
&
IID_IActiveScriptSite
,
&
IID_IOleCommandTarget
,
(
void
**
)
&
cmdtarget
);
ok
(
hres
==
E_NOINTERFACE
,
"QueryService(IID_IActiveScriptSite->IID_IOleCommandTarget) returned: %08lx
\n
"
,
hres
);
IServiceProvider_Release
(
provider
);
hres
=
IHTMLDocument2_get_parentWindow
(
doc
,
&
window
);
ok
(
hres
==
S_OK
,
"get_parentWindow failed: %08lx
\n
"
,
hres
);
hres
=
IHTMLWindow2_get_document
(
window
,
&
doc2
);
ok
(
hres
==
S_OK
,
"get_document failed: %08lx
\n
"
,
hres
);
IHTMLWindow2_Release
(
window
);
hres
=
IHTMLDocument2_QueryInterface
(
doc2
,
&
IID_IServiceProvider
,
(
void
**
)
&
provider
);
ok
(
hres
==
S_OK
,
"Could not get IServiceProvider iface: %08lx
\n
"
,
hres
);
IHTMLDocument2_Release
(
doc2
);
hres
=
IServiceProvider_QueryService
(
provider
,
&
IID_IActiveScriptSite
,
&
IID_IOleCommandTarget
,
(
void
**
)
&
cmdtarget
);
ok
(
hres
==
S_OK
,
"QueryService(IID_IActiveScriptSite->IID_IOleCommandTarget) failed: %08lx
\n
"
,
hres
);
ok
(
cmdtarget
!=
NULL
,
"cmdtarget == NULL
\n
"
);
hres
=
IOleCommandTarget_QueryInterface
(
cmdtarget
,
&
IID_IActiveScriptSite
,
(
void
**
)
&
unk
);
ok
(
hres
==
S_OK
,
"Command Target QI for IActiveScriptSite failed: %08lx
\n
"
,
hres
);
IUnknown_Release
(
unk
);
IOleCommandTarget_Release
(
cmdtarget
);
IServiceProvider_Release
(
provider
);
release_document
(
doc
);
}
...
...
dlls/mshtml/tests/script.c
View file @
a0624a7e
...
...
@@ -186,6 +186,7 @@ static BOOL is_ie9plus, is_english;
static
IHTMLDocument2
*
notif_doc
;
static
IOleDocumentView
*
view
;
static
IDispatchEx
*
window_dispex
;
static
IHTMLDocument2
*
doc_obj
;
static
BOOL
doc_complete
;
static
IDispatch
*
script_disp
;
static
BOOL
ax_objsafe
;
...
...
@@ -1924,7 +1925,8 @@ static IHTMLDocument2 *create_document(void)
todo_wine
#endif
ok
(
hres
==
S_OK
,
"CoCreateInstance failed: %08lx
\n
"
,
hres
);
return
SUCCEEDED
(
hres
)
?
doc
:
NULL
;
doc_obj
=
SUCCEEDED
(
hres
)
?
doc
:
NULL
;
return
doc_obj
;
}
static
void
load_string
(
IHTMLDocument2
*
doc
,
const
char
*
str
)
...
...
@@ -3076,10 +3078,34 @@ static void test_ui(void)
static
void
test_sp
(
void
)
{
IServiceProvider
*
sp
;
IServiceProvider
*
sp
,
*
doc_sp
,
*
doc_obj_sp
,
*
window_sp
;
IOleCommandTarget
*
cmdtarget
;
IHTMLWindow2
*
window
;
IHTMLDocument2
*
doc
;
IUnknown
*
unk
;
HRESULT
hres
;
hres
=
IDispatchEx_QueryInterface
(
window_dispex
,
&
IID_IHTMLWindow2
,
(
void
**
)
&
window
);
ok
(
hres
==
S_OK
,
"QueryInterface(IHTMLWindow2) failed: %08lx
\n
"
,
hres
);
ok
(
window
!=
NULL
,
"window is NULL
\n
"
);
hres
=
IHTMLWindow2_QueryInterface
(
window
,
&
IID_IServiceProvider
,
(
void
**
)
&
window_sp
);
ok
(
hres
==
S_OK
,
"Could not get IServiceProvider iface: %08lx
\n
"
,
hres
);
ok
(
window_sp
!=
NULL
,
"window service provider is NULL
\n
"
);
hres
=
IHTMLWindow2_get_document
(
window
,
&
doc
);
ok
(
hres
==
S_OK
,
"QueryInterface(IHTMLDocument2) failed: %08lx
\n
"
,
hres
);
ok
(
doc
!=
NULL
,
"doc is NULL
\n
"
);
ok
(
doc
!=
doc_obj
,
"doc node == doc obj
\n
"
);
hres
=
IHTMLDocument2_QueryInterface
(
doc
,
&
IID_IServiceProvider
,
(
void
**
)
&
doc_sp
);
ok
(
hres
==
S_OK
,
"Could not get IServiceProvider iface: %08lx
\n
"
,
hres
);
ok
(
doc_sp
!=
NULL
,
"doc service provider is NULL
\n
"
);
IHTMLDocument2_Release
(
doc
);
hres
=
IHTMLDocument2_QueryInterface
(
doc_obj
,
&
IID_IServiceProvider
,
(
void
**
)
&
doc_obj_sp
);
ok
(
hres
==
S_OK
,
"Could not get IServiceProvider iface: %08lx
\n
"
,
hres
);
ok
(
doc_obj_sp
!=
NULL
,
"doc_obj service provider is NULL
\n
"
);
hres
=
IActiveScriptSite_QueryInterface
(
site
,
&
IID_IServiceProvider
,
(
void
**
)
&
sp
);
ok
(
hres
==
S_OK
,
"Could not get IServiceProvider iface: %08lx
\n
"
,
hres
);
...
...
@@ -3087,7 +3113,60 @@ static void test_sp(void)
ok
(
hres
==
S_OK
,
"Could not get SID_SContainerDispatch service: %08lx
\n
"
,
hres
);
IUnknown_Release
(
unk
);
hres
=
IServiceProvider_QueryService
(
sp
,
&
SID_GetCaller
,
&
IID_IServiceProvider
,
(
void
**
)
&
unk
);
ok
(
hres
==
E_NOINTERFACE
,
"QueryService(SID_GetCaller) returned: %08lx
\n
"
,
hres
);
hres
=
IServiceProvider_QueryService
(
doc_sp
,
&
SID_GetCaller
,
&
IID_IServiceProvider
,
(
void
**
)
&
unk
);
ok
(
hres
==
E_NOINTERFACE
,
"QueryService(SID_GetCaller) returned: %08lx
\n
"
,
hres
);
hres
=
IServiceProvider_QueryService
(
doc_obj_sp
,
&
SID_GetCaller
,
&
IID_IServiceProvider
,
(
void
**
)
&
unk
);
ok
(
hres
==
E_NOINTERFACE
,
"QueryService(SID_GetCaller) returned: %08lx
\n
"
,
hres
);
hres
=
IServiceProvider_QueryService
(
window_sp
,
&
SID_GetCaller
,
&
IID_IServiceProvider
,
(
void
**
)
&
unk
);
ok
(
hres
==
E_NOINTERFACE
,
"QueryService(SID_GetCaller) returned: %08lx
\n
"
,
hres
);
hres
=
IServiceProvider_QueryService
(
sp
,
&
IID_IActiveScriptSite
,
&
IID_IOleCommandTarget
,
(
void
**
)
&
cmdtarget
);
ok
(
hres
==
S_OK
,
"QueryService(IActiveScriptSite->IOleCommandTarget) failed: %08lx
\n
"
,
hres
);
ok
(
cmdtarget
!=
NULL
,
"IOleCommandTarget is NULL
\n
"
);
hres
=
IActiveScriptSite_QueryInterface
(
site
,
&
IID_IOleCommandTarget
,
(
void
**
)
&
unk
);
ok
(
hres
==
S_OK
,
"QueryInterface(IOleCommandTarget) failed: %08lx
\n
"
,
hres
);
ok
(
unk
!=
NULL
,
"QueryInterface(IOleCommandTarget) is NULL
\n
"
);
ok
(
cmdtarget
==
(
IOleCommandTarget
*
)
unk
,
"cmdtarget from QS not same as from QI
\n
"
);
IUnknown_Release
(
unk
);
hres
=
IServiceProvider_QueryService
(
doc_sp
,
&
IID_IActiveScriptSite
,
&
IID_IOleCommandTarget
,
(
void
**
)
&
unk
);
ok
(
hres
==
S_OK
,
"QueryService(IActiveScriptSite->IOleCommandTarget) failed: %08lx
\n
"
,
hres
);
ok
(
cmdtarget
==
(
IOleCommandTarget
*
)
unk
,
"IActiveScriptSite service from document provider not same as site's
\n
"
);
IUnknown_Release
(
unk
);
hres
=
IServiceProvider_QueryService
(
doc_obj_sp
,
&
IID_IActiveScriptSite
,
&
IID_IOleCommandTarget
,
(
void
**
)
&
unk
);
ok
(
hres
==
E_NOINTERFACE
,
"QueryService(IActiveScriptSite->IOleCommandTarget) returned: %08lx
\n
"
,
hres
);
hres
=
IServiceProvider_QueryService
(
window_sp
,
&
IID_IActiveScriptSite
,
&
IID_IOleCommandTarget
,
(
void
**
)
&
unk
);
ok
(
hres
==
E_NOINTERFACE
,
"QueryService(IActiveScriptSite->IOleCommandTarget) returned: %08lx
\n
"
,
hres
);
if
(
site2
)
{
IOleCommandTarget
*
cmdtarget2
;
IServiceProvider
*
sp2
;
hres
=
IActiveScriptSite_QueryInterface
(
site2
,
&
IID_IServiceProvider
,
(
void
**
)
&
sp2
);
ok
(
hres
==
S_OK
,
"Could not get IServiceProvider iface: %08lx
\n
"
,
hres
);
hres
=
IServiceProvider_QueryService
(
sp2
,
&
IID_IActiveScriptSite
,
&
IID_IOleCommandTarget
,
(
void
**
)
&
cmdtarget2
);
ok
(
hres
==
S_OK
,
"QueryService(IActiveScriptSite->IOleCommandTarget) failed: %08lx
\n
"
,
hres
);
ok
(
cmdtarget2
!=
NULL
,
"IOleCommandTarget is NULL
\n
"
);
hres
=
IActiveScriptSite_QueryInterface
(
site2
,
&
IID_IOleCommandTarget
,
(
void
**
)
&
unk
);
ok
(
hres
==
S_OK
,
"QueryInterface(IOleCommandTarget) failed: %08lx
\n
"
,
hres
);
ok
(
unk
!=
NULL
,
"QueryInterface(IOleCommandTarget) is NULL
\n
"
);
ok
(
cmdtarget2
!=
(
IOleCommandTarget
*
)
unk
,
"cmdtarget from site2's QS same as from QI
\n
"
);
ok
(
cmdtarget2
==
cmdtarget
,
"site1's cmdtarget not same as site2's
\n
"
);
IOleCommandTarget_Release
(
cmdtarget2
);
IServiceProvider_Release
(
sp2
);
IUnknown_Release
(
unk
);
}
IOleCommandTarget_Release
(
cmdtarget
);
IServiceProvider_Release
(
window_sp
);
IServiceProvider_Release
(
doc_obj_sp
);
IServiceProvider_Release
(
doc_sp
);
IServiceProvider_Release
(
sp
);
IHTMLWindow2_Release
(
window
);
}
static
void
test_script_run
(
void
)
...
...
@@ -3712,6 +3791,7 @@ static HRESULT WINAPI ActiveScriptParse2_ParseScriptText(IActiveScriptParse *ifa
ok
(
!
lstrcmpW
(
pstrItemName
,
L"window"
),
"pstrItemName = %s
\n
"
,
wine_dbgstr_w
(
pstrItemName
));
ok
(
!
lstrcmpW
(
pstrDelimiter
,
L"</SCRIPT>"
),
"pstrDelimiter = %s
\n
"
,
wine_dbgstr_w
(
pstrDelimiter
));
ok
(
dwFlags
==
(
SCRIPTTEXT_ISVISIBLE
|
SCRIPTTEXT_HOSTMANAGESSOURCE
),
"dwFlags = %08lx
\n
"
,
dwFlags
);
test_sp
();
return
S_OK
;
}
...
...
@@ -4610,13 +4690,6 @@ static void test_simple_script(void)
test_exec_script
(
doc
,
L"execScript call"
,
L"TestScript1"
);
if
(
site
)
IActiveScriptSite_Release
(
site
);
if
(
site2
)
IActiveScriptSite_Release
(
site2
);
if
(
window_dispex
)
IDispatchEx_Release
(
window_dispex
);
hres
=
IHTMLDocument2_get_parentWindow
(
doc
,
&
window
);
ok
(
hres
==
S_OK
,
"get_parentWindow failed: %08lx
\n
"
,
hres
);
...
...
@@ -4648,6 +4721,16 @@ static void test_simple_script(void)
CHECK_CALLED
(
Close
);
CHECK_CALLED
(
Close2
);
if
(
site
)
IActiveScriptSite_Release
(
site
);
if
(
site2
)
IActiveScriptSite_Release
(
site2
);
if
(
window_dispex
)
IDispatchEx_Release
(
window_dispex
);
site
=
NULL
;
site2
=
NULL
;
window_dispex
=
NULL
;
hres
=
IHTMLWindow2_get_document
(
window
,
&
doc
);
ok
(
hres
==
S_OK
,
"get_document failed: %08lx
\n
"
,
hres
);
ok
(
doc
!=
doc_node
,
"doc == doc_node
\n
"
);
...
...
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