Commit d4aee460 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

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

parent 2e77a62f
......@@ -1160,12 +1160,12 @@ static HRESULT WINAPI HTMLDocument_get_domain(IHTMLDocument2 *iface, BSTR *p)
return E_NOTIMPL;
}
if(This->outer_window && !This->outer_window->uri)
if(This->window && (!This->window->base.outer_window || !This->window->base.outer_window->uri))
return E_FAIL;
nsAString_Init(&nsstr, NULL);
nsres = nsIDOMHTMLDocument_GetDomain(This->html_document, &nsstr);
if(NS_SUCCEEDED(nsres) && This->outer_window && This->outer_window->uri) {
if(NS_SUCCEEDED(nsres) && This->window) {
const PRUnichar *str;
HRESULT hres;
......@@ -1173,7 +1173,7 @@ static HRESULT WINAPI HTMLDocument_get_domain(IHTMLDocument2 *iface, BSTR *p)
if(!*str) {
TRACE("Gecko returned empty string, fallback to loaded URL.\n");
nsAString_Finish(&nsstr);
hres = IUri_GetHost(This->outer_window->uri, p);
hres = IUri_GetHost(This->window->base.outer_window->uri, p);
return FAILED(hres) ? hres : S_OK;
}
}
......
......@@ -119,6 +119,7 @@ function detached_iframe_doc() {
expect_exception(function() { origDoc.onclick; }, true);
expect_exception(function() { origDoc.toString; }, true);
expect_exception(function() { origDoc.toString(); }, true);
expect_exception(function() { origDoc.domain; });
expect_exception(function() { origDoc.frames; });
expect_exception(function() { origDoc.readyState; }, true);
expect_exception(function() { origDoc.URL; });
......
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