Commit 9fd64018 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Pass proper JSContext to nsIDOMHTMLDocument::Write and Open.

parent e2791cdf
......@@ -833,6 +833,7 @@ static HRESULT WINAPI HTMLDocument_get_nameProp(IHTMLDocument2 *iface, BSTR *p)
static HRESULT document_write(HTMLDocument *This, SAFEARRAY *psarray, BOOL ln)
{
VARIANT *var, tmp;
JSContext *jsctx;
nsAString nsstr;
ULONG i, argc;
nsresult nsres;
......@@ -859,6 +860,7 @@ static HRESULT document_write(HTMLDocument *This, SAFEARRAY *psarray, BOOL ln)
V_VT(&tmp) = VT_EMPTY;
jsctx = get_context_from_document(This->doc_node->nsdoc);
argc = psarray->rgsabound[0].cElements;
for(i=0; i < argc; i++) {
if(V_VT(var+i) == VT_BSTR) {
......@@ -873,9 +875,9 @@ static HRESULT document_write(HTMLDocument *This, SAFEARRAY *psarray, BOOL ln)
}
if(!ln || i != argc-1)
nsres = nsIDOMHTMLDocument_Write(This->doc_node->nsdoc, &nsstr, NULL /* FIXME! */);
nsres = nsIDOMHTMLDocument_Write(This->doc_node->nsdoc, &nsstr, jsctx);
else
nsres = nsIDOMHTMLDocument_Writeln(This->doc_node->nsdoc, &nsstr, NULL /* FIXME! */);
nsres = nsIDOMHTMLDocument_Writeln(This->doc_node->nsdoc, &nsstr, jsctx);
nsAString_Finish(&nsstr);
if(V_VT(var+i) != VT_BSTR)
VariantClear(&tmp);
......@@ -930,7 +932,8 @@ static HRESULT WINAPI HTMLDocument_open(IHTMLDocument2 *iface, BSTR url, VARIANT
|| V_VT(&features) != VT_ERROR || V_VT(&replace) != VT_ERROR)
FIXME("unsupported args\n");
nsres = nsIDOMHTMLDocument_Open(This->doc_node->nsdoc, NULL, NULL, NULL, NULL, 0, &tmp);
nsres = nsIDOMHTMLDocument_Open(This->doc_node->nsdoc, NULL, NULL, NULL,
get_context_from_document(This->doc_node->nsdoc), 0, &tmp);
if(NS_FAILED(nsres)) {
ERR("Open failed: %08x\n", nsres);
return E_FAIL;
......
......@@ -781,6 +781,7 @@ void NSContainer_Release(NSContainer*) DECLSPEC_HIDDEN;
void init_mutation(nsIComponentManager*) DECLSPEC_HIDDEN;
void init_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
void release_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
JSContext *get_context_from_document(nsIDOMHTMLDocument*) DECLSPEC_HIDDEN;
void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*) DECLSPEC_HIDDEN;
......
......@@ -19,6 +19,7 @@
#include "config.h"
#include <stdarg.h>
#include <assert.h>
#define COBJMACROS
......@@ -775,6 +776,22 @@ void release_document_mutation(HTMLDocumentNode *doc)
nsIDocument_Release(nsdoc);
}
JSContext *get_context_from_document(nsIDOMHTMLDocument *nsdoc)
{
nsIDocument *doc;
JSContext *ctx;
nsresult nsres;
nsres = nsIDOMHTMLDocument_QueryInterface(nsdoc, &IID_nsIDocument, (void**)&doc);
assert(nsres == NS_OK);
ctx = nsIContentUtils_GetContextFromDocument(content_utils, doc);
nsIDocument_Release(doc);
TRACE("ret %p\n", ctx);
return ctx;
}
void init_mutation(nsIComponentManager *component_manager)
{
nsIFactory *factory;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment