Jacek Caban (@jacek) commented about dlls/mshtml/mutation.c:
*/ compat_mode_t lock_document_mode(HTMLDocumentNode *doc) {
- TRACE("%p: %d\n", doc, doc->document_mode);
- if(!doc->document_mode_locked) { doc->document_mode_locked = TRUE;
if(doc->emulate_mode && doc->document_mode < COMPAT_MODE_IE10) {
nsIDOMDocumentType *nsdoctype;
if(NS_SUCCEEDED(nsIDOMDocument_GetDoctype(doc->dom_document, &nsdoctype)) && nsdoctype)
nsIDOMDocumentType_Release(nsdoctype);
else
doc->document_mode = COMPAT_MODE_QUIRKS;
}
Why do you check it here instead of when setting `document_mode` value? We use it without locking in some places, so it seems safer to do that right away.