From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com ---
Tested in next patch, as we'll need the command target for the script site. --- dlls/mshtml/htmlscript.h | 1 + dlls/mshtml/htmlwindow.c | 6 +++++- dlls/mshtml/script.c | 16 ++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/dlls/mshtml/htmlscript.h b/dlls/mshtml/htmlscript.h index f8760c134fe..837e9a4df62 100644 --- a/dlls/mshtml/htmlscript.h +++ b/dlls/mshtml/htmlscript.h @@ -39,6 +39,7 @@ HRESULT script_elem_from_nsscript(nsIDOMHTMLScriptElement*,HTMLScriptElement**); void bind_event_scripts(HTMLDocumentNode*); HRESULT load_script(HTMLScriptElement*,const WCHAR*,BOOL);
+void move_script_hosts(HTMLInnerWindow*,HTMLInnerWindow*); void release_script_hosts(HTMLInnerWindow*); void connect_scripts(HTMLInnerWindow*); void doc_insert_script(HTMLInnerWindow*,HTMLScriptElement*,BOOL); diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index fa99c453989..dd6c0bc5c5e 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -4547,8 +4547,12 @@ HRESULT update_window_doc(HTMLInnerWindow *window) return S_OK; }
- if(outer_window->base.inner_window) + if(outer_window->base.inner_window) { + if(!outer_window->base.inner_window->navigation_start_time && outer_window->browser->doc) + move_script_hosts(outer_window->base.inner_window, window); + detach_inner_window(outer_window->base.inner_window); + } outer_window->base.inner_window = window; outer_window->pending_window = NULL;
diff --git a/dlls/mshtml/script.c b/dlls/mshtml/script.c index cad0f17671a..b3eb99afa02 100644 --- a/dlls/mshtml/script.c +++ b/dlls/mshtml/script.c @@ -1780,6 +1780,22 @@ void update_browser_script_mode(GeckoBrowser *browser, IUri *uri) ERR("JavaScript setup failed: %08lx\n", nsres); }
+void move_script_hosts(HTMLInnerWindow *window, HTMLInnerWindow *new_window) +{ + ScriptHost *iter, *iter2; + + if(list_empty(&window->script_hosts)) + return; + + LIST_FOR_EACH_ENTRY_SAFE(iter, iter2, &window->script_hosts, ScriptHost, entry) { + iter->window = new_window; + list_remove(&iter->entry); + list_add_tail(&new_window->script_hosts, &iter->entry); + } + + lock_document_mode(new_window->doc); +} + void release_script_hosts(HTMLInnerWindow *window) { script_queue_entry_t *queue_iter;