From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com ---
Native is pretty weird. It actually seems to return "Permission Denied" (0x800a0046) when called from javascript, but works fine when called from C? We do have a test in events.c/test_document_close() that assumes it works, so for now I added this as todo_wine here in navigation.js. If you'd prefer it the other way around, I can make the old test todo_wine and "fix" the new one. --- dlls/mshtml/htmldoc.c | 2 +- dlls/mshtml/tests/navigation.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index e37f04fee0b..3f844fddf8d 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -905,7 +905,7 @@ static HRESULT WINAPI HTMLDocument_get_readyState(IHTMLDocument2 *iface, BSTR *p if(!p) return E_POINTER;
- return get_readystate_string(This->outer_window ? This->outer_window->readystate : 0, p); + return get_readystate_string(This->window && This->window->base.outer_window ? This->window->base.outer_window->readystate : 0, p); }
static HRESULT WINAPI HTMLDocument_get_frames(IHTMLDocument2 *iface, IHTMLFramesCollection2 **p) diff --git a/dlls/mshtml/tests/navigation.js b/dlls/mshtml/tests/navigation.js index 402d933a54a..84a0bbdcb5d 100644 --- a/dlls/mshtml/tests/navigation.js +++ b/dlls/mshtml/tests/navigation.js @@ -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.readyState; }, true); expect_exception(function() { origDoc.URL; }); expect_exception(function() { origDoc.URL = "blank.html"; });
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmldoc.c | 6 ++++-- dlls/mshtml/tests/navigation.js | 1 + 2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 3f844fddf8d..45618ad3eba 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -914,11 +914,13 @@ static HRESULT WINAPI HTMLDocument_get_frames(IHTMLDocument2 *iface, IHTMLFrames
TRACE("(%p)->(%p)\n", This, p);
- if(!This->outer_window) { + if(!This->window) { /* Not implemented by IE */ return E_NOTIMPL; } - return IHTMLWindow2_get_frames(&This->outer_window->base.IHTMLWindow2_iface, p); + if(!This->window->base.outer_window) + return E_FAIL; + return IHTMLWindow2_get_frames(&This->window->base.outer_window->base.IHTMLWindow2_iface, p); }
static HRESULT WINAPI HTMLDocument_get_embeds(IHTMLDocument2 *iface, IHTMLElementCollection **p) diff --git a/dlls/mshtml/tests/navigation.js b/dlls/mshtml/tests/navigation.js index 84a0bbdcb5d..fb8d1d5de5b 100644 --- a/dlls/mshtml/tests/navigation.js +++ b/dlls/mshtml/tests/navigation.js @@ -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.frames; }); expect_exception(function() { origDoc.readyState; }, true); expect_exception(function() { origDoc.URL; }); expect_exception(function() { origDoc.URL = "blank.html"; });
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmldoc.c | 6 +++--- dlls/mshtml/tests/navigation.js | 1 + 2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 45618ad3eba..b0872207819 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -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; } } diff --git a/dlls/mshtml/tests/navigation.js b/dlls/mshtml/tests/navigation.js index fb8d1d5de5b..ad10372b4c6 100644 --- a/dlls/mshtml/tests/navigation.js +++ b/dlls/mshtml/tests/navigation.js @@ -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; });
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmldoc.c | 14 +++++++++----- dlls/mshtml/tests/navigation.js | 2 ++ 2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index b0872207819..e7ff2771050 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -1188,10 +1188,12 @@ static HRESULT WINAPI HTMLDocument_put_cookie(IHTMLDocument2 *iface, BSTR v)
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
- if(!This->outer_window) + if(!This->window) return S_OK; + if(!This->window->base.outer_window) + return E_FAIL;
- bret = InternetSetCookieExW(This->outer_window->url, NULL, v, 0, 0); + bret = InternetSetCookieExW(This->window->base.outer_window->url, NULL, v, 0, 0); if(!bret) { FIXME("InternetSetCookieExW failed: %lu\n", GetLastError()); return HRESULT_FROM_WIN32(GetLastError()); @@ -1208,13 +1210,15 @@ static HRESULT WINAPI HTMLDocument_get_cookie(IHTMLDocument2 *iface, BSTR *p)
TRACE("(%p)->(%p)\n", This, p);
- if(!This->outer_window) { + if(!This->window) { *p = NULL; return S_OK; } + if(!This->window->base.outer_window) + return E_FAIL;
size = 0; - bret = InternetGetCookieExW(This->outer_window->url, NULL, NULL, &size, 0, NULL); + bret = InternetGetCookieExW(This->window->base.outer_window->url, NULL, NULL, &size, 0, NULL); if(!bret && GetLastError() != ERROR_INSUFFICIENT_BUFFER) { WARN("InternetGetCookieExW failed: %lu\n", GetLastError()); *p = NULL; @@ -1230,7 +1234,7 @@ static HRESULT WINAPI HTMLDocument_get_cookie(IHTMLDocument2 *iface, BSTR *p) if(!*p) return E_OUTOFMEMORY;
- bret = InternetGetCookieExW(This->outer_window->url, NULL, *p, &size, 0, NULL); + bret = InternetGetCookieExW(This->window->base.outer_window->url, NULL, *p, &size, 0, NULL); if(!bret) { ERR("InternetGetCookieExW failed: %lu\n", GetLastError()); return E_FAIL; diff --git a/dlls/mshtml/tests/navigation.js b/dlls/mshtml/tests/navigation.js index ad10372b4c6..bc24fa646d3 100644 --- a/dlls/mshtml/tests/navigation.js +++ b/dlls/mshtml/tests/navigation.js @@ -119,6 +119,8 @@ 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.cookie; }); + expect_exception(function() { origDoc.cookie = "test=val"; }); expect_exception(function() { origDoc.domain; }); expect_exception(function() { origDoc.frames; }); expect_exception(function() { origDoc.readyState; }, true);
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmldoc.c | 6 +++--- dlls/mshtml/tests/navigation.js | 1 + 2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index e7ff2771050..ebdb887fd64 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -1463,7 +1463,7 @@ static HRESULT WINAPI HTMLDocument_open(IHTMLDocument2 *iface, BSTR url, VARIANT
*pomWindowResult = NULL;
- if(!This->outer_window) + if(!This->window || !This->window->base.outer_window) return E_FAIL;
if(!This->dom_document) { @@ -1490,8 +1490,8 @@ static HRESULT WINAPI HTMLDocument_open(IHTMLDocument2 *iface, BSTR url, VARIANT if(tmp) nsISupports_Release(tmp);
- *pomWindowResult = (IDispatch*)&This->outer_window->base.IHTMLWindow2_iface; - IHTMLWindow2_AddRef(&This->outer_window->base.IHTMLWindow2_iface); + *pomWindowResult = (IDispatch*)&This->window->base.outer_window->base.IHTMLWindow2_iface; + IHTMLWindow2_AddRef(&This->window->base.outer_window->base.IHTMLWindow2_iface); return S_OK; }
diff --git a/dlls/mshtml/tests/navigation.js b/dlls/mshtml/tests/navigation.js index bc24fa646d3..23bca192f2d 100644 --- a/dlls/mshtml/tests/navigation.js +++ b/dlls/mshtml/tests/navigation.js @@ -126,6 +126,7 @@ function detached_iframe_doc() { expect_exception(function() { origDoc.readyState; }, true); expect_exception(function() { origDoc.URL; }); expect_exception(function() { origDoc.URL = "blank.html"; }); + expect_exception(function() { origDoc.open("blank.html", "_self"); });
next_test(); });
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);
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmldoc.c | 6 ++++-- dlls/mshtml/tests/navigation.js | 1 + 2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index a8edc3d0251..bc3782d54cc 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -6089,10 +6089,12 @@ static HRESULT HTMLDocumentNode_location_hook(DispatchEx *dispex, WORD flags, DI { HTMLDocumentNode *This = impl_from_DispatchEx(dispex);
- if(!(flags & DISPATCH_PROPERTYPUT) || !This->outer_window) + if(!(flags & DISPATCH_PROPERTYPUT) || !This->window) return S_FALSE; + if(!This->window->base.outer_window) + return E_FAIL;
- return IDispatchEx_InvokeEx(&This->outer_window->base.IDispatchEx_iface, DISPID_IHTMLWINDOW2_LOCATION, + return IDispatchEx_InvokeEx(&This->window->base.outer_window->base.IDispatchEx_iface, DISPID_IHTMLWINDOW2_LOCATION, 0, flags, dp, res, ei, caller); }
diff --git a/dlls/mshtml/tests/navigation.js b/dlls/mshtml/tests/navigation.js index 59ca6ce948b..2b32903abdb 100644 --- a/dlls/mshtml/tests/navigation.js +++ b/dlls/mshtml/tests/navigation.js @@ -124,6 +124,7 @@ function detached_iframe_doc() { expect_exception(function() { origDoc.documentElement; }); expect_exception(function() { origDoc.domain; }); expect_exception(function() { origDoc.frames; }); + expect_exception(function() { origDoc.location = "blank.html"; }); expect_exception(function() { origDoc.readyState; }, true); expect_exception(function() { origDoc.URL; }); expect_exception(function() { origDoc.URL = "blank.html"; });
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmlanchor.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/htmlanchor.c b/dlls/mshtml/htmlanchor.c index 5398f87ce55..b3bdd3584d7 100644 --- a/dlls/mshtml/htmlanchor.c +++ b/dlls/mshtml/htmlanchor.c @@ -48,12 +48,15 @@ static HRESULT navigate_href_new_window(HTMLElement *element, nsAString *href_st IUri *uri; HRESULT hres;
+ if(!element->node.doc->window->base.outer_window) + return S_OK; + nsAString_GetData(href_str, &href); - hres = create_relative_uri(element->node.doc->outer_window, href, &uri); + hres = create_relative_uri(element->node.doc->window->base.outer_window, href, &uri); if(FAILED(hres)) return hres;
- hres = navigate_new_window(element->node.doc->outer_window, uri, target, NULL, NULL); + hres = navigate_new_window(element->node.doc->window->base.outer_window, uri, target, NULL, NULL); IUri_Release(uri); return hres; } @@ -110,7 +113,10 @@ static HRESULT navigate_href(HTMLElement *element, nsAString *href_str, nsAStrin const PRUnichar *href; HRESULT hres;
- window = get_target_window(element->node.doc->outer_window, target_str, &use_new_window); + if(!element->node.doc->window->base.outer_window) + return S_OK; + + window = get_target_window(element->node.doc->window->base.outer_window, target_str, &use_new_window); if(!window) { if(use_new_window) { const PRUnichar *target;
From: Gabriel Ivăncescu gabrielopcode@gmail.com
We can't rely on dom_interactive_time either because setup_edit_mode loads (and sets it uninitialized).
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/editor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/editor.c b/dlls/mshtml/editor.c index e4a16956e46..69fcf6f3968 100644 --- a/dlls/mshtml/editor.c +++ b/dlls/mshtml/editor.c @@ -146,7 +146,7 @@ static DWORD query_ns_edit_status(HTMLDocumentNode *doc, const char *nscmd) nsICommandParams *nsparam; cpp_bool b = FALSE;
- if(doc->browser->usermode != EDITMODE || doc->outer_window->readystate < READYSTATE_INTERACTIVE) + if(doc->browser->usermode != EDITMODE || doc->browser->content_window->readystate < READYSTATE_INTERACTIVE) return OLECMDF_SUPPORTED;
if(nscmd) { @@ -180,7 +180,7 @@ static DWORD query_align_status(HTMLDocumentNode *doc, const WCHAR *align) cpp_bool b; nsresult nsres;
- if(doc->browser->usermode != EDITMODE || doc->outer_window->readystate < READYSTATE_INTERACTIVE) + if(doc->browser->usermode != EDITMODE || doc->browser->content_window->readystate < READYSTATE_INTERACTIVE) return OLECMDF_SUPPORTED;
if(!doc->html_document) { @@ -669,7 +669,7 @@ static HRESULT query_justify(HTMLDocumentNode *doc, OLECMD *cmd) case IDM_JUSTIFYLEFT: TRACE("(%p) IDM_JUSTIFYLEFT\n", doc); /* FIXME: We should set OLECMDF_LATCHED only if it's set explicitly. */ - if(doc->browser->usermode != EDITMODE || doc->outer_window->readystate < READYSTATE_INTERACTIVE) + if(doc->browser->usermode != EDITMODE || doc->browser->content_window->readystate < READYSTATE_INTERACTIVE) cmd->cmdf = OLECMDF_SUPPORTED; else cmd->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmldoc.c | 3 +-- dlls/mshtml/htmlframe.c | 6 +++--- dlls/mshtml/mshtml_private.h | 1 - dlls/mshtml/mutation.c | 2 +- dlls/mshtml/nsevents.c | 11 ++++++----- dlls/mshtml/olecmd.c | 4 ++-- dlls/mshtml/pluginhost.c | 4 ++-- dlls/mshtml/secmgr.c | 8 ++++---- 8 files changed, 19 insertions(+), 20 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index bc3782d54cc..a20472d22b8 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -4895,7 +4895,7 @@ static void HTMLDocumentNode_on_advise(IUnknown *iface, cp_static_data_t *cp) { HTMLDocumentNode *This = CONTAINING_RECORD((IHTMLDocument2*)iface, HTMLDocumentNode, IHTMLDocument2_iface);
- if(This->outer_window) + if(This->window && This->window->base.outer_window) update_doc_cp_events(This, cp); }
@@ -6208,7 +6208,6 @@ static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLInnerWindo doc->IDocumentRange_iface.lpVtbl = &DocumentRangeVtbl;
doc->doc_obj = doc_obj; - doc->outer_window = window ? window->base.outer_window : NULL; doc->window = window;
if(window) diff --git a/dlls/mshtml/htmlframe.c b/dlls/mshtml/htmlframe.c index 1a78dc3cc07..28bf42e2569 100644 --- a/dlls/mshtml/htmlframe.c +++ b/dlls/mshtml/htmlframe.c @@ -50,7 +50,7 @@ static HRESULT set_frame_doc(HTMLFrameBase *frame, nsIDOMDocument *nsdoc) window = mozwindow_to_window(mozwindow); if(!window && frame->element.node.doc->browser) { hres = create_outer_window(frame->element.node.doc->browser, mozwindow, - frame->element.node.doc->outer_window, &window); + frame->element.node.doc->window->base.outer_window, &window);
/* Don't hold ref to the created window; the parent keeps ref to it */ if(SUCCEEDED(hres)) @@ -132,7 +132,7 @@ static HRESULT WINAPI HTMLFrameBase_put_src(IHTMLFrameBase *iface, BSTR v)
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
- if(!This->content_window || !This->element.node.doc || !This->element.node.doc->outer_window) { + if(!This->content_window || !This->element.node.doc || !This->element.node.doc->window || !This->element.node.doc->window->base.outer_window) { nsAString nsstr; nsresult nsres;
@@ -150,7 +150,7 @@ static HRESULT WINAPI HTMLFrameBase_put_src(IHTMLFrameBase *iface, BSTR v) return S_OK; }
- return navigate_url(This->content_window, v, This->element.node.doc->outer_window->uri, BINDING_NAVIGATED); + return navigate_url(This->content_window, v, This->element.node.doc->window->base.outer_window->uri, BINDING_NAVIGATED); }
static HRESULT WINAPI HTMLFrameBase_get_src(IHTMLFrameBase *iface, BSTR *p) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 40dcb0ebfab..db37375c089 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -940,7 +940,6 @@ struct HTMLDocumentNode {
nsIDocumentObserver nsIDocumentObserver_iface; ConnectionPointContainer cp_container; - HTMLOuterWindow *outer_window; HTMLInnerWindow *window; HTMLDocumentObj *doc_obj;
diff --git a/dlls/mshtml/mutation.c b/dlls/mshtml/mutation.c index a1438debd6f..845c189f98b 100644 --- a/dlls/mshtml/mutation.c +++ b/dlls/mshtml/mutation.c @@ -314,7 +314,7 @@ static nsresult run_end_load(HTMLDocumentNode *This, nsISupports *arg1, nsISuppo
if(This->window == window) { window->dom_interactive_time = get_time_stamp(); - set_ready_state(This->outer_window, READYSTATE_INTERACTIVE); + set_ready_state(This->window->base.outer_window, READYSTATE_INTERACTIVE); } IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); return NS_OK; diff --git a/dlls/mshtml/nsevents.c b/dlls/mshtml/nsevents.c index 8c6631626d1..482d3196770 100644 --- a/dlls/mshtml/nsevents.c +++ b/dlls/mshtml/nsevents.c @@ -336,7 +336,7 @@ static nsresult handle_load(HTMLDocumentNode *doc, nsIDOMEvent *event)
TRACE("(%p)\n", doc);
- if(!doc->outer_window) + if(!doc->window || !doc->window->base.outer_window) return NS_ERROR_FAILURE; if(doc->doc_obj && doc->doc_obj->doc_node == doc) { doc_obj = doc->doc_obj; @@ -348,7 +348,8 @@ static nsresult handle_load(HTMLDocumentNode *doc, nsIDOMEvent *event) handle_docobj_load(doc_obj);
doc->window->dom_complete_time = get_time_stamp(); - set_ready_state(doc->outer_window, READYSTATE_COMPLETE); + if(doc->window->base.outer_window) + set_ready_state(doc->window->base.outer_window, READYSTATE_COMPLETE);
if(doc_obj) { if(doc_obj->view_sink) @@ -358,9 +359,9 @@ static nsresult handle_load(HTMLDocumentNode *doc, nsIDOMEvent *event)
update_title(doc_obj);
- if(doc_obj->doc_object_service && !(doc->outer_window->load_flags & BINDING_REFRESH)) + if(doc_obj->doc_object_service && doc->window->base.outer_window && !(doc->window->base.outer_window->load_flags & BINDING_REFRESH)) IDocObjectService_FireDocumentComplete(doc_obj->doc_object_service, - &doc->outer_window->base.IHTMLWindow2_iface, 0); + &doc->window->base.outer_window->base.IHTMLWindow2_iface, 0);
IUnknown_Release(doc_obj->outer_unk); } @@ -516,7 +517,7 @@ static nsIDOMEventTarget *get_default_document_target(HTMLDocumentNode *doc) nsISupports *target_iface; nsresult nsres;
- target_iface = doc->window ? (nsISupports*)doc->outer_window->nswindow : (nsISupports*)doc->dom_document; + target_iface = doc->window && doc->window->base.outer_window ? (nsISupports*)doc->window->base.outer_window->nswindow : (nsISupports*)doc->dom_document; nsres = nsISupports_QueryInterface(target_iface, &IID_nsIDOMEventTarget, (void**)&target); return NS_SUCCEEDED(nsres) ? target : NULL; } diff --git a/dlls/mshtml/olecmd.c b/dlls/mshtml/olecmd.c index 76ed84341cf..650c44c9d2b 100644 --- a/dlls/mshtml/olecmd.c +++ b/dlls/mshtml/olecmd.c @@ -490,10 +490,10 @@ static HRESULT exec_refresh(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *p } }
- if(!doc->outer_window) + if(!doc->window || !doc->window->base.outer_window) return E_UNEXPECTED;
- return reload_page(doc->outer_window); + return reload_page(doc->window->base.outer_window); }
static HRESULT exec_stop(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) diff --git a/dlls/mshtml/pluginhost.c b/dlls/mshtml/pluginhost.c index f910600de18..5f9e3588239 100644 --- a/dlls/mshtml/pluginhost.c +++ b/dlls/mshtml/pluginhost.c @@ -2227,12 +2227,12 @@ static HRESULT WINAPI PHServiceProvider_QueryService(IServiceProvider *iface, RE
TRACE("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
- if(!This->doc || !This->doc->outer_window) { + if(!This->doc || !This->doc->window || !This->doc->window->base.outer_window) { *ppv = NULL; return E_NOINTERFACE; }
- return IServiceProvider_QueryService(&This->doc->outer_window->base.IServiceProvider_iface, + return IServiceProvider_QueryService(&This->doc->window->base.outer_window->base.IServiceProvider_iface, guidService, riid, ppv); }
diff --git a/dlls/mshtml/secmgr.c b/dlls/mshtml/secmgr.c index 24c7ef2c817..ea53166f354 100644 --- a/dlls/mshtml/secmgr.c +++ b/dlls/mshtml/secmgr.c @@ -76,10 +76,10 @@ static HRESULT WINAPI InternetHostSecurityManager_ProcessUrlAction(IInternetHost
TRACE("(%p)->(%ld %p %ld %p %ld %lx %lx)\n", This, dwAction, pPolicy, cbPolicy, pContext, cbContext, dwFlags, dwReserved);
- if(!This->outer_window) + if(!This->window || !This->window->base.outer_window) return E_UNEXPECTED;
- url = This->outer_window->url ? This->outer_window->url : L"about:blank"; + url = This->window->base.outer_window->url ? This->window->base.outer_window->url : L"about:blank";
return IInternetSecurityManager_ProcessUrlAction(get_security_manager(), url, dwAction, pPolicy, cbPolicy, pContext, cbContext, dwFlags, dwReserved); @@ -181,10 +181,10 @@ static HRESULT WINAPI InternetHostSecurityManager_QueryCustomPolicy(IInternetHos
TRACE("(%p)->(%s %p %p %p %ld %lx)\n", This, debugstr_guid(guidKey), ppPolicy, pcbPolicy, pContext, cbContext, dwReserved);
- if(!This->outer_window) + if(!This->window || !This->window->base.outer_window) return E_UNEXPECTED;
- url = This->outer_window->url ? This->outer_window->url : L"about:blank"; + url = This->window->base.outer_window->url ? This->window->base.outer_window->url : L"about:blank";
hres = IInternetSecurityManager_QueryCustomPolicy(get_security_manager(), url, guidKey, ppPolicy, pcbPolicy, pContext, cbContext, dwReserved);
Jacek Caban (@jacek) commented about dlls/mshtml/editor.c:
nsICommandParams *nsparam; cpp_bool b = FALSE;
- if(doc->browser->usermode != EDITMODE || doc->outer_window->readystate < READYSTATE_INTERACTIVE)
- if(doc->browser->usermode != EDITMODE || doc->browser->content_window->readystate < READYSTATE_INTERACTIVE)
`browser->content_window` is not necessarily the same thing as `outer_window`, it will be different for iframes.
On Tue Dec 5 16:52:54 2023 +0000, Jacek Caban wrote:
`browser->content_window` is not necessarily the same thing as `outer_window`, it will be different for iframes.
I see, I thought as much but confused a bit with the edit mode check.
Do you have any suggestions? Basically, my dilemma is that checking for `dom_interactive_time` fails some tests in `htmldoc.c` because setup_edit_mode will set the readystate back to uninitialized, and then load the doc again, but the dom_interactive_time is kept the same and thus the tests will fail.
I don't understand how the setup_edit_mode thing works at all, mind explaining a bit? Should I just reset `dom_interactive_time` there to 0, or something else?
The thing is, based on my current knowledge of how the binding works, this creates a **new** document and this one gets detached, doesn't it? So checking for the readystate *of the new document* seems a bit… working by pure luck? Or I got it completely wrong.
On Tue Dec 5 17:04:02 2023 +0000, Gabriel Ivăncescu wrote:
I see, I thought as much but confused a bit with the edit mode check. Do you have any suggestions? Basically, my dilemma is that checking for `dom_interactive_time` fails some tests in `htmldoc.c` because setup_edit_mode will set the readystate back to uninitialized, and then load the doc again, but the dom_interactive_time is kept the same and thus the tests will fail. I don't understand how the setup_edit_mode thing works at all, mind explaining a bit? Should I just reset `dom_interactive_time` there to 0, or something else? The thing is, based on my current knowledge of how the binding works, this creates a **new** document and this one gets detached, doesn't it? So checking for the readystate *of the new document* seems a bit… working by pure luck? Or I got it completely wrong.
Yes, it may reload the page, which may change the underlying document. Note that callers will usually use HTMLDocumentObj to call those functions, so after reload it will simply be forwarded to the new document node. Returning `OLECMDF_SUPPORTED` when it's somehow called on a detached node seems good enough for now. (FWIW, looking at this, it already makes questionable assumptions about operating on the main document, let's just not make it worse).