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
705fb0f2
Commit
705fb0f2
authored
Sep 09, 2009
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 10, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Moved script host objects to HTMLWindow.
parent
43256560
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
42 deletions
+43
-42
htmldoc.c
dlls/mshtml/htmldoc.c
+0
-3
htmlwindow.c
dlls/mshtml/htmlwindow.c
+4
-0
mshtml_private.h
dlls/mshtml/mshtml_private.h
+11
-11
nsevents.c
dlls/mshtml/nsevents.c
+1
-1
persist.c
dlls/mshtml/persist.c
+1
-1
script.c
dlls/mshtml/script.c
+26
-26
No files found.
dlls/mshtml/htmldoc.c
View file @
705fb0f2
...
...
@@ -178,7 +178,6 @@ static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface)
if
(
!
ref
)
{
remove_doc_tasks
(
This
);
release_script_hosts
(
This
);
if
(
This
->
client
)
IOleObject_SetClientSite
(
OLEOBJ
(
This
),
NULL
);
...
...
@@ -1804,10 +1803,8 @@ static HRESULT alloc_doc(HTMLDocument **ret)
doc
->
lpSupportErrorInfoVtbl
=
&
SupportErrorInfoVtbl
;
doc
->
ref
=
1
;
doc
->
readystate
=
READYSTATE_UNINITIALIZED
;
doc
->
scriptmode
=
SCRIPTMODE_GECKO
;
list_init
(
&
doc
->
bindings
);
list_init
(
&
doc
->
script_hosts
);
list_init
(
&
doc
->
selection_list
);
list_init
(
&
doc
->
range_list
);
...
...
dlls/mshtml/htmlwindow.c
View file @
705fb0f2
...
...
@@ -95,6 +95,7 @@ static ULONG WINAPI HTMLWindow2_Release(IHTMLWindow2 *iface)
if
(
!
ref
)
{
if
(
This
->
event_target
)
release_event_target
(
This
->
event_target
);
release_script_hosts
(
This
);
list_remove
(
&
This
->
entry
);
release_dispex
(
&
This
->
dispex
);
heap_free
(
This
);
...
...
@@ -1330,6 +1331,9 @@ HRESULT HTMLWindow_Create(HTMLDocument *doc, nsIDOMWindow *nswindow, HTMLWindow
window
->
nswindow
=
nswindow
;
}
window
->
scriptmode
=
SCRIPTMODE_GECKO
;
list_init
(
&
window
->
script_hosts
);
list_add_head
(
&
window_list
,
&
window
->
entry
);
*
ret
=
window
;
...
...
dlls/mshtml/mshtml_private.h
View file @
705fb0f2
...
...
@@ -153,6 +153,11 @@ void release_dispex(DispatchEx*);
BOOL
dispex_query_interface
(
DispatchEx
*
,
REFIID
,
void
**
);
HRESULT
dispex_get_dprop_ref
(
DispatchEx
*
,
const
WCHAR
*
,
BOOL
,
VARIANT
**
);
typedef
enum
{
SCRIPTMODE_GECKO
,
SCRIPTMODE_ACTIVESCRIPT
}
SCRIPTMODE
;
typedef
struct
{
DispatchEx
dispex
;
const
IHTMLWindow2Vtbl
*
lpHTMLWindow2Vtbl
;
...
...
@@ -167,6 +172,9 @@ typedef struct {
event_target_t
*
event_target
;
IHTMLEventObj
*
event
;
SCRIPTMODE
scriptmode
;
struct
list
script_hosts
;
struct
list
entry
;
}
HTMLWindow
;
...
...
@@ -176,11 +184,6 @@ typedef enum {
EDITMODE
}
USERMODE
;
typedef
enum
{
SCRIPTMODE_GECKO
,
SCRIPTMODE_ACTIVESCRIPT
}
SCRIPTMODE
;
typedef
struct
{
const
IConnectionPointContainerVtbl
*
lpConnectionPointContainerVtbl
;
...
...
@@ -265,15 +268,12 @@ struct HTMLDocument {
LPOLESTR
url
;
struct
list
bindings
;
struct
list
script_hosts
;
HWND
hwnd
;
HWND
tooltips_hwnd
;
DOCHOSTUIINFO
hostinfo
;
USERMODE
usermode
;
SCRIPTMODE
scriptmode
;
READYSTATE
readystate
;
BOOL
in_place_active
;
BOOL
ui_active
;
...
...
@@ -623,11 +623,11 @@ void HTMLElement_destructor(HTMLDOMNode*);
HTMLDOMNode
*
get_node
(
HTMLDocument
*
,
nsIDOMNode
*
,
BOOL
);
void
release_nodes
(
HTMLDocument
*
);
void
release_script_hosts
(
HTML
Document
*
);
void
connect_scripts
(
HTML
Document
*
);
void
release_script_hosts
(
HTML
Window
*
);
void
connect_scripts
(
HTML
Window
*
);
void
doc_insert_script
(
HTMLDocument
*
,
nsIDOMHTMLScriptElement
*
);
IDispatch
*
script_parse_event
(
HTMLDocument
*
,
LPCWSTR
);
void
set_script_mode
(
HTML
Document
*
,
SCRIPTMODE
);
void
set_script_mode
(
HTML
Window
*
,
SCRIPTMODE
);
IHTMLElementCollection
*
create_all_collection
(
HTMLDOMNode
*
,
BOOL
);
IHTMLElementCollection
*
create_collection_from_nodelist
(
HTMLDocument
*
,
IUnknown
*
,
nsIDOMNodeList
*
);
...
...
dlls/mshtml/nsevents.c
View file @
705fb0f2
...
...
@@ -138,7 +138,7 @@ static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event
return
NS_OK
;
update_nsdocument
(
This
->
doc
);
connect_scripts
(
This
->
doc
);
connect_scripts
(
This
->
doc
->
window
);
if
(
This
->
editor_controller
)
{
nsIController_Release
(
This
->
editor_controller
);
...
...
dlls/mshtml/persist.c
View file @
705fb0f2
...
...
@@ -69,7 +69,7 @@ void set_current_mon(HTMLDocument *This, IMoniker *mon)
if
(
FAILED
(
hres
))
WARN
(
"GetDisplayName failed: %08x
\n
"
,
hres
);
set_script_mode
(
This
,
use_gecko_script
(
This
->
url
)
?
SCRIPTMODE_GECKO
:
SCRIPTMODE_ACTIVESCRIPT
);
set_script_mode
(
This
->
window
,
use_gecko_script
(
This
->
url
)
?
SCRIPTMODE_GECKO
:
SCRIPTMODE_ACTIVESCRIPT
);
}
static
HRESULT
set_moniker
(
HTMLDocument
*
This
,
IMoniker
*
mon
,
IBindCtx
*
pibc
,
BOOL
*
bind_complete
)
...
...
dlls/mshtml/script.c
View file @
705fb0f2
...
...
@@ -56,7 +56,7 @@ typedef struct {
SCRIPTSTATE
script_state
;
HTML
Document
*
doc
;
HTML
Window
*
window
;
GUID
guid
;
struct
list
entry
;
...
...
@@ -206,11 +206,11 @@ static void release_script_engine(ScriptHost *This)
This
->
script_state
=
SCRIPTSTATE_UNINITIALIZED
;
}
void
connect_scripts
(
HTML
Document
*
doc
)
void
connect_scripts
(
HTML
Window
*
window
)
{
ScriptHost
*
iter
;
LIST_FOR_EACH_ENTRY
(
iter
,
&
doc
->
script_hosts
,
ScriptHost
,
entry
)
{
LIST_FOR_EACH_ENTRY
(
iter
,
&
window
->
script_hosts
,
ScriptHost
,
entry
)
{
if
(
iter
->
script_state
==
SCRIPTSTATE_STARTED
)
IActiveScript_SetScriptState
(
iter
->
script
,
SCRIPTSTATE_CONNECTED
);
}
...
...
@@ -270,7 +270,7 @@ static ULONG WINAPI ActiveScriptSite_Release(IActiveScriptSite *iface)
if
(
!
ref
)
{
release_script_engine
(
This
);
if
(
This
->
doc
)
if
(
This
->
window
)
list_remove
(
&
This
->
entry
);
heap_free
(
This
);
}
...
...
@@ -305,11 +305,11 @@ static HRESULT WINAPI ActiveScriptSite_GetItemInfo(IActiveScriptSite *iface, LPC
if
(
strcmpW
(
pstrName
,
windowW
))
return
DISP_E_MEMBERNOTFOUND
;
if
(
!
This
->
doc
)
if
(
!
This
->
window
)
return
E_FAIL
;
/* FIXME: Return proxy object */
*
ppiunkItem
=
(
IUnknown
*
)
HTMLWINDOW2
(
This
->
doc
->
window
);
*
ppiunkItem
=
(
IUnknown
*
)
HTMLWINDOW2
(
This
->
window
);
IUnknown_AddRef
(
*
ppiunkItem
);
return
S_OK
;
...
...
@@ -529,7 +529,7 @@ static const IActiveScriptSiteDebug32Vtbl ActiveScriptSiteDebug32Vtbl = {
ActiveScriptSiteDebug32_OnScriptErrorDebug
};
static
ScriptHost
*
create_script_host
(
HTML
Document
*
doc
,
const
GUID
*
guid
)
static
ScriptHost
*
create_script_host
(
HTML
Window
*
window
,
const
GUID
*
guid
)
{
ScriptHost
*
ret
;
HRESULT
hres
;
...
...
@@ -540,11 +540,11 @@ static ScriptHost *create_script_host(HTMLDocument *doc, const GUID *guid)
ret
->
lpIActiveScriptSiteWindowVtbl
=
&
ActiveScriptSiteWindowVtbl
;
ret
->
lpIActiveScriptSiteDebug32Vtbl
=
&
ActiveScriptSiteDebug32Vtbl
;
ret
->
ref
=
1
;
ret
->
doc
=
doc
;
ret
->
window
=
window
;
ret
->
script_state
=
SCRIPTSTATE_UNINITIALIZED
;
ret
->
guid
=
*
guid
;
list_add_tail
(
&
doc
->
script_hosts
,
&
ret
->
entry
);
list_add_tail
(
&
window
->
script_hosts
,
&
ret
->
entry
);
hres
=
CoCreateInstance
(
&
ret
->
guid
,
NULL
,
CLSCTX_INPROC_SERVER
|
CLSCTX_INPROC_HANDLER
,
&
IID_IActiveScript
,
(
void
**
)
&
ret
->
script
);
...
...
@@ -593,7 +593,7 @@ static void parse_extern_script(ScriptHost *script_host, LPCWSTR src)
if
(
FAILED
(
hres
))
return
;
hres
=
bind_mon_to_buffer
(
script_host
->
doc
,
mon
,
(
void
**
)
&
buf
,
&
size
);
hres
=
bind_mon_to_buffer
(
script_host
->
window
->
doc
,
mon
,
(
void
**
)
&
buf
,
&
size
);
IMoniker_Release
(
mon
);
if
(
FAILED
(
hres
))
return
;
...
...
@@ -727,21 +727,21 @@ static BOOL get_script_guid(nsIDOMHTMLScriptElement *nsscript, GUID *guid)
return
ret
;
}
static
ScriptHost
*
get_script_host
(
HTML
Document
*
doc
,
const
GUID
*
guid
)
static
ScriptHost
*
get_script_host
(
HTML
Window
*
window
,
const
GUID
*
guid
)
{
ScriptHost
*
iter
;
if
(
IsEqualGUID
(
&
CLSID_JScript
,
guid
)
&&
doc
->
scriptmode
!=
SCRIPTMODE_ACTIVESCRIPT
)
{
if
(
IsEqualGUID
(
&
CLSID_JScript
,
guid
)
&&
window
->
scriptmode
!=
SCRIPTMODE_ACTIVESCRIPT
)
{
TRACE
(
"Ignoring JScript
\n
"
);
return
NULL
;
}
LIST_FOR_EACH_ENTRY
(
iter
,
&
doc
->
script_hosts
,
ScriptHost
,
entry
)
{
LIST_FOR_EACH_ENTRY
(
iter
,
&
window
->
script_hosts
,
ScriptHost
,
entry
)
{
if
(
IsEqualGUID
(
guid
,
&
iter
->
guid
))
return
iter
;
}
return
create_script_host
(
doc
,
guid
);
return
create_script_host
(
window
,
guid
);
}
void
doc_insert_script
(
HTMLDocument
*
doc
,
nsIDOMHTMLScriptElement
*
nsscript
)
...
...
@@ -754,7 +754,7 @@ void doc_insert_script(HTMLDocument *doc, nsIDOMHTMLScriptElement *nsscript)
return
;
}
script_host
=
get_script_host
(
doc
,
&
guid
);
script_host
=
get_script_host
(
doc
->
window
,
&
guid
);
if
(
!
script_host
)
return
;
...
...
@@ -795,7 +795,7 @@ IDispatch *script_parse_event(HTMLDocument *doc, LPCWSTR text)
ptr
=
text
;
}
script_host
=
get_script_host
(
doc
,
&
guid
);
script_host
=
get_script_host
(
doc
->
window
,
&
guid
);
if
(
!
script_host
||
!
script_host
->
parse_proc
)
return
NULL
;
...
...
@@ -831,27 +831,27 @@ static BOOL is_jscript_available(void)
return
available
;
}
void
set_script_mode
(
HTML
Document
*
doc
,
SCRIPTMODE
mode
)
void
set_script_mode
(
HTML
Window
*
window
,
SCRIPTMODE
mode
)
{
nsIWebBrowserSetup
*
setup
;
nsresult
nsres
;
if
(
mode
==
SCRIPTMODE_ACTIVESCRIPT
&&
!
is_jscript_available
())
{
TRACE
(
"jscript.dll not available
\n
"
);
doc
->
scriptmode
=
SCRIPTMODE_GECKO
;
window
->
scriptmode
=
SCRIPTMODE_GECKO
;
return
;
}
doc
->
scriptmode
=
mode
;
window
->
scriptmode
=
mode
;
if
(
!
doc
->
nscontainer
||
!
doc
->
nscontainer
->
webbrowser
)
if
(
!
window
->
doc
->
nscontainer
||
!
window
->
doc
->
nscontainer
->
webbrowser
)
return
;
nsres
=
nsIWebBrowser_QueryInterface
(
doc
->
nscontainer
->
webbrowser
,
nsres
=
nsIWebBrowser_QueryInterface
(
window
->
doc
->
nscontainer
->
webbrowser
,
&
IID_nsIWebBrowserSetup
,
(
void
**
)
&
setup
);
if
(
NS_SUCCEEDED
(
nsres
))
{
nsres
=
nsIWebBrowserSetup_SetProperty
(
setup
,
SETUP_ALLOW_JAVASCRIPT
,
doc
->
scriptmode
==
SCRIPTMODE_GECKO
);
window
->
scriptmode
==
SCRIPTMODE_GECKO
);
nsIWebBrowserSetup_Release
(
setup
);
}
...
...
@@ -859,16 +859,16 @@ void set_script_mode(HTMLDocument *doc, SCRIPTMODE mode)
ERR
(
"JavaScript setup failed: %08x
\n
"
,
nsres
);
}
void
release_script_hosts
(
HTML
Document
*
doc
)
void
release_script_hosts
(
HTML
Window
*
window
)
{
ScriptHost
*
iter
;
while
(
!
list_empty
(
&
doc
->
script_hosts
))
{
iter
=
LIST_ENTRY
(
list_head
(
&
doc
->
script_hosts
),
ScriptHost
,
entry
);
while
(
!
list_empty
(
&
window
->
script_hosts
))
{
iter
=
LIST_ENTRY
(
list_head
(
&
window
->
script_hosts
),
ScriptHost
,
entry
);
release_script_engine
(
iter
);
list_remove
(
&
iter
->
entry
);
iter
->
doc
=
NULL
;
iter
->
window
=
NULL
;
IActiveScript_Release
(
ACTSCPSITE
(
iter
));
}
}
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