From fc38aea9ba41652d134391c45e332da76e9f587f Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 30 Sep 2014 10:14:06 +0200 Subject: [PATCH] mshtml: Don't assume that nsIDOMHTMLElement inherits from nsIDOMNode in HTMLDocument_createStyleSheet. This will change after the next Gecko update. --- dlls/mshtml/htmldoc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 4837a89ee8f..a8d6d76c238 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -1625,10 +1625,14 @@ static HRESULT WINAPI HTMLDocument_createStyleSheet(IHTMLDocument2 *iface, BSTR nsres = nsIDOMHTMLDocument_GetHead(This->doc_node->nsdoc, &head_elem); if(NS_SUCCEEDED(nsres)) { - nsIDOMNode *tmp_node; + nsIDOMNode *head_node, *tmp_node; - nsres = nsIDOMHTMLHeadElement_AppendChild(head_elem, (nsIDOMNode*)elem->nselem, &tmp_node); + nsres = nsIDOMHTMLHeadElement_QueryInterface(head_elem, &IID_nsIDOMNode, (void**)&head_node); nsIDOMHTMLHeadElement_Release(head_elem); + assert(nsres == NS_OK); + + nsres = nsIDOMNode_AppendChild(head_node, elem->node.nsnode, &tmp_node); + nsIDOMNode_Release(head_node); if(NS_SUCCEEDED(nsres) && tmp_node) nsIDOMNode_Release(tmp_node); }