mshtml: Default to previous script type if not given.
This commit is contained in:
parent
156e212715
commit
1b2525d1bf
@ -2626,6 +2626,7 @@ static HRESULT create_inner_window(HTMLOuterWindow *outer_window, HTMLInnerWindo
|
|||||||
init_dispex(&window->dispex, (IUnknown*)&window->base.IHTMLWindow2_iface, &HTMLWindow_dispex);
|
init_dispex(&window->dispex, (IUnknown*)&window->base.IHTMLWindow2_iface, &HTMLWindow_dispex);
|
||||||
|
|
||||||
window->task_magic = get_task_target_magic();
|
window->task_magic = get_task_target_magic();
|
||||||
|
window->current_script_guid = CLSID_JScript;
|
||||||
|
|
||||||
*ret = window;
|
*ret = window;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
@ -385,6 +385,7 @@ struct HTMLInnerWindow {
|
|||||||
HTMLDocumentNode *doc;
|
HTMLDocumentNode *doc;
|
||||||
|
|
||||||
struct list script_hosts;
|
struct list script_hosts;
|
||||||
|
GUID current_script_guid;
|
||||||
|
|
||||||
IHTMLEventObj *event;
|
IHTMLEventObj *event;
|
||||||
|
|
||||||
@ -982,6 +983,9 @@ DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd
|
|||||||
|
|
||||||
DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
|
DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
|
||||||
|
|
||||||
|
DEFINE_GUID(CLSID_JScript, 0xf414c260,0x6ac0,0x11cf, 0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58);
|
||||||
|
DEFINE_GUID(CLSID_VBScript, 0xb54f3741,0x5b07,0x11cf, 0xa4,0xb0,0x00,0xaa,0x00,0x4a,0x55,0xe8);
|
||||||
|
|
||||||
/* memory allocation functions */
|
/* memory allocation functions */
|
||||||
|
|
||||||
static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
|
static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
|
||||||
|
@ -63,11 +63,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
|||||||
static const WCHAR windowW[] = {'w','i','n','d','o','w',0};
|
static const WCHAR windowW[] = {'w','i','n','d','o','w',0};
|
||||||
static const WCHAR emptyW[] = {0};
|
static const WCHAR emptyW[] = {0};
|
||||||
|
|
||||||
static const CLSID CLSID_JScript =
|
|
||||||
{0xf414c260,0x6ac0,0x11cf,{0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58}};
|
|
||||||
static const CLSID CLSID_VBScript =
|
|
||||||
{0xb54f3741,0x5b07,0x11cf,{0xa4,0xb0,0x00,0xaa,0x00,0x4a,0x55,0xe8}};
|
|
||||||
|
|
||||||
struct ScriptHost {
|
struct ScriptHost {
|
||||||
IActiveScriptSite IActiveScriptSite_iface;
|
IActiveScriptSite IActiveScriptSite_iface;
|
||||||
IActiveScriptSiteInterruptPoll IActiveScriptSiteInterruptPoll_iface;
|
IActiveScriptSiteInterruptPoll IActiveScriptSiteInterruptPoll_iface;
|
||||||
@ -646,6 +641,8 @@ static void parse_text(ScriptHost *script_host, LPCWSTR text)
|
|||||||
|
|
||||||
TRACE("%s\n", debugstr_w(text));
|
TRACE("%s\n", debugstr_w(text));
|
||||||
|
|
||||||
|
script_host->window->current_script_guid = script_host->guid;
|
||||||
|
|
||||||
VariantInit(&var);
|
VariantInit(&var);
|
||||||
memset(&excepinfo, 0, sizeof(excepinfo));
|
memset(&excepinfo, 0, sizeof(excepinfo));
|
||||||
TRACE(">>>\n");
|
TRACE(">>>\n");
|
||||||
@ -758,7 +755,7 @@ static BOOL get_guid_from_language(LPCWSTR type, GUID *guid)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL get_script_guid(nsIDOMHTMLScriptElement *nsscript, GUID *guid)
|
static BOOL get_script_guid(HTMLInnerWindow *window, nsIDOMHTMLScriptElement *nsscript, GUID *guid)
|
||||||
{
|
{
|
||||||
nsAString attr_str, val_str;
|
nsAString attr_str, val_str;
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
@ -793,7 +790,7 @@ static BOOL get_script_guid(nsIDOMHTMLScriptElement *nsscript, GUID *guid)
|
|||||||
if(*language) {
|
if(*language) {
|
||||||
ret = get_guid_from_language(language, guid);
|
ret = get_guid_from_language(language, guid);
|
||||||
}else {
|
}else {
|
||||||
*guid = CLSID_JScript;
|
*guid = window->current_script_guid;
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
@ -822,7 +819,7 @@ void doc_insert_script(HTMLInnerWindow *window, nsIDOMHTMLScriptElement *nsscrip
|
|||||||
ScriptHost *script_host;
|
ScriptHost *script_host;
|
||||||
GUID guid;
|
GUID guid;
|
||||||
|
|
||||||
if(!get_script_guid(nsscript, &guid)) {
|
if(!get_script_guid(window, nsscript, &guid)) {
|
||||||
WARN("Could not find script GUID\n");
|
WARN("Could not find script GUID\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -844,13 +841,15 @@ void doc_insert_script(HTMLInnerWindow *window, nsIDOMHTMLScriptElement *nsscrip
|
|||||||
IDispatch *script_parse_event(HTMLInnerWindow *window, LPCWSTR text)
|
IDispatch *script_parse_event(HTMLInnerWindow *window, LPCWSTR text)
|
||||||
{
|
{
|
||||||
ScriptHost *script_host;
|
ScriptHost *script_host;
|
||||||
GUID guid = CLSID_JScript;
|
GUID guid;
|
||||||
const WCHAR *ptr;
|
const WCHAR *ptr;
|
||||||
IDispatch *disp;
|
IDispatch *disp;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
static const WCHAR delimiterW[] = {'\"',0};
|
static const WCHAR delimiterW[] = {'\"',0};
|
||||||
|
|
||||||
|
TRACE("%s\n", debugstr_w(text));
|
||||||
|
|
||||||
for(ptr = text; isalnumW(*ptr); ptr++);
|
for(ptr = text; isalnumW(*ptr); ptr++);
|
||||||
if(*ptr == ':') {
|
if(*ptr == ':') {
|
||||||
LPWSTR language;
|
LPWSTR language;
|
||||||
@ -872,6 +871,7 @@ IDispatch *script_parse_event(HTMLInnerWindow *window, LPCWSTR text)
|
|||||||
ptr++;
|
ptr++;
|
||||||
}else {
|
}else {
|
||||||
ptr = text;
|
ptr = text;
|
||||||
|
guid = window->current_script_guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(IsEqualGUID(&CLSID_JScript, &guid)
|
if(IsEqualGUID(&CLSID_JScript, &guid)
|
||||||
@ -880,6 +880,8 @@ IDispatch *script_parse_event(HTMLInnerWindow *window, LPCWSTR text)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window->current_script_guid = guid;
|
||||||
|
|
||||||
script_host = get_script_host(window, &guid);
|
script_host = get_script_host(window, &guid);
|
||||||
if(!script_host || !script_host->parse_proc)
|
if(!script_host || !script_host->parse_proc)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -921,6 +923,8 @@ HRESULT exec_script(HTMLInnerWindow *window, const WCHAR *code, const WCHAR *lan
|
|||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window->current_script_guid = guid;
|
||||||
|
|
||||||
memset(&ei, 0, sizeof(ei));
|
memset(&ei, 0, sizeof(ei));
|
||||||
TRACE(">>>\n");
|
TRACE(">>>\n");
|
||||||
hres = IActiveScriptParse_ParseScriptText(script_host->parse, code, NULL, NULL, delimW, 0, 0, SCRIPTTEXT_ISVISIBLE, ret, &ei);
|
hres = IActiveScriptParse_ParseScriptText(script_host->parse, code, NULL, NULL, delimW, 0, 0, SCRIPTTEXT_ISVISIBLE, ret, &ei);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user