mshtml: Use first script host's GUID as default script guid.
This commit is contained in:
parent
24f4c09bb6
commit
156e94429d
|
@ -2721,7 +2721,6 @@ static HRESULT create_inner_window(HTMLOuterWindow *outer_window, IMoniker *mon,
|
|||
init_dispex(&window->dispex, (IUnknown*)&window->base.IHTMLWindow2_iface, &HTMLWindow_dispex);
|
||||
|
||||
window->task_magic = get_task_target_magic();
|
||||
window->current_script_guid = CLSID_JScript;
|
||||
|
||||
if(mon) {
|
||||
IMoniker_AddRef(mon);
|
||||
|
|
|
@ -388,7 +388,6 @@ struct HTMLInnerWindow {
|
|||
HTMLDocumentNode *doc;
|
||||
|
||||
struct list script_hosts;
|
||||
GUID current_script_guid;
|
||||
|
||||
IHTMLEventObj *event;
|
||||
|
||||
|
|
|
@ -641,8 +641,6 @@ static void parse_text(ScriptHost *script_host, LPCWSTR text)
|
|||
|
||||
TRACE("%s\n", debugstr_w(text));
|
||||
|
||||
script_host->window->current_script_guid = script_host->guid;
|
||||
|
||||
VariantInit(&var);
|
||||
memset(&excepinfo, 0, sizeof(excepinfo));
|
||||
TRACE(">>>\n");
|
||||
|
@ -722,6 +720,14 @@ static void parse_script_elem(ScriptHost *script_host, nsIDOMHTMLScriptElement *
|
|||
nsAString_Finish(&src_str);
|
||||
}
|
||||
|
||||
static GUID get_default_script_guid(HTMLInnerWindow *window)
|
||||
{
|
||||
/* If not specified, we should use very first script host that was created for the page (or JScript if none) */
|
||||
return list_empty(&window->script_hosts)
|
||||
? CLSID_JScript
|
||||
: LIST_ENTRY(list_head(&window->script_hosts), ScriptHost, entry)->guid;
|
||||
}
|
||||
|
||||
static BOOL get_guid_from_type(LPCWSTR type, GUID *guid)
|
||||
{
|
||||
const WCHAR text_javascriptW[] =
|
||||
|
@ -790,7 +796,7 @@ static BOOL get_script_guid(HTMLInnerWindow *window, nsIDOMHTMLScriptElement *ns
|
|||
if(*language) {
|
||||
ret = get_guid_from_language(language, guid);
|
||||
}else {
|
||||
*guid = window->current_script_guid;
|
||||
*guid = get_default_script_guid(window);
|
||||
ret = TRUE;
|
||||
}
|
||||
}else {
|
||||
|
@ -871,7 +877,7 @@ IDispatch *script_parse_event(HTMLInnerWindow *window, LPCWSTR text)
|
|||
ptr++;
|
||||
}else {
|
||||
ptr = text;
|
||||
guid = window->current_script_guid;
|
||||
guid = get_default_script_guid(window);
|
||||
}
|
||||
|
||||
if(IsEqualGUID(&CLSID_JScript, &guid)
|
||||
|
@ -880,8 +886,6 @@ IDispatch *script_parse_event(HTMLInnerWindow *window, LPCWSTR text)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
window->current_script_guid = guid;
|
||||
|
||||
script_host = get_script_host(window, &guid);
|
||||
if(!script_host || !script_host->parse_proc)
|
||||
return NULL;
|
||||
|
@ -923,8 +927,6 @@ HRESULT exec_script(HTMLInnerWindow *window, const WCHAR *code, const WCHAR *lan
|
|||
return E_FAIL;
|
||||
}
|
||||
|
||||
window->current_script_guid = guid;
|
||||
|
||||
memset(&ei, 0, sizeof(ei));
|
||||
TRACE(">>>\n");
|
||||
hres = IActiveScriptParse_ParseScriptText(script_host->parse, code, NULL, NULL, delimW, 0, 0, SCRIPTTEXT_ISVISIBLE, ret, &ei);
|
||||
|
|
|
@ -12,19 +12,30 @@ End Sub
|
|||
<script>
|
||||
' Verifies that we're in VBScript although there is no type specified
|
||||
If true then counter = counter+1
|
||||
function inccounter(x)
|
||||
counter = counter+x
|
||||
end function
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
// We're in javascript
|
||||
try {
|
||||
counter++;
|
||||
incCounter(2);
|
||||
}catch(e) {
|
||||
ok(false, "got an exception");
|
||||
}
|
||||
</script>
|
||||
<script type="text/vbscript">
|
||||
<script>
|
||||
' And back to VBScript
|
||||
If true then counter = counter+1
|
||||
|
||||
Sub runTest()
|
||||
Call ok(counter = 3, "counter = " & counter)
|
||||
Call ok(counter = 6, "counter = " & counter)
|
||||
Call external.reportSuccess()
|
||||
End Sub
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
// We're in javascript
|
||||
</script>
|
||||
<body onload="If true then runTest()">
|
||||
</body>
|
||||
|
|
Loading…
Reference in New Issue