Bug 1264968 part 2 - Allow persisting attributes of xul:window if its owner document is not root. r?enn draft
authorXidorn Quan <quanxunzhen@gmail.com>
Tue, 19 Apr 2016 12:51:23 +1000
changeset 352968 accf12cd9a52c4f03794ee2e3b376636d9450e7a
parent 352967 94453061ddec3379b9a18dd1f9c13eaa5ec89302
child 518798 bd3e2f11a96cf13e6d8575666493a3e1a00e6a25
push id15855
push userxquan@mozilla.com
push dateTue, 19 Apr 2016 02:51:57 +0000
reviewersenn
bugs1264968
milestone48.0a1
Bug 1264968 part 2 - Allow persisting attributes of xul:window if its owner document is not root. r?enn MozReview-Commit-ID: 12rz0WMZp0L
dom/xul/XULDocument.cpp
--- a/dom/xul/XULDocument.cpp
+++ b/dom/xul/XULDocument.cpp
@@ -909,16 +909,21 @@ XULDocument::AttributeWillChange(nsIDocu
         RemoveElementFromRefMap(aElement);
     }
 }
 
 static bool
 ShouldPersistAttribute(Element* aElement, nsIAtom* aAttribute)
 {
     if (aElement->IsXULElement(nsGkAtoms::window)) {
+        // This is not an element of the top document, its owner is
+        // not an nsXULWindow. Persist it.
+        if (aElement->OwnerDoc()->GetParentDocument()) {
+            return true;
+        }
         // The following attributes of xul:window should be handled in
         // nsXULWindow::SavePersistentAttributes instead of here.
         if (aAttribute == nsGkAtoms::screenX ||
             aAttribute == nsGkAtoms::screenY ||
             aAttribute == nsGkAtoms::width ||
             aAttribute == nsGkAtoms::height ||
             aAttribute == nsGkAtoms::sizemode) {
             return false;