#include "windef.h"
#include "winbase.h"
#include "winuser.h"
+#include "wininet.h"
#include "ole2.h"
#include "perhist.h"
#include "mshtmdid.h"
return E_UNEXPECTED;
}
- nsAString_Init(&nsstr, v);
+ nsAString_InitDepend(&nsstr, v);
nsres = nsIDOMHTMLDocument_SetTitle(This->doc_node->nsdoc, &nsstr);
nsAString_Finish(&nsstr);
if(NS_FAILED(nsres))
static HRESULT WINAPI HTMLDocument_get_referrer(IHTMLDocument2 *iface, BSTR *p)
{
HTMLDocument *This = HTMLDOC_THIS(iface);
+
FIXME("(%p)->(%p)\n", This, p);
- return E_NOTIMPL;
-}
+
+ *p = NULL;
+ return S_OK;
+ }
static HRESULT WINAPI HTMLDocument_get_location(IHTMLDocument2 *iface, IHTMLLocation **p)
{
static HRESULT WINAPI HTMLDocument_put_cookie(IHTMLDocument2 *iface, BSTR v)
{
HTMLDocument *This = HTMLDOC_THIS(iface);
- FIXME("(%p)->(%s)\n", This, debugstr_w(v));
- return E_NOTIMPL;
+ BOOL bret;
+
+ TRACE("(%p)->(%s)\n", This, debugstr_w(v));
+
+ bret = InternetSetCookieExW(This->window->url, NULL, v, 0, 0);
+ if(!bret) {
+ FIXME("InternetSetCookieExW failed: %u\n", GetLastError());
+ return HRESULT_FROM_WIN32(GetLastError());
+ }
+
+ return S_OK;
}
static HRESULT WINAPI HTMLDocument_get_cookie(IHTMLDocument2 *iface, BSTR *p)
{
HTMLDocument *This = HTMLDOC_THIS(iface);
- FIXME("(%p)->(%p)\n", This, p);
- return E_NOTIMPL;
+ DWORD size;
+ BOOL bret;
+
+ TRACE("(%p)->(%p)\n", This, p);
+
+ size = 0;
+ bret = InternetGetCookieExW(This->window->url, NULL, NULL, &size, 0, NULL);
+ if(!bret) {
+ switch(GetLastError()) {
+ case ERROR_INSUFFICIENT_BUFFER:
+ break;
+ case ERROR_NO_MORE_ITEMS:
+ *p = NULL;
+ return S_OK;
+ default:
+ FIXME("InternetGetCookieExW failed: %u\n", GetLastError());
+ return HRESULT_FROM_WIN32(GetLastError());
+ }
+ }
+
+ if(!size) {
+ *p = NULL;
+ return S_OK;
+ }
+
+ *p = SysAllocStringLen(NULL, size-1);
+ if(!*p)
+ return E_OUTOFMEMORY;
+
+ bret = InternetGetCookieExW(This->window->url, NULL, *p, &size, 0, NULL);
+ if(!bret) {
+ ERR("InternetGetCookieExW failed: %u\n", GetLastError());
+ return E_FAIL;
+ }
+
+ return S_OK;
}
static HRESULT WINAPI HTMLDocument_put_expando(IHTMLDocument2 *iface, VARIANT_BOOL v)
return E_UNEXPECTED;
}
+ if (!psarray)
+ return S_OK;
+
if(psarray->cDims != 1) {
FIXME("cDims=%d\n", psarray->cDims);
return E_INVALIDARG;
static HRESULT WINAPI HTMLDocument_clear(IHTMLDocument2 *iface)
{
HTMLDocument *This = HTMLDOC_THIS(iface);
- FIXME("(%p)\n", This);
- return E_NOTIMPL;
+ nsIDOMNSHTMLDocument *nsdoc;
+ nsresult nsres;
+
+ TRACE("(%p)\n", This);
+
+ nsres = nsIDOMHTMLDocument_QueryInterface(This->doc_node->nsdoc, &IID_nsIDOMNSHTMLDocument, (void**)&nsdoc);
+ if(NS_FAILED(nsres)) {
+ ERR("Could not get nsIDOMNSHTMLDocument iface: %08x\n", nsres);
+ return E_FAIL;
+ }
+
+ nsres = nsIDOMNSHTMLDocument_Clear(nsdoc);
+ nsIDOMNSHTMLDocument_Release(nsdoc);
+ if(NS_FAILED(nsres)) {
+ ERR("Clear failed: %08x\n", nsres);
+ return E_FAIL;
+ }
+
+ return S_OK;
}
static HRESULT WINAPI HTMLDocument_queryCommandSupported(IHTMLDocument2 *iface, BSTR cmdID,
static HRESULT WINAPI HTMLDocument_put_onmouseup(IHTMLDocument2 *iface, VARIANT v)
{
HTMLDocument *This = HTMLDOC_THIS(iface);
- FIXME("(%p)\n", This);
- return E_NOTIMPL;
+
+ TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
+
+ return set_doc_event(This, EVENTID_MOUSEUP, &v);
}
static HRESULT WINAPI HTMLDocument_get_onmouseup(IHTMLDocument2 *iface, VARIANT *p)
{
HTMLDocument *This = HTMLDOC_THIS(iface);
- FIXME("(%p)->(%p)\n", This, p);
- return E_NOTIMPL;
+
+ TRACE("(%p)->(%p)\n", This, p);
+
+ return get_doc_event(This, EVENTID_MOUSEUP, p);
}
static HRESULT WINAPI HTMLDocument_put_onmousedown(IHTMLDocument2 *iface, VARIANT v)
{
HTMLDocument *This = HTMLDOC_THIS(iface);
- FIXME("(%p)\n", This);
- return E_NOTIMPL;
+
+ TRACE("(%p)->()\n", This);
+
+ return set_doc_event(This, EVENTID_MOUSEDOWN, &v);
}
static HRESULT WINAPI HTMLDocument_get_onmousedown(IHTMLDocument2 *iface, VARIANT *p)
{
HTMLDocument *This = HTMLDOC_THIS(iface);
- FIXME("(%p)->(%p)\n", This, p);
- return E_NOTIMPL;
+
+ TRACE("(%p)->(%p)\n", This, p);
+
+ return get_doc_event(This, EVENTID_MOUSEDOWN, p);
}
static HRESULT WINAPI HTMLDocument_put_onmousemove(IHTMLDocument2 *iface, VARIANT v)
static HRESULT WINAPI HTMLDocument_put_onmouseout(IHTMLDocument2 *iface, VARIANT v)
{
HTMLDocument *This = HTMLDOC_THIS(iface);
- FIXME("(%p)\n", This);
- return E_NOTIMPL;
+
+ TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
+
+ return set_doc_event(This, EVENTID_MOUSEOUT, &v);
}
static HRESULT WINAPI HTMLDocument_get_onmouseout(IHTMLDocument2 *iface, VARIANT *p)
{
HTMLDocument *This = HTMLDOC_THIS(iface);
- FIXME("(%p)->(%p)\n", This, p);
- return E_NOTIMPL;
+
+ TRACE("(%p)->(%p)\n", This, p);
+
+ return get_doc_event(This, EVENTID_MOUSEOUT, p);
}
static HRESULT WINAPI HTMLDocument_put_onmouseover(IHTMLDocument2 *iface, VARIANT v)
static HRESULT WINAPI HTMLDocument_put_onreadystatechange(IHTMLDocument2 *iface, VARIANT v)
{
HTMLDocument *This = HTMLDOC_THIS(iface);
- FIXME("(%p)\n", This);
- return E_NOTIMPL;
+
+ TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
+
+ return set_doc_event(This, EVENTID_READYSTATECHANGE, &v);
}
static HRESULT WINAPI HTMLDocument_get_onreadystatechange(IHTMLDocument2 *iface, VARIANT *p)
{
HTMLDocument *This = HTMLDOC_THIS(iface);
- FIXME("(%p)->(%p)\n", This, p);
- return E_NOTIMPL;
+
+ TRACE("(%p)->(%p)\n", This, p);
+
+ return get_doc_event(This, EVENTID_READYSTATECHANGE, p);
}
static HRESULT WINAPI HTMLDocument_put_onafterupdate(IHTMLDocument2 *iface, VARIANT v)
HTMLDocument_createStyleSheet
};
+static void HTMLDocument_on_advise(IUnknown *iface, cp_static_data_t *cp)
+{
+ HTMLDocument *This = HTMLDOC_THIS(iface);
+
+ if(This->window)
+ update_cp_events(This->window, &This->doc_node->node.event_target, cp, This->doc_node->node.nsnode);
+}
+
+#undef HTMLDOC_THIS
+
#define SUPPINFO_THIS(iface) DEFINE_THIS(HTMLDocument, SupportErrorInfo, iface)
static HRESULT WINAPI SupportErrorInfo_QueryInterface(ISupportErrorInfo *iface, REFIID riid, void **ppv)
{
HTMLDocument *This = DISPEX_THIS(iface);
+ if(This->window && id == DISPID_IHTMLDOCUMENT2_LOCATION && (wFlags & DISPATCH_PROPERTYPUT))
+ return IDispatchEx_InvokeEx(DISPATCHEX(This->window), DISPID_IHTMLWINDOW2_LOCATION, lcid, wFlags,
+ pdp, pvarRes, pei, pspCaller);
+
+
return IDispatchEx_InvokeEx(This->dispex, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
}
}else if(IsEqualGUID(&IID_IViewObject2, riid)) {
TRACE("(%p)->(IID_IViewObject2, %p)\n", This, ppv);
*ppv = VIEWOBJ2(This);
+ }else if(IsEqualGUID(&IID_IViewObjectEx, riid)) {
+ TRACE("(%p)->(IID_IViewObjectEx, %p)\n", This, ppv);
+ *ppv = VIEWOBJEX(This);
}else if(IsEqualGUID(&IID_IOleWindow, riid)) {
TRACE("(%p)->(IID_IOleWindow, %p)\n", This, ppv);
*ppv = OLEWIN(This);
}else if(IsEqualGUID(&IID_IMarshal, riid)) {
TRACE("(%p)->(IID_IMarshal %p) returning NULL\n", This, ppv);
*ppv = NULL;
+ }else if(IsEqualGUID(&IID_IExternalConnection, riid)) {
+ TRACE("(%p)->(IID_IExternalConnection %p) returning NULL\n", This, ppv);
+ *ppv = NULL;
+ }else if(IsEqualGUID(&IID_IStdMarshalInfo, riid)) {
+ TRACE("(%p)->(IID_IStdMarshalInfo %p) returning NULL\n", This, ppv);
+ *ppv = NULL;
+ }else if(IsEqualGUID(&IID_IObjectWithSite, riid)) {
+ TRACE("(%p)->(IID_IObjectWithSite %p)\n", This, ppv);
+ *ppv = OBJSITE(This);
}else {
return FALSE;
}
return TRUE;
}
+static cp_static_data_t HTMLDocumentEvents_data = { HTMLDocumentEvents_tid, HTMLDocument_on_advise };
+
static void init_doc(HTMLDocument *doc, IUnknown *unk_impl, IDispatchEx *dispex)
{
doc->lpHTMLDocument2Vtbl = &HTMLDocumentVtbl;
HTMLDocument_Hlink_Init(doc);
ConnectionPointContainer_Init(&doc->cp_container, (IUnknown*)HTMLDOC(doc));
- ConnectionPoint_Init(&doc->cp_propnotif, &doc->cp_container, &IID_IPropertyNotifySink);
- ConnectionPoint_Init(&doc->cp_htmldocevents, &doc->cp_container, &DIID_HTMLDocumentEvents);
- ConnectionPoint_Init(&doc->cp_htmldocevents2, &doc->cp_container, &DIID_HTMLDocumentEvents2);
+ ConnectionPoint_Init(&doc->cp_dispatch, &doc->cp_container, &IID_IDispatch, NULL);
+ ConnectionPoint_Init(&doc->cp_propnotif, &doc->cp_container, &IID_IPropertyNotifySink, NULL);
+ ConnectionPoint_Init(&doc->cp_htmldocevents, &doc->cp_container, &DIID_HTMLDocumentEvents, &HTMLDocumentEvents_data);
+ ConnectionPoint_Init(&doc->cp_htmldocevents2, &doc->cp_container, &DIID_HTMLDocumentEvents2, NULL);
}
static void destroy_htmldoc(HTMLDocument *This)
{
HTMLDocumentNode *This = HTMLDOCNODE_NODE_THIS(iface);
+ if(This->body_event_target)
+ release_event_target(This->body_event_target);
if(This->nsevent_listener)
release_nsevents(This);
+ if(This->catmgr)
+ ICatInformation_Release(This->catmgr);
if(This->secmgr)
IInternetSecurityManager_Release(This->secmgr);
doc->ref = 1;
doc->basedoc.window = window;
+ if(window == doc_obj->basedoc.window)
+ doc->basedoc.cp_container.forward_container = &doc_obj->basedoc.cp_container;
nsIDOMHTMLDocument_AddRef(nsdoc);
doc->nsdoc = nsdoc;
HTMLDOMNode_Init(doc, &doc->node, (nsIDOMNode*)nsdoc);
doc->node.vtbl = &HTMLDocumentNodeImplVtbl;
+ doc->node.cp_container = &doc->basedoc.cp_container;
hres = CoInternetCreateSecurityManager(NULL, &doc->secmgr, 0);
if(FAILED(hres)) {
This->basedoc.window->doc_obj = NULL;
IHTMLWindow2_Release(HTMLWINDOW2(This->basedoc.window));
}
+ if(This->basedoc.advise_holder)
+ IOleAdviseHolder_Release(This->basedoc.advise_holder);
+ if(This->view_sink)
+ IAdviseSink_Release(This->view_sink);
if(This->client)
IOleObject_SetClientSite(OLEOBJ(&This->basedoc), NULL);
if(This->in_place_active)