mshtml: Use HTMLWindow::alert in nsPromptService::Alert.

This commit is contained in:
Jacek Caban 2006-12-08 12:38:19 +01:00 committed by Alexandre Julliard
parent 62f1ef9d85
commit 13f7784634
3 changed files with 34 additions and 3 deletions

View File

@ -39,6 +39,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
#define HTMLWINDOW2_THIS(iface) DEFINE_THIS(HTMLWindow, HTMLWindow2, iface)
static struct list window_list = LIST_INIT(window_list);
static HRESULT WINAPI HTMLWindow2_QueryInterface(IHTMLWindow2 *iface, REFIID riid, void **ppv)
{
HTMLWindow *This = HTMLWINDOW2_THIS(iface);
@ -85,8 +87,10 @@ static ULONG WINAPI HTMLWindow2_Release(IHTMLWindow2 *iface)
TRACE("(%p) ref=%d\n", This, ref);
if(!ref)
if(!ref) {
list_remove(&This->entry);
mshtml_free(This);
}
return ref;
}
@ -734,10 +738,19 @@ HTMLWindow *HTMLWindow_Create(HTMLDocument *doc)
ERR("GetContentDOMWindow failed: %08x\n", nsres);
}
list_add_head(&window_list, &ret->entry);
return ret;
}
HTMLWindow *nswindow_to_window(nsIDOMWindow *nswindow)
{
HTMLWindow *iter;
LIST_FOR_EACH_ENTRY(iter, &window_list, HTMLWindow, entry) {
if(iter->nswindow == nswindow)
return iter;
}
return NULL;
}

View File

@ -21,6 +21,8 @@
#include "mshtmhst.h"
#include "hlink.h"
#include "wine/list.h"
#ifdef INIT_GUID
#include "initguid.h"
#endif
@ -59,6 +61,8 @@ typedef struct {
HTMLDocument *doc;
nsIDOMWindow *nswindow;
struct list entry;
} HTMLWindow;
typedef enum {

View File

@ -146,8 +146,22 @@ static nsrefcnt NSAPI nsPromptService_Release(nsIPromptService *iface)
static nsresult NSAPI nsPromptService_Alert(nsIPromptService *iface, nsIDOMWindow *aParent,
const PRUnichar *aDialogTitle, const PRUnichar *aText)
{
FIXME("(%p %s %s)\n", aParent, debugstr_w(aDialogTitle), debugstr_w(aText));
return NS_ERROR_NOT_IMPLEMENTED;
HTMLWindow *window;
BSTR text;
TRACE("(%p %s %s)\n", aParent, debugstr_w(aDialogTitle), debugstr_w(aText));
window = nswindow_to_window(aParent);
if(!window) {
WARN("Could not find HTMLWindow for nsIDOMWindow %p\n", aParent);
return NS_ERROR_UNEXPECTED;
}
text = SysAllocString(aText);
IHTMLWindow2_alert(HTMLWINDOW2(window), text);
SysFreeString(text);
return NS_OK;
}
static nsresult NSAPI nsPromptService_AlertCheck(nsIPromptService *iface,