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) ...@@ -833,6 +833,7 @@ static HRESULT WINAPI HTMLDocument_get_nameProp(IHTMLDocument2 *iface, BSTR *p)
static HRESULT document_write(HTMLDocument *This, SAFEARRAY *psarray, BOOL ln) static HRESULT document_write(HTMLDocument *This, SAFEARRAY *psarray, BOOL ln)
{ {
VARIANT *var, tmp; VARIANT *var, tmp;
JSContext *jsctx;
nsAString nsstr; nsAString nsstr;
ULONG i, argc; ULONG i, argc;
nsresult nsres; nsresult nsres;
...@@ -859,6 +860,7 @@ static HRESULT document_write(HTMLDocument *This, SAFEARRAY *psarray, BOOL ln) ...@@ -859,6 +860,7 @@ static HRESULT document_write(HTMLDocument *This, SAFEARRAY *psarray, BOOL ln)
V_VT(&tmp) = VT_EMPTY; V_VT(&tmp) = VT_EMPTY;
jsctx = get_context_from_document(This->doc_node->nsdoc);
argc = psarray->rgsabound[0].cElements; argc = psarray->rgsabound[0].cElements;
for(i=0; i < argc; i++) { for(i=0; i < argc; i++) {
if(V_VT(var+i) == VT_BSTR) { if(V_VT(var+i) == VT_BSTR) {
...@@ -873,9 +875,9 @@ static HRESULT document_write(HTMLDocument *This, SAFEARRAY *psarray, BOOL ln) ...@@ -873,9 +875,9 @@ static HRESULT document_write(HTMLDocument *This, SAFEARRAY *psarray, BOOL ln)
} }
if(!ln || i != argc-1) 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 else
nsres = nsIDOMHTMLDocument_Writeln(This->doc_node->nsdoc, &nsstr, NULL /* FIXME! */); nsres = nsIDOMHTMLDocument_Writeln(This->doc_node->nsdoc, &nsstr, jsctx);
nsAString_Finish(&nsstr); nsAString_Finish(&nsstr);
if(V_VT(var+i) != VT_BSTR) if(V_VT(var+i) != VT_BSTR)
VariantClear(&tmp); VariantClear(&tmp);
...@@ -930,7 +932,8 @@ static HRESULT WINAPI HTMLDocument_open(IHTMLDocument2 *iface, BSTR url, VARIANT ...@@ -930,7 +932,8 @@ static HRESULT WINAPI HTMLDocument_open(IHTMLDocument2 *iface, BSTR url, VARIANT
|| V_VT(&features) != VT_ERROR || V_VT(&replace) != VT_ERROR) || V_VT(&features) != VT_ERROR || V_VT(&replace) != VT_ERROR)
FIXME("unsupported args\n"); 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)) { if(NS_FAILED(nsres)) {
ERR("Open failed: %08x\n", nsres); ERR("Open failed: %08x\n", nsres);
return E_FAIL; return E_FAIL;
......
...@@ -781,6 +781,7 @@ void NSContainer_Release(NSContainer*) DECLSPEC_HIDDEN; ...@@ -781,6 +781,7 @@ void NSContainer_Release(NSContainer*) DECLSPEC_HIDDEN;
void init_mutation(nsIComponentManager*) DECLSPEC_HIDDEN; void init_mutation(nsIComponentManager*) DECLSPEC_HIDDEN;
void init_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN; void init_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
void release_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 HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*) DECLSPEC_HIDDEN; void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*) DECLSPEC_HIDDEN;
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "config.h" #include "config.h"
#include <stdarg.h> #include <stdarg.h>
#include <assert.h>
#define COBJMACROS #define COBJMACROS
...@@ -775,6 +776,22 @@ void release_document_mutation(HTMLDocumentNode *doc) ...@@ -775,6 +776,22 @@ void release_document_mutation(HTMLDocumentNode *doc)
nsIDocument_Release(nsdoc); 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) void init_mutation(nsIComponentManager *component_manager)
{ {
nsIFactory *factory; 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