mshtml: Return failure in IHTMLDocument2::documentElement for detached documents.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
This commit is contained in:
Gabriel Ivăncescu 2023-12-05 19:42:19 +02:00 committed by Alexandre Julliard
parent 1f0517689d
commit cb14ca2a29
2 changed files with 8 additions and 3 deletions

View file

@ -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) {

View file

@ -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);