Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
a0c2d641
Commit
a0c2d641
authored
May 27, 2014
by
Jacek Caban
Committed by
Alexandre Julliard
Jun 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Use get_elem_attr_value helper in npplugin.c.
parent
75a2e8c4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
33 deletions
+27
-33
npplugin.c
dlls/mshtml/npplugin.c
+27
-33
No files found.
dlls/mshtml/npplugin.c
View file @
a0c2d641
...
...
@@ -211,10 +211,11 @@ typedef struct _NPPluginFuncs {
NPP_LostFocusPtr
lostfocus
;
}
NPPluginFuncs
;
static
nsIDOMElement
*
get_dom_element
(
NPP
instance
)
static
nsIDOM
HTML
Element
*
get_dom_element
(
NPP
instance
)
{
nsISupports
*
instance_unk
=
(
nsISupports
*
)
instance
->
ndata
;
nsIPluginInstance
*
plugin_instance
;
nsIDOMHTMLElement
*
html_elem
;
nsIDOMElement
*
elem
;
nsresult
nsres
;
...
...
@@ -231,17 +232,24 @@ static nsIDOMElement *get_dom_element(NPP instance)
return
NULL
;
}
return
elem
;
nsres
=
nsIDOMElement_QueryInterface
(
elem
,
&
IID_nsIDOMHTMLElement
,
(
void
**
)
&
html_elem
);
nsIDOMElement_Release
(
elem
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"Could not get nsIDOMHTMLElement iface: %08x
\n
"
,
nsres
);
return
NULL
;
}
return
html_elem
;
}
static
HTMLInnerWindow
*
get_elem_window
(
nsIDOMElement
*
elem
)
static
HTMLInnerWindow
*
get_elem_window
(
nsIDOM
HTML
Element
*
elem
)
{
nsIDOMWindow
*
nswindow
;
nsIDOMDocument
*
nsdoc
;
HTMLOuterWindow
*
window
;
nsresult
nsres
;
nsres
=
nsIDOMElement_GetOwnerDocument
(
elem
,
&
nsdoc
);
nsres
=
nsIDOM
HTML
Element_GetOwnerDocument
(
elem
,
&
nsdoc
);
if
(
NS_FAILED
(
nsres
))
return
NULL
;
...
...
@@ -287,29 +295,22 @@ static BOOL parse_classid(const PRUnichar *classid, CLSID *clsid)
return
SUCCEEDED
(
hres
);
}
static
BOOL
get_elem_clsid
(
nsIDOMElement
*
elem
,
CLSID
*
clsid
)
static
BOOL
get_elem_clsid
(
nsIDOM
HTML
Element
*
elem
,
CLSID
*
clsid
)
{
nsAString
attr_str
,
val_str
;
const
PRUnichar
*
val
;
nsAString
val_str
;
nsresult
nsres
;
BOOL
ret
=
FALSE
;
static
const
PRUnichar
classidW
[]
=
{
'c'
,
'l'
,
'a'
,
's'
,
's'
,
'i'
,
'd'
,
0
};
nsAString_InitDepend
(
&
attr_str
,
classidW
);
nsAString_Init
(
&
val_str
,
NULL
);
nsres
=
nsIDOMElement_GetAttribute
(
elem
,
&
attr_str
,
&
val_str
);
nsAString_Finish
(
&
attr_str
);
nsres
=
get_elem_attr_value
(
elem
,
classidW
,
&
val_str
,
&
val
);
if
(
NS_SUCCEEDED
(
nsres
))
{
const
PRUnichar
*
val
;
nsAString_GetData
(
&
val_str
,
&
val
);
if
(
*
val
)
ret
=
parse_classid
(
val
,
clsid
);
}
else
{
ERR
(
"GetAttribute failed: %08x
\n
"
,
nsres
);
nsAString_Finish
(
&
val_str
);
}
nsAString_Finish
(
&
val_str
);
return
ret
;
}
...
...
@@ -529,35 +530,28 @@ static void install_codebase(const WCHAR *url)
WARN
(
"FAILED: %08x
\n
"
,
hres
);
}
static
void
check_codebase
(
HTMLInnerWindow
*
window
,
nsIDOMElement
*
nselem
)
static
void
check_codebase
(
HTMLInnerWindow
*
window
,
nsIDOM
HTML
Element
*
nselem
)
{
nsAString
attr_str
,
val_str
;
BOOL
is_on_list
=
FALSE
;
install_entry_t
*
iter
;
const
PRUnichar
*
val
;
nsAString
val_str
;
IUri
*
uri
=
NULL
;
nsresult
nsres
;
HRESULT
hres
;
static
const
PRUnichar
codebaseW
[]
=
{
'c'
,
'o'
,
'd'
,
'e'
,
'b'
,
'a'
,
's'
,
'e'
,
0
};
nsAString_InitDepend
(
&
attr_str
,
codebaseW
);
nsAString_Init
(
&
val_str
,
NULL
);
nsres
=
nsIDOMElement_GetAttribute
(
nselem
,
&
attr_str
,
&
val_str
);
nsAString_Finish
(
&
attr_str
);
nsres
=
get_elem_attr_value
(
nselem
,
codebaseW
,
&
val_str
,
&
val
);
if
(
NS_SUCCEEDED
(
nsres
))
{
const
PRUnichar
*
val
;
nsAString_GetData
(
&
val_str
,
&
val
);
if
(
*
val
)
{
hres
=
CoInternetCombineUrlEx
(
window
->
base
.
outer_window
->
uri
,
val
,
0
,
&
uri
,
0
);
if
(
FAILED
(
hres
))
uri
=
NULL
;
}
}
else
{
ERR
(
"GetAttribute failed: %08x
\n
"
,
nsres
);
nsAString_Finish
(
&
val_str
);
}
nsAString_Finish
(
&
val_str
);
if
(
!
uri
)
return
;
...
...
@@ -599,7 +593,7 @@ static void check_codebase(HTMLInnerWindow *window, nsIDOMElement *nselem)
IUri_Release
(
uri
);
}
static
IUnknown
*
create_activex_object
(
HTMLInnerWindow
*
window
,
nsIDOMElement
*
nselem
,
CLSID
*
clsid
)
static
IUnknown
*
create_activex_object
(
HTMLInnerWindow
*
window
,
nsIDOM
HTML
Element
*
nselem
,
CLSID
*
clsid
)
{
IClassFactoryEx
*
cfex
;
IClassFactory
*
cf
;
...
...
@@ -645,7 +639,7 @@ static IUnknown *create_activex_object(HTMLInnerWindow *window, nsIDOMElement *n
static
NPError
CDECL
NPP_New
(
NPMIMEType
pluginType
,
NPP
instance
,
UINT16
mode
,
INT16
argc
,
char
**
argn
,
char
**
argv
,
NPSavedData
*
saved
)
{
nsIDOMElement
*
nselem
;
nsIDOM
HTML
Element
*
nselem
;
HTMLInnerWindow
*
window
;
IUnknown
*
obj
;
CLSID
clsid
;
...
...
@@ -662,7 +656,7 @@ static NPError CDECL NPP_New(NPMIMEType pluginType, NPP instance, UINT16 mode, I
window
=
get_elem_window
(
nselem
);
if
(
!
window
)
{
ERR
(
"Could not get element's window object
\n
"
);
nsIDOMElement_Release
(
nselem
);
nsIDOM
HTML
Element_Release
(
nselem
);
return
NPERR_GENERIC_ERROR
;
}
...
...
@@ -671,7 +665,7 @@ static NPError CDECL NPP_New(NPMIMEType pluginType, NPP instance, UINT16 mode, I
PluginHost
*
host
;
HRESULT
hres
;
hres
=
create_plugin_host
(
window
->
doc
,
nselem
,
obj
,
&
clsid
,
&
host
);
hres
=
create_plugin_host
(
window
->
doc
,
(
nsIDOMElement
*
)
nselem
,
obj
,
&
clsid
,
&
host
);
IUnknown_Release
(
obj
);
if
(
SUCCEEDED
(
hres
))
instance
->
pdata
=
host
;
...
...
@@ -681,7 +675,7 @@ static NPError CDECL NPP_New(NPMIMEType pluginType, NPP instance, UINT16 mode, I
err
=
NPERR_GENERIC_ERROR
;
}
nsIDOMElement_Release
(
nselem
);
nsIDOM
HTML
Element_Release
(
nselem
);
return
err
;
}
...
...
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