Add implemantation of property "Name" (IHTMLWindow2)

Jacek Caban jacek at codeweavers.com
Wed Apr 23 16:51:03 CDT 2008


Ivan Sinitsin wrote:
> This patch add implementation of HTMLWindow2_put_name, HTMLWindow2_get_name in 
> module htmlwindow.c (mshtml.dll)
>
> Changelog:
> Add implementation of HTMLWindow2_put_name, HTMLWindow2_get_name
>
>   
 > 

> @@ -289,15 +289,43 @@ static HRESULT WINAPI HTMLWindow2_get_na
>  static HRESULT WINAPI HTMLWindow2_put_name(IHTMLWindow2 *iface, BSTR v)
>  {
>      HTMLWindow *This = HTMLWINDOW2_THIS(iface);
> -    FIXME("(%p)->(%s)\n", This, debugstr_w(v));
> -    return E_NOTIMPL;
> +    nsAString aName;
> +    nsresult nsres;
> +
> +    TRACE("(%p)->(%s)\n", This, debugstr_w(v));
> +
> +    nsAString_Init(&aName, v);
> +    nsres = nsIDOMWindow_SetName(This->nswindow, &aName);
> +    if (NS_FAILED(nsres)) {
> +        TRACE("Failed nsIDOMWindow_SetName %08x \n",nsres);
> +        return nsres;

You shouldn't mix nsresult with HRESULT. Also you leak aName here. SetName should never return failure, so printinf ERR and returning S_OK is fine here.

> +    }
> +    nsAString_Finish(&aName);
> +    return S_OK;
>  }
>  
>  static HRESULT WINAPI HTMLWindow2_get_name(IHTMLWindow2 *iface, BSTR *p)
>  {
>      HTMLWindow *This = HTMLWINDOW2_THIS(iface);
> -    FIXME("(%p)->(%p)\n", This, p);
> -    return E_NOTIMPL;
> +    nsAString aName;
> +    nsresult nsres;
> +    TRACE("(%p)->(%p)\n", This, p);
> +
> +    nsAString_Init(&aName, NULL);
> +    nsres = nsIDOMWindow_GetName(This->nswindow, &aName);
> +    if (NS_FAILED(nsres)) {
> +        TRACE("Failed nsIDOMWindow_GetName %08x \n",nsres);
> +        return nsres;

Same as above.

> +    }
> +
> +    nsres = nsAString_GetData(&aName, p);

You can't do this, p is BSTR and must be allocated with SysAllocString. Look at other functions how to implement it.

> +    if (NS_FAILED(nsres)) {
> +        TRACE("Failed nsAString_GetData %08x \n",nsres);
> +        return nsres;
> +    }
> +    nsAString_Finish(&aName);
> +
> +    return S_OK;
>  }



Jacek




More information about the wine-devel mailing list