Jacek Caban (@jacek) commented about dlls/mshtml/script.c:
hres = IActiveScript_AddNamedItem(script_host->script, L"window", SCRIPTITEM_ISVISIBLE|SCRIPTITEM_ISSOURCE|SCRIPTITEM_GLOBALMEMBERS); if(SUCCEEDED(hres)) {
const struct list *list = &script_host->window->script_hosts, *head = list_head(list);
This is not very reliable. For example the second script engine could fail early and then the third one should probably take care of changing the mode.