Bug 1193572, part 3 - Don't re-initialize mType for XUL proto elements. r=baku
authorAndrew McCreight <continuation@gmail.com>
Thu, 13 Aug 2015 14:24:59 -0700
changeset 257736 35bb18f835956149f7377cd44c39421f719ef832
parent 257735 9b16a669ddc717870613ef78fd39fd8257b76834
child 257737 1fd45ba4bf7991a2b3939f2b30dea554d6177ef0
push id29226
push userryanvm@gmail.com
push dateFri, 14 Aug 2015 13:01:14 +0000
treeherdermozilla-central@1b2402247429 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1193572
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1193572, part 3 - Don't re-initialize mType for XUL proto elements. r=baku These are already set in the constructor.
dom/xul/nsXULElement.cpp
--- a/dom/xul/nsXULElement.cpp
+++ b/dom/xul/nsXULElement.cpp
@@ -2327,43 +2327,36 @@ nsXULPrototypeElement::Deserialize(nsIOb
             if (NS_WARN_IF(NS_FAILED(rv))) return rv;
             Type childType = (Type)number;
 
             nsRefPtr<nsXULPrototypeNode> child;
 
             switch (childType) {
             case eType_Element:
                 child = new nsXULPrototypeElement();
-                child->mType = childType;
-
                 rv = child->Deserialize(aStream, aProtoDoc, aDocumentURI,
                                         aNodeInfos);
                 if (NS_WARN_IF(NS_FAILED(rv))) return rv;
                 break;
             case eType_Text:
                 child = new nsXULPrototypeText();
-                child->mType = childType;
-
                 rv = child->Deserialize(aStream, aProtoDoc, aDocumentURI,
                                         aNodeInfos);
                 if (NS_WARN_IF(NS_FAILED(rv))) return rv;
                 break;
             case eType_PI:
                 child = new nsXULPrototypePI();
-                child->mType = childType;
-
                 rv = child->Deserialize(aStream, aProtoDoc, aDocumentURI,
                                         aNodeInfos);
                 if (NS_WARN_IF(NS_FAILED(rv))) return rv;
                 break;
             case eType_Script: {
                 // language version/options obtained during deserialization.
                 nsXULPrototypeScript* script = new nsXULPrototypeScript(0, 0);
                 child = script;
-                child->mType = childType;
 
                 rv = aStream->ReadBoolean(&script->mOutOfLine);
                 if (NS_WARN_IF(NS_FAILED(rv))) return rv;
                 if (! script->mOutOfLine) {
                     rv = script->Deserialize(aStream, aProtoDoc, aDocumentURI,
                                              aNodeInfos);
                     if (NS_WARN_IF(NS_FAILED(rv))) return rv;
                 } else {
@@ -2379,16 +2372,17 @@ nsXULPrototypeElement::Deserialize(nsIOb
                 break;
             }
             default:
                 MOZ_ASSERT(false, "Unexpected child type!");
                 return NS_ERROR_UNEXPECTED;
             }
 
             MOZ_ASSERT(child, "Don't append null to mChildren");
+            MOZ_ASSERT(child->mType == childType);
             mChildren.AppendElement(child);
 
             // Oh dear. Something failed during the deserialization.
             // We don't know what.  But likely consequences of failed
             // deserializations included calls to |AbortCaching| which
             // shuts down the cache and closes our streams.
             // If that happens, next time through this loop, we die a messy
             // death. So, let's just fail now, and propagate that failure