From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmldoc.c | 10 +++++++--- dlls/mshtml/tests/navigation.js | 1 + 2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index ebdb887fd64..a8edc3d0251 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -2364,9 +2364,13 @@ static HRESULT WINAPI HTMLDocument3_get_documentElement(IHTMLDocument3 *iface, I
TRACE("(%p)->(%p)\n", This, p);
- if(This->outer_window && This->outer_window->readystate == READYSTATE_UNINITIALIZED) { - *p = NULL; - return S_OK; + if(This->window) { + if(!This->window->base.outer_window) + return E_FAIL; + if(This->window->base.outer_window->readystate == READYSTATE_UNINITIALIZED) { + *p = NULL; + return S_OK; + } }
if(!This->dom_document) { diff --git a/dlls/mshtml/tests/navigation.js b/dlls/mshtml/tests/navigation.js index 23bca192f2d..59ca6ce948b 100644 --- a/dlls/mshtml/tests/navigation.js +++ b/dlls/mshtml/tests/navigation.js @@ -121,6 +121,7 @@ function detached_iframe_doc() { expect_exception(function() { origDoc.toString(); }, true); expect_exception(function() { origDoc.cookie; }); expect_exception(function() { origDoc.cookie = "test=val"; }); + expect_exception(function() { origDoc.documentElement; }); expect_exception(function() { origDoc.domain; }); expect_exception(function() { origDoc.frames; }); expect_exception(function() { origDoc.readyState; }, true);