Bug 477667: manifest attribute not handled in xhtml. r+sr=jst
authorDave Camp <dcamp@mozilla.com>
Mon, 09 Feb 2009 22:40:40 -0800
changeset 24809 4fec2720b00681c2a3999faf7e3cd9c981ef4dba
parent 24808 1deb39d3c86e8716146b79cc6d8936edc66fbb95
child 24810 87f99c57b51fb542048263ff9ff4adc9aa14e0dd
push idunknown
push userunknown
push dateunknown
bugs477667
milestone1.9.2a1pre
Bug 477667: manifest attribute not handled in xhtml. r+sr=jst
content/xml/document/src/nsXMLContentSink.cpp
dom/tests/mochitest/ajax/offline/Makefile.in
dom/tests/mochitest/ajax/offline/test_xhtmlManifest.xhtml
--- a/content/xml/document/src/nsXMLContentSink.cpp
+++ b/content/xml/document/src/nsXMLContentSink.cpp
@@ -995,16 +995,22 @@ nsXMLContentSink::SetDocElement(PRInt32 
   mDocElement = aContent;
   NS_ADDREF(mDocElement);
   nsresult rv = mDocument->AppendChildTo(mDocElement, PR_TRUE);
   if (NS_FAILED(rv)) {
     // If we return PR_FALSE here, the caller will bail out because it won't
     // find a parent content node to append to, which is fine.
     return PR_FALSE;
   }
+
+  if (aTagName == nsGkAtoms::html &&
+      aNameSpaceID == kNameSpaceID_XHTML) {
+    ProcessOfflineManifest(aContent);
+  }
+
   return PR_TRUE;
 }
 
 NS_IMETHODIMP
 nsXMLContentSink::HandleStartElement(const PRUnichar *aName,
                                      const PRUnichar **aAtts,
                                      PRUint32 aAttsCount,
                                      PRInt32 aIndex,
--- a/dom/tests/mochitest/ajax/offline/Makefile.in
+++ b/dom/tests/mochitest/ajax/offline/Makefile.in
@@ -102,12 +102,13 @@ include $(topsrcdir)/config/rules.mk
 	updating.cacheManifest \
 	updating.cacheManifest^headers^ \
 	simpleManifest.notmanifest \
 	changing1Sec.sjs \
 	changing1Hour.sjs \
 	changingManifest.cacheManifest \
 	changingManifest.cacheManifest^headers^ \
 	offlineChild.html \
+	test_xhtmlManifest.xhtml \
 	$(NULL)
 
 libs::	$(_TEST_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
new file mode 100644
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_xhtmlManifest.xhtml
@@ -0,0 +1,34 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://localhost:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
+<head>
+<title>xhtml manifest test</title>
+
+<script type="text/javascript" src="/MochiKit/packed.js"></script>
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+function manifestUpdated()
+{
+  OfflineTest.ok(true, "Application cache updated.");
+
+  OfflineTest.teardown();
+  OfflineTest.finish();
+}
+
+if (OfflineTest.setup()) {
+  applicationCache.onerror = OfflineTest.failEvent;
+  applicationCache.oncached = OfflineTest.priv(manifestUpdated);
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+</head>
+
+<body>
+
+</body>
+</html>