Jacek Caban : mshtml: Use HTMLWindow::alert in nsPromptService::Alert.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Dec 12 14:29:51 CST 2006
Module: wine
Branch: master
Commit: 13f77846345569bb68059e7b9b48f6838f74b6eb
URL: http://source.winehq.org/git/wine.git/?a=commit;h=13f77846345569bb68059e7b9b48f6838f74b6eb
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Dec 8 12:38:19 2006 +0100
mshtml: Use HTMLWindow::alert in nsPromptService::Alert.
---
dlls/mshtml/htmlwindow.c | 15 ++++++++++++++-
dlls/mshtml/mshtml_private.h | 4 ++++
dlls/mshtml/nsservice.c | 18 ++++++++++++++++--
3 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index 8f0fc2b..6cd106f 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -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(
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(HTMLDocume
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;
}
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index a463129..b7bfb36 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -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 {
diff --git a/dlls/mshtml/nsservice.c b/dlls/mshtml/nsservice.c
index 76887b2..d4c9d6b 100644
--- a/dlls/mshtml/nsservice.c
+++ b/dlls/mshtml/nsservice.c
@@ -146,8 +146,22 @@ static nsrefcnt NSAPI nsPromptService_Re
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,
More information about the wine-cvs
mailing list