Bug 1475262 - Only ignore XUL persist on top level windows. r=smaug

Fixes the incorrect assumption that all XUL <window> elements are top level
windows and will have their attribute persistence handled by the
nsXULWindow. An example of where this assumption fails is the password
manager which opens a <window> within a sub dialog that has no nsXULWindow.

MozReview-Commit-ID: 1f59QPIz42s

--HG--
extra : rebase_source : e91711ead3ba7714d8c6ad241e903dc160ad8bab
This commit is contained in:
Brendan Dahl 2018-07-12 13:55:55 -07:00
Родитель 8781fe39fe
Коммит cf9a56e726
1 изменённых файлов: 9 добавлений и 4 удалений

Просмотреть файл

@ -1092,9 +1092,11 @@ XULDocument::Persist(Element* aElement, int32_t aNameSpaceID,
return mLocalStore->RemoveValue(uri, id, attrstr);
}
// Persisting attributes to windows is handled by nsXULWindow.
// Persisting attributes to top level windows is handled by nsXULWindow.
if (aElement->IsXULElement(nsGkAtoms::window)) {
return NS_OK;
if (nsCOMPtr<nsIXULWindow> win = GetXULWindowIfToplevelChrome()) {
return NS_OK;
}
}
return mLocalStore->SetValue(uri, id, attrstr, valuestr);
@ -1629,9 +1631,12 @@ XULDocument::ApplyPersistentAttributesToElements(const nsAString &aID,
continue;
}
// Applying persistent attributes to windows is handled by nsXULWindow.
// Applying persistent attributes to top level windows is handled
// by nsXULWindow.
if (element->IsXULElement(nsGkAtoms::window)) {
continue;
if (nsCOMPtr<nsIXULWindow> win = GetXULWindowIfToplevelChrome()) {
continue;
}
}
Unused << element->SetAttr(kNameSpaceID_None, attr, value, true);