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
96604df6
Commit
96604df6
authored
Mar 12, 2019
by
Jacek Caban
Committed by
Alexandre Julliard
Mar 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Move script mode handling to GeckoBrowser.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7ba361b4
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
38 deletions
+45
-38
htmlscript.h
dlls/mshtml/htmlscript.h
+1
-1
htmlwindow.c
dlls/mshtml/htmlwindow.c
+0
-1
mshtml_private.h
dlls/mshtml/mshtml_private.h
+11
-7
nsembed.c
dlls/mshtml/nsembed.c
+1
-0
persist.c
dlls/mshtml/persist.c
+3
-16
script.c
dlls/mshtml/script.c
+29
-13
No files found.
dlls/mshtml/htmlscript.h
View file @
96604df6
...
...
@@ -44,6 +44,6 @@ void connect_scripts(HTMLInnerWindow*) DECLSPEC_HIDDEN;
void
doc_insert_script
(
HTMLInnerWindow
*
,
HTMLScriptElement
*
,
BOOL
)
DECLSPEC_HIDDEN
;
IDispatch
*
script_parse_event
(
HTMLInnerWindow
*
,
LPCWSTR
)
DECLSPEC_HIDDEN
;
HRESULT
exec_script
(
HTMLInnerWindow
*
,
const
WCHAR
*
,
const
WCHAR
*
,
VARIANT
*
)
DECLSPEC_HIDDEN
;
void
set_script_mode
(
HTMLOuterWindow
*
,
SCRIPTMODE
)
DECLSPEC_HIDDEN
;
void
update_browser_script_mode
(
GeckoBrowser
*
,
IUri
*
)
DECLSPEC_HIDDEN
;
BOOL
find_global_prop
(
HTMLInnerWindow
*
,
BSTR
,
DWORD
,
ScriptHost
**
,
DISPID
*
)
DECLSPEC_HIDDEN
;
IDispatch
*
get_script_disp
(
ScriptHost
*
)
DECLSPEC_HIDDEN
;
dlls/mshtml/htmlwindow.c
View file @
96604df6
...
...
@@ -3560,7 +3560,6 @@ HRESULT create_outer_window(GeckoBrowser *browser, mozIDOMWindowProxy *mozwindow
nsres
=
mozIDOMWindowProxy_QueryInterface
(
mozwindow
,
&
IID_nsIDOMWindow
,
(
void
**
)
&
window
->
nswindow
);
assert
(
nsres
==
NS_OK
);
window
->
scriptmode
=
parent
?
parent
->
scriptmode
:
SCRIPTMODE_GECKO
;
window
->
readystate
=
READYSTATE_UNINITIALIZED
;
window
->
task_magic
=
get_task_target_magic
();
...
...
dlls/mshtml/mshtml_private.h
View file @
96604df6
...
...
@@ -381,11 +381,6 @@ typedef struct HTMLFrameBase HTMLFrameBase;
typedef
struct
GeckoBrowser
GeckoBrowser
;
typedef
struct
HTMLAttributeCollection
HTMLAttributeCollection
;
typedef
enum
{
SCRIPTMODE_GECKO
,
SCRIPTMODE_ACTIVESCRIPT
}
SCRIPTMODE
;
typedef
struct
ScriptHost
ScriptHost
;
typedef
enum
{
...
...
@@ -500,8 +495,6 @@ struct HTMLOuterWindow {
BSTR
url
;
DWORD
load_flags
;
SCRIPTMODE
scriptmode
;
struct
list
sibling_entry
;
struct
wine_rb_entry
entry
;
};
...
...
@@ -699,6 +692,12 @@ struct HTMLDocumentObj {
typedef
struct
nsWeakReference
nsWeakReference
;
typedef
enum
{
SCRIPTMODE_GECKO
,
SCRIPTMODE_ACTIVESCRIPT
}
SCRIPTMODE
;
struct
GeckoBrowser
{
nsIWebBrowserChrome
nsIWebBrowserChrome_iface
;
nsIContextMenuListener
nsIContextMenuListener_iface
;
...
...
@@ -727,6 +726,7 @@ struct GeckoBrowser {
nsIURIContentListener
*
content_listener
;
HWND
hwnd
;
SCRIPTMODE
script_mode
;
struct
list
document_nodes
;
struct
list
outer_windows
;
...
...
@@ -998,6 +998,10 @@ HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**) DECL
BOOL
variant_to_nscolor
(
const
VARIANT
*
v
,
nsAString
*
nsstr
)
DECLSPEC_HIDDEN
;
HRESULT
nscolor_to_str
(
LPCWSTR
color
,
BSTR
*
ret
)
DECLSPEC_HIDDEN
;
static
inline
BOOL
is_main_content_window
(
HTMLOuterWindow
*
window
)
{
return
window
->
browser
&&
window
==
window
->
browser
->
content_window
;
}
struct
HTMLAttributeCollection
{
DispatchEx
dispex
;
...
...
dlls/mshtml/nsembed.c
View file @
96604df6
...
...
@@ -2167,6 +2167,7 @@ HRESULT create_gecko_browser(HTMLDocumentObj *doc, GeckoBrowser **_ret)
ret
->
doc
=
doc
;
ret
->
ref
=
1
;
ret
->
script_mode
=
SCRIPTMODE_ACTIVESCRIPT
;
list_init
(
&
ret
->
document_nodes
);
list_init
(
&
ret
->
outer_windows
);
...
...
dlls/mshtml/persist.c
View file @
96604df6
...
...
@@ -57,21 +57,6 @@ typedef struct {
LPOLESTR
url
;
}
download_proc_task_t
;
static
BOOL
use_gecko_script
(
HTMLOuterWindow
*
window
)
{
DWORD
zone
;
HRESULT
hres
;
hres
=
IInternetSecurityManager_MapUrlToZone
(
get_security_manager
(),
window
->
url
,
&
zone
,
0
);
if
(
FAILED
(
hres
))
{
WARN
(
"Could not map %s to zone: %08x
\n
"
,
debugstr_w
(
window
->
url
),
hres
);
return
TRUE
;
}
TRACE
(
"zone %d
\n
"
,
zone
);
return
zone
==
URLZONE_UNTRUSTED
;
}
static
void
notify_travellog_update
(
HTMLDocumentObj
*
doc
)
{
IOleCommandTarget
*
cmdtrg
;
...
...
@@ -179,7 +164,9 @@ void set_current_mon(HTMLOuterWindow *This, IMoniker *mon, DWORD flags)
set_current_uri
(
This
,
uri
);
if
(
uri
)
IUri_Release
(
uri
);
set_script_mode
(
This
,
use_gecko_script
(
This
)
?
SCRIPTMODE_GECKO
:
SCRIPTMODE_ACTIVESCRIPT
);
if
(
is_main_content_window
(
This
))
update_browser_script_mode
(
This
->
browser
,
uri
);
}
HRESULT
create_uri
(
const
WCHAR
*
uri_str
,
DWORD
flags
,
IUri
**
uri
)
...
...
dlls/mshtml/script.c
View file @
96604df6
...
...
@@ -1269,8 +1269,7 @@ static ScriptHost *get_elem_script_host(HTMLInnerWindow *window, HTMLScriptEleme
return
NULL
;
}
if
(
IsEqualGUID
(
&
CLSID_JScript
,
&
guid
)
&&
(
!
window
->
base
.
outer_window
||
window
->
base
.
outer_window
->
scriptmode
!=
SCRIPTMODE_ACTIVESCRIPT
))
{
if
(
IsEqualGUID
(
&
CLSID_JScript
,
&
guid
)
&&
(
!
window
->
doc
->
browser
||
window
->
doc
->
browser
->
script_mode
!=
SCRIPTMODE_ACTIVESCRIPT
))
{
TRACE
(
"Ignoring JScript
\n
"
);
return
NULL
;
}
...
...
@@ -1343,7 +1342,7 @@ IDispatch *script_parse_event(HTMLInnerWindow *window, LPCWSTR text)
}
if
(
IsEqualGUID
(
&
CLSID_JScript
,
&
guid
)
&&
(
!
window
->
base
.
outer_window
||
window
->
base
.
outer_window
->
script
mode
!=
SCRIPTMODE_ACTIVESCRIPT
))
{
&&
(
!
window
->
doc
->
browser
||
window
->
doc
->
browser
->
script_
mode
!=
SCRIPTMODE_ACTIVESCRIPT
))
{
TRACE
(
"Ignoring JScript
\n
"
);
return
NULL
;
}
...
...
@@ -1670,27 +1669,44 @@ static BOOL is_jscript_available(void)
return
available
;
}
void
set_script_mode
(
HTMLOuterWindow
*
window
,
SCRIPTMODE
mode
)
static
BOOL
use_gecko_script
(
IUri
*
uri
)
{
BSTR
display_uri
;
DWORD
zone
;
HRESULT
hres
;
hres
=
IUri_GetDisplayUri
(
uri
,
&
display_uri
);
if
(
FAILED
(
hres
))
return
FALSE
;
hres
=
IInternetSecurityManager_MapUrlToZone
(
get_security_manager
(),
display_uri
,
&
zone
,
0
);
SysFreeString
(
display_uri
);
if
(
FAILED
(
hres
))
{
WARN
(
"Could not map %s to zone: %08x
\n
"
,
debugstr_w
(
display_uri
),
hres
);
return
TRUE
;
}
TRACE
(
"zone %d
\n
"
,
zone
);
return
zone
==
URLZONE_UNTRUSTED
;
}
void
update_browser_script_mode
(
GeckoBrowser
*
browser
,
IUri
*
uri
)
{
nsIWebBrowserSetup
*
setup
;
nsresult
nsres
;
if
(
mode
==
SCRIPTMODE_ACTIVESCRIPT
&&
!
is_jscript_available
())
{
if
(
!
is_jscript_available
())
{
TRACE
(
"jscript.dll not available
\n
"
);
window
->
script
mode
=
SCRIPTMODE_GECKO
;
browser
->
script_
mode
=
SCRIPTMODE_GECKO
;
return
;
}
window
->
scriptmode
=
mode
;
if
(
!
window
->
doc_obj
->
nscontainer
||
!
window
->
doc_obj
->
nscontainer
->
webbrowser
)
return
;
browser
->
script_mode
=
use_gecko_script
(
uri
)
?
SCRIPTMODE_GECKO
:
SCRIPTMODE_ACTIVESCRIPT
;
nsres
=
nsIWebBrowser_QueryInterface
(
window
->
doc_obj
->
nscontainer
->
webbrowser
,
&
IID_nsIWebBrowserSetup
,
(
void
**
)
&
setup
);
nsres
=
nsIWebBrowser_QueryInterface
(
browser
->
webbrowser
,
&
IID_nsIWebBrowserSetup
,
(
void
**
)
&
setup
);
if
(
NS_SUCCEEDED
(
nsres
))
{
nsres
=
nsIWebBrowserSetup_SetProperty
(
setup
,
SETUP_ALLOW_JAVASCRIPT
,
window
->
script
mode
==
SCRIPTMODE_GECKO
);
browser
->
script_
mode
==
SCRIPTMODE_GECKO
);
if
(
NS_SUCCEEDED
(
nsres
))
nsres
=
nsIWebBrowserSetup_SetProperty
(
setup
,
SETUP_DISABLE_NOSCRIPT
,
TRUE
);
...
...
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