2 * Copyright 2008 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
32 #include "mshtml_private.h"
33 #include "htmlscript.h"
34 #include "htmlevent.h"
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
40 #define IE_MAJOR_VERSION 7
41 #define IE_MINOR_VERSION 0
43 static const IID NS_ICONTENTUTILS_CID =
44 {0x762C4AE7,0xB923,0x422F,{0xB9,0x7E,0xB9,0xBF,0xC1,0xEF,0x7B,0xF0}};
46 static nsIContentUtils *content_utils;
48 static PRUnichar *handle_insert_comment(HTMLDocumentNode *doc, const PRUnichar *comment)
50 int majorv = 0, minorv = 0;
51 const PRUnichar *ptr, *end;
63 static const PRUnichar endifW[] = {'<','!','[','e','n','d','i','f',']'};
65 if(comment[0] != '[' || comment[1] != 'i' || comment[2] != 'f')
72 if(ptr[0] == 'l' && ptr[1] == 't') {
80 }else if(ptr[0] == 'g' && ptr[1] == 't') {
95 if(ptr[0] != 'I' || ptr[1] != 'E')
101 while(isspaceW(*ptr))
106 while(isdigitW(*ptr))
107 majorv = majorv*10 + (*ptr++ - '0');
113 while(isdigitW(*ptr))
114 minorv = minorv*10 + (*ptr++ - '0');
117 while(isspaceW(*ptr))
119 if(ptr[0] != ']' || ptr[1] != '>')
124 if(len < sizeof(endifW)/sizeof(WCHAR))
127 end = ptr + len-sizeof(endifW)/sizeof(WCHAR);
128 if(memcmp(end, endifW, sizeof(endifW)))
133 if(majorv == IE_MAJOR_VERSION && minorv == IE_MINOR_VERSION)
137 if(majorv > IE_MAJOR_VERSION)
139 if(majorv == IE_MAJOR_VERSION && minorv > IE_MINOR_VERSION)
143 if(majorv > IE_MAJOR_VERSION)
145 if(majorv == IE_MAJOR_VERSION && minorv >= IE_MINOR_VERSION)
149 if(majorv < IE_MAJOR_VERSION)
151 if(majorv == IE_MAJOR_VERSION && minorv < IE_MINOR_VERSION)
155 if(majorv < IE_MAJOR_VERSION)
157 if(majorv == IE_MAJOR_VERSION && minorv <= IE_MINOR_VERSION)
162 buf = heap_alloc((end-ptr+1)*sizeof(WCHAR));
166 memcpy(buf, ptr, (end-ptr)*sizeof(WCHAR));
172 static nsresult run_insert_comment(HTMLDocumentNode *doc, nsISupports *comment_iface, nsISupports *arg2)
174 const PRUnichar *comment;
175 nsIDOMComment *nscomment;
176 PRUnichar *replace_html;
177 nsAString comment_str;
180 nsres = nsISupports_QueryInterface(comment_iface, &IID_nsIDOMComment, (void**)&nscomment);
181 if(NS_FAILED(nsres)) {
182 ERR("Could not get nsIDOMComment iface:%08x\n", nsres);
186 nsAString_Init(&comment_str, NULL);
187 nsres = nsIDOMComment_GetData(nscomment, &comment_str);
191 nsAString_GetData(&comment_str, &comment);
192 replace_html = handle_insert_comment(doc, comment);
193 nsAString_Finish(&comment_str);
198 hres = replace_node_by_html(doc->nsdoc, (nsIDOMNode*)nscomment, replace_html);
199 heap_free(replace_html);
201 nsres = NS_ERROR_FAILURE;
205 nsIDOMComment_Release(nscomment);
209 static nsresult run_bind_to_tree(HTMLDocumentNode *doc, nsISupports *nsiface, nsISupports *arg2)
216 TRACE("(%p)->(%p)\n", doc, nsiface);
218 nsres = nsISupports_QueryInterface(nsiface, &IID_nsIDOMNode, (void**)&nsnode);
222 hres = get_node(doc, nsnode, TRUE, &node);
223 nsIDOMNode_Release(nsnode);
225 ERR("Could not get node\n");
229 if(node->vtbl->bind_to_tree)
230 node->vtbl->bind_to_tree(node);
236 /* Calls undocumented 69 cmd of CGID_Explorer */
237 static void call_explorer_69(HTMLDocumentObj *doc)
239 IOleCommandTarget *olecmd;
246 hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd);
251 hres = IOleCommandTarget_Exec(olecmd, &CGID_Explorer, 69, 0, NULL, &var);
252 IOleCommandTarget_Release(olecmd);
253 if(SUCCEEDED(hres) && V_VT(&var) != VT_NULL)
254 FIXME("handle result\n");
257 static void parse_complete(HTMLDocumentObj *doc)
259 TRACE("(%p)\n", doc);
261 if(doc->usermode == EDITMODE)
262 init_editor(&doc->basedoc);
264 call_explorer_69(doc);
266 IAdviseSink_OnViewChange(doc->view_sink, DVASPECT_CONTENT, -1);
267 call_property_onchanged(&doc->basedoc.cp_propnotif, 1005);
268 call_explorer_69(doc);
270 if(doc->is_webbrowser && doc->usermode != EDITMODE)
271 IDocObjectService_FireNavigateComplete2(doc->doc_object_service, &doc->basedoc.window->base.IHTMLWindow2_iface, 0);
273 /* FIXME: IE7 calls EnableModelless(TRUE), EnableModelless(FALSE) and sets interactive state here */
276 static nsresult run_end_load(HTMLDocumentNode *This, nsISupports *arg1, nsISupports *arg2)
278 TRACE("(%p)\n", This);
280 if(!This->basedoc.doc_obj)
283 if(This == This->basedoc.doc_obj->basedoc.doc_node) {
285 * This should be done in the worker thread that parses HTML,
286 * but we don't have such thread (Gecko parses HTML for us).
288 parse_complete(This->basedoc.doc_obj);
291 bind_event_scripts(This);
292 set_ready_state(This->basedoc.window, READYSTATE_INTERACTIVE);
296 static nsresult run_insert_script(HTMLDocumentNode *doc, nsISupports *script_iface, nsISupports *parser_iface)
298 nsIDOMHTMLScriptElement *nsscript;
299 HTMLScriptElement *script_elem;
300 nsIParser *nsparser = NULL;
301 script_queue_entry_t *iter;
302 HTMLInnerWindow *window;
306 TRACE("(%p)->(%p)\n", doc, script_iface);
308 window = doc->window;
312 nsres = nsISupports_QueryInterface(script_iface, &IID_nsIDOMHTMLScriptElement, (void**)&nsscript);
313 if(NS_FAILED(nsres)) {
314 ERR("Could not get nsIDOMHTMLScriptElement: %08x\n", nsres);
319 nsres = nsISupports_QueryInterface(parser_iface, &IID_nsIParser, (void**)&nsparser);
320 if(NS_FAILED(nsres)) {
321 ERR("Could not get nsIParser iface: %08x\n", nsres);
326 hres = script_elem_from_nsscript(doc, nsscript, &script_elem);
327 nsIDOMHTMLScriptElement_Release(nsscript);
329 return NS_ERROR_FAILURE;
332 nsIParser_BeginEvaluatingParserInsertedScript(nsparser);
333 window->parser_callback_cnt++;
336 IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface);
338 doc_insert_script(window, script_elem);
340 while(!list_empty(&window->script_queue)) {
341 iter = LIST_ENTRY(list_head(&window->script_queue), script_queue_entry_t, entry);
342 list_remove(&iter->entry);
343 doc_insert_script(window, iter->script);
344 IHTMLScriptElement_Release(&iter->script->IHTMLScriptElement_iface);
348 IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface);
351 window->parser_callback_cnt--;
352 nsIParser_EndEvaluatingParserInsertedScript(nsparser);
353 nsIParser_Release(nsparser);
356 IHTMLScriptElement_Release(&script_elem->IHTMLScriptElement_iface);
361 typedef struct nsRunnable nsRunnable;
363 typedef nsresult (*runnable_proc_t)(HTMLDocumentNode*,nsISupports*,nsISupports*);
366 nsIRunnable nsIRunnable_iface;
370 runnable_proc_t proc;
372 HTMLDocumentNode *doc;
377 static inline nsRunnable *impl_from_nsIRunnable(nsIRunnable *iface)
379 return CONTAINING_RECORD(iface, nsRunnable, nsIRunnable_iface);
382 static nsresult NSAPI nsRunnable_QueryInterface(nsIRunnable *iface,
383 nsIIDRef riid, void **result)
385 nsRunnable *This = impl_from_nsIRunnable(iface);
387 if(IsEqualGUID(riid, &IID_nsISupports)) {
388 TRACE("(%p)->(IID_nsISupports %p)\n", This, result);
389 *result = &This->nsIRunnable_iface;
390 }else if(IsEqualGUID(riid, &IID_nsIRunnable)) {
391 TRACE("(%p)->(IID_nsIRunnable %p)\n", This, result);
392 *result = &This->nsIRunnable_iface;
395 WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), result);
396 return NS_NOINTERFACE;
399 nsISupports_AddRef((nsISupports*)*result);
403 static nsrefcnt NSAPI nsRunnable_AddRef(nsIRunnable *iface)
405 nsRunnable *This = impl_from_nsIRunnable(iface);
406 LONG ref = InterlockedIncrement(&This->ref);
408 TRACE("(%p) ref=%d\n", This, ref);
413 static nsrefcnt NSAPI nsRunnable_Release(nsIRunnable *iface)
415 nsRunnable *This = impl_from_nsIRunnable(iface);
416 LONG ref = InterlockedDecrement(&This->ref);
418 TRACE("(%p) ref=%d\n", This, ref);
421 htmldoc_release(&This->doc->basedoc);
423 nsISupports_Release(This->arg1);
425 nsISupports_Release(This->arg2);
432 static nsresult NSAPI nsRunnable_Run(nsIRunnable *iface)
434 nsRunnable *This = impl_from_nsIRunnable(iface);
436 return This->proc(This->doc, This->arg1, This->arg2);
439 static const nsIRunnableVtbl nsRunnableVtbl = {
440 nsRunnable_QueryInterface,
446 static void add_script_runner(HTMLDocumentNode *This, runnable_proc_t proc, nsISupports *arg1, nsISupports *arg2)
448 nsRunnable *runnable;
450 runnable = heap_alloc_zero(sizeof(*runnable));
454 runnable->nsIRunnable_iface.lpVtbl = &nsRunnableVtbl;
457 htmldoc_addref(&This->basedoc);
458 runnable->doc = This;
459 runnable->proc = proc;
462 nsISupports_AddRef(arg1);
463 runnable->arg1 = arg1;
466 nsISupports_AddRef(arg2);
467 runnable->arg2 = arg2;
469 nsIContentUtils_AddScriptRunner(content_utils, &runnable->nsIRunnable_iface);
471 nsIRunnable_Release(&runnable->nsIRunnable_iface);
474 static inline HTMLDocumentNode *impl_from_nsIDocumentObserver(nsIDocumentObserver *iface)
476 return CONTAINING_RECORD(iface, HTMLDocumentNode, nsIDocumentObserver_iface);
479 static nsresult NSAPI nsDocumentObserver_QueryInterface(nsIDocumentObserver *iface,
480 nsIIDRef riid, void **result)
482 HTMLDocumentNode *This = impl_from_nsIDocumentObserver(iface);
484 if(IsEqualGUID(&IID_nsISupports, riid)) {
485 TRACE("(%p)->(IID_nsISupports, %p)\n", This, result);
486 *result = &This->nsIDocumentObserver_iface;
487 }else if(IsEqualGUID(&IID_nsIMutationObserver, riid)) {
488 TRACE("(%p)->(IID_nsIMutationObserver %p)\n", This, result);
489 *result = &This->nsIDocumentObserver_iface;
490 }else if(IsEqualGUID(&IID_nsIDocumentObserver, riid)) {
491 TRACE("(%p)->(IID_nsIDocumentObserver %p)\n", This, result);
492 *result = &This->nsIDocumentObserver_iface;
495 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), result);
496 return NS_NOINTERFACE;
499 htmldoc_addref(&This->basedoc);
503 static nsrefcnt NSAPI nsDocumentObserver_AddRef(nsIDocumentObserver *iface)
505 HTMLDocumentNode *This = impl_from_nsIDocumentObserver(iface);
506 return htmldoc_addref(&This->basedoc);
509 static nsrefcnt NSAPI nsDocumentObserver_Release(nsIDocumentObserver *iface)
511 HTMLDocumentNode *This = impl_from_nsIDocumentObserver(iface);
512 return htmldoc_release(&This->basedoc);
515 static void NSAPI nsDocumentObserver_CharacterDataWillChange(nsIDocumentObserver *iface,
516 nsIDocument *aDocument, nsIContent *aContent, void /*CharacterDataChangeInfo*/ *aInfo)
520 static void NSAPI nsDocumentObserver_CharacterDataChanged(nsIDocumentObserver *iface,
521 nsIDocument *aDocument, nsIContent *aContent, void /*CharacterDataChangeInfo*/ *aInfo)
525 static void NSAPI nsDocumentObserver_AttributeWillChange(nsIDocumentObserver *iface, nsIDocument *aDocument,
526 nsIContent *aContent, PRInt32 aNameSpaceID, nsIAtom *aAttribute, PRInt32 aModType)
530 static void NSAPI nsDocumentObserver_AttributeChanged(nsIDocumentObserver *iface, nsIDocument *aDocument,
531 nsIContent *aContent, PRInt32 aNameSpaceID, nsIAtom *aAttribute, PRInt32 aModType)
535 static void NSAPI nsDocumentObserver_ContentAppended(nsIDocumentObserver *iface, nsIDocument *aDocument,
536 nsIContent *aContainer, nsIContent *aFirstNewContent, PRInt32 aNewIndexInContainer)
540 static void NSAPI nsDocumentObserver_ContentInserted(nsIDocumentObserver *iface, nsIDocument *aDocument,
541 nsIContent *aContainer, nsIContent *aChild, PRInt32 aIndexInContainer)
545 static void NSAPI nsDocumentObserver_ContentRemoved(nsIDocumentObserver *iface, nsIDocument *aDocument,
546 nsIContent *aContainer, nsIContent *aChild, PRInt32 aIndexInContainer,
547 nsIContent *aProviousSibling)
551 static void NSAPI nsDocumentObserver_NodeWillBeDestroyed(nsIDocumentObserver *iface, const nsINode *aNode)
555 static void NSAPI nsDocumentObserver_ParentChainChanged(nsIDocumentObserver *iface, nsIContent *aContent)
559 static void NSAPI nsDocumentObserver_BeginUpdate(nsIDocumentObserver *iface, nsIDocument *aDocument,
560 nsUpdateType aUpdateType)
564 static void NSAPI nsDocumentObserver_EndUpdate(nsIDocumentObserver *iface, nsIDocument *aDocument,
565 nsUpdateType aUpdateType)
569 static void NSAPI nsDocumentObserver_BeginLoad(nsIDocumentObserver *iface, nsIDocument *aDocument)
573 static void NSAPI nsDocumentObserver_EndLoad(nsIDocumentObserver *iface, nsIDocument *aDocument)
575 HTMLDocumentNode *This = impl_from_nsIDocumentObserver(iface);
577 TRACE("(%p)\n", This);
579 if(This->skip_mutation_notif)
582 This->content_ready = TRUE;
583 add_script_runner(This, run_end_load, NULL, NULL);
586 static void NSAPI nsDocumentObserver_ContentStatesChanged(nsIDocumentObserver *iface, nsIDocument *aDocument,
587 nsIContent *aContent, nsEventStates *aStateMask)
591 static void NSAPI nsDocumentObserver_DocumentStatesChanged(nsIDocumentObserver *iface, nsIDocument *aDocument,
592 nsEventStates *aStateMask)
596 static void NSAPI nsDocumentObserver_StyleSheetAdded(nsIDocumentObserver *iface, nsIDocument *aDocument,
597 nsIStyleSheet *aStyleSheet, cpp_bool aDocumentSheet)
601 static void NSAPI nsDocumentObserver_StyleSheetRemoved(nsIDocumentObserver *iface, nsIDocument *aDocument,
602 nsIStyleSheet *aStyleSheet, cpp_bool aDocumentSheet)
606 static void NSAPI nsDocumentObserver_StyleSheetApplicableStateChanged(nsIDocumentObserver *iface,
607 nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, cpp_bool aApplicable)
611 static void NSAPI nsDocumentObserver_StyleRuleChanged(nsIDocumentObserver *iface, nsIDocument *aDocument,
612 nsIStyleSheet *aStyleSheet, nsIStyleRule *aOldStyleRule, nsIStyleSheet *aNewStyleRule)
616 static void NSAPI nsDocumentObserver_StyleRuleAdded(nsIDocumentObserver *iface, nsIDocument *aDocument,
617 nsIStyleSheet *aStyleSheet, nsIStyleRule *aStyleRule)
621 static void NSAPI nsDocumentObserver_StyleRuleRemoved(nsIDocumentObserver *iface, nsIDocument *aDocument,
622 nsIStyleSheet *aStyleSheet, nsIStyleRule *aStyleRule)
626 static void NSAPI nsDocumentObserver_BindToDocument(nsIDocumentObserver *iface, nsIDocument *aDocument,
627 nsIContent *aContent)
629 HTMLDocumentNode *This = impl_from_nsIDocumentObserver(iface);
630 nsIDOMHTMLIFrameElement *nsiframe;
631 nsIDOMHTMLFrameElement *nsframe;
632 nsIDOMHTMLScriptElement *nsscript;
633 nsIDOMComment *nscomment;
634 nsIDOMElement *nselem;
637 TRACE("(%p)\n", This);
639 nsres = nsIContent_QueryInterface(aContent, &IID_nsIDOMElement, (void**)&nselem);
640 if(NS_SUCCEEDED(nsres)) {
641 check_event_attr(This, nselem);
642 nsIDOMElement_Release(nselem);
645 nsres = nsIContent_QueryInterface(aContent, &IID_nsIDOMComment, (void**)&nscomment);
646 if(NS_SUCCEEDED(nsres)) {
647 TRACE("comment node\n");
649 add_script_runner(This, run_insert_comment, (nsISupports*)nscomment, NULL);
650 nsIDOMComment_Release(nscomment);
654 nsres = nsIContent_QueryInterface(aContent, &IID_nsIDOMHTMLIFrameElement, (void**)&nsiframe);
655 if(NS_SUCCEEDED(nsres)) {
656 TRACE("iframe node\n");
658 add_script_runner(This, run_bind_to_tree, (nsISupports*)nsiframe, NULL);
659 nsIDOMHTMLIFrameElement_Release(nsiframe);
663 nsres = nsIContent_QueryInterface(aContent, &IID_nsIDOMHTMLFrameElement, (void**)&nsframe);
664 if(NS_SUCCEEDED(nsres)) {
665 TRACE("frame node\n");
667 add_script_runner(This, run_bind_to_tree, (nsISupports*)nsframe, NULL);
668 nsIDOMHTMLFrameElement_Release(nsframe);
672 nsres = nsIContent_QueryInterface(aContent, &IID_nsIDOMHTMLScriptElement, (void**)&nsscript);
673 if(NS_SUCCEEDED(nsres)) {
674 HTMLScriptElement *script_elem;
677 TRACE("script element\n");
679 hres = script_elem_from_nsscript(This, nsscript, &script_elem);
680 nsIDOMHTMLScriptElement_Release(nsscript);
684 if(script_elem->parse_on_bind)
685 add_script_runner(This, run_insert_script, (nsISupports*)nsscript, NULL);
687 IHTMLScriptElement_Release(&script_elem->IHTMLScriptElement_iface);
691 static void NSAPI nsDocumentObserver_AttemptToExecuteScript(nsIDocumentObserver *iface, nsIContent *aContent,
692 nsIParser *aParser, cpp_bool *aBlock)
694 HTMLDocumentNode *This = impl_from_nsIDocumentObserver(iface);
695 nsIDOMHTMLScriptElement *nsscript;
698 TRACE("(%p)->(%p %p %p)\n", This, aContent, aParser, aBlock);
700 nsres = nsIContent_QueryInterface(aContent, &IID_nsIDOMHTMLScriptElement, (void**)&nsscript);
701 if(NS_SUCCEEDED(nsres)) {
702 TRACE("script node\n");
704 add_script_runner(This, run_insert_script, (nsISupports*)nsscript, (nsISupports*)aParser);
705 nsIDOMHTMLScriptElement_Release(nsscript);
709 static const nsIDocumentObserverVtbl nsDocumentObserverVtbl = {
710 nsDocumentObserver_QueryInterface,
711 nsDocumentObserver_AddRef,
712 nsDocumentObserver_Release,
713 nsDocumentObserver_CharacterDataWillChange,
714 nsDocumentObserver_CharacterDataChanged,
715 nsDocumentObserver_AttributeWillChange,
716 nsDocumentObserver_AttributeChanged,
717 nsDocumentObserver_ContentAppended,
718 nsDocumentObserver_ContentInserted,
719 nsDocumentObserver_ContentRemoved,
720 nsDocumentObserver_NodeWillBeDestroyed,
721 nsDocumentObserver_ParentChainChanged,
722 nsDocumentObserver_BeginUpdate,
723 nsDocumentObserver_EndUpdate,
724 nsDocumentObserver_BeginLoad,
725 nsDocumentObserver_EndLoad,
726 nsDocumentObserver_ContentStatesChanged,
727 nsDocumentObserver_DocumentStatesChanged,
728 nsDocumentObserver_StyleSheetAdded,
729 nsDocumentObserver_StyleSheetRemoved,
730 nsDocumentObserver_StyleSheetApplicableStateChanged,
731 nsDocumentObserver_StyleRuleChanged,
732 nsDocumentObserver_StyleRuleAdded,
733 nsDocumentObserver_StyleRuleRemoved,
734 nsDocumentObserver_BindToDocument,
735 nsDocumentObserver_AttemptToExecuteScript
738 void init_document_mutation(HTMLDocumentNode *doc)
743 doc->nsIDocumentObserver_iface.lpVtbl = &nsDocumentObserverVtbl;
745 nsres = nsIDOMHTMLDocument_QueryInterface(doc->nsdoc, &IID_nsIDocument, (void**)&nsdoc);
746 if(NS_FAILED(nsres)) {
747 ERR("Could not get nsIDocument: %08x\n", nsres);
751 nsIContentUtils_AddDocumentObserver(content_utils, nsdoc, &doc->nsIDocumentObserver_iface);
752 nsIDocument_Release(nsdoc);
755 void release_document_mutation(HTMLDocumentNode *doc)
760 nsres = nsIDOMHTMLDocument_QueryInterface(doc->nsdoc, &IID_nsIDocument, (void**)&nsdoc);
761 if(NS_FAILED(nsres)) {
762 ERR("Could not get nsIDocument: %08x\n", nsres);
766 nsIContentUtils_RemoveDocumentObserver(content_utils, nsdoc, &doc->nsIDocumentObserver_iface);
767 nsIDocument_Release(nsdoc);
770 void init_mutation(nsIComponentManager *component_manager)
775 if(!component_manager) {
777 nsIContentUtils_Release(content_utils);
778 content_utils = NULL;
783 nsres = nsIComponentManager_GetClassObject(component_manager, &NS_ICONTENTUTILS_CID,
784 &IID_nsIFactory, (void**)&factory);
785 if(NS_FAILED(nsres)) {
786 ERR("Could not create nsIContentUtils service: %08x\n", nsres);
790 nsres = nsIFactory_CreateInstance(factory, NULL, &IID_nsIContentUtils, (void**)&content_utils);
791 nsIFactory_Release(factory);
793 ERR("Could not create nsIContentUtils instance: %08x\n", nsres);