The first few patches will introduce temporary leaks or cyclic refs, but that's because we'll handle them properly with the dispex CC, and the last patch should fix this. Other objects' traversal will follow in another MR.
-- v2: mshtml: Traverse inner windows. mshtml: Traverse variants using a helper function. mshtml: Implement Cycle Collection for dispex without traversal. mshtml: Implement Cycle Collection for outer windows. mshtml: Use unlink and destructor in the vtbl for HTMLLocation. mshtml: Separate the HTMLLocation from the outer window. mshtml: Use unlink and destructor in the vtbl for PerformanceTiming. mshtml: Move PerformanceTiming related fields to the window. mshtml: Move PerformanceNavigation related fields to the window. mshtml: Use ASCII strings for dispex object names.
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/dispex.c | 12 +++++------- dlls/mshtml/htmlanchor.c | 2 +- dlls/mshtml/htmlarea.c | 2 +- dlls/mshtml/htmlattr.c | 2 +- dlls/mshtml/htmlbody.c | 2 +- dlls/mshtml/htmlcomment.c | 2 +- dlls/mshtml/htmlcurstyle.c | 2 +- dlls/mshtml/htmldoc.c | 4 ++-- dlls/mshtml/htmlelem.c | 14 +++++++------- dlls/mshtml/htmlelemcol.c | 2 +- dlls/mshtml/htmlevent.c | 20 ++++++++++---------- dlls/mshtml/htmlform.c | 2 +- dlls/mshtml/htmlframe.c | 4 ++-- dlls/mshtml/htmlgeneric.c | 2 +- dlls/mshtml/htmlhead.c | 8 ++++---- dlls/mshtml/htmlimg.c | 4 ++-- dlls/mshtml/htmlinput.c | 6 +++--- dlls/mshtml/htmllink.c | 2 +- dlls/mshtml/htmllocation.c | 2 +- dlls/mshtml/htmlnode.c | 4 ++-- dlls/mshtml/htmlobject.c | 4 ++-- dlls/mshtml/htmlscript.c | 2 +- dlls/mshtml/htmlselect.c | 6 +++--- dlls/mshtml/htmlstorage.c | 2 +- dlls/mshtml/htmlstyle.c | 4 ++-- dlls/mshtml/htmlstyleelem.c | 2 +- dlls/mshtml/htmlstylesheet.c | 8 ++++---- dlls/mshtml/htmltable.c | 6 +++--- dlls/mshtml/htmltextarea.c | 2 +- dlls/mshtml/htmltextnode.c | 2 +- dlls/mshtml/htmlwindow.c | 2 +- dlls/mshtml/mshtml_private.h | 2 +- dlls/mshtml/mutation.c | 4 ++-- dlls/mshtml/omnavigator.c | 24 ++++++++++++------------ dlls/mshtml/range.c | 4 ++-- dlls/mshtml/selection.c | 2 +- dlls/mshtml/xmlhttprequest.c | 4 ++-- 37 files changed, 88 insertions(+), 90 deletions(-)
diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 6bd2c9cf6cb..5f1fb98ddab 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -917,7 +917,7 @@ static const dispex_static_data_vtbl_t function_dispex_vtbl = { static const tid_t function_iface_tids[] = {0};
static dispex_static_data_t function_dispex = { - L"Function", + "Function", &function_dispex_vtbl, NULL_tid, function_iface_tids @@ -1549,8 +1549,7 @@ HRESULT dispex_to_string(DispatchEx *dispex, BSTR *ret) static const WCHAR suffix[] = L"]"; WCHAR buf[ARRAY_SIZE(prefix) + 28 + ARRAY_SIZE(suffix)], *p = buf; compat_mode_t compat_mode = dispex_compat_mode(dispex); - const WCHAR *name = dispex->info->desc->name; - unsigned len; + const char *name = dispex->info->desc->name;
if(!ret) return E_INVALIDARG; @@ -1560,10 +1559,9 @@ HRESULT dispex_to_string(DispatchEx *dispex, BSTR *ret) if(compat_mode < COMPAT_MODE_IE9) p--; else { - len = wcslen(name); - assert(len <= 28); - memcpy(p, name, len * sizeof(WCHAR)); - p += len; + while(*name) + *p++ = *name++; + assert(p + ARRAY_SIZE(suffix) - buf <= ARRAY_SIZE(buf)); } memcpy(p, suffix, sizeof(suffix));
diff --git a/dlls/mshtml/htmlanchor.c b/dlls/mshtml/htmlanchor.c index 988daa5d255..9705c7722f5 100644 --- a/dlls/mshtml/htmlanchor.c +++ b/dlls/mshtml/htmlanchor.c @@ -895,7 +895,7 @@ static const tid_t HTMLAnchorElement_iface_tids[] = { };
static dispex_static_data_t HTMLAnchorElement_dispex = { - L"HTMLAnchorElement", + "HTMLAnchorElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLAnchorElement_tid, HTMLAnchorElement_iface_tids, diff --git a/dlls/mshtml/htmlarea.c b/dlls/mshtml/htmlarea.c index 2e4c92f8d4c..3f16f019c3f 100644 --- a/dlls/mshtml/htmlarea.c +++ b/dlls/mshtml/htmlarea.c @@ -502,7 +502,7 @@ static const tid_t HTMLAreaElement_iface_tids[] = { 0 }; static dispex_static_data_t HTMLAreaElement_dispex = { - L"HTMLAreaElement", + "HTMLAreaElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLAreaElement_tid, HTMLAreaElement_iface_tids, diff --git a/dlls/mshtml/htmlattr.c b/dlls/mshtml/htmlattr.c index c99e39a47bd..112c03cb0b5 100644 --- a/dlls/mshtml/htmlattr.c +++ b/dlls/mshtml/htmlattr.c @@ -506,7 +506,7 @@ static const tid_t HTMLDOMAttribute_iface_tids[] = { 0 }; static dispex_static_data_t HTMLDOMAttribute_dispex = { - L"Attr", + "Attr", &HTMLDOMAttribute_dispex_vtbl, DispHTMLDOMAttribute_tid, HTMLDOMAttribute_iface_tids diff --git a/dlls/mshtml/htmlbody.c b/dlls/mshtml/htmlbody.c index 867aec39fc2..72a6366872b 100644 --- a/dlls/mshtml/htmlbody.c +++ b/dlls/mshtml/htmlbody.c @@ -1004,7 +1004,7 @@ static const tid_t HTMLBodyElement_iface_tids[] = { };
static dispex_static_data_t HTMLBodyElement_dispex = { - L"HTMLBodyElement", + "HTMLBodyElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLBody_tid, HTMLBodyElement_iface_tids, diff --git a/dlls/mshtml/htmlcomment.c b/dlls/mshtml/htmlcomment.c index 705d84f4367..6af08f25af8 100644 --- a/dlls/mshtml/htmlcomment.c +++ b/dlls/mshtml/htmlcomment.c @@ -200,7 +200,7 @@ static const tid_t HTMLCommentElement_iface_tids[] = { 0 }; static dispex_static_data_t HTMLCommentElement_dispex = { - L"Comment", + "Comment", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLCommentElement_tid, HTMLCommentElement_iface_tids, diff --git a/dlls/mshtml/htmlcurstyle.c b/dlls/mshtml/htmlcurstyle.c index c7a9a3c086d..8b16e97f357 100644 --- a/dlls/mshtml/htmlcurstyle.c +++ b/dlls/mshtml/htmlcurstyle.c @@ -1300,7 +1300,7 @@ static const tid_t HTMLCurrentStyle_iface_tids[] = { 0 }; static dispex_static_data_t HTMLCurrentStyle_dispex = { - L"MSCurrentStyleCSSProperties", + "MSCurrentStyleCSSProperties", &CSSStyle_dispex_vtbl, DispHTMLCurrentStyle_tid, HTMLCurrentStyle_iface_tids, diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 23b0064c9a6..d4761db77aa 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -386,7 +386,7 @@ static const tid_t DocumentType_iface_tids[] = { };
static dispex_static_data_t DocumentType_dispex = { - L"DocumentType", + "DocumentType", &DocumentType_event_target_vtbl.dispex_vtbl, DispDOMDocumentType_tid, DocumentType_iface_tids @@ -6180,7 +6180,7 @@ static void HTMLDocumentNode_init_dispex_info(dispex_data_t *info, compat_mode_t }
static dispex_static_data_t HTMLDocumentNode_dispex = { - L"HTMLDocument", + "HTMLDocument", &HTMLDocumentNode_event_target_vtbl.dispex_vtbl, DispHTMLDocument_tid, HTMLDocumentNode_iface_tids, diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 91316a8f237..838f4a2ae66 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -870,7 +870,7 @@ static const tid_t HTMLRect_iface_tids[] = { 0 }; static dispex_static_data_t HTMLRect_dispex = { - L"ClientRect", + "ClientRect", &HTMLRect_dispex_vtbl, IHTMLRect_tid, HTMLRect_iface_tids, @@ -1308,7 +1308,7 @@ static const tid_t HTMLRectCollection_iface_tids[] = { 0 }; static dispex_static_data_t HTMLRectCollection_dispex = { - L"ClientRectList", + "ClientRectList", &HTMLRectCollection_dispex_vtbl, IHTMLRectCollection_tid, HTMLRectCollection_iface_tids @@ -7847,7 +7847,7 @@ static const tid_t token_list_iface_tids[] = { 0 }; static dispex_static_data_t token_list_dispex = { - L"DOMTokenList", + "DOMTokenList", &token_list_dispex_vtbl, IWineDOMTokenList_tid, token_list_iface_tids @@ -7958,7 +7958,7 @@ static const IWineHTMLElementPrivateVtbl WineHTMLElementPrivateVtbl = { };
static dispex_static_data_t HTMLElement_dispex = { - L"HTMLElement", + "HTMLElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLUnknownElement_tid, HTMLElement_iface_tids, @@ -7966,7 +7966,7 @@ static dispex_static_data_t HTMLElement_dispex = { };
static dispex_static_data_t HTMLUnknownElement_dispex = { - L"HTMLUnknownElement", + "HTMLUnknownElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLUnknownElement_tid, HTMLElement_iface_tids, @@ -8275,7 +8275,7 @@ static const tid_t HTMLFiltersCollection_iface_tids[] = { 0 }; static dispex_static_data_t HTMLFiltersCollection_dispex = { - L"FiltersCollection", + "FiltersCollection", &HTMLFiltersCollection_dispex_vtbl, IHTMLFiltersCollection_tid, HTMLFiltersCollection_iface_tids @@ -9045,7 +9045,7 @@ static const tid_t HTMLAttributeCollection_iface_tids[] = { };
static dispex_static_data_t HTMLAttributeCollection_dispex = { - L"NamedNodeMap", + "NamedNodeMap", &HTMLAttributeCollection_dispex_vtbl, DispHTMLAttributeCollection_tid, HTMLAttributeCollection_iface_tids diff --git a/dlls/mshtml/htmlelemcol.c b/dlls/mshtml/htmlelemcol.c index 178ccde9b4d..79dd59fca91 100644 --- a/dlls/mshtml/htmlelemcol.c +++ b/dlls/mshtml/htmlelemcol.c @@ -648,7 +648,7 @@ static const tid_t HTMLElementCollection_iface_tids[] = { };
static dispex_static_data_t HTMLElementCollection_dispex = { - L"HTMLCollection", + "HTMLCollection", &HTMLElementColection_dispex_vtbl, DispHTMLElementCollection_tid, HTMLElementCollection_iface_tids diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index 6b5ea716a75..41c8b36e941 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -900,7 +900,7 @@ static const tid_t HTMLEventObj_iface_tids[] = { };
static dispex_static_data_t HTMLEventObj_dispex = { - L"MSEventObj", + "MSEventObj", &HTMLEventObj_dispex_vtbl, DispCEventObj_tid, HTMLEventObj_iface_tids @@ -2975,7 +2975,7 @@ static const tid_t DOMEvent_iface_tids[] = { };
static dispex_static_data_t DOMEvent_dispex = { - L"Event", + "Event", &DOMEvent_dispex_vtbl, DispDOMEvent_tid, DOMEvent_iface_tids @@ -2993,7 +2993,7 @@ static const tid_t DOMUIEvent_iface_tids[] = { };
static dispex_static_data_t DOMUIEvent_dispex = { - L"UIEvent", + "UIEvent", &DOMUIEvent_dispex_vtbl, DispDOMUIEvent_tid, DOMUIEvent_iface_tids @@ -3012,7 +3012,7 @@ static const tid_t DOMMouseEvent_iface_tids[] = { };
static dispex_static_data_t DOMMouseEvent_dispex = { - L"MouseEvent", + "MouseEvent", &DOMMouseEvent_dispex_vtbl, DispDOMMouseEvent_tid, DOMMouseEvent_iface_tids @@ -3031,7 +3031,7 @@ static const tid_t DOMKeyboardEvent_iface_tids[] = { };
static dispex_static_data_t DOMKeyboardEvent_dispex = { - L"KeyboardEvent", + "KeyboardEvent", &DOMKeyboardEvent_dispex_vtbl, DispDOMKeyboardEvent_tid, DOMKeyboardEvent_iface_tids @@ -3044,7 +3044,7 @@ static void DOMPageTransitionEvent_init_dispex_info(dispex_data_t *info, compat_ }
static dispex_static_data_t DOMPageTransitionEvent_dispex = { - L"PageTransitionEvent", + "PageTransitionEvent", &DOMEvent_dispex_vtbl, DispDOMEvent_tid, DOMEvent_iface_tids, @@ -3063,7 +3063,7 @@ static const tid_t DOMCustomEvent_iface_tids[] = { };
static dispex_static_data_t DOMCustomEvent_dispex = { - L"CustomEvent", + "CustomEvent", &DOMCustomEvent_dispex_vtbl, DispDOMCustomEvent_tid, DOMCustomEvent_iface_tids @@ -3080,7 +3080,7 @@ static const tid_t DOMMessageEvent_iface_tids[] = { };
static dispex_static_data_t DOMMessageEvent_dispex = { - L"MessageEvent", + "MessageEvent", &DOMMessageEvent_dispex_vtbl, DispDOMMessageEvent_tid, DOMMessageEvent_iface_tids, @@ -3099,7 +3099,7 @@ static const tid_t DOMProgressEvent_iface_tids[] = { };
static dispex_static_data_t DOMProgressEvent_dispex = { - L"ProgressEvent", + "ProgressEvent", &DOMProgressEvent_dispex_vtbl, DispDOMProgressEvent_tid, DOMProgressEvent_iface_tids @@ -3117,7 +3117,7 @@ static const tid_t DOMStorageEvent_iface_tids[] = { };
static dispex_static_data_t DOMStorageEvent_dispex = { - L"StorageEvent", + "StorageEvent", &DOMStorageEvent_dispex_vtbl, DispDOMStorageEvent_tid, DOMStorageEvent_iface_tids diff --git a/dlls/mshtml/htmlform.c b/dlls/mshtml/htmlform.c index 78b06391a8f..7ecbbeca31b 100644 --- a/dlls/mshtml/htmlform.c +++ b/dlls/mshtml/htmlform.c @@ -1000,7 +1000,7 @@ static const tid_t HTMLFormElement_iface_tids[] = { };
static dispex_static_data_t HTMLFormElement_dispex = { - L"HTMLFormElement", + "HTMLFormElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLFormElement_tid, HTMLFormElement_iface_tids, diff --git a/dlls/mshtml/htmlframe.c b/dlls/mshtml/htmlframe.c index 126edc56181..c90ebe430dd 100644 --- a/dlls/mshtml/htmlframe.c +++ b/dlls/mshtml/htmlframe.c @@ -1036,7 +1036,7 @@ static const tid_t HTMLFrameElement_iface_tids[] = { };
static dispex_static_data_t HTMLFrameElement_dispex = { - L"HTMLFrameElement", + "HTMLFrameElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLFrameElement_tid, HTMLFrameElement_iface_tids, @@ -1625,7 +1625,7 @@ static const tid_t HTMLIFrame_iface_tids[] = { };
static dispex_static_data_t HTMLIFrame_dispex = { - L"HTMLIFrameElement", + "HTMLIFrameElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLIFrame_tid, HTMLIFrame_iface_tids, diff --git a/dlls/mshtml/htmlgeneric.c b/dlls/mshtml/htmlgeneric.c index 4666348fddb..450d49ff16c 100644 --- a/dlls/mshtml/htmlgeneric.c +++ b/dlls/mshtml/htmlgeneric.c @@ -169,7 +169,7 @@ static const tid_t HTMLGenericElement_iface_tids[] = { };
static dispex_static_data_t HTMLGenericElement_dispex = { - L"HTMLUnknownElement", + "HTMLUnknownElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLGenericElement_tid, HTMLGenericElement_iface_tids, diff --git a/dlls/mshtml/htmlhead.c b/dlls/mshtml/htmlhead.c index 1ef183338c7..92d90a6d5aa 100644 --- a/dlls/mshtml/htmlhead.c +++ b/dlls/mshtml/htmlhead.c @@ -184,7 +184,7 @@ static const tid_t HTMLTitleElement_iface_tids[] = { 0 }; static dispex_static_data_t HTMLTitleElement_dispex = { - L"HTMLTitleElement", + "HTMLTitleElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLTitleElement_tid, HTMLTitleElement_iface_tids, @@ -369,7 +369,7 @@ static const tid_t HTMLHtmlElement_iface_tids[] = { 0 }; static dispex_static_data_t HTMLHtmlElement_dispex = { - L"HTMLHtmlElement", + "HTMLHtmlElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLHtmlElement_tid, HTMLHtmlElement_iface_tids, @@ -606,7 +606,7 @@ static const tid_t HTMLMetaElement_iface_tids[] = { };
static dispex_static_data_t HTMLMetaElement_dispex = { - L"HTMLMetaElement", + "HTMLMetaElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLMetaElement_tid, HTMLMetaElement_iface_tids, @@ -770,7 +770,7 @@ static const tid_t HTMLHeadElement_iface_tids[] = { 0 }; static dispex_static_data_t HTMLHeadElement_dispex = { - L"HTMLHeadElement", + "HTMLHeadElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLHeadElement_tid, HTMLHeadElement_iface_tids, diff --git a/dlls/mshtml/htmlimg.c b/dlls/mshtml/htmlimg.c index cc091429500..aad4d1f6dfa 100644 --- a/dlls/mshtml/htmlimg.c +++ b/dlls/mshtml/htmlimg.c @@ -735,7 +735,7 @@ static void HTMLImgElement_init_dispex_info(dispex_data_t *info, compat_mode_t m }
static dispex_static_data_t HTMLImgElement_dispex = { - L"HTMLImageElement", + "HTMLImageElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLImg_tid, HTMLImgElement_iface_tids, @@ -988,7 +988,7 @@ static const dispex_static_data_vtbl_t HTMLImageElementFactory_dispex_vtbl = { };
static dispex_static_data_t HTMLImageElementFactory_dispex = { - L"Function", + "Function", &HTMLImageElementFactory_dispex_vtbl, IHTMLImageElementFactory_tid, HTMLImageElementFactory_iface_tids diff --git a/dlls/mshtml/htmlinput.c b/dlls/mshtml/htmlinput.c index 415b1aa7c59..68bdc62e0c7 100644 --- a/dlls/mshtml/htmlinput.c +++ b/dlls/mshtml/htmlinput.c @@ -1449,7 +1449,7 @@ static const tid_t HTMLInputElement_iface_tids[] = { 0 }; static dispex_static_data_t HTMLInputElement_dispex = { - L"HTMLInputElement", + "HTMLInputElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLInputElement_tid, HTMLInputElement_iface_tids, @@ -1646,7 +1646,7 @@ static const tid_t HTMLLabelElement_iface_tids[] = { };
static dispex_static_data_t HTMLLabelElement_dispex = { - L"HTMLLabelElement", + "HTMLLabelElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLLabelElement_tid, HTMLLabelElement_iface_tids, @@ -1988,7 +1988,7 @@ static const tid_t HTMLButtonElement_iface_tids[] = { };
static dispex_static_data_t HTMLButtonElement_dispex = { - L"HTMLButtonElement", + "HTMLButtonElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLButtonElement_tid, HTMLButtonElement_iface_tids, diff --git a/dlls/mshtml/htmllink.c b/dlls/mshtml/htmllink.c index 82dc9b6dbe1..6d15d9ee7ba 100644 --- a/dlls/mshtml/htmllink.c +++ b/dlls/mshtml/htmllink.c @@ -441,7 +441,7 @@ static const tid_t HTMLLinkElement_iface_tids[] = { 0 }; static dispex_static_data_t HTMLLinkElement_dispex = { - L"HTMLLinkElement", + "HTMLLinkElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLLinkElement_tid, HTMLLinkElement_iface_tids, diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c index d9e458d9c5f..1e340487f0b 100644 --- a/dlls/mshtml/htmllocation.c +++ b/dlls/mshtml/htmllocation.c @@ -612,7 +612,7 @@ static const tid_t HTMLLocation_iface_tids[] = { 0 }; static dispex_static_data_t HTMLLocation_dispex = { - L"Location", + "Location", NULL, DispHTMLLocation_tid, HTMLLocation_iface_tids diff --git a/dlls/mshtml/htmlnode.c b/dlls/mshtml/htmlnode.c index d412b570aec..337dc282fe6 100644 --- a/dlls/mshtml/htmlnode.c +++ b/dlls/mshtml/htmlnode.c @@ -458,7 +458,7 @@ static const tid_t HTMLDOMChildrenCollection_iface_tids[] = { };
static dispex_static_data_t HTMLDOMChildrenCollection_dispex = { - L"NodeList", + "NodeList", &HTMLDOMChildrenCollection_dispex_vtbl, DispDOMChildrenCollection_tid, HTMLDOMChildrenCollection_iface_tids, @@ -1512,7 +1512,7 @@ static const tid_t HTMLDOMNode_iface_tids[] = { 0 }; static dispex_static_data_t HTMLDOMNode_dispex = { - L"Node", + "Node", NULL, IHTMLDOMNode_tid, HTMLDOMNode_iface_tids, diff --git a/dlls/mshtml/htmlobject.c b/dlls/mshtml/htmlobject.c index f70da7bb8df..23858d39fbd 100644 --- a/dlls/mshtml/htmlobject.c +++ b/dlls/mshtml/htmlobject.c @@ -771,7 +771,7 @@ static const tid_t HTMLObjectElement_iface_tids[] = { 0 }; static dispex_static_data_t HTMLObjectElement_dispex = { - L"HTMLObjectElement", + "HTMLObjectElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLObjectElement_tid, HTMLObjectElement_iface_tids, @@ -1034,7 +1034,7 @@ static const tid_t HTMLEmbedElement_iface_tids[] = { 0 }; static dispex_static_data_t HTMLEmbedElement_dispex = { - L"HTMLEmbedElement", + "HTMLEmbedElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLEmbed_tid, HTMLEmbedElement_iface_tids, diff --git a/dlls/mshtml/htmlscript.c b/dlls/mshtml/htmlscript.c index b440224309f..6ce48362d96 100644 --- a/dlls/mshtml/htmlscript.c +++ b/dlls/mshtml/htmlscript.c @@ -474,7 +474,7 @@ static const tid_t HTMLScriptElement_iface_tids[] = { };
static dispex_static_data_t HTMLScriptElement_dispex = { - L"HTMLScriptElement", + "HTMLScriptElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLScriptElement_tid, HTMLScriptElement_iface_tids, diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c index b48805de64d..0a5905e6f1f 100644 --- a/dlls/mshtml/htmlselect.c +++ b/dlls/mshtml/htmlselect.c @@ -412,7 +412,7 @@ static const tid_t HTMLOptionElement_iface_tids[] = { 0 }; static dispex_static_data_t HTMLOptionElement_dispex = { - L"HTMLOptionElement", + "HTMLOptionElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLOptionElement_tid, HTMLOptionElement_iface_tids, @@ -642,7 +642,7 @@ static const dispex_static_data_vtbl_t HTMLOptionElementFactory_dispex_vtbl = { };
static dispex_static_data_t HTMLOptionElementFactory_dispex = { - L"Function", + "Function", &HTMLOptionElementFactory_dispex_vtbl, IHTMLOptionElementFactory_tid, HTMLOptionElementFactory_iface_tids, @@ -1489,7 +1489,7 @@ static const tid_t HTMLSelectElement_tids[] = { };
static dispex_static_data_t HTMLSelectElement_dispex = { - L"HTMLSelectElement", + "HTMLSelectElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLSelectElement_tid, HTMLSelectElement_tids, diff --git a/dlls/mshtml/htmlstorage.c b/dlls/mshtml/htmlstorage.c index cad2b2dbd32..77c8383680e 100644 --- a/dlls/mshtml/htmlstorage.c +++ b/dlls/mshtml/htmlstorage.c @@ -1328,7 +1328,7 @@ static const tid_t HTMLStorage_iface_tids[] = { 0 }; static dispex_static_data_t HTMLStorage_dispex = { - L"Storage", + "Storage", &HTMLStorage_dispex_vtbl, IHTMLStorage_tid, HTMLStorage_iface_tids diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c index b696a155fc2..16a1140f97d 100644 --- a/dlls/mshtml/htmlstyle.c +++ b/dlls/mshtml/htmlstyle.c @@ -10023,7 +10023,7 @@ static const tid_t HTMLStyle_iface_tids[] = { 0 }; static dispex_static_data_t HTMLStyle_dispex = { - L"MSStyleCSSProperties", + "MSStyleCSSProperties", &CSSStyle_dispex_vtbl, DispHTMLStyle_tid, HTMLStyle_iface_tids, @@ -10119,7 +10119,7 @@ static const tid_t HTMLW3CComputedStyle_iface_tids[] = { 0 }; static dispex_static_data_t HTMLW3CComputedStyle_dispex = { - L"CSSStyleDeclaration", + "CSSStyleDeclaration", &CSSStyle_dispex_vtbl, DispHTMLW3CComputedStyle_tid, HTMLW3CComputedStyle_iface_tids, diff --git a/dlls/mshtml/htmlstyleelem.c b/dlls/mshtml/htmlstyleelem.c index 4409f982343..ce13fc815ba 100644 --- a/dlls/mshtml/htmlstyleelem.c +++ b/dlls/mshtml/htmlstyleelem.c @@ -454,7 +454,7 @@ static const tid_t HTMLStyleElement_iface_tids[] = { 0 }; static dispex_static_data_t HTMLStyleElement_dispex = { - L"HTMLStyleElement", + "HTMLStyleElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLStyleElement_tid, HTMLStyleElement_iface_tids, diff --git a/dlls/mshtml/htmlstylesheet.c b/dlls/mshtml/htmlstylesheet.c index 010f3ef3f8c..8ce0f85b76e 100644 --- a/dlls/mshtml/htmlstylesheet.c +++ b/dlls/mshtml/htmlstylesheet.c @@ -229,7 +229,7 @@ static const tid_t HTMLStyleSheetRule_iface_tids[] = { 0 }; static dispex_static_data_t HTMLStyleSheetRule_dispex = { - L"CSSStyleRule", + "CSSStyleRule", &HTMLStyleSheetRule_dispex_vtbl, DispHTMLStyleSheetRule_tid, HTMLStyleSheetRule_iface_tids @@ -504,7 +504,7 @@ static const tid_t HTMLStyleSheetRulesCollection_iface_tids[] = { 0 }; static dispex_static_data_t HTMLStyleSheetRulesCollection_dispex = { - L"MSCSSRuleList", + "MSCSSRuleList", &HTMLStyleSheetRulesCollection_dispex_vtbl, DispHTMLStyleSheetRulesCollection_tid, HTMLStyleSheetRulesCollection_iface_tids @@ -941,7 +941,7 @@ static const tid_t HTMLStyleSheetsCollection_iface_tids[] = { 0 }; static dispex_static_data_t HTMLStyleSheetsCollection_dispex = { - L"StyleSheetList", + "StyleSheetList", &HTMLStyleSheetsCollection_dispex_vtbl, DispHTMLStyleSheetsCollection_tid, HTMLStyleSheetsCollection_iface_tids @@ -1529,7 +1529,7 @@ static const tid_t HTMLStyleSheet_iface_tids[] = { 0 }; static dispex_static_data_t HTMLStyleSheet_dispex = { - L"CSSStyleSheet", + "CSSStyleSheet", &HTMLStyleSheet_dispex_vtbl, DispHTMLStyleSheet_tid, HTMLStyleSheet_iface_tids, diff --git a/dlls/mshtml/htmltable.c b/dlls/mshtml/htmltable.c index cde97e5144c..a4b2b1f3621 100644 --- a/dlls/mshtml/htmltable.c +++ b/dlls/mshtml/htmltable.c @@ -516,7 +516,7 @@ static const tid_t HTMLTableCell_iface_tids[] = { };
static dispex_static_data_t HTMLTableCell_dispex = { - L"HTMLTableDataCellElement", + "HTMLTableDataCellElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLTableCell_tid, HTMLTableCell_iface_tids, @@ -956,7 +956,7 @@ static const tid_t HTMLTableRow_iface_tids[] = { };
static dispex_static_data_t HTMLTableRow_dispex = { - L"HTMLTableRowElement", + "HTMLTableRowElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLTableRow_tid, HTMLTableRow_iface_tids, @@ -1984,7 +1984,7 @@ static const tid_t HTMLTable_iface_tids[] = { };
static dispex_static_data_t HTMLTable_dispex = { - L"HTMLTableElement", + "HTMLTableElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLTable_tid, HTMLTable_iface_tids, diff --git a/dlls/mshtml/htmltextarea.c b/dlls/mshtml/htmltextarea.c index 6b40b630112..47be8be4281 100644 --- a/dlls/mshtml/htmltextarea.c +++ b/dlls/mshtml/htmltextarea.c @@ -475,7 +475,7 @@ static const tid_t HTMLTextAreaElement_iface_tids[] = { };
static dispex_static_data_t HTMLTextAreaElement_dispex = { - L"HTMLTextAreaElement", + "HTMLTextAreaElement", &HTMLElement_event_target_vtbl.dispex_vtbl, DispHTMLTextAreaElement_tid, HTMLTextAreaElement_iface_tids, diff --git a/dlls/mshtml/htmltextnode.c b/dlls/mshtml/htmltextnode.c index a09c0758452..af3f57044b8 100644 --- a/dlls/mshtml/htmltextnode.c +++ b/dlls/mshtml/htmltextnode.c @@ -366,7 +366,7 @@ static const tid_t HTMLDOMTextNode_iface_tids[] = { 0 }; static dispex_static_data_t HTMLDOMTextNode_dispex = { - L"Text", + "Text", NULL, DispHTMLDOMTextNode_tid, HTMLDOMTextNode_iface_tids, diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index a90a0da2dde..e668f8a5d2b 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -4065,7 +4065,7 @@ static const tid_t HTMLWindow_iface_tids[] = { };
static dispex_static_data_t HTMLWindow_dispex = { - L"Window", + "Window", &HTMLWindow_event_target_vtbl.dispex_vtbl, DispHTMLWindow2_tid, HTMLWindow_iface_tids, diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 6d57a314870..32ea4c9c9ea 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -371,7 +371,7 @@ typedef struct { } dispex_static_data_vtbl_t;
typedef struct { - const WCHAR *name; + const char *name; const dispex_static_data_vtbl_t *vtbl; const tid_t disp_tid; const tid_t* const iface_tids; diff --git a/dlls/mshtml/mutation.c b/dlls/mshtml/mutation.c index 13d0b757158..7890faa1b16 100644 --- a/dlls/mshtml/mutation.c +++ b/dlls/mshtml/mutation.c @@ -1237,7 +1237,7 @@ static const tid_t mutation_observer_iface_tids[] = { 0 }; static dispex_static_data_t mutation_observer_dispex = { - L"MutationObserver", + "MutationObserver", &mutation_observer_dispex_vtbl, IWineMSHTMLMutationObserver_tid, mutation_observer_iface_tids @@ -1398,7 +1398,7 @@ static const tid_t mutation_observer_ctor_iface_tids[] = { };
static dispex_static_data_t mutation_observer_ctor_dispex = { - L"Function", + "Function", &mutation_observer_ctor_dispex_vtbl, NULL_tid, mutation_observer_ctor_iface_tids diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index 2e098bf2d09..b40438361cc 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -323,7 +323,7 @@ static const tid_t HTMLDOMImplementation_iface_tids[] = { 0 }; static dispex_static_data_t HTMLDOMImplementation_dispex = { - L"DOMImplementation", + "DOMImplementation", &HTMLDOMImplementation_dispex_vtbl, DispHTMLDOMImplementation_tid, HTMLDOMImplementation_iface_tids, @@ -589,7 +589,7 @@ static const tid_t HTMLScreen_iface_tids[] = { 0 }; static dispex_static_data_t HTMLScreen_dispex = { - L"Screen", + "Screen", &HTMLScreen_dispex_vtbl, DispHTMLScreen_tid, HTMLScreen_iface_tids @@ -766,7 +766,7 @@ static const tid_t OmHistory_iface_tids[] = { 0 }; static dispex_static_data_t OmHistory_dispex = { - L"History", + "History", &OmHistory_dispex_vtbl, DispHTMLHistory_tid, OmHistory_iface_tids @@ -944,7 +944,7 @@ static const tid_t HTMLPluginsCollection_iface_tids[] = { 0 }; static dispex_static_data_t HTMLPluginsCollection_dispex = { - L"PluginArray", + "PluginArray", &HTMLPluginsCollection_dispex_vtbl, DispCPlugins_tid, HTMLPluginsCollection_iface_tids @@ -1110,7 +1110,7 @@ static const tid_t HTMLMimeTypesCollection_iface_tids[] = { 0 }; static dispex_static_data_t HTMLMimeTypesCollection_dispex = { - L"MimeTypeArray", + "MimeTypeArray", &HTMLMimeTypesCollection_dispex_vtbl, IHTMLMimeTypesCollection_tid, HTMLMimeTypesCollection_iface_tids @@ -1561,7 +1561,7 @@ static const tid_t OmNavigator_iface_tids[] = { 0 }; static dispex_static_data_t OmNavigator_dispex = { - L"Navigator", + "Navigator", &OmNavigator_dispex_vtbl, DispHTMLNavigator_tid, OmNavigator_iface_tids @@ -1961,7 +1961,7 @@ static const tid_t HTMLPerformanceTiming_iface_tids[] = { 0 }; static dispex_static_data_t HTMLPerformanceTiming_dispex = { - L"PerformanceTiming", + "PerformanceTiming", NULL, IHTMLPerformanceTiming_tid, HTMLPerformanceTiming_iface_tids @@ -2157,7 +2157,7 @@ static const tid_t HTMLPerformanceNavigation_iface_tids[] = { 0 }; static dispex_static_data_t HTMLPerformanceNavigation_dispex = { - L"PerformanceNavigation", + "PerformanceNavigation", &HTMLPerformanceNavigation_dispex_vtbl, IHTMLPerformanceNavigation_tid, HTMLPerformanceNavigation_iface_tids @@ -2359,7 +2359,7 @@ static const tid_t HTMLPerformance_iface_tids[] = { 0 }; static dispex_static_data_t HTMLPerformance_dispex = { - L"Performance", + "Performance", &HTMLPerformance_dispex_vtbl, IHTMLPerformance_tid, HTMLPerformance_iface_tids @@ -2538,7 +2538,7 @@ static const tid_t HTMLNamespaceCollection_iface_tids[] = { 0 }; static dispex_static_data_t HTMLNamespaceCollection_dispex = { - L"MSNamespaceInfoCollection", + "MSNamespaceInfoCollection", &HTMLNamespaceCollection_dispex_vtbl, DispHTMLNamespaceCollection_tid, HTMLNamespaceCollection_iface_tids @@ -2807,7 +2807,7 @@ static const tid_t console_iface_tids[] = { 0 }; static dispex_static_data_t console_dispex = { - L"Console", + "Console", &console_dispex_vtbl, IWineMSHTMLConsole_tid, console_iface_tids @@ -3151,7 +3151,7 @@ static const tid_t media_query_list_iface_tids[] = { 0 }; static dispex_static_data_t media_query_list_dispex = { - L"MediaQueryList", + "MediaQueryList", &media_query_list_dispex_vtbl, IWineMSHTMLMediaQueryList_tid, media_query_list_iface_tids diff --git a/dlls/mshtml/range.c b/dlls/mshtml/range.c index 562dbf35b49..e7234994933 100644 --- a/dlls/mshtml/range.c +++ b/dlls/mshtml/range.c @@ -1743,7 +1743,7 @@ static const tid_t HTMLTxtRange_iface_tids[] = { 0 }; static dispex_static_data_t HTMLTxtRange_dispex = { - L"TextRange", + "TextRange", &HTMLTxtRange_dispex_vtbl, IHTMLTxtRange_tid, HTMLTxtRange_iface_tids @@ -2107,7 +2107,7 @@ static const tid_t HTMLDOMRange_iface_tids[] = { };
static dispex_static_data_t HTMLDOMRange_dispex = { - L"Range", + "Range", &HTMLDOMRange_dispex_vtbl, DispHTMLDOMRange_tid, HTMLDOMRange_iface_tids diff --git a/dlls/mshtml/selection.c b/dlls/mshtml/selection.c index cc9c0acece6..3067b1a43b1 100644 --- a/dlls/mshtml/selection.c +++ b/dlls/mshtml/selection.c @@ -355,7 +355,7 @@ static const tid_t HTMLSelectionObject_iface_tids[] = { 0 }; static dispex_static_data_t HTMLSelectionObject_dispex = { - L"MSSelection", + "MSSelection", &HTMLSelectionObject_dispex_vtbl, IHTMLSelectionObject_tid, /* FIXME: We have a test for that, but it doesn't expose IHTMLSelectionObject2 iface. */ HTMLSelectionObject_iface_tids diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c index 75f52fb6c8e..417923cf444 100644 --- a/dlls/mshtml/xmlhttprequest.c +++ b/dlls/mshtml/xmlhttprequest.c @@ -1606,7 +1606,7 @@ static const tid_t HTMLXMLHttpRequest_iface_tids[] = { 0 }; static dispex_static_data_t HTMLXMLHttpRequest_dispex = { - L"XMLHttpRequest", + "XMLHttpRequest", &HTMLXMLHttpRequest_event_target_vtbl.dispex_vtbl, DispHTMLXMLHttpRequest_tid, HTMLXMLHttpRequest_iface_tids, @@ -1825,7 +1825,7 @@ static const tid_t HTMLXMLHttpRequestFactory_iface_tids[] = { 0 }; static dispex_static_data_t HTMLXMLHttpRequestFactory_dispex = { - L"Function", + "Function", &HTMLXMLHttpRequestFactory_dispex_vtbl, IHTMLXMLHttpRequestFactory_tid, HTMLXMLHttpRequestFactory_iface_tids
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/mshtml_private.h | 6 +++--- dlls/mshtml/navigate.c | 6 +++--- dlls/mshtml/omnavigator.c | 26 +++++++++++++++++--------- 3 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 32ea4c9c9ea..a259c470b0c 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -530,9 +530,6 @@ typedef struct {
LONG ref;
- ULONG navigation_type; - ULONG redirect_count; - ULONGLONG navigation_start_time; ULONGLONG unload_event_start_time; ULONGLONG unload_event_end_time; @@ -644,6 +641,9 @@ struct HTMLInnerWindow { IDispatch *mutation_observer_ctor; nsChannelBSC *bscallback; struct list bindings; + + ULONG navigation_type; + ULONG redirect_count; };
typedef enum { diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c index 3583fb91069..b13570f3ca3 100644 --- a/dlls/mshtml/navigate.c +++ b/dlls/mshtml/navigate.c @@ -1351,9 +1351,9 @@ static HRESULT nsChannelBSC_start_binding(BSCallback *bsc) DWORD flags = This->bsc.window->base.outer_window->load_flags;
if(flags & BINDING_FROMHIST) - This->bsc.window->performance_timing->navigation_type = 2; /* TYPE_BACK_FORWARD */ + This->bsc.window->navigation_type = 2; /* TYPE_BACK_FORWARD */ if(flags & BINDING_REFRESH) - This->bsc.window->performance_timing->navigation_type = 1; /* TYPE_RELOAD */ + This->bsc.window->navigation_type = 1; /* TYPE_RELOAD */
This->bsc.window->base.outer_window->base.inner_window->doc->skip_mutation_notif = FALSE; This->bsc.window->performance_timing->navigation_start_time = get_time_stamp(); @@ -1726,7 +1726,7 @@ static HRESULT nsChannelBSC_on_progress(BSCallback *bsc, ULONG progress, ULONG t break; case BINDSTATUS_REDIRECTING: if(This->is_doc_channel) { - This->bsc.window->performance_timing->redirect_count++; + This->bsc.window->redirect_count++; if(!This->bsc.window->performance_timing->redirect_time) This->bsc.window->performance_timing->redirect_time = get_time_stamp(); } diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index b40438361cc..f21a48079f7 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -1988,7 +1988,7 @@ typedef struct { IHTMLPerformanceNavigation IHTMLPerformanceNavigation_iface;
LONG ref; - HTMLPerformanceTiming *timing; + HTMLInnerWindow *window; } HTMLPerformanceNavigation;
static inline HTMLPerformanceNavigation *impl_from_IHTMLPerformanceNavigation(IHTMLPerformanceNavigation *iface) @@ -2082,7 +2082,7 @@ static HRESULT WINAPI HTMLPerformanceNavigation_get_type(IHTMLPerformanceNavigat
TRACE("(%p)->(%p)\n", This, p);
- *p = This->timing->navigation_type; + *p = This->window->navigation_type; return S_OK; }
@@ -2092,7 +2092,7 @@ static HRESULT WINAPI HTMLPerformanceNavigation_get_redirectCount(IHTMLPerforman
TRACE("(%p)->(%p)\n", This, p);
- *p = This->timing->redirect_count; + *p = This->window->redirect_count; return S_OK; }
@@ -2134,10 +2134,10 @@ static inline HTMLPerformanceNavigation *HTMLPerformanceNavigation_from_Dispatch static void HTMLPerformanceNavigation_unlink(DispatchEx *dispex) { HTMLPerformanceNavigation *This = HTMLPerformanceNavigation_from_DispatchEx(dispex); - if(This->timing) { - HTMLPerformanceTiming *timing = This->timing; - This->timing = NULL; - IHTMLPerformanceTiming_Release(&timing->IHTMLPerformanceTiming_iface); + if(This->window) { + HTMLInnerWindow *window = This->window; + This->window = NULL; + IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); } }
@@ -2169,6 +2169,7 @@ typedef struct {
LONG ref;
+ HTMLInnerWindow *window; IHTMLPerformanceNavigation *navigation; HTMLPerformanceTiming *timing; } HTMLPerformance; @@ -2274,8 +2275,8 @@ static HRESULT WINAPI HTMLPerformance_get_navigation(IHTMLPerformance *iface,
navigation->IHTMLPerformanceNavigation_iface.lpVtbl = &HTMLPerformanceNavigationVtbl; navigation->ref = 1; - navigation->timing = This->timing; - IHTMLPerformanceTiming_AddRef(&This->timing->IHTMLPerformanceTiming_iface); + navigation->window = This->window; + IHTMLWindow2_AddRef(&This->window->base.IHTMLWindow2_iface);
init_dispatch(&navigation->dispex, (IUnknown*)&navigation->IHTMLPerformanceNavigation_iface, &HTMLPerformanceNavigation_dispex, dispex_compat_mode(&This->dispex)); @@ -2335,6 +2336,11 @@ static inline HTMLPerformance *HTMLPerformance_from_DispatchEx(DispatchEx *iface static void HTMLPerformance_unlink(DispatchEx *dispex) { HTMLPerformance *This = HTMLPerformance_from_DispatchEx(dispex); + if(This->window) { + HTMLInnerWindow *window = This->window; + This->window = NULL; + IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); + } unlink_ref(&This->navigation); if(This->timing) { HTMLPerformanceTiming *timing = This->timing; @@ -2376,6 +2382,8 @@ HRESULT create_performance(HTMLInnerWindow *window, IHTMLPerformance **ret)
performance->IHTMLPerformance_iface.lpVtbl = &HTMLPerformanceVtbl; performance->ref = 1; + performance->window = window; + IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface);
init_dispatch(&performance->dispex, (IUnknown*)&performance->IHTMLPerformance_iface, &HTMLPerformance_dispex, compat_mode);
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmlwindow.c | 8 -- dlls/mshtml/mshtml_private.h | 43 +++++------ dlls/mshtml/mutation.c | 2 +- dlls/mshtml/navigate.c | 20 ++--- dlls/mshtml/nsevents.c | 25 +++---- dlls/mshtml/omnavigator.c | 138 ++++++++++++++++++----------------- dlls/mshtml/view.c | 4 +- 7 files changed, 111 insertions(+), 129 deletions(-)
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index e668f8a5d2b..d139cc51fd7 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -3776,7 +3776,6 @@ static void HTMLWindow_unlink(DispatchEx *dispex) This->local_storage = NULL; IHTMLStorage_Release(local_storage); } - IHTMLPerformanceTiming_Release(&This->performance_timing->IHTMLPerformanceTiming_iface); unlink_variant(&This->performance); }
@@ -4102,18 +4101,11 @@ static void *alloc_window(size_t size) static HRESULT create_inner_window(HTMLOuterWindow *outer_window, IMoniker *mon, HTMLInnerWindow **ret) { HTMLInnerWindow *window; - HRESULT hres;
window = alloc_window(sizeof(HTMLInnerWindow)); if(!window) return E_OUTOFMEMORY;
- hres = create_performance_timing(&window->performance_timing); - if(FAILED(hres)) { - free(window); - return hres; - } - list_init(&window->children); list_init(&window->script_hosts); list_init(&window->bindings); diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index a259c470b0c..9aa36f3d30f 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -524,30 +524,6 @@ typedef struct { HTMLInnerWindow *window; } OmHistory;
-typedef struct { - DispatchEx dispex; - IHTMLPerformanceTiming IHTMLPerformanceTiming_iface; - - LONG ref; - - ULONGLONG navigation_start_time; - ULONGLONG unload_event_start_time; - ULONGLONG unload_event_end_time; - ULONGLONG redirect_time; - ULONGLONG dns_lookup_time; - ULONGLONG connect_time; - ULONGLONG request_time; - ULONGLONG response_start_time; - ULONGLONG response_end_time; - ULONGLONG dom_interactive_time; - ULONGLONG dom_complete_time; - ULONGLONG dom_content_loaded_event_start_time; - ULONGLONG dom_content_loaded_event_end_time; - ULONGLONG load_event_start_time; - ULONGLONG load_event_end_time; - ULONGLONG first_paint_time; -} HTMLPerformanceTiming; - typedef struct nsChannelBSC nsChannelBSC;
struct HTMLWindow { @@ -625,7 +601,6 @@ struct HTMLInnerWindow {
BOOL performance_initialized; VARIANT performance; - HTMLPerformanceTiming *performance_timing;
unsigned blocking_depth; unsigned parser_callback_cnt; @@ -644,6 +619,23 @@ struct HTMLInnerWindow {
ULONG navigation_type; ULONG redirect_count; + + ULONGLONG navigation_start_time; + ULONGLONG unload_event_start_time; + ULONGLONG unload_event_end_time; + ULONGLONG redirect_time; + ULONGLONG dns_lookup_time; + ULONGLONG connect_time; + ULONGLONG request_time; + ULONGLONG response_start_time; + ULONGLONG response_end_time; + ULONGLONG dom_interactive_time; + ULONGLONG dom_complete_time; + ULONGLONG dom_content_loaded_event_start_time; + ULONGLONG dom_content_loaded_event_end_time; + ULONGLONG load_event_start_time; + ULONGLONG load_event_end_time; + ULONGLONG first_paint_time; };
typedef enum { @@ -1017,7 +1009,6 @@ void HTMLLocation_Init(HTMLLocation*); HRESULT create_navigator(compat_mode_t,IOmNavigator**); HRESULT create_html_screen(compat_mode_t,IHTMLScreen**); HRESULT create_performance(HTMLInnerWindow*,IHTMLPerformance**); -HRESULT create_performance_timing(HTMLPerformanceTiming**); HRESULT create_history(HTMLInnerWindow*,OmHistory**); HRESULT create_namespace_collection(compat_mode_t,IHTMLNamespaceCollection**); HRESULT create_dom_implementation(HTMLDocumentNode*,IHTMLDOMImplementation**); diff --git a/dlls/mshtml/mutation.c b/dlls/mshtml/mutation.c index 7890faa1b16..8df0211621e 100644 --- a/dlls/mshtml/mutation.c +++ b/dlls/mshtml/mutation.c @@ -313,7 +313,7 @@ static nsresult run_end_load(HTMLDocumentNode *This, nsISupports *arg1, nsISuppo bind_event_scripts(This);
if(This->window == window) { - window->performance_timing->dom_interactive_time = get_time_stamp(); + window->dom_interactive_time = get_time_stamp(); set_ready_state(This->outer_window, READYSTATE_INTERACTIVE); } IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c index b13570f3ca3..8172abd8040 100644 --- a/dlls/mshtml/navigate.c +++ b/dlls/mshtml/navigate.c @@ -1095,7 +1095,7 @@ static HRESULT read_stream_data(nsChannelBSC *This, IStream *stream) IWinInetHttpInfo *wininet_info;
if(This->is_doc_channel) - This->bsc.window->performance_timing->response_start_time = get_time_stamp(); + This->bsc.window->response_start_time = get_time_stamp();
This->response_processed = TRUE; if(This->bsc.binding) { @@ -1356,7 +1356,7 @@ static HRESULT nsChannelBSC_start_binding(BSCallback *bsc) This->bsc.window->navigation_type = 1; /* TYPE_RELOAD */
This->bsc.window->base.outer_window->base.inner_window->doc->skip_mutation_notif = FALSE; - This->bsc.window->performance_timing->navigation_start_time = get_time_stamp(); + This->bsc.window->navigation_start_time = get_time_stamp(); }
return S_OK; @@ -1524,7 +1524,7 @@ static HRESULT nsChannelBSC_stop_binding(BSCallback *bsc, HRESULT result) nsChannelBSC *This = nsChannelBSC_from_BSCallback(bsc);
if(This->is_doc_channel && This->bsc.window) { - This->bsc.window->performance_timing->response_end_time = get_time_stamp(); + This->bsc.window->response_end_time = get_time_stamp(); if(result != E_ABORT) { if(FAILED(result)) handle_navigation_error(This, result); @@ -1727,21 +1727,21 @@ static HRESULT nsChannelBSC_on_progress(BSCallback *bsc, ULONG progress, ULONG t case BINDSTATUS_REDIRECTING: if(This->is_doc_channel) { This->bsc.window->redirect_count++; - if(!This->bsc.window->performance_timing->redirect_time) - This->bsc.window->performance_timing->redirect_time = get_time_stamp(); + if(!This->bsc.window->redirect_time) + This->bsc.window->redirect_time = get_time_stamp(); } return handle_redirect(This, status_text); case BINDSTATUS_FINDINGRESOURCE: - if(This->is_doc_channel && !This->bsc.window->performance_timing->dns_lookup_time) - This->bsc.window->performance_timing->dns_lookup_time = get_time_stamp(); + if(This->is_doc_channel && !This->bsc.window->dns_lookup_time) + This->bsc.window->dns_lookup_time = get_time_stamp(); break; case BINDSTATUS_CONNECTING: if(This->is_doc_channel) - This->bsc.window->performance_timing->connect_time = get_time_stamp(); + This->bsc.window->connect_time = get_time_stamp(); break; case BINDSTATUS_SENDINGREQUEST: if(This->is_doc_channel) - This->bsc.window->performance_timing->request_time = get_time_stamp(); + This->bsc.window->request_time = get_time_stamp(); break; case BINDSTATUS_BEGINDOWNLOADDATA: { IWinInetHttpInfo *http_info; @@ -1798,7 +1798,7 @@ static HRESULT nsChannelBSC_on_response(BSCallback *bsc, DWORD response_code, HRESULT hres;
if(This->is_doc_channel) - This->bsc.window->performance_timing->response_start_time = get_time_stamp(); + This->bsc.window->response_start_time = get_time_stamp();
This->response_processed = TRUE; This->nschannel->response_status = response_code; diff --git a/dlls/mshtml/nsevents.c b/dlls/mshtml/nsevents.c index 76a3f4ab4c6..78a54c83955 100644 --- a/dlls/mshtml/nsevents.c +++ b/dlls/mshtml/nsevents.c @@ -238,7 +238,7 @@ static nsresult handle_dom_content_loaded(HTMLDocumentNode *doc, nsIDOMEvent *ns HRESULT hres;
if(doc->window) - doc->window->performance_timing->dom_content_loaded_event_start_time = get_time_stamp(); + doc->window->dom_content_loaded_event_start_time = get_time_stamp();
hres = create_event_from_nsevent(nsevent, dispex_compat_mode(&doc->node.event_target.dispex), &event); if(SUCCEEDED(hres)) { @@ -247,7 +247,7 @@ static nsresult handle_dom_content_loaded(HTMLDocumentNode *doc, nsIDOMEvent *ns }
if(doc->window) - doc->window->performance_timing->dom_content_loaded_event_end_time = get_time_stamp(); + doc->window->dom_content_loaded_event_end_time = get_time_stamp();
return NS_OK; } @@ -345,7 +345,7 @@ static nsresult handle_load(HTMLDocumentNode *doc, nsIDOMEvent *event) if(doc_obj) handle_docobj_load(doc_obj);
- doc->window->performance_timing->dom_complete_time = get_time_stamp(); + doc->window->dom_complete_time = get_time_stamp(); set_ready_state(doc->outer_window, READYSTATE_COMPLETE);
if(doc_obj) { @@ -363,7 +363,7 @@ static nsresult handle_load(HTMLDocumentNode *doc, nsIDOMEvent *event) IUnknown_Release(doc_obj->outer_unk); }
- doc->window->performance_timing->load_event_start_time = get_time_stamp(); + doc->window->load_event_start_time = get_time_stamp();
if(doc->dom_document) { hres = create_document_event(doc, EVENTID_LOAD, &load_event); @@ -381,7 +381,7 @@ static nsresult handle_load(HTMLDocumentNode *doc, nsIDOMEvent *event) IDOMEvent_Release(&load_event->IDOMEvent_iface); }
- doc->window->performance_timing->load_event_end_time = get_time_stamp(); + doc->window->load_event_end_time = get_time_stamp(); return NS_OK; }
@@ -406,8 +406,7 @@ static nsresult handle_beforeunload(HTMLDocumentNode *doc, nsIDOMEvent *nsevent)
static nsresult handle_unload(HTMLDocumentNode *doc, nsIDOMEvent *nsevent) { - HTMLPerformanceTiming *timing = NULL; - HTMLInnerWindow *window; + HTMLInnerWindow *window, *pending_window; DOMEvent *event; HRESULT hres;
@@ -415,11 +414,9 @@ static nsresult handle_unload(HTMLDocumentNode *doc, nsIDOMEvent *nsevent) return NS_OK; doc->unload_sent = TRUE;
- if(window->base.outer_window->pending_window) - timing = window->base.outer_window->pending_window->performance_timing; - - if(timing) - timing->unload_event_start_time = get_time_stamp(); + pending_window = window->base.outer_window->pending_window; + if(pending_window) + pending_window->unload_event_start_time = get_time_stamp();
hres = create_event_from_nsevent(nsevent, dispex_compat_mode(&doc->node.event_target.dispex), &event); if(SUCCEEDED(hres)) { @@ -427,8 +424,8 @@ static nsresult handle_unload(HTMLDocumentNode *doc, nsIDOMEvent *nsevent) IDOMEvent_Release(&event->IDOMEvent_iface); }
- if(timing) - timing->unload_event_end_time = get_time_stamp(); + if(pending_window) + pending_window->unload_event_end_time = get_time_stamp();
return NS_OK; } diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index f21a48079f7..73f382f0bbc 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -1584,6 +1584,14 @@ HRESULT create_navigator(compat_mode_t compat_mode, IOmNavigator **navigator) return S_OK; }
+typedef struct { + DispatchEx dispex; + IHTMLPerformanceTiming IHTMLPerformanceTiming_iface; + + LONG ref; + HTMLInnerWindow *window; +} HTMLPerformanceTiming; + static inline HTMLPerformanceTiming *impl_from_IHTMLPerformanceTiming(IHTMLPerformanceTiming *iface) { return CONTAINING_RECORD(iface, HTMLPerformanceTiming, IHTMLPerformanceTiming_iface); @@ -1629,8 +1637,8 @@ static ULONG WINAPI HTMLPerformanceTiming_Release(IHTMLPerformanceTiming *iface) TRACE("(%p) ref=%ld\n", This, ref);
if(!ref) { - if(This->dispex.outer) - release_dispex(&This->dispex); + IHTMLWindow2_Release(&This->window->base.IHTMLWindow2_iface); + release_dispex(&This->dispex); free(This); }
@@ -1674,20 +1682,22 @@ static HRESULT WINAPI HTMLPerformanceTiming_Invoke(IHTMLPerformanceTiming *iface
static ULONGLONG get_fetch_time(HTMLPerformanceTiming *This) { + HTMLInnerWindow *window = This->window; + /* If there's no prior doc unloaded and no redirects, fetch time == navigationStart time */ - if(!This->unload_event_end_time && !This->redirect_time) - return This->navigation_start_time; + if(!window->unload_event_end_time && !window->redirect_time) + return window->navigation_start_time;
- if(This->dns_lookup_time) - return This->dns_lookup_time; - if(This->connect_time) - return This->connect_time; - if(This->request_time) - return This->request_time; - if(This->unload_event_end_time) - return This->unload_event_end_time; + if(window->dns_lookup_time) + return window->dns_lookup_time; + if(window->connect_time) + return window->connect_time; + if(window->request_time) + return window->request_time; + if(window->unload_event_end_time) + return window->unload_event_end_time;
- return This->redirect_time; + return window->redirect_time; }
static HRESULT WINAPI HTMLPerformanceTiming_get_navigationStart(IHTMLPerformanceTiming *iface, ULONGLONG *p) @@ -1696,7 +1706,7 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_navigationStart(IHTMLPerformance
TRACE("(%p)->(%p)\n", This, p);
- *p = This->navigation_start_time; + *p = This->window->navigation_start_time; return S_OK; }
@@ -1706,7 +1716,7 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_unloadEventStart(IHTMLPerformanc
TRACE("(%p)->(%p)\n", This, p);
- *p = This->unload_event_start_time; + *p = This->window->unload_event_start_time; return S_OK; }
@@ -1716,7 +1726,7 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_unloadEventEnd(IHTMLPerformanceT
TRACE("(%p)->(%p)\n", This, p);
- *p = This->unload_event_end_time; + *p = This->window->unload_event_end_time; return S_OK; }
@@ -1726,7 +1736,7 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_redirectStart(IHTMLPerformanceTi
TRACE("(%p)->(%p)\n", This, p);
- *p = This->redirect_time; + *p = This->window->redirect_time; return S_OK; }
@@ -1736,7 +1746,7 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_redirectEnd(IHTMLPerformanceTimi
TRACE("(%p)->(%p)\n", This, p);
- *p = This->redirect_time ? get_fetch_time(This) : 0; + *p = This->window->redirect_time ? get_fetch_time(This) : 0; return S_OK; }
@@ -1756,7 +1766,7 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_domainLookupStart(IHTMLPerforman
TRACE("(%p)->(%p)\n", This, p);
- *p = This->dns_lookup_time ? This->dns_lookup_time : get_fetch_time(This); + *p = This->window->dns_lookup_time ? This->window->dns_lookup_time : get_fetch_time(This); return S_OK; }
@@ -1766,8 +1776,8 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_domainLookupEnd(IHTMLPerformance
TRACE("(%p)->(%p)\n", This, p);
- *p = This->connect_time ? This->connect_time : - This->dns_lookup_time ? This->dns_lookup_time : get_fetch_time(This); + *p = This->window->connect_time ? This->window->connect_time : + This->window->dns_lookup_time ? This->window->dns_lookup_time : get_fetch_time(This); return S_OK; }
@@ -1777,8 +1787,8 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_connectStart(IHTMLPerformanceTim
TRACE("(%p)->(%p)\n", This, p);
- *p = This->connect_time ? This->connect_time : - This->dns_lookup_time ? This->dns_lookup_time : get_fetch_time(This); + *p = This->window->connect_time ? This->window->connect_time : + This->window->dns_lookup_time ? This->window->dns_lookup_time : get_fetch_time(This); return S_OK; }
@@ -1788,9 +1798,9 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_connectEnd(IHTMLPerformanceTimin
TRACE("(%p)->(%p)\n", This, p);
- *p = This->request_time ? This->request_time : - This->connect_time ? This->connect_time : - This->dns_lookup_time ? This->dns_lookup_time : get_fetch_time(This); + *p = This->window->request_time ? This->window->request_time : + This->window->connect_time ? This->window->connect_time : + This->window->dns_lookup_time ? This->window->dns_lookup_time : get_fetch_time(This); return S_OK; }
@@ -1800,9 +1810,9 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_requestStart(IHTMLPerformanceTim
TRACE("(%p)->(%p)\n", This, p);
- *p = This->request_time ? This->request_time : - This->connect_time ? This->connect_time : - This->dns_lookup_time ? This->dns_lookup_time : get_fetch_time(This); + *p = This->window->request_time ? This->window->request_time : + This->window->connect_time ? This->window->connect_time : + This->window->dns_lookup_time ? This->window->dns_lookup_time : get_fetch_time(This); return S_OK; }
@@ -1812,7 +1822,7 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_responseStart(IHTMLPerformanceTi
TRACE("(%p)->(%p)\n", This, p);
- *p = This->response_start_time; + *p = This->window->response_start_time; return S_OK; }
@@ -1822,7 +1832,7 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_responseEnd(IHTMLPerformanceTimi
TRACE("(%p)->(%p)\n", This, p);
- *p = This->response_end_time; + *p = This->window->response_end_time; return S_OK; }
@@ -1833,7 +1843,7 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_domLoading(IHTMLPerformanceTimin TRACE("(%p)->(%p)\n", This, p);
/* Make sure this is after responseEnd, when the Gecko parser starts */ - *p = This->response_end_time; + *p = This->window->response_end_time; return S_OK; }
@@ -1843,7 +1853,7 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_domInteractive(IHTMLPerformanceT
TRACE("(%p)->(%p)\n", This, p);
- *p = This->dom_interactive_time; + *p = This->window->dom_interactive_time; return S_OK; }
@@ -1853,7 +1863,7 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_domContentLoadedEventStart(IHTML
TRACE("(%p)->(%p)\n", This, p);
- *p = This->dom_content_loaded_event_start_time; + *p = This->window->dom_content_loaded_event_start_time; return S_OK; }
@@ -1863,7 +1873,7 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_domContentLoadedEventEnd(IHTMLPe
TRACE("(%p)->(%p)\n", This, p);
- *p = This->dom_content_loaded_event_end_time; + *p = This->window->dom_content_loaded_event_end_time; return S_OK; }
@@ -1873,7 +1883,7 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_domComplete(IHTMLPerformanceTimi
TRACE("(%p)->(%p)\n", This, p);
- *p = This->dom_complete_time; + *p = This->window->dom_complete_time; return S_OK; }
@@ -1883,7 +1893,7 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_loadEventStart(IHTMLPerformanceT
TRACE("(%p)->(%p)\n", This, p);
- *p = This->load_event_start_time; + *p = This->window->load_event_start_time; return S_OK; }
@@ -1893,7 +1903,7 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_loadEventEnd(IHTMLPerformanceTim
TRACE("(%p)->(%p)\n", This, p);
- *p = This->load_event_end_time; + *p = This->window->load_event_end_time; return S_OK; }
@@ -1903,7 +1913,7 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_msFirstPaint(IHTMLPerformanceTim
TRACE("(%p)->(%p)\n", This, p);
- *p = This->first_paint_time; + *p = This->window->first_paint_time; return S_OK; }
@@ -1967,22 +1977,6 @@ static dispex_static_data_t HTMLPerformanceTiming_dispex = { HTMLPerformanceTiming_iface_tids };
-HRESULT create_performance_timing(HTMLPerformanceTiming **ret) -{ - HTMLPerformanceTiming *timing; - - timing = calloc(1, sizeof(*timing)); - if(!timing) - return E_OUTOFMEMORY; - - timing->IHTMLPerformanceTiming_iface.lpVtbl = &HTMLPerformanceTimingVtbl; - timing->ref = 1; - - /* Defer initializing the dispex until it's actually needed (for compat mode) */ - *ret = timing; - return S_OK; -} - typedef struct { DispatchEx dispex; IHTMLPerformanceNavigation IHTMLPerformanceNavigation_iface; @@ -2171,7 +2165,7 @@ typedef struct {
HTMLInnerWindow *window; IHTMLPerformanceNavigation *navigation; - HTMLPerformanceTiming *timing; + IHTMLPerformanceTiming *timing; } HTMLPerformance;
static inline HTMLPerformance *impl_from_IHTMLPerformance(IHTMLPerformance *iface) @@ -2294,7 +2288,25 @@ static HRESULT WINAPI HTMLPerformance_get_timing(IHTMLPerformance *iface, IHTMLP
TRACE("(%p)->(%p)\n", This, p);
- IHTMLPerformanceTiming_AddRef(*p = &This->timing->IHTMLPerformanceTiming_iface); + if(!This->timing) { + HTMLPerformanceTiming *timing; + + timing = calloc(1, sizeof(*timing)); + if(!timing) + return E_OUTOFMEMORY; + + timing->IHTMLPerformanceTiming_iface.lpVtbl = &HTMLPerformanceTimingVtbl; + timing->ref = 1; + timing->window = This->window; + IHTMLWindow2_AddRef(&This->window->base.IHTMLWindow2_iface); + + init_dispatch(&timing->dispex, (IUnknown*)&timing->IHTMLPerformanceTiming_iface, + &HTMLPerformanceTiming_dispex, dispex_compat_mode(&This->dispex)); + + This->timing = &timing->IHTMLPerformanceTiming_iface; + } + + IHTMLPerformanceTiming_AddRef(*p = This->timing); return S_OK; }
@@ -2342,11 +2354,7 @@ static void HTMLPerformance_unlink(DispatchEx *dispex) IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); } unlink_ref(&This->navigation); - if(This->timing) { - HTMLPerformanceTiming *timing = This->timing; - This->timing = NULL; - IHTMLPerformanceTiming_Release(&timing->IHTMLPerformanceTiming_iface); - } + unlink_ref(&This->timing); }
static void HTMLPerformance_destructor(DispatchEx *dispex) @@ -2388,12 +2396,6 @@ HRESULT create_performance(HTMLInnerWindow *window, IHTMLPerformance **ret) init_dispatch(&performance->dispex, (IUnknown*)&performance->IHTMLPerformance_iface, &HTMLPerformance_dispex, compat_mode);
- performance->timing = window->performance_timing; - IHTMLPerformanceTiming_AddRef(&performance->timing->IHTMLPerformanceTiming_iface); - - init_dispatch(&performance->timing->dispex, (IUnknown*)&performance->timing->IHTMLPerformanceTiming_iface, - &HTMLPerformanceTiming_dispex, compat_mode); - *ret = &performance->IHTMLPerformance_iface; return S_OK; } diff --git a/dlls/mshtml/view.c b/dlls/mshtml/view.c index 43ebc5284f5..fe7448ec0cf 100644 --- a/dlls/mshtml/view.c +++ b/dlls/mshtml/view.c @@ -50,8 +50,8 @@ static void paint_document(HTMLDocumentObj *This) RECT rect; HDC hdc;
- if(This->window && This->window->base.inner_window && !This->window->base.inner_window->performance_timing->first_paint_time) - This->window->base.inner_window->performance_timing->first_paint_time = get_time_stamp(); + if(This->window && This->window->base.inner_window && !This->window->base.inner_window->first_paint_time) + This->window->base.inner_window->first_paint_time = get_time_stamp();
GetClientRect(This->hwnd, &rect);
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/omnavigator.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-)
diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index 73f382f0bbc..ce96ab7f84e 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -1636,11 +1636,8 @@ static ULONG WINAPI HTMLPerformanceTiming_Release(IHTMLPerformanceTiming *iface)
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) { - IHTMLWindow2_Release(&This->window->base.IHTMLWindow2_iface); + if(!ref) release_dispex(&This->dispex); - free(This); - }
return ref; } @@ -1966,13 +1963,39 @@ static const IHTMLPerformanceTimingVtbl HTMLPerformanceTimingVtbl = { HTMLPerformanceTiming_toJSON };
+static inline HTMLPerformanceTiming *HTMLPerformanceTiming_from_DispatchEx(DispatchEx *iface) +{ + return CONTAINING_RECORD(iface, HTMLPerformanceTiming, dispex); +} + +static void HTMLPerformanceTiming_unlink(DispatchEx *dispex) +{ + HTMLPerformanceTiming *This = HTMLPerformanceTiming_from_DispatchEx(dispex); + if(This->window) { + HTMLInnerWindow *window = This->window; + This->window = NULL; + IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); + } +} + +static void HTMLPerformanceTiming_destructor(DispatchEx *dispex) +{ + HTMLPerformanceTiming *This = HTMLPerformanceTiming_from_DispatchEx(dispex); + free(This); +} + +static const dispex_static_data_vtbl_t HTMLPerformanceTiming_dispex_vtbl = { + HTMLPerformanceTiming_destructor, + HTMLPerformanceTiming_unlink +}; + static const tid_t HTMLPerformanceTiming_iface_tids[] = { IHTMLPerformanceTiming_tid, 0 }; static dispex_static_data_t HTMLPerformanceTiming_dispex = { "PerformanceTiming", - NULL, + &HTMLPerformanceTiming_dispex_vtbl, IHTMLPerformanceTiming_tid, HTMLPerformanceTiming_iface_tids };
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmllocation.c | 50 +++++++++++++++++++++++++----------- dlls/mshtml/htmlwindow.c | 32 +++++++++++++++-------- dlls/mshtml/mshtml_private.h | 8 ++++-- 3 files changed, 62 insertions(+), 28 deletions(-)
diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c index 1e340487f0b..5473ecebebb 100644 --- a/dlls/mshtml/htmllocation.c +++ b/dlls/mshtml/htmllocation.c @@ -36,19 +36,14 @@
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
-static inline HTMLOuterWindow *get_window(HTMLLocation *This) -{ - return CONTAINING_RECORD(This, HTMLOuterWindow, location); -} - static IUri *get_uri(HTMLLocation *This) { - return get_window(This)->uri; + return This->window->uri; }
static HRESULT get_url_components(HTMLLocation *This, URL_COMPONENTSW *url) { - const WCHAR *doc_url = get_window(This)->url ? get_window(This)->url : L"about:blank"; + const WCHAR *doc_url = This->window->url ? This->window->url : L"about:blank";
if(!InternetCrackUrlW(doc_url, 0, 0, url)) { FIXME("InternetCrackUrlW failed: 0x%08lx\n", GetLastError()); @@ -93,13 +88,27 @@ static HRESULT WINAPI HTMLLocation_QueryInterface(IHTMLLocation *iface, REFIID r static ULONG WINAPI HTMLLocation_AddRef(IHTMLLocation *iface) { HTMLLocation *This = impl_from_IHTMLLocation(iface); - return IHTMLWindow2_AddRef(&get_window(This)->base.IHTMLWindow2_iface); + LONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) ref=%ld\n", This, ref); + + return ref; }
static ULONG WINAPI HTMLLocation_Release(IHTMLLocation *iface) { HTMLLocation *This = impl_from_IHTMLLocation(iface); - return IHTMLWindow2_Release(&get_window(This)->base.IHTMLWindow2_iface); + LONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%ld\n", This, ref); + + if(!ref) { + IHTMLWindow2_Release(&This->window->base.IHTMLWindow2_iface); + release_dispex(&This->dispex); + free(This); + } + + return ref; }
static HRESULT WINAPI HTMLLocation_GetTypeInfoCount(IHTMLLocation *iface, UINT *pctinfo) @@ -139,7 +148,7 @@ static HRESULT WINAPI HTMLLocation_put_href(IHTMLLocation *iface, BSTR v)
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
- return navigate_url(get_window(This), v, get_uri(This), BINDING_NAVIGATED); + return navigate_url(This->window, v, get_uri(This), BINDING_NAVIGATED); }
static HRESULT WINAPI HTMLLocation_get_href(IHTMLLocation *iface, BSTR *p) @@ -500,7 +509,7 @@ static HRESULT WINAPI HTMLLocation_put_hash(IHTMLLocation *iface, BSTR v) memcpy(hash + 1, v, size - sizeof(WCHAR)); }
- hres = navigate_url(get_window(This), hash, get_uri(This), BINDING_NAVIGATED); + hres = navigate_url(This->window, hash, get_uri(This), BINDING_NAVIGATED);
if(hash != v) free(hash); @@ -544,12 +553,12 @@ static HRESULT WINAPI HTMLLocation_reload(IHTMLLocation *iface, VARIANT_BOOL fla TRACE("(%p)->(%x)\n", This, flag);
/* reload is supposed to fail if called from a script with different origin, but IE doesn't care */ - if(!is_main_content_window(get_window(This))) { + if(!is_main_content_window(This->window)) { FIXME("Unsupported on iframe\n"); return E_NOTIMPL; }
- return reload_page(get_window(This)); + return reload_page(This->window); }
static HRESULT WINAPI HTMLLocation_replace(IHTMLLocation *iface, BSTR bstr) @@ -558,7 +567,7 @@ static HRESULT WINAPI HTMLLocation_replace(IHTMLLocation *iface, BSTR bstr)
TRACE("(%p)->(%s)\n", This, debugstr_w(bstr));
- return navigate_url(get_window(This), bstr, get_uri(This), BINDING_NAVIGATED | BINDING_REPLACE); + return navigate_url(This->window, bstr, get_uri(This), BINDING_NAVIGATED | BINDING_REPLACE); }
static HRESULT WINAPI HTMLLocation_assign(IHTMLLocation *iface, BSTR bstr) @@ -618,10 +627,21 @@ static dispex_static_data_t HTMLLocation_dispex = { HTMLLocation_iface_tids };
-void HTMLLocation_Init(HTMLLocation *location) +HRESULT create_location(HTMLOuterWindow *window, HTMLLocation **ret) { + HTMLLocation *location; + + if(!(location = calloc(1, sizeof(*location)))) + return E_OUTOFMEMORY; + location->IHTMLLocation_iface.lpVtbl = &HTMLLocationVtbl; + location->ref = 1; + location->window = window; + IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface);
init_dispatch(&location->dispex, (IUnknown*)&location->IHTMLLocation_iface, &HTMLLocation_dispex, COMPAT_MODE_QUIRKS); + + *ret = location; + return S_OK; } diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index d139cc51fd7..a6b204881d2 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -67,13 +67,17 @@ static inline BOOL is_outer_window(HTMLWindow *window) return &window->outer_window->base == window; }
-static void get_location(HTMLOuterWindow *This, HTMLLocation **ret) +static HRESULT get_location(HTMLOuterWindow *This, HTMLLocation **ret) { - if(!This->location.dispex.outer) - HTMLLocation_Init(&This->location); + if(!This->location) { + HRESULT hres = create_location(This, &This->location); + if(FAILED(hres)) + return hres; + }
- IHTMLLocation_AddRef(&This->location.IHTMLLocation_iface); - *ret = &This->location; + IHTMLLocation_AddRef(&This->location->IHTMLLocation_iface); + *ret = This->location; + return S_OK; }
void get_top_window(HTMLOuterWindow *window, HTMLOuterWindow **ret) @@ -127,8 +131,8 @@ static void detach_inner_window(HTMLInnerWindow *window) if(doc) detach_document_node(doc);
- if(outer_window && outer_window->location.dispex.outer) - dispex_unlink(&outer_window->location.dispex); + if(outer_window && outer_window->location) + dispex_unlink(&outer_window->location->dispex);
abort_window_bindings(window); remove_target_tasks(window->task_magic); @@ -234,8 +238,8 @@ static void release_outer_window(HTMLOuterWindow *This) if(This->base.inner_window) detach_inner_window(This->base.inner_window);
- if(This->location.dispex.outer) - release_dispex(&This->location.dispex); + if(This->location) + IHTMLLocation_Release(&This->location->IHTMLLocation_iface);
if(This->frame_element) This->frame_element->content_window = NULL; @@ -737,10 +741,14 @@ static HRESULT WINAPI HTMLWindow2_get_location(IHTMLWindow2 *iface, IHTMLLocatio { HTMLWindow *This = impl_from_IHTMLWindow2(iface); HTMLLocation *location; + HRESULT hres;
TRACE("(%p)->(%p)\n", This, p);
- get_location(This->outer_window, &location); + hres = get_location(This->outer_window, &location); + if(FAILED(hres)) + return hres; + *p = &location->IHTMLLocation_iface; return S_OK; } @@ -3956,7 +3964,9 @@ static HRESULT IHTMLWindow2_location_hook(DispatchEx *dispex, WORD flags, DISPPA
TRACE("forwarding to location.href\n");
- get_location(This->base.outer_window, &location); + hres = get_location(This->base.outer_window, &location); + if(FAILED(hres)) + return hres;
hres = IDispatchEx_InvokeEx(&location->dispex.IDispatchEx_iface, DISPID_VALUE, 0, flags, dp, res, ei, caller); IHTMLLocation_Release(&location->IHTMLLocation_iface); diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 9aa36f3d30f..32ab0fa871a 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -513,6 +513,10 @@ typedef struct { struct HTMLLocation { DispatchEx dispex; IHTMLLocation IHTMLLocation_iface; + + LONG ref; + + HTMLOuterWindow *window; };
typedef struct { @@ -568,7 +572,7 @@ struct HTMLOuterWindow { BOOL readystate_pending;
HTMLInnerWindow *pending_window; - HTMLLocation location; + HTMLLocation *location; IMoniker *mon; IUri *uri; IUri *uri_nofrag; @@ -1005,7 +1009,7 @@ void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**); HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**); HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**); HRESULT HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow*,HTMLXMLHttpRequestFactory**); -void HTMLLocation_Init(HTMLLocation*); +HRESULT create_location(HTMLOuterWindow*,HTMLLocation**); HRESULT create_navigator(compat_mode_t,IOmNavigator**); HRESULT create_html_screen(compat_mode_t,IHTMLScreen**); HRESULT create_performance(HTMLInnerWindow*,IHTMLPerformance**);
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmllocation.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-)
diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c index 5473ecebebb..418c59ca308 100644 --- a/dlls/mshtml/htmllocation.c +++ b/dlls/mshtml/htmllocation.c @@ -102,11 +102,8 @@ static ULONG WINAPI HTMLLocation_Release(IHTMLLocation *iface)
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) { - IHTMLWindow2_Release(&This->window->base.IHTMLWindow2_iface); + if(!ref) release_dispex(&This->dispex); - free(This); - }
return ref; } @@ -616,13 +613,39 @@ static const IHTMLLocationVtbl HTMLLocationVtbl = { HTMLLocation_toString };
+static inline HTMLLocation *impl_from_DispatchEx(DispatchEx *iface) +{ + return CONTAINING_RECORD(iface, HTMLLocation, dispex); +} + +static void HTMLLocation_unlink(DispatchEx *dispex) +{ + HTMLLocation *This = impl_from_DispatchEx(dispex); + if(This->window) { + HTMLOuterWindow *window = This->window; + This->window = NULL; + IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); + } +} + +static void HTMLLocation_destructor(DispatchEx *dispex) +{ + HTMLLocation *This = impl_from_DispatchEx(dispex); + free(This); +} + +static const dispex_static_data_vtbl_t HTMLLocation_dispex_vtbl = { + HTMLLocation_destructor, + HTMLLocation_unlink +}; + static const tid_t HTMLLocation_iface_tids[] = { IHTMLLocation_tid, 0 }; static dispex_static_data_t HTMLLocation_dispex = { "Location", - NULL, + &HTMLLocation_dispex_vtbl, DispHTMLLocation_tid, HTMLLocation_iface_tids };
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmlwindow.c | 230 ++++++++++++++++++++++++++++------- dlls/mshtml/mshtml_private.h | 2 + dlls/mshtml/nsembed.c | 1 + dlls/mshtml/persist.c | 3 +- 4 files changed, 192 insertions(+), 44 deletions(-)
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index a6b204881d2..8a5ca5b441c 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -45,6 +45,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
+static ExternalCycleCollectionParticipant outer_window_ccp; + static int window_map_compare(const void *key, const struct wine_rb_entry *entry) { HTMLOuterWindow *window = WINE_RB_ENTRY_VALUE(entry, HTMLOuterWindow, entry); @@ -198,9 +200,12 @@ static HRESULT WINAPI HTMLWindow2_QueryInterface(IHTMLWindow2 *iface, REFIID rii *ppv = NULL; FIXME("(%p)->(IID_IMarshal %p)\n", This, ppv); return E_NOINTERFACE; - }else if(dispex_query_interface(&This->inner_window->event_target.dispex, riid, ppv)) { - assert(!*ppv); - return E_NOINTERFACE; + }else if(IsEqualGUID(&IID_nsXPCOMCycleCollectionParticipant, riid) && is_outer_window(This)) { + *ppv = &outer_window_ccp; + return S_OK; + }else if(IsEqualGUID(&IID_nsCycleCollectionISupports, riid) && is_outer_window(This)) { + *ppv = &This->IHTMLWindow2_iface; + return S_OK; }else { return EventTarget_QI(&This->inner_window->event_target, riid, ppv); } @@ -219,57 +224,36 @@ static ULONG WINAPI HTMLWindow2_AddRef(IHTMLWindow2 *iface) return ref; }
-static void release_outer_window(HTMLOuterWindow *This) +static ULONG WINAPI HTMLWindow2_Release(IHTMLWindow2 *iface) { - if(This->browser) { - list_remove(&This->browser_entry); - This->browser = NULL; - } + HTMLWindow *This = impl_from_IHTMLWindow2(iface); + LONG ref = InterlockedDecrement(&This->ref);
- if(This->pending_window) { - abort_window_bindings(This->pending_window); - This->pending_window->base.outer_window = NULL; - IHTMLWindow2_Release(&This->pending_window->base.IHTMLWindow2_iface); - } + TRACE("(%p) ref=%ld\n", This, ref);
- remove_target_tasks(This->task_magic); - set_current_mon(This, NULL, 0); - set_current_uri(This, NULL); - if(This->base.inner_window) - detach_inner_window(This->base.inner_window); + if(!ref) + release_dispex(&This->inner_window->event_target.dispex);
- if(This->location) - IHTMLLocation_Release(&This->location->IHTMLLocation_iface); + return ref; +}
- if(This->frame_element) - This->frame_element->content_window = NULL; +static ULONG WINAPI outer_window_AddRef(IHTMLWindow2 *iface) +{ + HTMLOuterWindow *This = impl_from_IHTMLWindow2(iface)->outer_window; + LONG ref = ccref_incr(&This->ccref, (nsISupports*)&This->base.IHTMLWindow2_iface);
- if(This->nswindow) - nsIDOMWindow_Release(This->nswindow); - if(This->window_proxy) - mozIDOMWindowProxy_Release(This->window_proxy); + TRACE("(%p) ref=%ld\n", This, ref);
- wine_rb_remove(&window_map, &This->entry); - free(This); + return ref; }
-static ULONG WINAPI HTMLWindow2_Release(IHTMLWindow2 *iface) +static ULONG WINAPI outer_window_Release(IHTMLWindow2 *iface) { - HTMLWindow *This = impl_from_IHTMLWindow2(iface); - LONG ref = InterlockedDecrement(&This->ref); + HTMLOuterWindow *This = impl_from_IHTMLWindow2(iface)->outer_window; + LONG ref = ccref_decr(&This->ccref, (nsISupports*)&This->base.IHTMLWindow2_iface, &outer_window_ccp);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) { - if (This->console) - IWineMSHTMLConsole_Release(This->console); - - if(is_outer_window(This)) - release_outer_window(This->outer_window); - else - release_dispex(&This->inner_window->event_target.dispex); - } - return ref; }
@@ -1559,6 +1543,86 @@ static const IHTMLWindow2Vtbl HTMLWindow2Vtbl = { HTMLWindow2_get_external };
+static const IHTMLWindow2Vtbl outer_window_HTMLWindow2Vtbl = { + HTMLWindow2_QueryInterface, + outer_window_AddRef, + outer_window_Release, + HTMLWindow2_GetTypeInfoCount, + HTMLWindow2_GetTypeInfo, + HTMLWindow2_GetIDsOfNames, + HTMLWindow2_Invoke, + HTMLWindow2_item, + HTMLWindow2_get_length, + HTMLWindow2_get_frames, + HTMLWindow2_put_defaultStatus, + HTMLWindow2_get_defaultStatus, + HTMLWindow2_put_status, + HTMLWindow2_get_status, + HTMLWindow2_setTimeout, + HTMLWindow2_clearTimeout, + HTMLWindow2_alert, + HTMLWindow2_confirm, + HTMLWindow2_prompt, + HTMLWindow2_get_Image, + HTMLWindow2_get_location, + HTMLWindow2_get_history, + HTMLWindow2_close, + HTMLWindow2_put_opener, + HTMLWindow2_get_opener, + HTMLWindow2_get_navigator, + HTMLWindow2_put_name, + HTMLWindow2_get_name, + HTMLWindow2_get_parent, + HTMLWindow2_open, + HTMLWindow2_get_self, + HTMLWindow2_get_top, + HTMLWindow2_get_window, + HTMLWindow2_navigate, + HTMLWindow2_put_onfocus, + HTMLWindow2_get_onfocus, + HTMLWindow2_put_onblur, + HTMLWindow2_get_onblur, + HTMLWindow2_put_onload, + HTMLWindow2_get_onload, + HTMLWindow2_put_onbeforeunload, + HTMLWindow2_get_onbeforeunload, + HTMLWindow2_put_onunload, + HTMLWindow2_get_onunload, + HTMLWindow2_put_onhelp, + HTMLWindow2_get_onhelp, + HTMLWindow2_put_onerror, + HTMLWindow2_get_onerror, + HTMLWindow2_put_onresize, + HTMLWindow2_get_onresize, + HTMLWindow2_put_onscroll, + HTMLWindow2_get_onscroll, + HTMLWindow2_get_document, + HTMLWindow2_get_event, + HTMLWindow2_get__newEnum, + HTMLWindow2_showModalDialog, + HTMLWindow2_showHelp, + HTMLWindow2_get_screen, + HTMLWindow2_get_Option, + HTMLWindow2_focus, + HTMLWindow2_get_closed, + HTMLWindow2_blur, + HTMLWindow2_scroll, + HTMLWindow2_get_clientInformation, + HTMLWindow2_setInterval, + HTMLWindow2_clearInterval, + HTMLWindow2_put_offscreenBuffering, + HTMLWindow2_get_offscreenBuffering, + HTMLWindow2_execScript, + HTMLWindow2_toString, + HTMLWindow2_scrollBy, + HTMLWindow2_scrollTo, + HTMLWindow2_moveTo, + HTMLWindow2_moveBy, + HTMLWindow2_resizeTo, + HTMLWindow2_resizeBy, + HTMLWindow2_get_external +}; + static inline HTMLWindow *impl_from_IHTMLWindow3(IHTMLWindow3 *iface) { return CONTAINING_RECORD(iface, HTMLWindow, IHTMLWindow3_iface); @@ -4081,6 +4145,84 @@ static dispex_static_data_t HTMLWindow_dispex = { HTMLWindow_init_dispex_info };
+static nsresult NSAPI outer_window_traverse(void *ccp, void *p, nsCycleCollectionTraversalCallback *cb) +{ + HTMLOuterWindow *window = impl_from_IHTMLWindow2(p)->outer_window; + + describe_cc_node(&window->ccref, "OuterWindow", cb); + + if(window->base.console) + note_cc_edge((nsISupports*)window->base.console, "console", cb); + if(window->pending_window) + note_cc_edge((nsISupports*)&window->pending_window->base.IHTMLWindow2_iface, "pending_window", cb); + if(window->base.inner_window) + note_cc_edge((nsISupports*)&window->base.inner_window->base.IHTMLWindow2_iface, "inner_window", cb); + if(window->location) + note_cc_edge((nsISupports*)&window->location->IHTMLLocation_iface, "location", cb); + if(window->nswindow) + note_cc_edge((nsISupports*)window->nswindow, "nswindow", cb); + if(window->window_proxy) + note_cc_edge((nsISupports*)window->window_proxy, "window_proxy", cb); + return NS_OK; +} + +static nsresult NSAPI outer_window_unlink(void *p) +{ + HTMLOuterWindow *window = impl_from_IHTMLWindow2(p)->outer_window; + + remove_target_tasks(window->task_magic); + unlink_ref(&window->base.console); + + if(window->browser) { + list_remove(&window->browser_entry); + window->browser = NULL; + } + if(window->pending_window) { + HTMLInnerWindow *pending_window = window->pending_window; + abort_window_bindings(pending_window); + pending_window->base.outer_window = NULL; + window->pending_window = NULL; + IHTMLWindow2_Release(&pending_window->base.IHTMLWindow2_iface); + } + + set_current_mon(window, NULL, 0); + set_current_uri(window, NULL); + if(window->base.inner_window) + detach_inner_window(window->base.inner_window); + if(window->location) { + HTMLLocation *location = window->location; + window->location = NULL; + IHTMLLocation_Release(&location->IHTMLLocation_iface); + } + if(window->frame_element) { + window->frame_element->content_window = NULL; + window->frame_element = NULL; + } + unlink_ref(&window->nswindow); + if(window->window_proxy) { + unlink_ref(&window->window_proxy); + wine_rb_remove(&window_map, &window->entry); + } + return NS_OK; +} + +static void NSAPI outer_window_delete_cycle_collectable(void *p) +{ + HTMLOuterWindow *window = impl_from_IHTMLWindow2(p)->outer_window; + outer_window_unlink(p); + free(window); +} + +void init_window_cc(void) +{ + static const CCObjCallback ccp_callback = { + outer_window_traverse, + outer_window_unlink, + outer_window_delete_cycle_collectable + }; + ccp_init(&outer_window_ccp, &ccp_callback); +} + static void *alloc_window(size_t size) { HTMLWindow *window; @@ -4089,7 +4231,6 @@ static void *alloc_window(size_t size) if(!window) return NULL;
- window->IHTMLWindow2_iface.lpVtbl = &HTMLWindow2Vtbl; window->IHTMLWindow3_iface.lpVtbl = &HTMLWindow3Vtbl; window->IHTMLWindow4_iface.lpVtbl = &HTMLWindow4Vtbl; window->IHTMLWindow5_iface.lpVtbl = &HTMLWindow5Vtbl; @@ -4103,7 +4244,6 @@ static void *alloc_window(size_t size) window->IProvideMultipleClassInfo_iface.lpVtbl = &ProvideMultipleClassInfoVtbl; window->IWineHTMLWindowPrivate_iface.lpVtbl = &WineHTMLWindowPrivateVtbl; window->IWineHTMLWindowCompatPrivate_iface.lpVtbl = &WineHTMLWindowCompatPrivateVtbl; - window->ref = 1;
return window; } @@ -4115,6 +4255,7 @@ static HRESULT create_inner_window(HTMLOuterWindow *outer_window, IMoniker *mon, window = alloc_window(sizeof(HTMLInnerWindow)); if(!window) return E_OUTOFMEMORY; + window->base.IHTMLWindow2_iface.lpVtbl = &HTMLWindow2Vtbl;
list_init(&window->children); list_init(&window->script_hosts); @@ -4124,6 +4265,7 @@ static HRESULT create_inner_window(HTMLOuterWindow *outer_window, IMoniker *mon, window->base.outer_window = outer_window; window->base.inner_window = window;
+ window->base.ref = 1; EventTarget_Init(&window->event_target, (IUnknown*)&window->base.IHTMLWindow2_iface, &HTMLWindow_dispex, COMPAT_MODE_NONE);
@@ -4148,11 +4290,13 @@ HRESULT create_outer_window(GeckoBrowser *browser, mozIDOMWindowProxy *mozwindow window = alloc_window(sizeof(HTMLOuterWindow)); if(!window) return E_OUTOFMEMORY; + window->base.IHTMLWindow2_iface.lpVtbl = &outer_window_HTMLWindow2Vtbl;
window->base.outer_window = window; window->base.inner_window = NULL; window->browser = browser; list_add_head(&browser->outer_windows, &window->browser_entry); + ccref_init(&window->ccref, 1);
mozIDOMWindowProxy_AddRef(mozwindow); window->window_proxy = mozwindow; diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 32ab0fa871a..47d6f4421e2 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -557,6 +557,7 @@ struct HTMLWindow { struct HTMLOuterWindow { HTMLWindow base;
+ nsCycleCollectingAutoRefCnt ccref; LONG task_magic;
nsIDOMWindow *nswindow; @@ -1070,6 +1071,7 @@ BOOL is_gecko_path(const char*); void set_viewer_zoom(GeckoBrowser*,float); float get_viewer_zoom(GeckoBrowser*);
+void init_window_cc(void); void init_node_cc(void);
HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*); diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c index 21ddb3cb38f..61d4ec335b4 100644 --- a/dlls/mshtml/nsembed.c +++ b/dlls/mshtml/nsembed.c @@ -596,6 +596,7 @@ static BOOL init_xpcom(const PRUnichar *gre_path) ERR("NS_GetComponentRegistrar failed: %08lx\n", nsres); }
+ init_window_cc(); init_node_cc();
return TRUE; diff --git a/dlls/mshtml/persist.c b/dlls/mshtml/persist.c index bea2ab65750..dd79d85a1c5 100644 --- a/dlls/mshtml/persist.c +++ b/dlls/mshtml/persist.c @@ -466,7 +466,8 @@ static void notif_readystate(HTMLOuterWindow *window)
static void notif_readystate_proc(event_task_t *task) { - notif_readystate(task->window->base.outer_window); + if(task->window->base.outer_window) + notif_readystate(task->window->base.outer_window); }
static void notif_readystate_destr(event_task_t *task)
From: Gabriel Ivăncescu gabrielopcode@gmail.com
DOM Nodes don't make use of the destructor yet, so they are special case no-ops as temporary exceptions, because they still use their own mechanism which will change in the future.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/dispex.c | 64 ++++++++++++++------ dlls/mshtml/htmlattr.c | 8 +-- dlls/mshtml/htmldoc.c | 12 +++- dlls/mshtml/htmlelem.c | 55 +++++------------ dlls/mshtml/htmlelemcol.c | 10 +-- dlls/mshtml/htmlevent.c | 21 ++----- dlls/mshtml/htmlevent.h | 2 - dlls/mshtml/htmlimg.c | 8 +-- dlls/mshtml/htmllocation.c | 8 +-- dlls/mshtml/htmlnode.c | 25 ++++---- dlls/mshtml/htmlselect.c | 8 +-- dlls/mshtml/htmlstorage.c | 9 +-- dlls/mshtml/htmlstyle.c | 8 +-- dlls/mshtml/htmlstyle.h | 2 - dlls/mshtml/htmlstylesheet.c | 40 +++--------- dlls/mshtml/htmltextnode.c | 10 ++- dlls/mshtml/htmlwindow.c | 18 +++--- dlls/mshtml/mshtml_private.h | 53 ++++++++-------- dlls/mshtml/mutation.c | 19 ++---- dlls/mshtml/nsembed.c | 1 + dlls/mshtml/omnavigator.c | 114 ++++++++--------------------------- dlls/mshtml/range.c | 20 ++---- dlls/mshtml/selection.c | 10 +-- dlls/mshtml/xmlhttprequest.c | 18 +++--- 24 files changed, 196 insertions(+), 347 deletions(-)
diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 5f1fb98ddab..53aeba303a2 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -33,6 +33,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
#define MAX_ARGS 16
+ExternalCycleCollectionParticipant dispex_ccp; + static CRITICAL_SECTION cs_dispex_static_data; static CRITICAL_SECTION_DEBUG cs_dispex_static_data_dbg = { @@ -88,7 +90,6 @@ typedef struct { typedef struct { DispatchEx dispex; IUnknown IUnknown_iface; - LONG ref; DispatchEx *obj; func_info_t *info; } func_disp_t; @@ -812,7 +813,7 @@ static HRESULT WINAPI Function_QueryInterface(IUnknown *iface, REFIID riid, void static ULONG WINAPI Function_AddRef(IUnknown *iface) { func_disp_t *This = impl_from_IUnknown(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -822,13 +823,10 @@ static ULONG WINAPI Function_AddRef(IUnknown *iface) static ULONG WINAPI Function_Release(IUnknown *iface) { func_disp_t *This = impl_from_IUnknown(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -933,7 +931,6 @@ static func_disp_t *create_func_disp(DispatchEx *obj, func_info_t *info)
ret->IUnknown_iface.lpVtbl = &FunctionUnkVtbl; init_dispatch(&ret->dispex, &ret->IUnknown_iface, &function_dispex, dispex_compat_mode(obj)); - ret->ref = 1; ret->obj = obj; ret->info = info;
@@ -1979,7 +1976,13 @@ BOOL dispex_query_interface(DispatchEx *This, REFIID riid, void **ppv) *ppv = &This->IDispatchEx_iface; else if(IsEqualGUID(&IID_IDispatchEx, riid)) *ppv = &This->IDispatchEx_iface; - else if(IsEqualGUID(&IID_IDispatchJS, riid)) + else if(IsEqualGUID(&IID_nsXPCOMCycleCollectionParticipant, riid)) { + *ppv = &dispex_ccp; + return TRUE; + }else if(IsEqualGUID(&IID_nsCycleCollectionISupports, riid)) { + *ppv = &This->IDispatchEx_iface; + return TRUE; + }else if(IsEqualGUID(&IID_IDispatchJS, riid)) *ppv = NULL; else if(IsEqualGUID(&IID_UndocumentedScriptIface, riid)) *ppv = NULL; @@ -1995,12 +1998,15 @@ BOOL dispex_query_interface(DispatchEx *This, REFIID riid, void **ppv) return TRUE; }
-void dispex_traverse(DispatchEx *This, nsCycleCollectionTraversalCallback *cb) +static nsresult NSAPI dispex_traverse(void *ccp, void *p, nsCycleCollectionTraversalCallback *cb) { + DispatchEx *This = impl_from_IDispatchEx(p); dynamic_prop_t *prop;
+ describe_cc_node(&This->ccref, This->info->desc->name, cb); + if(!This->dynamic_data) - return; + return NS_OK;
for(prop = This->dynamic_data->props; prop < This->dynamic_data->props + This->dynamic_data->prop_cnt; prop++) { if(V_VT(&prop->var) == VT_DISPATCH) @@ -2018,9 +2024,11 @@ void dispex_traverse(DispatchEx *This, nsCycleCollectionTraversalCallback *cb) note_cc_edge((nsISupports*)V_DISPATCH(&iter->val), "func_val", cb); } } + + return NS_OK; }
-void dispex_unlink(DispatchEx *This) +void dispex_props_unlink(DispatchEx *This) { dynamic_prop_t *prop;
@@ -2048,16 +2056,23 @@ void dispex_unlink(DispatchEx *This) } }
-const void *dispex_get_vtbl(DispatchEx *dispex) +nsresult NSAPI dispex_unlink(void *p) { - return dispex->info->desc->vtbl; + DispatchEx *This = impl_from_IDispatchEx(p); + + if(This->info->desc->vtbl->unlink) + This->info->desc->vtbl->unlink(This); + + dispex_props_unlink(This); + return NS_OK; }
-void release_dispex(DispatchEx *This) +void NSAPI dispex_delete_cycle_collectable(void *p) { + DispatchEx *This = impl_from_IDispatchEx(p); dynamic_prop_t *prop;
- if(This->info->desc->vtbl && This->info->desc->vtbl->unlink) + if(This->info->desc->vtbl->unlink) This->info->desc->vtbl->unlink(This);
if(!This->dynamic_data) @@ -2087,8 +2102,22 @@ void release_dispex(DispatchEx *This) free(This->dynamic_data);
destructor: - if(This->info->desc->vtbl && This->info->desc->vtbl->destructor) - This->info->desc->vtbl->destructor(This); + This->info->desc->vtbl->destructor(This); +} + +void init_dispex_cc(void) +{ + static const CCObjCallback dispex_ccp_callback = { + dispex_traverse, + dispex_unlink, + dispex_delete_cycle_collectable + }; + ccp_init(&dispex_ccp, &dispex_ccp_callback); +} + +const void *dispex_get_vtbl(DispatchEx *dispex) +{ + return dispex->info->desc->vtbl; }
void init_dispatch(DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *data, compat_mode_t compat_mode) @@ -2098,6 +2127,7 @@ void init_dispatch(DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *da dispex->IDispatchEx_iface.lpVtbl = &DispatchExVtbl; dispex->outer = outer; dispex->dynamic_data = NULL; + ccref_init(&dispex->ccref, 1);
if(data->vtbl && data->vtbl->get_compat_mode) { /* delayed init */ diff --git a/dlls/mshtml/htmlattr.c b/dlls/mshtml/htmlattr.c index 112c03cb0b5..bb8a0b1e3f3 100644 --- a/dlls/mshtml/htmlattr.c +++ b/dlls/mshtml/htmlattr.c @@ -65,7 +65,7 @@ static HRESULT WINAPI HTMLDOMAttribute_QueryInterface(IHTMLDOMAttribute *iface, static ULONG WINAPI HTMLDOMAttribute_AddRef(IHTMLDOMAttribute *iface) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -75,13 +75,10 @@ static ULONG WINAPI HTMLDOMAttribute_AddRef(IHTMLDOMAttribute *iface) static ULONG WINAPI HTMLDOMAttribute_Release(IHTMLDOMAttribute *iface) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -529,7 +526,6 @@ HRESULT HTMLDOMAttribute_Create(const WCHAR *name, HTMLElement *elem, DISPID dis
ret->IHTMLDOMAttribute_iface.lpVtbl = &HTMLDOMAttributeVtbl; ret->IHTMLDOMAttribute2_iface.lpVtbl = &HTMLDOMAttribute2Vtbl; - ret->ref = 1; ret->dispid = dispid; ret->elem = elem;
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index d4761db77aa..e48b80efa79 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -295,6 +295,10 @@ static inline DocumentType *DocumentType_from_DispatchEx(DispatchEx *iface) return CONTAINING_RECORD(iface, DocumentType, node.event_target.dispex); }
+static void DocumentType_dispex_destructor(DispatchEx *dispex) +{ +} + static HRESULT DocumentType_QI(HTMLDOMNode *iface, REFIID riid, void **ppv) { DocumentType *This = DocumentType_from_HTMLDOMNode(iface); @@ -367,6 +371,7 @@ static IHTMLEventObj *DocumentType_set_current_event(DispatchEx *dispex, IHTMLEv
static event_target_vtbl_t DocumentType_event_target_vtbl = { { + DocumentType_dispex_destructor, NULL, }, DocumentType_get_gecko_target, @@ -5915,6 +5920,10 @@ static inline HTMLDocumentNode *impl_from_DispatchEx(DispatchEx *iface) return CONTAINING_RECORD(iface, HTMLDocumentNode, node.event_target.dispex); }
+static void HTMLDocumentNode_dispex_destructor(DispatchEx *dispex) +{ +} + static HRESULT HTMLDocumentNode_get_name(DispatchEx *dispex, DISPID id, BSTR *name) { HTMLDocumentNode *This = impl_from_DispatchEx(dispex); @@ -6086,7 +6095,7 @@ static HRESULT HTMLDocumentNode_location_hook(DispatchEx *dispex, WORD flags, DI
static const event_target_vtbl_t HTMLDocumentNode_event_target_vtbl = { { - NULL, + HTMLDocumentNode_dispex_destructor, NULL, NULL, NULL, @@ -6195,7 +6204,6 @@ static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLInnerWindo if(!doc) return NULL;
- doc->ref = 1; doc->IDispatchEx_iface.lpVtbl = &DocDispatchExVtbl; doc->IHTMLDocument2_iface.lpVtbl = &HTMLDocumentVtbl; doc->IHTMLDocument3_iface.lpVtbl = &HTMLDocument3Vtbl; diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 838f4a2ae66..902e4c9f3e7 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -339,8 +339,6 @@ typedef struct { DispatchEx dispex; IHTMLFiltersCollection IHTMLFiltersCollection_iface; - - LONG ref; } HTMLFiltersCollection;
static inline HTMLFiltersCollection *impl_from_IHTMLFiltersCollection(IHTMLFiltersCollection *iface) @@ -531,8 +529,6 @@ typedef struct { IHTMLRect IHTMLRect_iface; IHTMLRect2 IHTMLRect2_iface;
- LONG ref; - nsIDOMClientRect *nsrect; } HTMLRect;
@@ -568,7 +564,7 @@ static HRESULT WINAPI HTMLRect_QueryInterface(IHTMLRect *iface, REFIID riid, voi static ULONG WINAPI HTMLRect_AddRef(IHTMLRect *iface) { HTMLRect *This = impl_from_IHTMLRect(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -578,13 +574,10 @@ static ULONG WINAPI HTMLRect_AddRef(IHTMLRect *iface) static ULONG WINAPI HTMLRect_Release(IHTMLRect *iface) { HTMLRect *This = impl_from_IHTMLRect(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -887,7 +880,6 @@ static HRESULT create_html_rect(nsIDOMClientRect *nsrect, compat_mode_t compat_m
rect->IHTMLRect_iface.lpVtbl = &HTMLRectVtbl; rect->IHTMLRect2_iface.lpVtbl = &HTMLRect2Vtbl; - rect->ref = 1;
init_dispatch(&rect->dispex, (IUnknown*)&rect->IHTMLRect_iface, &HTMLRect_dispex, compat_mode);
@@ -902,8 +894,6 @@ typedef struct { DispatchEx dispex; IHTMLRectCollection IHTMLRectCollection_iface;
- LONG ref; - nsIDOMClientRectList *rect_list; } HTMLRectCollection;
@@ -1070,7 +1060,7 @@ static HRESULT WINAPI HTMLRectCollection_QueryInterface(IHTMLRectCollection *ifa static ULONG WINAPI HTMLRectCollection_AddRef(IHTMLRectCollection *iface) { HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -1080,13 +1070,10 @@ static ULONG WINAPI HTMLRectCollection_AddRef(IHTMLRectCollection *iface) static ULONG WINAPI HTMLRectCollection_Release(IHTMLRectCollection *iface) { HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -3327,7 +3314,6 @@ static HRESULT WINAPI HTMLElement2_getClientRects(IHTMLElement2 *iface, IHTMLRec }
rects->IHTMLRectCollection_iface.lpVtbl = &HTMLRectCollectionVtbl; - rects->ref = 1; rects->rect_list = rect_list; init_dispatch(&rects->dispex, (IUnknown*)&rects->IHTMLRectCollection_iface, &HTMLRectCollection_dispex, dispex_compat_mode(&This->node.event_target.dispex)); @@ -6961,6 +6947,10 @@ static inline HTMLElement *impl_from_DispatchEx(DispatchEx *iface) return CONTAINING_RECORD(iface, HTMLElement, node.event_target.dispex); }
+static void HTMLElement_dispex_destructor(DispatchEx *dispex) +{ +} + static HRESULT HTMLElement_get_dispid(DispatchEx *dispex, BSTR name, DWORD grfdex, DISPID *pid) { @@ -7356,7 +7346,7 @@ static const tid_t HTMLElement_iface_tids[] = {
const event_target_vtbl_t HTMLElement_event_target_vtbl = { { - NULL, + HTMLElement_dispex_destructor, NULL, NULL, HTMLElement_get_dispid, @@ -7379,8 +7369,6 @@ struct token_list { DispatchEx dispex; IWineDOMTokenList IWineDOMTokenList_iface; IHTMLElement *element; - - LONG ref; };
static inline struct token_list *impl_from_IWineDOMTokenList(IWineDOMTokenList *iface) @@ -7413,7 +7401,7 @@ static HRESULT WINAPI token_list_QueryInterface(IWineDOMTokenList *iface, REFIID static ULONG WINAPI token_list_AddRef(IWineDOMTokenList *iface) { struct token_list *token_list = impl_from_IWineDOMTokenList(iface); - LONG ref = InterlockedIncrement(&token_list->ref); + LONG ref = dispex_ccref_incr(&token_list->dispex);
TRACE("(%p) ref=%ld\n", token_list, ref);
@@ -7423,13 +7411,10 @@ static ULONG WINAPI token_list_AddRef(IWineDOMTokenList *iface) static ULONG WINAPI token_list_Release(IWineDOMTokenList *iface) { struct token_list *token_list = impl_from_IWineDOMTokenList(iface); - LONG ref = InterlockedDecrement(&token_list->ref); + LONG ref = dispex_ccref_decr(&token_list->dispex);
TRACE("(%p) ref=%ld\n", token_list, ref);
- if(!ref) - release_dispex(&token_list->dispex); - return ref; }
@@ -7865,7 +7850,6 @@ static HRESULT create_token_list(compat_mode_t compat_mode, IHTMLElement *elemen }
obj->IWineDOMTokenList_iface.lpVtbl = &WineDOMTokenListVtbl; - obj->ref = 1; init_dispatch(&obj->dispex, (IUnknown*)&obj->IWineDOMTokenList_iface, &token_list_dispex, compat_mode); IHTMLElement_AddRef(element); obj->element = element; @@ -8120,7 +8104,7 @@ static HRESULT WINAPI HTMLFiltersCollection_QueryInterface(IHTMLFiltersCollectio static ULONG WINAPI HTMLFiltersCollection_AddRef(IHTMLFiltersCollection *iface) { HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -8130,13 +8114,10 @@ static ULONG WINAPI HTMLFiltersCollection_AddRef(IHTMLFiltersCollection *iface) static ULONG WINAPI HTMLFiltersCollection_Release(IHTMLFiltersCollection *iface) { HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -8289,7 +8270,6 @@ static HRESULT create_filters_collection(compat_mode_t compat_mode, IHTMLFilters return E_OUTOFMEMORY;
collection->IHTMLFiltersCollection_iface.lpVtbl = &HTMLFiltersCollectionVtbl; - collection->ref = 1;
init_dispatch(&collection->dispex, (IUnknown*)&collection->IHTMLFiltersCollection_iface, &HTMLFiltersCollection_dispex, min(compat_mode, COMPAT_MODE_IE8)); @@ -8580,7 +8560,7 @@ static HRESULT WINAPI HTMLAttributeCollection_QueryInterface(IHTMLAttributeColle static ULONG WINAPI HTMLAttributeCollection_AddRef(IHTMLAttributeCollection *iface) { HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -8590,13 +8570,10 @@ static ULONG WINAPI HTMLAttributeCollection_AddRef(IHTMLAttributeCollection *ifa static ULONG WINAPI HTMLAttributeCollection_Release(IHTMLAttributeCollection *iface) { HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -9068,7 +9045,6 @@ HRESULT HTMLElement_get_attr_col(HTMLDOMNode *iface, HTMLAttributeCollection **a This->attrs->IHTMLAttributeCollection_iface.lpVtbl = &HTMLAttributeCollectionVtbl; This->attrs->IHTMLAttributeCollection2_iface.lpVtbl = &HTMLAttributeCollection2Vtbl; This->attrs->IHTMLAttributeCollection3_iface.lpVtbl = &HTMLAttributeCollection3Vtbl; - This->attrs->ref = 2;
This->attrs->elem = This; list_init(&This->attrs->attrs); @@ -9076,5 +9052,6 @@ HRESULT HTMLElement_get_attr_col(HTMLDOMNode *iface, HTMLAttributeCollection **a &HTMLAttributeCollection_dispex, dispex_compat_mode(&iface->event_target.dispex));
*ac = This->attrs; + IHTMLAttributeCollection_AddRef(&This->attrs->IHTMLAttributeCollection_iface); return S_OK; } diff --git a/dlls/mshtml/htmlelemcol.c b/dlls/mshtml/htmlelemcol.c index 79dd59fca91..c9448adbe09 100644 --- a/dlls/mshtml/htmlelemcol.c +++ b/dlls/mshtml/htmlelemcol.c @@ -37,8 +37,6 @@ typedef struct {
HTMLElement **elems; DWORD len; - - LONG ref; } HTMLElementCollection;
typedef struct { @@ -238,7 +236,7 @@ static HRESULT WINAPI HTMLElementCollection_QueryInterface(IHTMLElementCollectio static ULONG WINAPI HTMLElementCollection_AddRef(IHTMLElementCollection *iface) { HTMLElementCollection *This = impl_from_IHTMLElementCollection(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -248,13 +246,10 @@ static ULONG WINAPI HTMLElementCollection_AddRef(IHTMLElementCollection *iface) static ULONG WINAPI HTMLElementCollection_Release(IHTMLElementCollection *iface) { HTMLElementCollection *This = impl_from_IHTMLElementCollection(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -866,7 +861,6 @@ static IHTMLElementCollection *HTMLElementCollection_Create(HTMLElement **elems, return NULL;
ret->IHTMLElementCollection_iface.lpVtbl = &HTMLElementCollectionVtbl; - ret->ref = 1; ret->elems = elems; ret->len = len;
diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index 41c8b36e941..79dc58bb57d 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -335,8 +335,6 @@ typedef struct { DispatchEx dispex; IHTMLEventObj IHTMLEventObj_iface;
- LONG ref; - DOMEvent *event; VARIANT return_value; } HTMLEventObj; @@ -371,7 +369,7 @@ static HRESULT WINAPI HTMLEventObj_QueryInterface(IHTMLEventObj *iface, REFIID r static ULONG WINAPI HTMLEventObj_AddRef(IHTMLEventObj *iface) { HTMLEventObj *This = impl_from_IHTMLEventObj(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -381,13 +379,10 @@ static ULONG WINAPI HTMLEventObj_AddRef(IHTMLEventObj *iface) static ULONG WINAPI HTMLEventObj_Release(IHTMLEventObj *iface) { HTMLEventObj *This = impl_from_IHTMLEventObj(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -915,7 +910,6 @@ static HTMLEventObj *alloc_event_obj(DOMEvent *event, compat_mode_t compat_mode) return NULL;
event_obj->IHTMLEventObj_iface.lpVtbl = &HTMLEventObjVtbl; - event_obj->ref = 1; event_obj->event = event; if(event) IDOMEvent_AddRef(&event->IDOMEvent_iface); @@ -973,7 +967,7 @@ static HRESULT WINAPI DOMEvent_QueryInterface(IDOMEvent *iface, REFIID riid, voi static ULONG WINAPI DOMEvent_AddRef(IDOMEvent *iface) { DOMEvent *This = impl_from_IDOMEvent(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%lu\n", This, ref);
@@ -983,13 +977,10 @@ static ULONG WINAPI DOMEvent_AddRef(IDOMEvent *iface) static ULONG WINAPI DOMEvent_Release(IDOMEvent *iface) { DOMEvent *This = impl_from_IDOMEvent(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%lu\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -3132,7 +3123,6 @@ static void *event_ctor(unsigned size, dispex_static_data_t *dispex_data, void * return NULL; event->IDOMEvent_iface.lpVtbl = &DOMEventVtbl; event->query_interface = query_interface; - event->ref = 1; event->event_id = event_id; if(event_id != EVENTID_LAST) { event->type = wcsdup(event_info[event_id].name); @@ -4531,11 +4521,12 @@ void release_event_target(EventTarget *event_target) WINE_RB_FOR_EACH_ENTRY_DESTRUCTOR(iter, iter2, &event_target->handler_map, listener_container_t, entry) { while(!list_empty(&iter->listeners)) { event_listener_t *listener = LIST_ENTRY(list_head(&iter->listeners), event_listener_t, entry); + list_remove(&listener->entry); if(listener->function) IDispatch_Release(listener->function); - list_remove(&listener->entry); free(listener); } free(iter); } + rb_destroy(&event_target->handler_map, NULL, NULL); } diff --git a/dlls/mshtml/htmlevent.h b/dlls/mshtml/htmlevent.h index f6c7cbc381b..782ac5dd902 100644 --- a/dlls/mshtml/htmlevent.h +++ b/dlls/mshtml/htmlevent.h @@ -75,8 +75,6 @@ typedef enum { typedef struct DOMEvent { DispatchEx dispex; IDOMEvent IDOMEvent_iface; - - LONG ref; void *(*query_interface)(struct DOMEvent*,REFIID);
nsIDOMEvent *nsevent; diff --git a/dlls/mshtml/htmlimg.c b/dlls/mshtml/htmlimg.c index aad4d1f6dfa..fac0a56ab74 100644 --- a/dlls/mshtml/htmlimg.c +++ b/dlls/mshtml/htmlimg.c @@ -794,7 +794,7 @@ static HRESULT WINAPI HTMLImageElementFactory_QueryInterface(IHTMLImageElementFa static ULONG WINAPI HTMLImageElementFactory_AddRef(IHTMLImageElementFactory *iface) { HTMLImageElementFactory *This = impl_from_IHTMLImageElementFactory(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -804,13 +804,10 @@ static ULONG WINAPI HTMLImageElementFactory_AddRef(IHTMLImageElementFactory *ifa static ULONG WINAPI HTMLImageElementFactory_Release(IHTMLImageElementFactory *iface) { HTMLImageElementFactory *This = impl_from_IHTMLImageElementFactory(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -1003,7 +1000,6 @@ HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow *window, HTMLImageElement return E_OUTOFMEMORY;
ret->IHTMLImageElementFactory_iface.lpVtbl = &HTMLImageElementFactoryVtbl; - ret->ref = 1; ret->window = window;
init_dispatch(&ret->dispex, (IUnknown*)&ret->IHTMLImageElementFactory_iface, diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c index 418c59ca308..216ebf44d9a 100644 --- a/dlls/mshtml/htmllocation.c +++ b/dlls/mshtml/htmllocation.c @@ -88,7 +88,7 @@ static HRESULT WINAPI HTMLLocation_QueryInterface(IHTMLLocation *iface, REFIID r static ULONG WINAPI HTMLLocation_AddRef(IHTMLLocation *iface) { HTMLLocation *This = impl_from_IHTMLLocation(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -98,13 +98,10 @@ static ULONG WINAPI HTMLLocation_AddRef(IHTMLLocation *iface) static ULONG WINAPI HTMLLocation_Release(IHTMLLocation *iface) { HTMLLocation *This = impl_from_IHTMLLocation(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -658,7 +655,6 @@ HRESULT create_location(HTMLOuterWindow *window, HTMLLocation **ret) return E_OUTOFMEMORY;
location->IHTMLLocation_iface.lpVtbl = &HTMLLocationVtbl; - location->ref = 1; location->window = window; IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface);
diff --git a/dlls/mshtml/htmlnode.c b/dlls/mshtml/htmlnode.c index 337dc282fe6..ad292fbae90 100644 --- a/dlls/mshtml/htmlnode.c +++ b/dlls/mshtml/htmlnode.c @@ -41,8 +41,6 @@ typedef struct { DispatchEx dispex; IHTMLDOMChildrenCollection IHTMLDOMChildrenCollection_iface;
- LONG ref; - nsIDOMNodeList *nslist; } HTMLDOMChildrenCollection;
@@ -225,7 +223,7 @@ static HRESULT WINAPI HTMLDOMChildrenCollection_QueryInterface(IHTMLDOMChildrenC static ULONG WINAPI HTMLDOMChildrenCollection_AddRef(IHTMLDOMChildrenCollection *iface) { HTMLDOMChildrenCollection *This = impl_from_IHTMLDOMChildrenCollection(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -235,13 +233,10 @@ static ULONG WINAPI HTMLDOMChildrenCollection_AddRef(IHTMLDOMChildrenCollection static ULONG WINAPI HTMLDOMChildrenCollection_Release(IHTMLDOMChildrenCollection *iface) { HTMLDOMChildrenCollection *This = impl_from_IHTMLDOMChildrenCollection(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -473,7 +468,6 @@ HRESULT create_child_collection(nsIDOMNodeList *nslist, compat_mode_t compat_mod return E_OUTOFMEMORY;
collection->IHTMLDOMChildrenCollection_iface.lpVtbl = &HTMLDOMChildrenCollectionVtbl; - collection->ref = 1;
nsIDOMNodeList_AddRef(nslist); collection->nslist = nslist; @@ -1425,6 +1419,10 @@ static const IHTMLDOMNode3Vtbl HTMLDOMNode3Vtbl = { HTMLDOMNode3_isSupported };
+static void HTMLDOMNode_dispex_destructor(DispatchEx *dispex) +{ +} + HRESULT HTMLDOMNode_QI(HTMLDOMNode *This, REFIID riid, void **ppv) { TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv); @@ -1507,13 +1505,17 @@ void HTMLDOMNode_Init(HTMLDocumentNode *doc, HTMLDOMNode *node, nsIDOMNode *nsno assert(nsres == NS_OK); }
+static const dispex_static_data_vtbl_t HTMLDOMNode_dispex_vtbl = { + HTMLDOMNode_dispex_destructor, +}; + static const tid_t HTMLDOMNode_iface_tids[] = { IHTMLDOMNode_tid, 0 }; static dispex_static_data_t HTMLDOMNode_dispex = { "Node", - NULL, + &HTMLDOMNode_dispex_vtbl, IHTMLDOMNode_tid, HTMLDOMNode_iface_tids, HTMLDOMNode_init_dispex_info @@ -1591,7 +1593,6 @@ static nsresult NSAPI HTMLDOMNode_traverse(void *ccp, void *p, nsCycleCollection note_cc_edge((nsISupports*)This->nsnode, "This->nsnode", cb); if(This->doc && &This->doc->node != This) note_cc_edge((nsISupports*)&This->doc->node.IHTMLDOMNode_iface, "This->doc", cb); - dispex_traverse(&This->event_target.dispex, cb);
if(This->vtbl->traverse) This->vtbl->traverse(This, cb); @@ -1608,7 +1609,7 @@ static nsresult NSAPI HTMLDOMNode_unlink(void *p) if(This->vtbl->unlink) This->vtbl->unlink(This);
- dispex_unlink(&This->event_target.dispex); + dispex_unlink(&This->event_target.dispex.IDispatchEx_iface); unlink_ref(&This->nsnode);
if(This->doc && &This->doc->node != This) { @@ -1631,7 +1632,7 @@ static void NSAPI HTMLDOMNode_delete_cycle_collectable(void *p) if(This->vtbl->unlink) This->vtbl->unlink(This); This->vtbl->destructor(This); - release_dispex(&This->event_target.dispex); + dispex_delete_cycle_collectable(&This->event_target.dispex.IDispatchEx_iface); free(This); }
diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c index 0a5905e6f1f..ac9c4ea8f5b 100644 --- a/dlls/mshtml/htmlselect.c +++ b/dlls/mshtml/htmlselect.c @@ -473,7 +473,7 @@ static HRESULT WINAPI HTMLOptionElementFactory_QueryInterface(IHTMLOptionElement static ULONG WINAPI HTMLOptionElementFactory_AddRef(IHTMLOptionElementFactory *iface) { HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -483,13 +483,10 @@ static ULONG WINAPI HTMLOptionElementFactory_AddRef(IHTMLOptionElementFactory *i static ULONG WINAPI HTMLOptionElementFactory_Release(IHTMLOptionElementFactory *iface) { HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -657,7 +654,6 @@ HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow *window, HTMLOptionEleme return E_OUTOFMEMORY;
ret->IHTMLOptionElementFactory_iface.lpVtbl = &HTMLOptionElementFactoryVtbl; - ret->ref = 1; ret->window = window;
init_dispatch(&ret->dispex, (IUnknown*)&ret->IHTMLOptionElementFactory_iface, diff --git a/dlls/mshtml/htmlstorage.c b/dlls/mshtml/htmlstorage.c index 77c8383680e..3c3259c3804 100644 --- a/dlls/mshtml/htmlstorage.c +++ b/dlls/mshtml/htmlstorage.c @@ -39,7 +39,6 @@ enum { MAX_QUOTA = 5000000 }; typedef struct { DispatchEx dispex; IHTMLStorage IHTMLStorage_iface; - LONG ref; unsigned num_props; BSTR *props; HTMLInnerWindow *window; @@ -383,7 +382,7 @@ static HRESULT WINAPI HTMLStorage_QueryInterface(IHTMLStorage *iface, REFIID rii static ULONG WINAPI HTMLStorage_AddRef(IHTMLStorage *iface) { HTMLStorage *This = impl_from_IHTMLStorage(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -393,13 +392,10 @@ static ULONG WINAPI HTMLStorage_AddRef(IHTMLStorage *iface) static ULONG WINAPI HTMLStorage_Release(IHTMLStorage *iface) { HTMLStorage *This = impl_from_IHTMLStorage(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -1481,7 +1477,6 @@ HRESULT create_html_storage(HTMLInnerWindow *window, BOOL local, IHTMLStorage ** }
storage->IHTMLStorage_iface.lpVtbl = &HTMLStorageVtbl; - storage->ref = 1; storage->window = window;
init_dispatch(&storage->dispex, (IUnknown*)&storage->IHTMLStorage_iface, &HTMLStorage_dispex, diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c index 16a1140f97d..f302de0cf8c 100644 --- a/dlls/mshtml/htmlstyle.c +++ b/dlls/mshtml/htmlstyle.c @@ -4758,7 +4758,7 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_QueryInterface(IHTMLCSSStyleDeclar static ULONG WINAPI HTMLCSSStyleDeclaration_AddRef(IHTMLCSSStyleDeclaration *iface) { CSSStyle *This = impl_from_IHTMLCSSStyleDeclaration(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -4768,13 +4768,10 @@ static ULONG WINAPI HTMLCSSStyleDeclaration_AddRef(IHTMLCSSStyleDeclaration *ifa static ULONG WINAPI HTMLCSSStyleDeclaration_Release(IHTMLCSSStyleDeclaration *iface) { CSSStyle *This = impl_from_IHTMLCSSStyleDeclaration(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -10073,7 +10070,6 @@ void init_css_style(CSSStyle *style, nsIDOMCSSStyleDeclaration *nsstyle, style_q { style->IHTMLCSSStyleDeclaration_iface.lpVtbl = &HTMLCSSStyleDeclarationVtbl; style->IHTMLCSSStyleDeclaration2_iface.lpVtbl = &HTMLCSSStyleDeclaration2Vtbl; - style->ref = 1; style->qi = qi; style->nsstyle = nsstyle; nsIDOMCSSStyleDeclaration_AddRef(nsstyle); diff --git a/dlls/mshtml/htmlstyle.h b/dlls/mshtml/htmlstyle.h index 73d54128120..caae7d6ffa0 100644 --- a/dlls/mshtml/htmlstyle.h +++ b/dlls/mshtml/htmlstyle.h @@ -23,8 +23,6 @@ struct CSSStyle { DispatchEx dispex; IHTMLCSSStyleDeclaration IHTMLCSSStyleDeclaration_iface; IHTMLCSSStyleDeclaration2 IHTMLCSSStyleDeclaration2_iface; - - LONG ref; style_qi_t qi;
nsIDOMCSSStyleDeclaration *nsstyle; diff --git a/dlls/mshtml/htmlstylesheet.c b/dlls/mshtml/htmlstylesheet.c index 8ce0f85b76e..fd43e68949e 100644 --- a/dlls/mshtml/htmlstylesheet.c +++ b/dlls/mshtml/htmlstylesheet.c @@ -36,8 +36,6 @@ struct HTMLStyleSheet { IHTMLStyleSheet IHTMLStyleSheet_iface; IHTMLStyleSheet4 IHTMLStyleSheet4_iface;
- LONG ref; - nsIDOMCSSStyleSheet *nsstylesheet; };
@@ -45,8 +43,6 @@ struct HTMLStyleSheetsCollection { DispatchEx dispex; IHTMLStyleSheetsCollection IHTMLStyleSheetsCollection_iface;
- LONG ref; - nsIDOMStyleSheetList *nslist; };
@@ -63,8 +59,6 @@ struct HTMLStyleSheetRulesCollection { DispatchEx dispex; IHTMLStyleSheetRulesCollection IHTMLStyleSheetRulesCollection_iface;
- LONG ref; - nsIDOMCSSRuleList *nslist; };
@@ -72,8 +66,6 @@ struct HTMLStyleSheetRule { DispatchEx dispex; IHTMLStyleSheetRule IHTMLStyleSheetRule_iface;
- LONG ref; - nsIDOMCSSRule *nsstylesheetrule; };
@@ -109,7 +101,7 @@ static HRESULT WINAPI HTMLStyleSheetRule_QueryInterface(IHTMLStyleSheetRule *ifa static ULONG WINAPI HTMLStyleSheetRule_AddRef(IHTMLStyleSheetRule *iface) { HTMLStyleSheetRule *This = impl_from_IHTMLStyleSheetRule(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -119,13 +111,10 @@ static ULONG WINAPI HTMLStyleSheetRule_AddRef(IHTMLStyleSheetRule *iface) static ULONG WINAPI HTMLStyleSheetRule_Release(IHTMLStyleSheetRule *iface) { HTMLStyleSheetRule *This = impl_from_IHTMLStyleSheetRule(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -245,7 +234,6 @@ static HRESULT create_style_sheet_rule(nsIDOMCSSRule *nsstylesheetrule, compat_m return E_OUTOFMEMORY;
rule->IHTMLStyleSheetRule_iface.lpVtbl = &HTMLStyleSheetRuleVtbl; - rule->ref = 1; rule->nsstylesheetrule = NULL;
init_dispatch(&rule->dispex, (IUnknown *)&rule->IHTMLStyleSheetRule_iface, &HTMLStyleSheetRule_dispex, @@ -294,7 +282,7 @@ static HRESULT WINAPI HTMLStyleSheetRulesCollection_QueryInterface(IHTMLStyleShe static ULONG WINAPI HTMLStyleSheetRulesCollection_AddRef(IHTMLStyleSheetRulesCollection *iface) { HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -304,13 +292,10 @@ static ULONG WINAPI HTMLStyleSheetRulesCollection_AddRef(IHTMLStyleSheetRulesCol static ULONG WINAPI HTMLStyleSheetRulesCollection_Release(IHTMLStyleSheetRulesCollection *iface) { HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -519,7 +504,6 @@ static HRESULT create_style_sheet_rules_collection(nsIDOMCSSRuleList *nslist, co return E_OUTOFMEMORY;
collection->IHTMLStyleSheetRulesCollection_iface.lpVtbl = &HTMLStyleSheetRulesCollectionVtbl; - collection->ref = 1; collection->nslist = nslist;
init_dispatch(&collection->dispex, (IUnknown*)&collection->IHTMLStyleSheetRulesCollection_iface, @@ -689,7 +673,7 @@ static HRESULT WINAPI HTMLStyleSheetsCollection_QueryInterface(IHTMLStyleSheetsC static ULONG WINAPI HTMLStyleSheetsCollection_AddRef(IHTMLStyleSheetsCollection *iface) { HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -699,13 +683,10 @@ static ULONG WINAPI HTMLStyleSheetsCollection_AddRef(IHTMLStyleSheetsCollection static ULONG WINAPI HTMLStyleSheetsCollection_Release(IHTMLStyleSheetsCollection *iface) { HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -956,7 +937,6 @@ HRESULT create_style_sheet_collection(nsIDOMStyleSheetList *nslist, compat_mode_ return E_OUTOFMEMORY;
collection->IHTMLStyleSheetsCollection_iface.lpVtbl = &HTMLStyleSheetsCollectionVtbl; - collection->ref = 1;
if(nslist) nsIDOMStyleSheetList_AddRef(nslist); @@ -1003,7 +983,7 @@ static HRESULT WINAPI HTMLStyleSheet_QueryInterface(IHTMLStyleSheet *iface, REFI static ULONG WINAPI HTMLStyleSheet_AddRef(IHTMLStyleSheet *iface) { HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -1013,13 +993,10 @@ static ULONG WINAPI HTMLStyleSheet_AddRef(IHTMLStyleSheet *iface) static ULONG WINAPI HTMLStyleSheet_Release(IHTMLStyleSheet *iface) { HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -1546,7 +1523,6 @@ HRESULT create_style_sheet(nsIDOMStyleSheet *nsstylesheet, compat_mode_t compat_
style_sheet->IHTMLStyleSheet_iface.lpVtbl = &HTMLStyleSheetVtbl; style_sheet->IHTMLStyleSheet4_iface.lpVtbl = &HTMLStyleSheet4Vtbl; - style_sheet->ref = 1; style_sheet->nsstylesheet = NULL;
init_dispatch(&style_sheet->dispex, (IUnknown*)&style_sheet->IHTMLStyleSheet_iface, diff --git a/dlls/mshtml/htmltextnode.c b/dlls/mshtml/htmltextnode.c index af3f57044b8..1bae5994c14 100644 --- a/dlls/mshtml/htmltextnode.c +++ b/dlls/mshtml/htmltextnode.c @@ -319,6 +319,10 @@ static const IHTMLDOMTextNode2Vtbl HTMLDOMTextNode2Vtbl = { HTMLDOMTextNode2_replaceData };
+static void HTMLDOMTextNode_destructor(DispatchEx *dispex) +{ +} + static inline HTMLDOMTextNode *impl_from_HTMLDOMNode(HTMLDOMNode *iface) { return CONTAINING_RECORD(iface, HTMLDOMTextNode, node); @@ -358,6 +362,10 @@ static const NodeImplVtbl HTMLDOMTextNodeImplVtbl = { HTMLDOMTextNode_clone };
+static const dispex_static_data_vtbl_t HTMLDOMTextNode_dispex_vtbl = { + HTMLDOMTextNode_destructor, +}; + static const tid_t HTMLDOMTextNode_iface_tids[] = { IHTMLDOMNode_tid, IHTMLDOMNode2_tid, @@ -367,7 +375,7 @@ static const tid_t HTMLDOMTextNode_iface_tids[] = { }; static dispex_static_data_t HTMLDOMTextNode_dispex = { "Text", - NULL, + &HTMLDOMTextNode_dispex_vtbl, DispHTMLDOMTextNode_tid, HTMLDOMTextNode_iface_tids, HTMLDOMNode_init_dispex_info diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 8a5ca5b441c..68777c18c7f 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -134,7 +134,7 @@ static void detach_inner_window(HTMLInnerWindow *window) detach_document_node(doc);
if(outer_window && outer_window->location) - dispex_unlink(&outer_window->location->dispex); + dispex_props_unlink(&outer_window->location->dispex);
abort_window_bindings(window); remove_target_tasks(window->task_magic); @@ -200,11 +200,11 @@ static HRESULT WINAPI HTMLWindow2_QueryInterface(IHTMLWindow2 *iface, REFIID rii *ppv = NULL; FIXME("(%p)->(IID_IMarshal %p)\n", This, ppv); return E_NOINTERFACE; - }else if(IsEqualGUID(&IID_nsXPCOMCycleCollectionParticipant, riid) && is_outer_window(This)) { - *ppv = &outer_window_ccp; + }else if(IsEqualGUID(&IID_nsXPCOMCycleCollectionParticipant, riid)) { + *ppv = is_outer_window(This) ? &outer_window_ccp : &dispex_ccp; return S_OK; - }else if(IsEqualGUID(&IID_nsCycleCollectionISupports, riid) && is_outer_window(This)) { - *ppv = &This->IHTMLWindow2_iface; + }else if(IsEqualGUID(&IID_nsCycleCollectionISupports, riid)) { + *ppv = is_outer_window(This) ? (nsISupports*)&This->IHTMLWindow2_iface : (nsISupports*)&This->inner_window->event_target.dispex.IDispatchEx_iface; return S_OK; }else { return EventTarget_QI(&This->inner_window->event_target, riid, ppv); @@ -217,7 +217,7 @@ static HRESULT WINAPI HTMLWindow2_QueryInterface(IHTMLWindow2 *iface, REFIID rii static ULONG WINAPI HTMLWindow2_AddRef(IHTMLWindow2 *iface) { HTMLWindow *This = impl_from_IHTMLWindow2(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->inner_window->event_target.dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -227,13 +227,10 @@ static ULONG WINAPI HTMLWindow2_AddRef(IHTMLWindow2 *iface) static ULONG WINAPI HTMLWindow2_Release(IHTMLWindow2 *iface) { HTMLWindow *This = impl_from_IHTMLWindow2(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->inner_window->event_target.dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->inner_window->event_target.dispex); - return ref; }
@@ -4265,7 +4262,6 @@ static HRESULT create_inner_window(HTMLOuterWindow *outer_window, IMoniker *mon, window->base.outer_window = outer_window; window->base.inner_window = window;
- window->base.ref = 1; EventTarget_Init(&window->event_target, (IUnknown*)&window->base.IHTMLWindow2_iface, &HTMLWindow_dispex, COMPAT_MODE_NONE);
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 47d6f4421e2..7f39b4293fd 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -337,6 +337,11 @@ typedef struct dispex_dynamic_data_t dispex_dynamic_data_t; #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
typedef struct DispatchEx DispatchEx; +typedef struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback; + +typedef struct { + UINT_PTR x; +} nsCycleCollectingAutoRefCnt;
/* dispex is our base IDispatchEx implementation for all mshtml objects, and the vtbl allows @@ -347,7 +352,8 @@ typedef struct DispatchEx DispatchEx; - dynamic props: These props are generally allocated by external code (e.g. 'document.wine = 42' creates 'wine' dynamic prop on document) */ typedef struct { - /* Unlike delete_cycle_collectable, unlink is called before the destructor (if available). */ + /* Used to implement Cycle Collection callbacks; note that the destructor is not optional! + Unlike delete_cycle_collectable, unlink is called before the destructor (if available). */ void (*destructor)(DispatchEx*); void (*unlink)(DispatchEx*);
@@ -393,23 +399,18 @@ struct DispatchEx { IDispatchEx IDispatchEx_iface;
IUnknown *outer; + nsCycleCollectingAutoRefCnt ccref;
dispex_data_t *info; dispex_dynamic_data_t *dynamic_data; };
-typedef struct { - UINT_PTR x; -} nsCycleCollectingAutoRefCnt; - typedef struct { void *vtbl; int ref_flags; void *callbacks; } ExternalCycleCollectionParticipant;
-typedef struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback; - typedef struct { nsresult (NSAPI *traverse)(void*,void*,nsCycleCollectionTraversalCallback*); nsresult (NSAPI *unlink)(void*); @@ -425,16 +426,28 @@ extern void (__cdecl *ccp_init)(ExternalCycleCollectionParticipant*,const CCObjC extern void (__cdecl *describe_cc_node)(nsCycleCollectingAutoRefCnt*,const char*,nsCycleCollectionTraversalCallback*); extern void (__cdecl *note_cc_edge)(nsISupports*,const char*,nsCycleCollectionTraversalCallback*);
+extern ExternalCycleCollectionParticipant dispex_ccp; + +static inline LONG dispex_ccref_incr(DispatchEx *dispex) +{ + return ccref_incr(&dispex->ccref, (nsISupports*)&dispex->IDispatchEx_iface); +} + +static inline LONG dispex_ccref_decr(DispatchEx *dispex) +{ + return ccref_decr(&dispex->ccref, (nsISupports*)&dispex->IDispatchEx_iface, &dispex_ccp); +} + void init_dispatch(DispatchEx*,IUnknown*,dispex_static_data_t*,compat_mode_t); -void release_dispex(DispatchEx*); BOOL dispex_query_interface(DispatchEx*,REFIID,void**); +void dispex_props_unlink(DispatchEx*); +nsresult NSAPI dispex_unlink(void*); +void NSAPI dispex_delete_cycle_collectable(void*); HRESULT change_type(VARIANT*,VARIANT*,VARTYPE,IServiceProvider*); HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**); HRESULT get_dispids(tid_t,DWORD*,DISPID**); HRESULT remove_attribute(DispatchEx*,DISPID,VARIANT_BOOL*); HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,BOOL,DISPID*); -void dispex_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*); -void dispex_unlink(DispatchEx*); void release_typelib(void); HRESULT get_class_typeinfo(const CLSID*,ITypeInfo**); const void *dispex_get_vtbl(DispatchEx*); @@ -487,8 +500,6 @@ typedef struct { DispatchEx dispex; IHTMLOptionElementFactory IHTMLOptionElementFactory_iface;
- LONG ref; - HTMLInnerWindow *window; } HTMLOptionElementFactory;
@@ -496,8 +507,6 @@ typedef struct { DispatchEx dispex; IHTMLImageElementFactory IHTMLImageElementFactory_iface;
- LONG ref; - HTMLInnerWindow *window; } HTMLImageElementFactory;
@@ -505,8 +514,6 @@ typedef struct { DispatchEx dispex; IHTMLXMLHttpRequestFactory IHTMLXMLHttpRequestFactory_iface;
- LONG ref; - HTMLInnerWindow *window; } HTMLXMLHttpRequestFactory;
@@ -514,8 +521,6 @@ struct HTMLLocation { DispatchEx dispex; IHTMLLocation IHTMLLocation_iface;
- LONG ref; - HTMLOuterWindow *window; };
@@ -523,8 +528,6 @@ typedef struct { DispatchEx dispex; IOmHistory IOmHistory_iface;
- LONG ref; - HTMLInnerWindow *window; } OmHistory;
@@ -548,8 +551,6 @@ struct HTMLWindow {
IWineMSHTMLConsole *console;
- LONG ref; - HTMLInnerWindow *inner_window; HTMLOuterWindow *outer_window; }; @@ -955,9 +956,6 @@ struct HTMLDocumentNode { IInternetHostSecurityManager IInternetHostSecurityManager_iface;
nsIDocumentObserver nsIDocumentObserver_iface; - - LONG ref; - ConnectionPointContainer cp_container; HTMLOuterWindow *outer_window; HTMLInnerWindow *window; @@ -1071,6 +1069,7 @@ BOOL is_gecko_path(const char*); void set_viewer_zoom(GeckoBrowser*,float); float get_viewer_zoom(GeckoBrowser*);
+void init_dispex_cc(void); void init_window_cc(void); void init_node_cc(void);
@@ -1157,8 +1156,6 @@ struct HTMLAttributeCollection { IHTMLAttributeCollection2 IHTMLAttributeCollection2_iface; IHTMLAttributeCollection3 IHTMLAttributeCollection3_iface;
- LONG ref; - HTMLElement *elem; struct list attrs; }; @@ -1168,8 +1165,6 @@ typedef struct { IHTMLDOMAttribute IHTMLDOMAttribute_iface; IHTMLDOMAttribute2 IHTMLDOMAttribute2_iface;
- LONG ref; - /* value is valid only for detached attributes (when elem == NULL). */ VARIANT value; /* name must be valid for detached attributes */ diff --git a/dlls/mshtml/mutation.c b/dlls/mshtml/mutation.c index 8df0211621e..4d1078cce81 100644 --- a/dlls/mshtml/mutation.c +++ b/dlls/mshtml/mutation.c @@ -1080,7 +1080,6 @@ void init_mutation(nsIComponentManager *component_manager) struct mutation_observer { IWineMSHTMLMutationObserver IWineMSHTMLMutationObserver_iface;
- LONG ref; DispatchEx dispex; IDispatch *callback; }; @@ -1113,7 +1112,7 @@ static HRESULT WINAPI MutationObserver_QueryInterface(IWineMSHTMLMutationObserve static ULONG WINAPI MutationObserver_AddRef(IWineMSHTMLMutationObserver *iface) { struct mutation_observer *This = impl_from_IWineMSHTMLMutationObserver(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -1123,13 +1122,10 @@ static ULONG WINAPI MutationObserver_AddRef(IWineMSHTMLMutationObserver *iface) static ULONG WINAPI MutationObserver_Release(IWineMSHTMLMutationObserver *iface) { struct mutation_observer *This = impl_from_IWineMSHTMLMutationObserver(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -1258,7 +1254,6 @@ static HRESULT create_mutation_observer(compat_mode_t compat_mode, IDispatch *ca }
obj->IWineMSHTMLMutationObserver_iface.lpVtbl = &WineMSHTMLMutationObserverVtbl; - obj->ref = 1; init_dispatch(&obj->dispex, (IUnknown*)&obj->IWineMSHTMLMutationObserver_iface, &mutation_observer_dispex, compat_mode);
@@ -1271,8 +1266,6 @@ static HRESULT create_mutation_observer(compat_mode_t compat_mode, IDispatch *ca struct mutation_observer_ctor { IUnknown IUnknown_iface; DispatchEx dispex; - - LONG ref; };
static inline struct mutation_observer_ctor *mutation_observer_ctor_from_IUnknown(IUnknown *iface) @@ -1308,7 +1301,7 @@ static HRESULT WINAPI mutation_observer_ctor_QueryInterface(IUnknown *iface, REF static ULONG WINAPI mutation_observer_ctor_AddRef(IUnknown *iface) { struct mutation_observer_ctor *This = mutation_observer_ctor_from_IUnknown(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -1318,13 +1311,10 @@ static ULONG WINAPI mutation_observer_ctor_AddRef(IUnknown *iface) static ULONG WINAPI mutation_observer_ctor_Release(IUnknown *iface) { struct mutation_observer_ctor *This = mutation_observer_ctor_from_IUnknown(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -1418,7 +1408,6 @@ HRESULT create_mutation_observer_ctor(compat_mode_t compat_mode, IDispatch **ret }
obj->IUnknown_iface.lpVtbl = &mutation_observer_ctor_vtbl; - obj->ref = 1; init_dispatch(&obj->dispex, (IUnknown*)&obj->IUnknown_iface, &mutation_observer_ctor_dispex, compat_mode);
diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c index 61d4ec335b4..00295242f4a 100644 --- a/dlls/mshtml/nsembed.c +++ b/dlls/mshtml/nsembed.c @@ -596,6 +596,7 @@ static BOOL init_xpcom(const PRUnichar *gre_path) ERR("NS_GetComponentRegistrar failed: %08lx\n", nsres); }
+ init_dispex_cc(); init_window_cc(); init_node_cc();
diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index ce96ab7f84e..4ba7991ab05 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -38,8 +38,6 @@ typedef struct { DispatchEx dispex; IOmNavigator IOmNavigator_iface;
- LONG ref; - HTMLPluginsCollection *plugins; HTMLMimeTypesCollection *mime_types; } OmNavigator; @@ -49,8 +47,6 @@ typedef struct { IHTMLDOMImplementation IHTMLDOMImplementation_iface; IHTMLDOMImplementation2 IHTMLDOMImplementation2_iface;
- LONG ref; - nsIDOMDOMImplementation *implementation; GeckoBrowser *browser; } HTMLDOMImplementation; @@ -85,7 +81,7 @@ static HRESULT WINAPI HTMLDOMImplementation_QueryInterface(IHTMLDOMImplementatio static ULONG WINAPI HTMLDOMImplementation_AddRef(IHTMLDOMImplementation *iface) { HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -95,13 +91,10 @@ static ULONG WINAPI HTMLDOMImplementation_AddRef(IHTMLDOMImplementation *iface) static ULONG WINAPI HTMLDOMImplementation_Release(IHTMLDOMImplementation *iface) { HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -344,7 +337,6 @@ HRESULT create_dom_implementation(HTMLDocumentNode *doc_node, IHTMLDOMImplementa
dom_implementation->IHTMLDOMImplementation_iface.lpVtbl = &HTMLDOMImplementationVtbl; dom_implementation->IHTMLDOMImplementation2_iface.lpVtbl = &HTMLDOMImplementation2Vtbl; - dom_implementation->ref = 1; dom_implementation->browser = doc_node->browser;
init_dispatch(&dom_implementation->dispex, (IUnknown*)&dom_implementation->IHTMLDOMImplementation_iface, @@ -370,8 +362,6 @@ void detach_dom_implementation(IHTMLDOMImplementation *iface) typedef struct { DispatchEx dispex; IHTMLScreen IHTMLScreen_iface; - - LONG ref; } HTMLScreen;
static inline HTMLScreen *impl_from_IHTMLScreen(IHTMLScreen *iface) @@ -404,7 +394,7 @@ static HRESULT WINAPI HTMLScreen_QueryInterface(IHTMLScreen *iface, REFIID riid, static ULONG WINAPI HTMLScreen_AddRef(IHTMLScreen *iface) { HTMLScreen *This = impl_from_IHTMLScreen(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -414,13 +404,10 @@ static ULONG WINAPI HTMLScreen_AddRef(IHTMLScreen *iface) static ULONG WINAPI HTMLScreen_Release(IHTMLScreen *iface) { HTMLScreen *This = impl_from_IHTMLScreen(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -604,7 +591,6 @@ HRESULT create_html_screen(compat_mode_t compat_mode, IHTMLScreen **ret) return E_OUTOFMEMORY;
screen->IHTMLScreen_iface.lpVtbl = &HTMLSreenVtbl; - screen->ref = 1;
init_dispatch(&screen->dispex, (IUnknown*)&screen->IHTMLScreen_iface, &HTMLScreen_dispex, compat_mode);
@@ -642,7 +628,7 @@ static HRESULT WINAPI OmHistory_QueryInterface(IOmHistory *iface, REFIID riid, v static ULONG WINAPI OmHistory_AddRef(IOmHistory *iface) { OmHistory *This = impl_from_IOmHistory(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -652,13 +638,10 @@ static ULONG WINAPI OmHistory_AddRef(IOmHistory *iface) static ULONG WINAPI OmHistory_Release(IOmHistory *iface) { OmHistory *This = impl_from_IOmHistory(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -784,7 +767,6 @@ HRESULT create_history(HTMLInnerWindow *window, OmHistory **ret) init_dispatch(&history->dispex, (IUnknown*)&history->IOmHistory_iface, &OmHistory_dispex, dispex_compat_mode(&window->event_target.dispex)); history->IOmHistory_iface.lpVtbl = &OmHistoryVtbl; - history->ref = 1;
history->window = window;
@@ -796,8 +778,6 @@ struct HTMLPluginsCollection { DispatchEx dispex; IHTMLPluginsCollection IHTMLPluginsCollection_iface;
- LONG ref; - OmNavigator *navigator; };
@@ -831,7 +811,7 @@ static HRESULT WINAPI HTMLPluginsCollection_QueryInterface(IHTMLPluginsCollectio static ULONG WINAPI HTMLPluginsCollection_AddRef(IHTMLPluginsCollection *iface) { HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -841,13 +821,10 @@ static ULONG WINAPI HTMLPluginsCollection_AddRef(IHTMLPluginsCollection *iface) static ULONG WINAPI HTMLPluginsCollection_Release(IHTMLPluginsCollection *iface) { HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -959,7 +936,6 @@ static HRESULT create_plugins_collection(OmNavigator *navigator, HTMLPluginsColl return E_OUTOFMEMORY;
col->IHTMLPluginsCollection_iface.lpVtbl = &HTMLPluginsCollectionVtbl; - col->ref = 1; col->navigator = navigator;
init_dispatch(&col->dispex, (IUnknown*)&col->IHTMLPluginsCollection_iface, @@ -973,8 +949,6 @@ struct HTMLMimeTypesCollection { DispatchEx dispex; IHTMLMimeTypesCollection IHTMLMimeTypesCollection_iface;
- LONG ref; - OmNavigator *navigator; };
@@ -1008,7 +982,7 @@ static HRESULT WINAPI HTMLMimeTypesCollection_QueryInterface(IHTMLMimeTypesColle static ULONG WINAPI HTMLMimeTypesCollection_AddRef(IHTMLMimeTypesCollection *iface) { HTMLMimeTypesCollection *This = impl_from_IHTMLMimeTypesCollection(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -1018,13 +992,10 @@ static ULONG WINAPI HTMLMimeTypesCollection_AddRef(IHTMLMimeTypesCollection *ifa static ULONG WINAPI HTMLMimeTypesCollection_Release(IHTMLMimeTypesCollection *iface) { HTMLMimeTypesCollection *This = impl_from_IHTMLMimeTypesCollection(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -1125,7 +1096,6 @@ static HRESULT create_mime_types_collection(OmNavigator *navigator, HTMLMimeType return E_OUTOFMEMORY;
col->IHTMLMimeTypesCollection_iface.lpVtbl = &HTMLMimeTypesCollectionVtbl; - col->ref = 1; col->navigator = navigator;
init_dispatch(&col->dispex, (IUnknown*)&col->IHTMLMimeTypesCollection_iface, @@ -1165,7 +1135,7 @@ static HRESULT WINAPI OmNavigator_QueryInterface(IOmNavigator *iface, REFIID rii static ULONG WINAPI OmNavigator_AddRef(IOmNavigator *iface) { OmNavigator *This = impl_from_IOmNavigator(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -1175,13 +1145,10 @@ static ULONG WINAPI OmNavigator_AddRef(IOmNavigator *iface) static ULONG WINAPI OmNavigator_Release(IOmNavigator *iface) { OmNavigator *This = impl_from_IOmNavigator(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -1576,7 +1543,6 @@ HRESULT create_navigator(compat_mode_t compat_mode, IOmNavigator **navigator) return E_OUTOFMEMORY;
ret->IOmNavigator_iface.lpVtbl = &OmNavigatorVtbl; - ret->ref = 1;
init_dispatch(&ret->dispex, (IUnknown*)&ret->IOmNavigator_iface, &OmNavigator_dispex, compat_mode);
@@ -1588,7 +1554,6 @@ typedef struct { DispatchEx dispex; IHTMLPerformanceTiming IHTMLPerformanceTiming_iface;
- LONG ref; HTMLInnerWindow *window; } HTMLPerformanceTiming;
@@ -1622,7 +1587,7 @@ static HRESULT WINAPI HTMLPerformanceTiming_QueryInterface(IHTMLPerformanceTimin static ULONG WINAPI HTMLPerformanceTiming_AddRef(IHTMLPerformanceTiming *iface) { HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -1632,13 +1597,10 @@ static ULONG WINAPI HTMLPerformanceTiming_AddRef(IHTMLPerformanceTiming *iface) static ULONG WINAPI HTMLPerformanceTiming_Release(IHTMLPerformanceTiming *iface) { HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -2004,7 +1966,6 @@ typedef struct { DispatchEx dispex; IHTMLPerformanceNavigation IHTMLPerformanceNavigation_iface;
- LONG ref; HTMLInnerWindow *window; } HTMLPerformanceNavigation;
@@ -2038,7 +1999,7 @@ static HRESULT WINAPI HTMLPerformanceNavigation_QueryInterface(IHTMLPerformanceN static ULONG WINAPI HTMLPerformanceNavigation_AddRef(IHTMLPerformanceNavigation *iface) { HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -2048,13 +2009,10 @@ static ULONG WINAPI HTMLPerformanceNavigation_AddRef(IHTMLPerformanceNavigation static ULONG WINAPI HTMLPerformanceNavigation_Release(IHTMLPerformanceNavigation *iface) { HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -2184,8 +2142,6 @@ typedef struct { DispatchEx dispex; IHTMLPerformance IHTMLPerformance_iface;
- LONG ref; - HTMLInnerWindow *window; IHTMLPerformanceNavigation *navigation; IHTMLPerformanceTiming *timing; @@ -2221,7 +2177,7 @@ static HRESULT WINAPI HTMLPerformance_QueryInterface(IHTMLPerformance *iface, RE static ULONG WINAPI HTMLPerformance_AddRef(IHTMLPerformance *iface) { HTMLPerformance *This = impl_from_IHTMLPerformance(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -2231,13 +2187,10 @@ static ULONG WINAPI HTMLPerformance_AddRef(IHTMLPerformance *iface) static ULONG WINAPI HTMLPerformance_Release(IHTMLPerformance *iface) { HTMLPerformance *This = impl_from_IHTMLPerformance(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -2291,7 +2244,6 @@ static HRESULT WINAPI HTMLPerformance_get_navigation(IHTMLPerformance *iface, return E_OUTOFMEMORY;
navigation->IHTMLPerformanceNavigation_iface.lpVtbl = &HTMLPerformanceNavigationVtbl; - navigation->ref = 1; navigation->window = This->window; IHTMLWindow2_AddRef(&This->window->base.IHTMLWindow2_iface);
@@ -2319,7 +2271,6 @@ static HRESULT WINAPI HTMLPerformance_get_timing(IHTMLPerformance *iface, IHTMLP return E_OUTOFMEMORY;
timing->IHTMLPerformanceTiming_iface.lpVtbl = &HTMLPerformanceTimingVtbl; - timing->ref = 1; timing->window = This->window; IHTMLWindow2_AddRef(&This->window->base.IHTMLWindow2_iface);
@@ -2412,7 +2363,6 @@ HRESULT create_performance(HTMLInnerWindow *window, IHTMLPerformance **ret) return E_OUTOFMEMORY;
performance->IHTMLPerformance_iface.lpVtbl = &HTMLPerformanceVtbl; - performance->ref = 1; performance->window = window; IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface);
@@ -2426,8 +2376,6 @@ HRESULT create_performance(HTMLInnerWindow *window, IHTMLPerformance **ret) typedef struct { DispatchEx dispex; IHTMLNamespaceCollection IHTMLNamespaceCollection_iface; - - LONG ref; } HTMLNamespaceCollection;
static inline HTMLNamespaceCollection *impl_from_IHTMLNamespaceCollection(IHTMLNamespaceCollection *iface) @@ -2460,7 +2408,7 @@ static HRESULT WINAPI HTMLNamespaceCollection_QueryInterface(IHTMLNamespaceColle static ULONG WINAPI HTMLNamespaceCollection_AddRef(IHTMLNamespaceCollection *iface) { HTMLNamespaceCollection *This = impl_from_IHTMLNamespaceCollection(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -2470,13 +2418,10 @@ static ULONG WINAPI HTMLNamespaceCollection_AddRef(IHTMLNamespaceCollection *ifa static ULONG WINAPI HTMLNamespaceCollection_Release(IHTMLNamespaceCollection *iface) { HTMLNamespaceCollection *This = impl_from_IHTMLNamespaceCollection(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -2585,7 +2530,6 @@ HRESULT create_namespace_collection(compat_mode_t compat_mode, IHTMLNamespaceCol return E_OUTOFMEMORY;
namespaces->IHTMLNamespaceCollection_iface.lpVtbl = &HTMLNamespaceCollectionVtbl; - namespaces->ref = 1; init_dispatch(&namespaces->dispex, (IUnknown*)&namespaces->IHTMLNamespaceCollection_iface, &HTMLNamespaceCollection_dispex, compat_mode); *ret = &namespaces->IHTMLNamespaceCollection_iface; @@ -2595,7 +2539,6 @@ HRESULT create_namespace_collection(compat_mode_t compat_mode, IHTMLNamespaceCol struct console { DispatchEx dispex; IWineMSHTMLConsole IWineMSHTMLConsole_iface; - LONG ref; };
static inline struct console *impl_from_IWineMSHTMLConsole(IWineMSHTMLConsole *iface) @@ -2628,7 +2571,7 @@ static HRESULT WINAPI console_QueryInterface(IWineMSHTMLConsole *iface, REFIID r static ULONG WINAPI console_AddRef(IWineMSHTMLConsole *iface) { struct console *console = impl_from_IWineMSHTMLConsole(iface); - LONG ref = InterlockedIncrement(&console->ref); + LONG ref = dispex_ccref_incr(&console->dispex);
TRACE("(%p) ref=%ld\n", console, ref);
@@ -2638,13 +2581,10 @@ static ULONG WINAPI console_AddRef(IWineMSHTMLConsole *iface) static ULONG WINAPI console_Release(IWineMSHTMLConsole *iface) { struct console *console = impl_from_IWineMSHTMLConsole(iface); - LONG ref = InterlockedDecrement(&console->ref); + LONG ref = dispex_ccref_decr(&console->dispex);
TRACE("(%p) ref=%ld\n", console, ref);
- if(!ref) - release_dispex(&console->dispex); - return ref; }
@@ -2858,7 +2798,6 @@ void create_console(compat_mode_t compat_mode, IWineMSHTMLConsole **ret) }
obj->IWineMSHTMLConsole_iface.lpVtbl = &WineMSHTMLConsoleVtbl; - obj->ref = 1; init_dispatch(&obj->dispex, (IUnknown*)&obj->IWineMSHTMLConsole_iface, &console_dispex, compat_mode);
*ret = &obj->IWineMSHTMLConsole_iface; @@ -2873,7 +2812,6 @@ struct media_query_list_callback; struct media_query_list { DispatchEx dispex; IWineMSHTMLMediaQueryList IWineMSHTMLMediaQueryList_iface; - LONG ref; nsIDOMMediaQueryList *nsquerylist; struct media_query_list_callback *callback; struct list listeners; @@ -2912,7 +2850,7 @@ static HRESULT WINAPI media_query_list_QueryInterface(IWineMSHTMLMediaQueryList static ULONG WINAPI media_query_list_AddRef(IWineMSHTMLMediaQueryList *iface) { struct media_query_list *media_query_list = impl_from_IWineMSHTMLMediaQueryList(iface); - LONG ref = InterlockedIncrement(&media_query_list->ref); + LONG ref = dispex_ccref_incr(&media_query_list->dispex);
TRACE("(%p) ref=%ld\n", media_query_list, ref);
@@ -2922,13 +2860,10 @@ static ULONG WINAPI media_query_list_AddRef(IWineMSHTMLMediaQueryList *iface) static ULONG WINAPI media_query_list_Release(IWineMSHTMLMediaQueryList *iface) { struct media_query_list *media_query_list = impl_from_IWineMSHTMLMediaQueryList(iface); - LONG ref = InterlockedDecrement(&media_query_list->ref); + LONG ref = dispex_ccref_decr(&media_query_list->dispex);
TRACE("(%p) ref=%ld\n", media_query_list, ref);
- if(!ref) - release_dispex(&media_query_list->dispex); - return ref; }
@@ -3227,7 +3162,6 @@ HRESULT create_media_query_list(HTMLWindow *window, BSTR media_query, IDispatch assert(NS_SUCCEEDED(nsres));
media_query_list->IWineMSHTMLMediaQueryList_iface.lpVtbl = &media_query_list_vtbl; - media_query_list->ref = 1; list_init(&media_query_list->listeners); init_dispatch(&media_query_list->dispex, (IUnknown*)&media_query_list->IWineMSHTMLMediaQueryList_iface, &media_query_list_dispex, dispex_compat_mode(&window->inner_window->event_target.dispex)); diff --git a/dlls/mshtml/range.c b/dlls/mshtml/range.c index e7234994933..4c7bd710265 100644 --- a/dlls/mshtml/range.c +++ b/dlls/mshtml/range.c @@ -37,8 +37,6 @@ typedef struct { IHTMLTxtRange IHTMLTxtRange_iface; IOleCommandTarget IOleCommandTarget_iface;
- LONG ref; - nsIDOMRange *nsrange; HTMLDocumentNode *doc;
@@ -49,8 +47,6 @@ typedef struct { DispatchEx dispex; IHTMLDOMRange IHTMLDOMRange_iface;
- LONG ref; - nsIDOMRange *nsrange; } HTMLDOMRange;
@@ -841,7 +837,7 @@ static HRESULT WINAPI HTMLTxtRange_QueryInterface(IHTMLTxtRange *iface, REFIID r static ULONG WINAPI HTMLTxtRange_AddRef(IHTMLTxtRange *iface) { HTMLTxtRange *This = impl_from_IHTMLTxtRange(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -851,13 +847,10 @@ static ULONG WINAPI HTMLTxtRange_AddRef(IHTMLTxtRange *iface) static ULONG WINAPI HTMLTxtRange_Release(IHTMLTxtRange *iface) { HTMLTxtRange *This = impl_from_IHTMLTxtRange(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -1762,7 +1755,6 @@ HRESULT HTMLTxtRange_Create(HTMLDocumentNode *doc, nsIDOMRange *nsrange, IHTMLTx
ret->IHTMLTxtRange_iface.lpVtbl = &HTMLTxtRangeVtbl; ret->IOleCommandTarget_iface.lpVtbl = &OleCommandTargetVtbl; - ret->ref = 1;
if(nsrange) nsIDOMRange_AddRef(nsrange); @@ -1805,7 +1797,7 @@ static HRESULT WINAPI HTMLDOMRange_QueryInterface(IHTMLDOMRange *iface, REFIID r static ULONG WINAPI HTMLDOMRange_AddRef(IHTMLDOMRange *iface) { HTMLDOMRange *This = impl_from_IHTMLDOMRange(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -1815,13 +1807,10 @@ static ULONG WINAPI HTMLDOMRange_AddRef(IHTMLDOMRange *iface) static ULONG WINAPI HTMLDOMRange_Release(IHTMLDOMRange *iface) { HTMLDOMRange *This = impl_from_IHTMLDOMRange(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -2124,7 +2113,6 @@ HRESULT create_dom_range(nsIDOMRange *nsrange, compat_mode_t compat_mode, IHTMLD init_dispatch(&ret->dispex, (IUnknown*)&ret->IHTMLDOMRange_iface, &HTMLDOMRange_dispex, compat_mode);
ret->IHTMLDOMRange_iface.lpVtbl = &HTMLDOMRangeVtbl; - ret->ref = 1;
if(nsrange) nsIDOMRange_AddRef(nsrange); diff --git a/dlls/mshtml/selection.c b/dlls/mshtml/selection.c index 3067b1a43b1..3b840d526d2 100644 --- a/dlls/mshtml/selection.c +++ b/dlls/mshtml/selection.c @@ -36,8 +36,6 @@ typedef struct { IHTMLSelectionObject IHTMLSelectionObject_iface; IHTMLSelectionObject2 IHTMLSelectionObject2_iface;
- LONG ref; - nsISelection *nsselection; HTMLDocumentNode *doc;
@@ -79,7 +77,7 @@ static HRESULT WINAPI HTMLSelectionObject_QueryInterface(IHTMLSelectionObject *i static ULONG WINAPI HTMLSelectionObject_AddRef(IHTMLSelectionObject *iface) { HTMLSelectionObject *This = impl_from_IHTMLSelectionObject(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -89,13 +87,10 @@ static ULONG WINAPI HTMLSelectionObject_AddRef(IHTMLSelectionObject *iface) static ULONG WINAPI HTMLSelectionObject_Release(IHTMLSelectionObject *iface) { HTMLSelectionObject *This = impl_from_IHTMLSelectionObject(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -374,7 +369,6 @@ HRESULT HTMLSelectionObject_Create(HTMLDocumentNode *doc, nsISelection *nsselect
selection->IHTMLSelectionObject_iface.lpVtbl = &HTMLSelectionObjectVtbl; selection->IHTMLSelectionObject2_iface.lpVtbl = &HTMLSelectionObject2Vtbl; - selection->ref = 1; selection->nsselection = nsselection; /* We shouldn't call AddRef here */
selection->doc = doc; diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c index 417923cf444..ba18bd419fa 100644 --- a/dlls/mshtml/xmlhttprequest.c +++ b/dlls/mshtml/xmlhttprequest.c @@ -136,7 +136,6 @@ struct HTMLXMLHttpRequest { IHTMLXMLHttpRequest2 IHTMLXMLHttpRequest2_iface; IWineXMLHttpRequestPrivate IWineXMLHttpRequestPrivate_iface; IProvideClassInfo2 IProvideClassInfo2_iface; - LONG ref; LONG task_magic; LONG ready_state; response_type_t response_type; @@ -536,7 +535,7 @@ static HRESULT WINAPI HTMLXMLHttpRequest_QueryInterface(IHTMLXMLHttpRequest *ifa static ULONG WINAPI HTMLXMLHttpRequest_AddRef(IHTMLXMLHttpRequest *iface) { HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->event_target.dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -546,12 +545,14 @@ static ULONG WINAPI HTMLXMLHttpRequest_AddRef(IHTMLXMLHttpRequest *iface) static ULONG WINAPI HTMLXMLHttpRequest_Release(IHTMLXMLHttpRequest *iface) { HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->event_target.dispex);
TRACE("(%p) ref=%ld\n", This, ref);
+ /* The Cycle Collector might delay the unlink or destruction after ref reaches 0, + but we don't want a task to possibly grab ref to us and send events anymore. */ if(!ref) - release_dispex(&This->event_target.dispex); + This->magic++;
return ref; } @@ -1647,7 +1648,7 @@ static HRESULT WINAPI HTMLXMLHttpRequestFactory_QueryInterface(IHTMLXMLHttpReque static ULONG WINAPI HTMLXMLHttpRequestFactory_AddRef(IHTMLXMLHttpRequestFactory *iface) { HTMLXMLHttpRequestFactory *This = impl_from_IHTMLXMLHttpRequestFactory(iface); - LONG ref = InterlockedIncrement(&This->ref); + LONG ref = dispex_ccref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
@@ -1657,13 +1658,10 @@ static ULONG WINAPI HTMLXMLHttpRequestFactory_AddRef(IHTMLXMLHttpRequestFactory static ULONG WINAPI HTMLXMLHttpRequestFactory_Release(IHTMLXMLHttpRequestFactory *iface) { HTMLXMLHttpRequestFactory *This = impl_from_IHTMLXMLHttpRequestFactory(iface); - LONG ref = InterlockedDecrement(&This->ref); + LONG ref = dispex_ccref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
- if(!ref) - release_dispex(&This->dispex); - return ref; }
@@ -1739,7 +1737,6 @@ static HRESULT WINAPI HTMLXMLHttpRequestFactory_create(IHTMLXMLHttpRequestFactor ret->IProvideClassInfo2_iface.lpVtbl = &ProvideClassInfo2Vtbl; EventTarget_Init(&ret->event_target, (IUnknown*)&ret->IHTMLXMLHttpRequest_iface, &HTMLXMLHttpRequest_dispex, This->window->doc->document_mode); - ret->ref = 1;
/* Always register the handlers because we need them to track state */ event_listener->nsIDOMEventListener_iface.lpVtbl = &XMLHttpReqEventListenerVtbl; @@ -1840,7 +1837,6 @@ HRESULT HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow* window, HTMLXMLHttpReq return E_OUTOFMEMORY;
ret->IHTMLXMLHttpRequestFactory_iface.lpVtbl = &HTMLXMLHttpRequestFactoryVtbl; - ret->ref = 1; ret->window = window;
init_dispatch(&ret->dispex, (IUnknown*)&ret->IHTMLXMLHttpRequestFactory_iface,
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/dispex.c | 9 +++------ dlls/mshtml/mshtml_private.h | 6 ++++++ 2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 53aeba303a2..d0019c63168 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -2008,10 +2008,8 @@ static nsresult NSAPI dispex_traverse(void *ccp, void *p, nsCycleCollectionTrave if(!This->dynamic_data) return NS_OK;
- for(prop = This->dynamic_data->props; prop < This->dynamic_data->props + This->dynamic_data->prop_cnt; prop++) { - if(V_VT(&prop->var) == VT_DISPATCH) - note_cc_edge((nsISupports*)V_DISPATCH(&prop->var), "dispex_data", cb); - } + for(prop = This->dynamic_data->props; prop < This->dynamic_data->props + This->dynamic_data->prop_cnt; prop++) + traverse_variant(&prop->var, "dispex_data", cb);
if(This->dynamic_data->func_disps) { func_obj_entry_t *iter = This->dynamic_data->func_disps, *end = iter + This->info->func_disp_cnt; @@ -2020,8 +2018,7 @@ static nsresult NSAPI dispex_traverse(void *ccp, void *p, nsCycleCollectionTrave if(!iter->func_obj) continue; note_cc_edge((nsISupports*)&iter->func_obj->dispex.IDispatchEx_iface, "func_obj", cb); - if(V_VT(&iter->val) == VT_DISPATCH) - note_cc_edge((nsISupports*)V_DISPATCH(&iter->val), "func_val", cb); + traverse_variant(&iter->val, "func_val", cb); } }
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 7f39b4293fd..6391a27c5f9 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -1495,6 +1495,12 @@ static inline void unlink_variant(VARIANT *v) unlink_ref(&V_UNKNOWN(v)); }
+static inline void traverse_variant(VARIANT *v, const char *name, nsCycleCollectionTraversalCallback *cb) +{ + if(V_VT(v) == VT_DISPATCH || V_VT(v) == VT_UNKNOWN) + note_cc_edge((nsISupports*)V_UNKNOWN(v), "dispex_data", cb); +} + #ifdef __i386__ extern void *call_thiscall_func; #endif
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/dispex.c | 4 ++++ dlls/mshtml/htmlattr.c | 1 + dlls/mshtml/htmldoc.c | 1 + dlls/mshtml/htmlelem.c | 6 ++++++ dlls/mshtml/htmlelemcol.c | 1 + dlls/mshtml/htmlevent.c | 9 +++++++++ dlls/mshtml/htmlimg.c | 1 + dlls/mshtml/htmllocation.c | 1 + dlls/mshtml/htmlnode.c | 2 ++ dlls/mshtml/htmlselect.c | 1 + dlls/mshtml/htmlstorage.c | 1 + dlls/mshtml/htmlstyle.c | 1 + dlls/mshtml/htmlstylesheet.c | 4 ++++ dlls/mshtml/htmltextnode.c | 1 + dlls/mshtml/htmlwindow.c | 33 +++++++++++++++++++++++++++++++++ dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/mutation.c | 2 ++ dlls/mshtml/omnavigator.c | 8 ++++++++ dlls/mshtml/range.c | 2 ++ dlls/mshtml/selection.c | 1 + dlls/mshtml/xmlhttprequest.c | 2 ++ 21 files changed, 83 insertions(+)
diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index d0019c63168..966a47dc9cd 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -906,6 +906,7 @@ static HRESULT function_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPAR static const dispex_static_data_vtbl_t function_dispex_vtbl = { function_destructor, NULL, + NULL, function_value, NULL, NULL, @@ -2005,6 +2006,9 @@ static nsresult NSAPI dispex_traverse(void *ccp, void *p, nsCycleCollectionTrave
describe_cc_node(&This->ccref, This->info->desc->name, cb);
+ if(This->info->desc->vtbl->traverse) + This->info->desc->vtbl->traverse(This, cb); + if(!This->dynamic_data) return NS_OK;
diff --git a/dlls/mshtml/htmlattr.c b/dlls/mshtml/htmlattr.c index bb8a0b1e3f3..1bceaef43bb 100644 --- a/dlls/mshtml/htmlattr.c +++ b/dlls/mshtml/htmlattr.c @@ -494,6 +494,7 @@ static void HTMLDOMAttribute_destructor(DispatchEx *dispex)
static const dispex_static_data_vtbl_t HTMLDOMAttribute_dispex_vtbl = { HTMLDOMAttribute_destructor, + NULL, HTMLDOMAttribute_unlink };
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index e48b80efa79..9264562b319 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -6099,6 +6099,7 @@ static const event_target_vtbl_t HTMLDocumentNode_event_target_vtbl = { NULL, NULL, NULL, + NULL, HTMLDocumentNode_get_name, HTMLDocumentNode_invoke, NULL, diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 902e4c9f3e7..52145c0a4c0 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -855,6 +855,7 @@ void HTMLRect_init_dispex_info(dispex_data_t *info, compat_mode_t mode)
static const dispex_static_data_vtbl_t HTMLRect_dispex_vtbl = { HTMLRect_destructor, + NULL, HTMLRect_unlink };
@@ -1283,6 +1284,7 @@ static HRESULT HTMLRectCollection_invoke(DispatchEx *dispex, DISPID id, LCID lci
static const dispex_static_data_vtbl_t HTMLRectCollection_dispex_vtbl = { HTMLRectCollection_destructor, + NULL, HTMLRectCollection_unlink, NULL, HTMLRectCollection_get_dispid, @@ -7349,6 +7351,7 @@ const event_target_vtbl_t HTMLElement_event_target_vtbl = { HTMLElement_dispex_destructor, NULL, NULL, + NULL, HTMLElement_get_dispid, HTMLElement_get_name, HTMLElement_invoke, @@ -7820,6 +7823,7 @@ static HRESULT token_list_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD
static const dispex_static_data_vtbl_t token_list_dispex_vtbl = { token_list_destructor, + NULL, token_list_unlink, token_list_value, token_list_get_dispid, @@ -8245,6 +8249,7 @@ static const dispex_static_data_vtbl_t HTMLFiltersCollection_dispex_vtbl = { HTMLFiltersCollection_destructor, NULL, NULL, + NULL, HTMLFiltersCollection_get_dispid, HTMLFiltersCollection_get_name, HTMLFiltersCollection_invoke, @@ -9006,6 +9011,7 @@ static HRESULT HTMLAttributeCollection_invoke(DispatchEx *dispex, DISPID id, LCI
static const dispex_static_data_vtbl_t HTMLAttributeCollection_dispex_vtbl = { HTMLAttributeCollection_destructor, + NULL, HTMLAttributeCollection_unlink, NULL, HTMLAttributeCollection_get_dispid, diff --git a/dlls/mshtml/htmlelemcol.c b/dlls/mshtml/htmlelemcol.c index c9448adbe09..58460c7f8d9 100644 --- a/dlls/mshtml/htmlelemcol.c +++ b/dlls/mshtml/htmlelemcol.c @@ -629,6 +629,7 @@ static HRESULT HTMLElementCollection_invoke(DispatchEx *dispex, DISPID id, LCID
static const dispex_static_data_vtbl_t HTMLElementColection_dispex_vtbl = { HTMLElementCollection_destructor, + NULL, HTMLElementCollection_unlink, NULL, HTMLElementCollection_get_dispid, diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index 79dc58bb57d..222496273d6 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -886,6 +886,7 @@ static void HTMLEventObj_destructor(DispatchEx *dispex)
static const dispex_static_data_vtbl_t HTMLEventObj_dispex_vtbl = { HTMLEventObj_destructor, + NULL, HTMLEventObj_unlink };
@@ -2957,6 +2958,7 @@ static void DOMStorageEvent_destructor(DispatchEx *dispex)
static const dispex_static_data_vtbl_t DOMEvent_dispex_vtbl = { DOMEvent_destructor, + NULL, DOMEvent_unlink };
@@ -2974,6 +2976,7 @@ static dispex_static_data_t DOMEvent_dispex = {
static const dispex_static_data_vtbl_t DOMUIEvent_dispex_vtbl = { DOMEvent_destructor, + NULL, DOMUIEvent_unlink };
@@ -2992,6 +2995,7 @@ static dispex_static_data_t DOMUIEvent_dispex = {
static const dispex_static_data_vtbl_t DOMMouseEvent_dispex_vtbl = { DOMEvent_destructor, + NULL, DOMMouseEvent_unlink };
@@ -3011,6 +3015,7 @@ static dispex_static_data_t DOMMouseEvent_dispex = {
static const dispex_static_data_vtbl_t DOMKeyboardEvent_dispex_vtbl = { DOMEvent_destructor, + NULL, DOMKeyboardEvent_unlink };
@@ -3044,6 +3049,7 @@ static dispex_static_data_t DOMPageTransitionEvent_dispex = {
static const dispex_static_data_vtbl_t DOMCustomEvent_dispex_vtbl = { DOMCustomEvent_destructor, + NULL, DOMCustomEvent_unlink };
@@ -3062,6 +3068,7 @@ static dispex_static_data_t DOMCustomEvent_dispex = {
static const dispex_static_data_vtbl_t DOMMessageEvent_dispex_vtbl = { DOMMessageEvent_destructor, + NULL, DOMMessageEvent_unlink };
@@ -3080,6 +3087,7 @@ static dispex_static_data_t DOMMessageEvent_dispex = {
static const dispex_static_data_vtbl_t DOMProgressEvent_dispex_vtbl = { DOMEvent_destructor, + NULL, DOMProgressEvent_unlink };
@@ -3098,6 +3106,7 @@ static dispex_static_data_t DOMProgressEvent_dispex = {
static const dispex_static_data_vtbl_t DOMStorageEvent_dispex_vtbl = { DOMStorageEvent_destructor, + NULL, DOMEvent_unlink };
diff --git a/dlls/mshtml/htmlimg.c b/dlls/mshtml/htmlimg.c index fac0a56ab74..effcd2af591 100644 --- a/dlls/mshtml/htmlimg.c +++ b/dlls/mshtml/htmlimg.c @@ -978,6 +978,7 @@ static const tid_t HTMLImageElementFactory_iface_tids[] = { static const dispex_static_data_vtbl_t HTMLImageElementFactory_dispex_vtbl = { HTMLImageElementFactory_destructor, NULL, + NULL, HTMLImageElementFactory_value, NULL, NULL, diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c index 216ebf44d9a..49327ef56a8 100644 --- a/dlls/mshtml/htmllocation.c +++ b/dlls/mshtml/htmllocation.c @@ -633,6 +633,7 @@ static void HTMLLocation_destructor(DispatchEx *dispex)
static const dispex_static_data_vtbl_t HTMLLocation_dispex_vtbl = { HTMLLocation_destructor, + NULL, HTMLLocation_unlink };
diff --git a/dlls/mshtml/htmlnode.c b/dlls/mshtml/htmlnode.c index ad292fbae90..9b7220606cc 100644 --- a/dlls/mshtml/htmlnode.c +++ b/dlls/mshtml/htmlnode.c @@ -439,6 +439,7 @@ static HRESULT HTMLDOMChildrenCollection_invoke(DispatchEx *dispex, DISPID id, L
static const dispex_static_data_vtbl_t HTMLDOMChildrenCollection_dispex_vtbl = { HTMLDOMChildrenCollection_destructor, + NULL, HTMLDOMChildrenCollection_unlink, NULL, HTMLDOMChildrenCollection_get_dispid, @@ -1507,6 +1508,7 @@ void HTMLDOMNode_Init(HTMLDocumentNode *doc, HTMLDOMNode *node, nsIDOMNode *nsno
static const dispex_static_data_vtbl_t HTMLDOMNode_dispex_vtbl = { HTMLDOMNode_dispex_destructor, + NULL, };
static const tid_t HTMLDOMNode_iface_tids[] = { diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c index ac9c4ea8f5b..3490c639e41 100644 --- a/dlls/mshtml/htmlselect.c +++ b/dlls/mshtml/htmlselect.c @@ -632,6 +632,7 @@ static const tid_t HTMLOptionElementFactory_iface_tids[] = { static const dispex_static_data_vtbl_t HTMLOptionElementFactory_dispex_vtbl = { HTMLOptionElementFactory_destructor, NULL, + NULL, HTMLOptionElementFactory_value, NULL, NULL, diff --git a/dlls/mshtml/htmlstorage.c b/dlls/mshtml/htmlstorage.c index 3c3259c3804..fefb38fbd95 100644 --- a/dlls/mshtml/htmlstorage.c +++ b/dlls/mshtml/htmlstorage.c @@ -1311,6 +1311,7 @@ static const dispex_static_data_vtbl_t HTMLStorage_dispex_vtbl = { HTMLStorage_destructor, NULL, NULL, + NULL, HTMLStorage_get_dispid, HTMLStorage_get_name, HTMLStorage_invoke, diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c index f302de0cf8c..439ec010a14 100644 --- a/dlls/mshtml/htmlstyle.c +++ b/dlls/mshtml/htmlstyle.c @@ -10003,6 +10003,7 @@ void CSSStyle_init_dispex_info(dispex_data_t *info, compat_mode_t mode)
const dispex_static_data_vtbl_t CSSStyle_dispex_vtbl = { CSSStyle_destructor, + NULL, CSSStyle_unlink, NULL, CSSStyle_get_dispid, diff --git a/dlls/mshtml/htmlstylesheet.c b/dlls/mshtml/htmlstylesheet.c index fd43e68949e..0d8466350b2 100644 --- a/dlls/mshtml/htmlstylesheet.c +++ b/dlls/mshtml/htmlstylesheet.c @@ -210,6 +210,7 @@ static void HTMLStyleSheetRule_destructor(DispatchEx *dispex)
static const dispex_static_data_vtbl_t HTMLStyleSheetRule_dispex_vtbl = { HTMLStyleSheetRule_destructor, + NULL, HTMLStyleSheetRule_unlink };
@@ -478,6 +479,7 @@ static HRESULT HTMLStyleSheetRulesCollection_invoke(DispatchEx *dispex, DISPID i
static const dispex_static_data_vtbl_t HTMLStyleSheetRulesCollection_dispex_vtbl = { HTMLStyleSheetRulesCollection_destructor, + NULL, HTMLStyleSheetRulesCollection_unlink, NULL, HTMLStyleSheetRulesCollection_get_dispid, @@ -911,6 +913,7 @@ static HRESULT HTMLStyleSheetsCollection_invoke(DispatchEx *dispex, DISPID id, L
static const dispex_static_data_vtbl_t HTMLStyleSheetsCollection_dispex_vtbl = { HTMLStyleSheetsCollection_destructor, + NULL, HTMLStyleSheetsCollection_unlink, NULL, HTMLStyleSheetsCollection_get_dispid, @@ -1498,6 +1501,7 @@ static void HTMLStyleSheet_init_dispex_info(dispex_data_t *info, compat_mode_t m
static const dispex_static_data_vtbl_t HTMLStyleSheet_dispex_vtbl = { HTMLStyleSheet_destructor, + NULL, HTMLStyleSheet_unlink };
diff --git a/dlls/mshtml/htmltextnode.c b/dlls/mshtml/htmltextnode.c index 1bae5994c14..1d455b4b323 100644 --- a/dlls/mshtml/htmltextnode.c +++ b/dlls/mshtml/htmltextnode.c @@ -364,6 +364,7 @@ static const NodeImplVtbl HTMLDOMTextNodeImplVtbl = {
static const dispex_static_data_vtbl_t HTMLDOMTextNode_dispex_vtbl = { HTMLDOMTextNode_destructor, + NULL, };
static const tid_t HTMLDOMTextNode_iface_tids[] = { diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 68777c18c7f..047430a0df5 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -3788,6 +3788,38 @@ static inline HTMLInnerWindow *impl_from_DispatchEx(DispatchEx *iface) return CONTAINING_RECORD(iface, HTMLInnerWindow, event_target.dispex); }
+static void HTMLWindow_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback *cb) +{ + HTMLInnerWindow *This = impl_from_DispatchEx(dispex); + HTMLOuterWindow *child; + + if(This->base.console) + note_cc_edge((nsISupports*)This->base.console, "console", cb); + LIST_FOR_EACH_ENTRY(child, &This->children, HTMLOuterWindow, sibling_entry) + note_cc_edge((nsISupports*)&child->base.IHTMLWindow2_iface, "child", cb); + if(This->doc) + note_cc_edge((nsISupports*)&This->doc->node.IHTMLDOMNode_iface, "doc", cb); + if(This->image_factory) + note_cc_edge((nsISupports*)&This->image_factory->IHTMLImageElementFactory_iface, "image_factory", cb); + if(This->option_factory) + note_cc_edge((nsISupports*)&This->option_factory->IHTMLOptionElementFactory_iface, "option_factory", cb); + if(This->xhr_factory) + note_cc_edge((nsISupports*)&This->xhr_factory->IHTMLXMLHttpRequestFactory_iface, "xhr_factory", cb); + if(This->mutation_observer_ctor) + note_cc_edge((nsISupports*)This->mutation_observer_ctor, "mutation_observer_ctor", cb); + if(This->screen) + note_cc_edge((nsISupports*)This->screen, "screen", cb); + if(This->history) + note_cc_edge((nsISupports*)&This->history->IOmHistory_iface, "history", cb); + if(This->navigator) + note_cc_edge((nsISupports*)This->navigator, "navigator", cb); + if(This->session_storage) + note_cc_edge((nsISupports*)This->session_storage, "session_storage", cb); + if(This->local_storage) + note_cc_edge((nsISupports*)This->local_storage, "local_storage", cb); + traverse_variant(&This->performance, "performance", cb); +} + static void HTMLWindow_unlink(DispatchEx *dispex) { HTMLInnerWindow *This = impl_from_DispatchEx(dispex); @@ -4111,6 +4143,7 @@ static IHTMLEventObj *HTMLWindow_set_current_event(DispatchEx *dispex, IHTMLEven static const event_target_vtbl_t HTMLWindow_event_target_vtbl = { { HTMLWindow_destructor, + HTMLWindow_traverse, HTMLWindow_unlink, NULL, NULL, diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 6391a27c5f9..943e579ebdc 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -355,6 +355,7 @@ typedef struct { /* Used to implement Cycle Collection callbacks; note that the destructor is not optional! Unlike delete_cycle_collectable, unlink is called before the destructor (if available). */ void (*destructor)(DispatchEx*); + void (*traverse)(DispatchEx*,nsCycleCollectionTraversalCallback*); void (*unlink)(DispatchEx*);
/* Called when the object wants to handle DISPID_VALUE invocations */ diff --git a/dlls/mshtml/mutation.c b/dlls/mshtml/mutation.c index 4d1078cce81..e9c4019de69 100644 --- a/dlls/mshtml/mutation.c +++ b/dlls/mshtml/mutation.c @@ -1225,6 +1225,7 @@ static void mutation_observer_destructor(DispatchEx *dispex)
static const dispex_static_data_vtbl_t mutation_observer_dispex_vtbl = { mutation_observer_destructor, + NULL, mutation_observer_unlink };
@@ -1380,6 +1381,7 @@ static HRESULT mutation_observer_ctor_value(DispatchEx *dispex, LCID lcid, static dispex_static_data_vtbl_t mutation_observer_ctor_dispex_vtbl = { mutation_observer_ctor_destructor, NULL, + NULL, mutation_observer_ctor_value };
diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index 4ba7991ab05..7cc6ef6e94b 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -302,6 +302,7 @@ static void HTMLDOMImplementation_destructor(DispatchEx *dispex)
static const dispex_static_data_vtbl_t HTMLDOMImplementation_dispex_vtbl = { HTMLDOMImplementation_destructor, + NULL, HTMLDOMImplementation_unlink };
@@ -913,6 +914,7 @@ static void HTMLPluginsCollection_destructor(DispatchEx *dispex)
static const dispex_static_data_vtbl_t HTMLPluginsCollection_dispex_vtbl = { HTMLPluginsCollection_destructor, + NULL, HTMLPluginsCollection_unlink };
@@ -1073,6 +1075,7 @@ static void HTMLMimeTypesCollection_destructor(DispatchEx *dispex)
static const dispex_static_data_vtbl_t HTMLMimeTypesCollection_dispex_vtbl = { HTMLMimeTypesCollection_destructor, + NULL, HTMLMimeTypesCollection_unlink };
@@ -1520,6 +1523,7 @@ static void OmNavigator_destructor(DispatchEx *dispex)
static const dispex_static_data_vtbl_t OmNavigator_dispex_vtbl = { OmNavigator_destructor, + NULL, OmNavigator_unlink };
@@ -1948,6 +1952,7 @@ static void HTMLPerformanceTiming_destructor(DispatchEx *dispex)
static const dispex_static_data_vtbl_t HTMLPerformanceTiming_dispex_vtbl = { HTMLPerformanceTiming_destructor, + NULL, HTMLPerformanceTiming_unlink };
@@ -2124,6 +2129,7 @@ static void HTMLPerformanceNavigation_destructor(DispatchEx *dispex)
static const dispex_static_data_vtbl_t HTMLPerformanceNavigation_dispex_vtbl = { HTMLPerformanceNavigation_destructor, + NULL, HTMLPerformanceNavigation_unlink };
@@ -2339,6 +2345,7 @@ static void HTMLPerformance_destructor(DispatchEx *dispex)
static const dispex_static_data_vtbl_t HTMLPerformance_dispex_vtbl = { HTMLPerformance_destructor, + NULL, HTMLPerformance_unlink };
@@ -3111,6 +3118,7 @@ static void media_query_list_destructor(DispatchEx *dispex)
static const dispex_static_data_vtbl_t media_query_list_dispex_vtbl = { media_query_list_destructor, + NULL, media_query_list_unlink };
diff --git a/dlls/mshtml/range.c b/dlls/mshtml/range.c index 4c7bd710265..b733b4ff0ad 100644 --- a/dlls/mshtml/range.c +++ b/dlls/mshtml/range.c @@ -1728,6 +1728,7 @@ static void HTMLTxtRange_destructor(DispatchEx *dispex)
static const dispex_static_data_vtbl_t HTMLTxtRange_dispex_vtbl = { HTMLTxtRange_destructor, + NULL, HTMLTxtRange_unlink };
@@ -2087,6 +2088,7 @@ static void HTMLDOMRange_destructor(DispatchEx *dispex)
static const dispex_static_data_vtbl_t HTMLDOMRange_dispex_vtbl = { HTMLDOMRange_destructor, + NULL, HTMLDOMRange_unlink };
diff --git a/dlls/mshtml/selection.c b/dlls/mshtml/selection.c index 3b840d526d2..78aa55e8c6b 100644 --- a/dlls/mshtml/selection.c +++ b/dlls/mshtml/selection.c @@ -341,6 +341,7 @@ static void HTMLSelectionObject_destructor(DispatchEx *dispex)
static const dispex_static_data_vtbl_t HTMLSelectionObject_dispex_vtbl = { HTMLSelectionObject_destructor, + NULL, HTMLSelectionObject_unlink };
diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c index ba18bd419fa..3ee7c1681a0 100644 --- a/dlls/mshtml/xmlhttprequest.c +++ b/dlls/mshtml/xmlhttprequest.c @@ -1596,6 +1596,7 @@ static void HTMLXMLHttpRequest_init_dispex_info(dispex_data_t *info, compat_mode static event_target_vtbl_t HTMLXMLHttpRequest_event_target_vtbl = { { HTMLXMLHttpRequest_destructor, + NULL, HTMLXMLHttpRequest_unlink }, HTMLXMLHttpRequest_get_gecko_target, @@ -1814,6 +1815,7 @@ static HRESULT HTMLXMLHttpRequestFactory_value(DispatchEx *iface, LCID lcid, WOR static const dispex_static_data_vtbl_t HTMLXMLHttpRequestFactory_dispex_vtbl = { HTMLXMLHttpRequestFactory_destructor, NULL, + NULL, HTMLXMLHttpRequestFactory_value };
Jacek Caban (@jacek) commented about dlls/mshtml/htmlwindow.c:
*ppv = NULL; FIXME("(%p)->(IID_IMarshal %p)\n", This, ppv); return E_NOINTERFACE;
- }else if(dispex_query_interface(&This->inner_window->event_target.dispex, riid, ppv)) {
assert(!*ppv);
return E_NOINTERFACE;
- }else if(IsEqualGUID(&IID_nsXPCOMCycleCollectionParticipant, riid) && is_outer_window(This)) {
You could also introduce separated QueryInterface for outer that would handle it.
Jacek Caban (@jacek) commented about dlls/mshtml/htmlwindow.c:
HTMLWindow2_get_external
};
+static const IHTMLWindow2Vtbl outer_window_HTMLWindow2Vtbl = {
- HTMLWindow2_QueryInterface,
- outer_window_AddRef,
- outer_window_Release,
Please move vtbl split to a separated patch.
Jacek Caban (@jacek) commented about dlls/mshtml/htmlwindow.c:
HTMLWindow_init_dispex_info
};
+static nsresult NSAPI outer_window_traverse(void *ccp, void *p, nsCycleCollectionTraversalCallback *cb) +{
- HTMLOuterWindow *window = impl_from_IHTMLWindow2(p)->outer_window;
- describe_cc_node(&window->ccref, "OuterWindow", cb);
- if(window->base.console)
note_cc_edge((nsISupports*)window->base.console, "console", cb);
Console should probably be moved to inner window instead.
On Fri Aug 11 17:45:02 2023 +0000, Jacek Caban wrote:
Console should probably be moved to inner window instead.
Yeah, I've no idea why it's in the base window, I thought there was a reason for it so didn't want to touch it.