diff --git a/dlls/mshtml/htmlframebase.c b/dlls/mshtml/htmlframebase.c
index 78cacc2ba65..56c1023be8c 100644
--- a/dlls/mshtml/htmlframebase.c
+++ b/dlls/mshtml/htmlframebase.c
@@ -283,10 +283,10 @@ static HRESULT WINAPI HTMLFrameBase_put_scrolling(IHTMLFrameBase *iface, BSTR v)
return E_INVALIDARG;
if(This->nsframe) {
- nsAString_Init(&nsstr, v);
+ nsAString_InitDepend(&nsstr, v);
nsres = nsIDOMHTMLFrameElement_SetScrolling(This->nsframe, &nsstr);
}else if(This->nsiframe) {
- nsAString_Init(&nsstr, v);
+ nsAString_InitDepend(&nsstr, v);
nsres = nsIDOMHTMLIFrameElement_SetScrolling(This->nsiframe, &nsstr);
}else {
ERR("No attached ns frame object\n");
diff --git a/dlls/mshtml/htmlimg.c b/dlls/mshtml/htmlimg.c
index 4ba6d36b586..aad12743dab 100644
--- a/dlls/mshtml/htmlimg.c
+++ b/dlls/mshtml/htmlimg.c
@@ -228,7 +228,7 @@ static HRESULT WINAPI HTMLImgElement_put_alt(IHTMLImgElement *iface, BSTR v)
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
- nsAString_Init(&alt_str, v);
+ nsAString_InitDepend(&alt_str, v);
nsres = nsIDOMHTMLImageElement_SetAlt(This->nsimg, &alt_str);
nsAString_Finish(&alt_str);
if(NS_FAILED(nsres))
@@ -268,7 +268,7 @@ static HRESULT WINAPI HTMLImgElement_put_src(IHTMLImgElement *iface, BSTR v)
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
- nsAString_Init(&src_str, v);
+ nsAString_InitDepend(&src_str, v);
nsres = nsIDOMHTMLImageElement_SetSrc(This->nsimg, &src_str);
nsAString_Finish(&src_str);
if(NS_FAILED(nsres))
diff --git a/dlls/mshtml/htmlinput.c b/dlls/mshtml/htmlinput.c
index a72a9f2f88f..1b8d1c5413f 100644
--- a/dlls/mshtml/htmlinput.c
+++ b/dlls/mshtml/htmlinput.c
@@ -143,7 +143,7 @@ static HRESULT WINAPI HTMLInputElement_put_value(IHTMLInputElement *iface, BSTR
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
- nsAString_Init(&val_str, v);
+ nsAString_InitDepend(&val_str, v);
nsres = nsIDOMHTMLInputElement_SetValue(This->nsinput, &val_str);
nsAString_Finish(&val_str);
if(NS_FAILED(nsres))
@@ -512,7 +512,7 @@ static HRESULT WINAPI HTMLInputElement_put_src(IHTMLInputElement *iface, BSTR v)
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
- nsAString_Init(&nsstr, v);
+ nsAString_InitDepend(&nsstr, v);
nsres = nsIDOMHTMLInputElement_SetSrc(This->nsinput, &nsstr);
nsAString_Finish(&nsstr);
if(NS_FAILED(nsres))
diff --git a/dlls/mshtml/htmlnode.c b/dlls/mshtml/htmlnode.c
index b8cecf0629e..a5ea3f4dd00 100644
--- a/dlls/mshtml/htmlnode.c
+++ b/dlls/mshtml/htmlnode.c
@@ -645,7 +645,7 @@ static HRESULT WINAPI HTMLDOMNode_put_nodeValue(IHTMLDOMNode *iface, VARIANT v)
TRACE("bstr %s\n", debugstr_w(V_BSTR(&v)));
- nsAString_Init(&val_str, V_BSTR(&v));
+ nsAString_InitDepend(&val_str, V_BSTR(&v));
nsIDOMNode_SetNodeValue(This->nsnode, &val_str);
nsAString_Finish(&val_str);
diff --git a/dlls/mshtml/htmloption.c b/dlls/mshtml/htmloption.c
index ea205ea7f2f..3e037627bf1 100644
--- a/dlls/mshtml/htmloption.c
+++ b/dlls/mshtml/htmloption.c
@@ -117,7 +117,7 @@ static HRESULT WINAPI HTMLOptionElement_put_value(IHTMLOptionElement *iface, BST
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
- nsAString_Init(&value_str, v);
+ nsAString_InitDepend(&value_str, v);
nsres = nsIDOMHTMLOptionElement_SetValue(This->nsoption, &value_str);
nsAString_Finish(&value_str);
if(NS_FAILED(nsres))
@@ -209,7 +209,7 @@ static HRESULT WINAPI HTMLOptionElement_put_text(IHTMLOptionElement *iface, BSTR
}
}
- nsAString_Init(&text_str, v);
+ nsAString_InitDepend(&text_str, v);
nsres = nsIDOMHTMLDocument_CreateTextNode(This->element.node.doc->nsdoc, &text_str, &text_node);
nsAString_Finish(&text_str);
if(NS_FAILED(nsres)) {
diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c
index bb45a5ebeb5..6698606a4c4 100644
--- a/dlls/mshtml/htmlselect.c
+++ b/dlls/mshtml/htmlselect.c
@@ -253,7 +253,7 @@ static HRESULT WINAPI HTMLSelectElement_put_value(IHTMLSelectElement *iface, BST
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
- nsAString_Init(&value_str, v);
+ nsAString_InitDepend(&value_str, v);
nsres = nsIDOMHTMLSelectElement_SetValue(This->nsselect, &value_str);
nsAString_Finish(&value_str);
if(NS_FAILED(nsres))
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index d6a249a564b..58d5f7b5789 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -694,7 +694,7 @@ static HRESULT WINAPI HTMLWindow2_put_name(IHTMLWindow2 *iface, BSTR v)
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
- nsAString_Init(&name_str, v);
+ nsAString_InitDepend(&name_str, v);
nsres = nsIDOMWindow_SetName(This->nswindow, &name_str);
nsAString_Finish(&name_str);
if(NS_FAILED(nsres))
diff --git a/dlls/mshtml/mutation.c b/dlls/mshtml/mutation.c
index 372c467bf53..0adf87e7e58 100644
--- a/dlls/mshtml/mutation.c
+++ b/dlls/mshtml/mutation.c
@@ -168,12 +168,12 @@ static BOOL handle_insert_comment(HTMLDocumentNode *doc, const PRUnichar *commen
memcpy(buf, ptr, (end-ptr)*sizeof(WCHAR));
buf[end-ptr] = 0;
- nsAString_Init(&nsstr, buf);
- heap_free(buf);
+ nsAString_InitDepend(&nsstr, buf);
/* FIXME: Find better way to insert HTML to document. */
nsres = nsIDOMHTMLDocument_Write(doc->nsdoc, &nsstr);
nsAString_Finish(&nsstr);
+ heap_free(buf);
if(NS_FAILED(nsres)) {
ERR("Write failed: %08x\n", nsres);
return FALSE;
@@ -396,7 +396,7 @@ static nsresult NSAPI nsRunnable_Run(nsIRunnable *iface)
static const PRUnichar remove_comment_magicW[] =
{'#','!','w','i','n','e', 'r','e','m','o','v','e','!','#',0};
- nsAString_Init(&magic_str, remove_comment_magicW);
+ nsAString_InitDepend(&magic_str, remove_comment_magicW);
nsres = nsIDOMComment_SetData(nscomment, &magic_str);
nsAString_Finish(&magic_str);
if(NS_FAILED(nsres))
diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c
index 0e7ea894c2f..3415657fbcb 100644
--- a/dlls/mshtml/nsembed.c
+++ b/dlls/mshtml/nsembed.c
@@ -426,7 +426,7 @@ static BOOL init_xpcom(const PRUnichar *gre_path)
nsAString path;
nsIFile *gre_dir;
- nsAString_Init(&path, gre_path);
+ nsAString_InitDepend(&path, gre_path);
nsres = NS_NewLocalFile(&path, FALSE, &gre_dir);
nsAString_Finish(&path);
if(NS_FAILED(nsres)) {
diff --git a/dlls/mshtml/nsevents.c b/dlls/mshtml/nsevents.c
index 46f057f079a..2dd8248ce92 100644
--- a/dlls/mshtml/nsevents.c
+++ b/dlls/mshtml/nsevents.c
@@ -316,7 +316,7 @@ static void init_event(nsIDOMEventTarget *target, const PRUnichar *type,
nsAString type_str;
nsresult nsres;
- nsAString_Init(&type_str, type);
+ nsAString_InitDepend(&type_str, type);
nsres = nsIDOMEventTarget_AddEventListener(target, &type_str, listener, capture);
nsAString_Finish(&type_str);
if(NS_FAILED(nsres))
diff --git a/dlls/mshtml/script.c b/dlls/mshtml/script.c
index efd2605de39..1d21da9a07e 100644
--- a/dlls/mshtml/script.c
+++ b/dlls/mshtml/script.c
@@ -758,9 +758,9 @@ static BOOL get_script_guid(nsIDOMHTMLScriptElement *nsscript, GUID *guid)
ERR("GetType failed: %08x\n", nsres);
}
- nsAString_Init(&attr_str, languageW);
-
+ nsAString_InitDepend(&attr_str, languageW);
nsres = nsIDOMHTMLScriptElement_GetAttribute(nsscript, &attr_str, &val_str);
+ nsAString_Finish(&attr_str);
if(NS_SUCCEEDED(nsres)) {
const PRUnichar *language;
@@ -776,7 +776,6 @@ static BOOL get_script_guid(nsIDOMHTMLScriptElement *nsscript, GUID *guid)
ERR("GetAttribute(language) failed: %08x\n", nsres);
}
- nsAString_Finish(&attr_str);
nsAString_Finish(&val_str);
return ret;
diff --git a/dlls/mshtml/txtrange.c b/dlls/mshtml/txtrange.c
index 0ece6ecb969..9b2bb94aec4 100644
--- a/dlls/mshtml/txtrange.c
+++ b/dlls/mshtml/txtrange.c
@@ -1141,7 +1141,7 @@ static HRESULT WINAPI HTMLTxtRange_put_text(IHTMLTxtRange *iface, BSTR v)
if(!This->doc)
return MSHTML_E_NODOC;
- nsAString_Init(&text_str, v);
+ nsAString_InitDepend(&text_str, v);
nsres = nsIDOMHTMLDocument_CreateTextNode(This->doc->nsdoc, &text_str, &text_node);
nsAString_Finish(&text_str);
if(NS_FAILED(nsres)) {