Commit 427610da authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Use stored nsdoc in get_doc_string.

parent e90386b2
...@@ -335,25 +335,17 @@ static HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, BO ...@@ -335,25 +335,17 @@ static HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, BO
static HRESULT get_doc_string(HTMLDocument *This, char **str, DWORD *len) static HRESULT get_doc_string(HTMLDocument *This, char **str, DWORD *len)
{ {
nsIDOMDocument *nsdoc;
nsIDOMNode *nsnode; nsIDOMNode *nsnode;
LPCWSTR strw; LPCWSTR strw;
nsAString nsstr; nsAString nsstr;
nsresult nsres; nsresult nsres;
if(!This->nscontainer) { if(!This->nsdoc) {
WARN("no nscontainer, returning NULL\n"); WARN("NULL nsdoc\n");
return S_OK; return E_UNEXPECTED;
}
nsres = nsIWebNavigation_GetDocument(This->nscontainer->navigation, &nsdoc);
if(NS_FAILED(nsres)) {
ERR("GetDocument failed: %08x\n", nsres);
return E_FAIL;
} }
nsres = nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMNode, (void**)&nsnode); nsres = nsIDOMHTMLDocument_QueryInterface(This->nsdoc, &IID_nsIDOMNode, (void**)&nsnode);
nsIDOMDocument_Release(nsdoc);
if(NS_FAILED(nsres)) { if(NS_FAILED(nsres)) {
ERR("Could not get nsIDOMNode failed: %08x\n", nsres); ERR("Could not get nsIDOMNode failed: %08x\n", nsres);
return E_FAIL; return E_FAIL;
...@@ -601,12 +593,11 @@ static HRESULT WINAPI PersistFile_Save(IPersistFile *iface, LPCOLESTR pszFileNam ...@@ -601,12 +593,11 @@ static HRESULT WINAPI PersistFile_Save(IPersistFile *iface, LPCOLESTR pszFileNam
} }
hres = get_doc_string(This, &str, &len); hres = get_doc_string(This, &str, &len);
if(FAILED(hres)) if(SUCCEEDED(hres))
return hres; WriteFile(file, str, len, &written, NULL);
WriteFile(file, str, len, &written, NULL);
CloseHandle(file); CloseHandle(file);
return S_OK; return hres;
} }
static HRESULT WINAPI PersistFile_SaveCompleted(IPersistFile *iface, LPCOLESTR pszFileName) static HRESULT WINAPI PersistFile_SaveCompleted(IPersistFile *iface, LPCOLESTR pszFileName)
......
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