mshtml: Set SCRIPTPROP_INVOKEVERSIONING based on document mode value.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
67de587f60
commit
dd78fd0966
|
@ -5035,8 +5035,7 @@ static compat_mode_t HTMLDocumentNode_get_compat_mode(DispatchEx *dispex)
|
|||
|
||||
TRACE("(%p) returning %u\n", This, This->document_mode);
|
||||
|
||||
This->document_mode_locked = TRUE;
|
||||
return This->document_mode;
|
||||
return lock_document_mode(This);
|
||||
}
|
||||
|
||||
static nsISupports *HTMLDocumentNode_get_gecko_target(DispatchEx *dispex)
|
||||
|
@ -5173,8 +5172,8 @@ HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_ob
|
|||
compat_mode_t parent_mode = window->base.outer_window->parent->base.inner_window->doc->document_mode;
|
||||
TRACE("parent mode %u\n", parent_mode);
|
||||
if(parent_mode >= COMPAT_MODE_IE9) {
|
||||
doc->document_mode_locked = TRUE;
|
||||
doc->document_mode = parent_mode;
|
||||
lock_document_mode(doc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3019,9 +3019,7 @@ static HRESULT HTMLWindow_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD
|
|||
static compat_mode_t HTMLWindow_get_compat_mode(DispatchEx *dispex)
|
||||
{
|
||||
HTMLInnerWindow *This = impl_from_DispatchEx(dispex);
|
||||
|
||||
This->doc->document_mode_locked = TRUE;
|
||||
return This->doc->document_mode;
|
||||
return lock_document_mode(This->doc);
|
||||
}
|
||||
|
||||
static nsISupports *HTMLWindow_get_gecko_target(DispatchEx *dispex)
|
||||
|
|
|
@ -898,6 +898,8 @@ void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN
|
|||
HRESULT create_nscontainer(HTMLDocumentObj*,NSContainer**) DECLSPEC_HIDDEN;
|
||||
void NSContainer_Release(NSContainer*) DECLSPEC_HIDDEN;
|
||||
|
||||
compat_mode_t lock_document_mode(HTMLDocumentNode*) DECLSPEC_HIDDEN;
|
||||
|
||||
void init_mutation(nsIComponentManager*) DECLSPEC_HIDDEN;
|
||||
void init_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
|
||||
void release_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -362,6 +362,18 @@ static nsresult run_insert_script(HTMLDocumentNode *doc, nsISupports *script_ifa
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* We may change document mode only in early stage of document lifetime.
|
||||
* Later attempts will not have an effect.
|
||||
*/
|
||||
compat_mode_t lock_document_mode(HTMLDocumentNode *doc)
|
||||
{
|
||||
TRACE("%p: %d\n", doc, doc->document_mode);
|
||||
|
||||
doc->document_mode_locked = TRUE;
|
||||
return doc->document_mode;
|
||||
}
|
||||
|
||||
static void set_document_mode(HTMLDocumentNode *doc, compat_mode_t document_mode, BOOL lock)
|
||||
{
|
||||
if(doc->document_mode_locked) {
|
||||
|
@ -371,9 +383,9 @@ static void set_document_mode(HTMLDocumentNode *doc, compat_mode_t document_mode
|
|||
|
||||
TRACE("%p: %d\n", doc, document_mode);
|
||||
|
||||
if(lock)
|
||||
doc->document_mode_locked = TRUE;
|
||||
doc->document_mode = document_mode;
|
||||
if(lock)
|
||||
lock_document_mode(doc);
|
||||
}
|
||||
|
||||
static BOOL parse_ua_compatible(const WCHAR *p, compat_mode_t *r)
|
||||
|
@ -816,8 +828,7 @@ static void NSAPI nsDocumentObserver_AttemptToExecuteScript(nsIDocumentObserver
|
|||
if(NS_SUCCEEDED(nsres)) {
|
||||
TRACE("script node\n");
|
||||
|
||||
This->document_mode_locked = TRUE;
|
||||
|
||||
lock_document_mode(This);
|
||||
add_script_runner(This, run_insert_script, (nsISupports*)nsscript, (nsISupports*)aParser);
|
||||
nsIDOMHTMLScriptElement_Release(nsscript);
|
||||
}
|
||||
|
|
|
@ -112,26 +112,6 @@ static void set_script_prop(ScriptHost *script_host, DWORD property, VARIANT *va
|
|||
WARN("SetProperty(%x) failed: %08x\n", property, hres);
|
||||
}
|
||||
|
||||
static BOOL is_quirks_mode(HTMLDocumentNode *doc)
|
||||
{
|
||||
const WCHAR *compat_mode;
|
||||
nsAString nsstr;
|
||||
nsresult nsres;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
static const WCHAR BackCompatW[] = {'B','a','c','k','C','o','m','p','a','t',0};
|
||||
|
||||
nsAString_Init(&nsstr, NULL);
|
||||
nsres = nsIDOMHTMLDocument_GetCompatMode(doc->nsdoc, &nsstr);
|
||||
if(NS_SUCCEEDED(nsres)) {
|
||||
nsAString_GetData(&nsstr, &compat_mode);
|
||||
if(!strcmpW(compat_mode, BackCompatW))
|
||||
ret = TRUE;
|
||||
}
|
||||
nsAString_Finish(&nsstr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static BOOL init_script_engine(ScriptHost *script_host)
|
||||
{
|
||||
IObjectSafety *safety;
|
||||
|
@ -170,7 +150,7 @@ static BOOL init_script_engine(ScriptHost *script_host)
|
|||
return FALSE;
|
||||
|
||||
V_VT(&var) = VT_I4;
|
||||
V_I4(&var) = is_quirks_mode(script_host->window->doc) ? 1 : 2;
|
||||
V_I4(&var) = lock_document_mode(script_host->window->doc) == COMPAT_MODE_QUIRKS ? 1 : 2;
|
||||
set_script_prop(script_host, SCRIPTPROP_INVOKEVERSIONING, &var);
|
||||
|
||||
V_VT(&var) = VT_BOOL;
|
||||
|
|
Loading…
Reference in New Issue