Jacek Caban : mshtml: Get rid of setup_nswindow.

Alexandre Julliard julliard at winehq.org
Fri Oct 10 08:06:36 CDT 2008


Module: wine
Branch: master
Commit: 27eb80cc3abb18c24e9f1f67fb32fc000d66990d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=27eb80cc3abb18c24e9f1f67fb32fc000d66990d

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Oct  9 15:26:18 2008 -0500

mshtml: Get rid of setup_nswindow.

It's no longer needed.

---

 dlls/mshtml/htmlwindow.c     |  102 ------------------------------------------
 dlls/mshtml/mshtml_private.h |    1 -
 dlls/mshtml/nsevents.c       |    1 -
 3 files changed, 0 insertions(+), 104 deletions(-)

diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index 76efb9d..1027399 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -1177,108 +1177,6 @@ static dispex_static_data_t HTMLWindow_dispex = {
     HTMLWindow_iface_tids
 };
 
-static const char wineConfig_func[] =
-"window.__defineGetter__(\"external\",function() {\n"
-"    return window.__wineWindow__.external;\n"
-"});\n"
-"window.__wineWindow__ = wineWindow;\n";
-
-static void astr_to_nswstr(const char *str, nsAString *nsstr)
-{
-    LPWSTR wstr;
-    int len;
-
-    len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
-    wstr = heap_alloc(len*sizeof(WCHAR));
-    MultiByteToWideChar(CP_ACP, 0, str, -1, wstr, len);
-
-    nsAString_Init(nsstr, wstr);
-
-    heap_free(wstr);
-}
-
-static nsresult call_js_func(nsIScriptContainer *script_container, nsISupports *target,
-                             const char *name, const char *body,
-                             PRUint32 argc, const char **arg_names, nsIArray *argv)
-{
-    nsACString name_str;
-    nsAString body_str;
-    JSObject func_obj, jsglobal;
-    nsIVariant *jsret;
-    nsresult nsres;
-
-    nsres = nsIScriptContainer_GetGlobalObject(script_container, &jsglobal);
-    if(NS_FAILED(nsres))
-        ERR("GetGlobalObject: %08x\n", nsres);
-
-    nsACString_Init(&name_str, name);
-    astr_to_nswstr(body, &body_str);
-
-    nsres =  nsIScriptContainer_CompileFunction(script_container, jsglobal, &name_str, argc, arg_names,
-                                                &body_str, NULL, 1, FALSE, &func_obj);
-
-    nsACString_Finish(&name_str);
-    nsAString_Finish(&body_str);
-
-    if(NS_FAILED(nsres)) {
-        ERR("CompileFunction failed: %08x\n", nsres);
-        return nsres;
-    }
-
-    nsres = nsIScriptContainer_CallFunction(script_container, target, jsglobal, func_obj, argv, &jsret);
-
-    nsIScriptContainer_DropScriptObject(script_container, func_obj);
-    nsIScriptContainer_DropScriptObject(script_container, jsglobal);
-    if(NS_FAILED(nsres)) {
-        ERR("CallFunction failed: %08x\n", nsres);
-        return nsres;
-    }
-
-    nsIVariant_Release(jsret);
-    return NS_OK;
-}
-
-void setup_nswindow(HTMLWindow *This)
-{
-    nsIScriptContainer *script_container;
-    nsIDOMWindow *nswindow;
-    nsIDOMDocument *domdoc;
-    nsIWritableVariant *nsvar;
-    nsIMutableArray *argv;
-    nsresult nsres;
-
-    static const char *args[] = {"wineWindow"};
-
-    TRACE("(%p)\n", This);
-
-    nsIWebNavigation_GetDocument(This->doc->nscontainer->navigation, &domdoc);
-    nsres = nsIDOMDocument_QueryInterface(domdoc, &IID_nsIScriptContainer, (void**)&script_container);
-    nsIDOMDocument_Release(domdoc);
-    if(NS_FAILED(nsres)) {
-        TRACE("Could not get nsIDOMScriptContainer: %08x\n", nsres);
-        return;
-    }
-
-    nsIWebBrowser_GetContentDOMWindow(This->doc->nscontainer->webbrowser, &nswindow);
-
-    nsvar = create_nsvariant();
-    nsres = nsIWritableVariant_SetAsInterface(nsvar, &IID_IDispatch, HTMLWINDOW2(This));
-    if(NS_FAILED(nsres))
-        ERR("SetAsInterface failed: %08x\n", nsres);
-
-    argv = create_nsarray();
-    nsres = nsIMutableArray_AppendElement(argv, (nsISupports*)nsvar, FALSE);
-    nsIWritableVariant_Release(nsvar);
-    if(NS_FAILED(nsres))
-        ERR("AppendElement failed: %08x\n", nsres);
-
-    call_js_func(script_container, (nsISupports*)nswindow/*HTMLWINDOW2(This)*/, "wineConfig",
-                 wineConfig_func, 1, args, (nsIArray*)argv);
-
-    nsIMutableArray_Release(argv);
-    nsIScriptContainer_Release(script_container);
-}
-
 HTMLWindow *HTMLWindow_Create(HTMLDocument *doc)
 {
     HTMLWindow *ret = heap_alloc_zero(sizeof(HTMLWindow));
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index cac1117..7243600 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -467,7 +467,6 @@ HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLDocument*);
 HTMLLocation *HTMLLocation_Create(HTMLDocument*);
 IOmNavigator *OmNavigator_Create(void);
-void setup_nswindow(HTMLWindow*);
 
 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
diff --git a/dlls/mshtml/nsevents.c b/dlls/mshtml/nsevents.c
index d226ccb..b6cc0f8 100644
--- a/dlls/mshtml/nsevents.c
+++ b/dlls/mshtml/nsevents.c
@@ -139,7 +139,6 @@ static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event
 
     update_nsdocument(This->doc);
     connect_scripts(This->doc);
-    setup_nswindow(This->doc->window);
 
     if(This->editor_controller) {
         nsIController_Release(This->editor_controller);




More information about the wine-cvs mailing list