diff --git a/dlls/mshtml/htmlframebase.c b/dlls/mshtml/htmlframebase.c
index 850d1a9b754..6c52e53b6be 100644
--- a/dlls/mshtml/htmlframebase.c
+++ b/dlls/mshtml/htmlframebase.c
@@ -39,13 +39,14 @@ HRESULT set_frame_doc(HTMLFrameBase *frame, nsIDOMDocument *nsdoc)
{
nsIDOMWindow *nswindow;
HTMLWindow *window;
+ nsresult nsres;
HRESULT hres = S_OK;
if(frame->content_window)
return S_OK;
- nswindow = get_nsdoc_window(nsdoc);
- if(!nswindow)
+ nsres = nsIDOMDocument_GetDefaultView(nsdoc, &nswindow);
+ if(NS_FAILED(nsres) || !nswindow)
return E_FAIL;
window = nswindow_to_window(nswindow);
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index 17fe01600e2..960a4458c88 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -83,20 +83,6 @@ static void window_set_docnode(HTMLWindow *window, HTMLDocumentNode *doc_node)
}
}
-nsIDOMWindow *get_nsdoc_window(nsIDOMDocument *nsdoc)
-{
- nsIDOMWindow *nswindow;
- nsresult nsres;
-
- nsres = nsIDOMDocument_GetDefaultView(nsdoc, &nswindow);
- if(NS_FAILED(nsres)) {
- ERR("GetDefaultView failed: %08x\n", nsres);
- return NULL;
- }
-
- return nswindow;
-}
-
static void release_children(HTMLWindow *This)
{
HTMLWindow *child;
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index eac02d9ec67..9bb37e482a5 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -609,7 +609,6 @@ HRESULT create_document_fragment(nsIDOMNode*,HTMLDocumentNode*,HTMLDocumentNode*
HRESULT HTMLWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLWindow*,HTMLWindow**) DECLSPEC_HIDDEN;
void update_window_doc(HTMLWindow*) DECLSPEC_HIDDEN;
HTMLWindow *nswindow_to_window(const nsIDOMWindow*) DECLSPEC_HIDDEN;
-nsIDOMWindow *get_nsdoc_window(nsIDOMDocument*) DECLSPEC_HIDDEN;
HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLWindow*) DECLSPEC_HIDDEN;
HTMLImageElementFactory *HTMLImageElementFactory_Create(HTMLWindow*) DECLSPEC_HIDDEN;
HRESULT HTMLLocation_Create(HTMLWindow*,HTMLLocation**) DECLSPEC_HIDDEN;
diff --git a/dlls/mshtml/npplugin.c b/dlls/mshtml/npplugin.c
index 62f0d523913..e22499bcb95 100644
--- a/dlls/mshtml/npplugin.c
+++ b/dlls/mshtml/npplugin.c
@@ -126,9 +126,9 @@ static HTMLWindow *get_elem_window(nsIDOMElement *elem)
if(NS_FAILED(nsres))
return NULL;
- nswindow = get_nsdoc_window(nsdoc);
+ nsres = nsIDOMDocument_GetDefaultView(nsdoc, &nswindow);
nsIDOMDocument_Release(nsdoc);
- if(!nswindow)
+ if(NS_FAILED(nsres) || !nswindow)
return NULL;
window = nswindow_to_window(nswindow);