Commit 13f77846 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

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

parent 62f1ef9d
......@@ -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;
}
......@@ -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 {
......
......@@ -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,
......
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