--- a/xpfe/appshell/nsXULWindow.cpp
+++ b/xpfe/appshell/nsXULWindow.cpp
@@ -1631,65 +1631,64 @@ NS_IMETHODIMP nsXULWindow::SavePersisten
nsCOMPtr<nsIBaseWindow> parent(do_QueryReferent(mParentWindow));
if (parent && gotRestoredBounds) {
int32_t parentX, parentY;
if (NS_SUCCEEDED(parent->GetPosition(&parentX, &parentY))) {
rect.MoveBy(-parentX, -parentY);
}
}
- char sizeBuf[10];
nsAutoString sizeString;
nsAutoString windowElementId;
// fetch docShellElement's ID and XUL owner document
RefPtr<dom::XULDocument> ownerXULDoc =
docShellElement->OwnerDoc()->AsXULDocument();
if (docShellElement->IsXULElement()) {
docShellElement->GetId(windowElementId);
}
bool shouldPersist = !isFullscreen && ownerXULDoc;
ErrorResult rv;
// (only for size elements which are persisted)
if ((mPersistentAttributesDirty & PAD_POSITION) && gotRestoredBounds) {
if (persistString.Find("screenX") >= 0) {
- SprintfLiteral(sizeBuf, "%d", NSToIntRound(rect.X() / posScale.scale));
- CopyASCIItoUTF16(sizeBuf, sizeString);
+ sizeString.Truncate();
+ sizeString.AppendInt(NSToIntRound(rect.X() / posScale.scale));
docShellElement->SetAttribute(SCREENX_ATTRIBUTE, sizeString, rv);
if (shouldPersist) {
IgnoredErrorResult err;
ownerXULDoc->Persist(windowElementId, SCREENX_ATTRIBUTE, err);
}
}
if (persistString.Find("screenY") >= 0) {
- SprintfLiteral(sizeBuf, "%d", NSToIntRound(rect.Y() / posScale.scale));
- CopyASCIItoUTF16(sizeBuf, sizeString);
+ sizeString.Truncate();
+ sizeString.AppendInt(NSToIntRound(rect.Y() / posScale.scale));
docShellElement->SetAttribute(SCREENY_ATTRIBUTE, sizeString, rv);
if (shouldPersist) {
IgnoredErrorResult err;
ownerXULDoc->Persist(windowElementId, SCREENY_ATTRIBUTE, err);
}
}
}
if ((mPersistentAttributesDirty & PAD_SIZE) && gotRestoredBounds) {
LayoutDeviceIntRect innerRect = rect - GetOuterToInnerSizeDifference(mWindow);
if (persistString.Find("width") >= 0) {
- SprintfLiteral(sizeBuf, "%d", NSToIntRound(innerRect.Width() / sizeScale.scale));
- CopyASCIItoUTF16(sizeBuf, sizeString);
+ sizeString.Truncate();
+ sizeString.AppendInt(NSToIntRound(innerRect.Width() / sizeScale.scale));
docShellElement->SetAttribute(WIDTH_ATTRIBUTE, sizeString, rv);
if (shouldPersist) {
IgnoredErrorResult err;
ownerXULDoc->Persist(windowElementId, WIDTH_ATTRIBUTE, err);
}
}
if (persistString.Find("height") >= 0) {
- SprintfLiteral(sizeBuf, "%d", NSToIntRound(innerRect.Height() / sizeScale.scale));
- CopyASCIItoUTF16(sizeBuf, sizeString);
+ sizeString.Truncate();
+ sizeString.AppendInt(NSToIntRound(innerRect.Height() / sizeScale.scale));
docShellElement->SetAttribute(HEIGHT_ATTRIBUTE, sizeString, rv);
if (shouldPersist) {
IgnoredErrorResult err;
ownerXULDoc->Persist(windowElementId, HEIGHT_ATTRIBUTE, err);
}
}
}
@@ -1709,18 +1708,18 @@ NS_IMETHODIMP nsXULWindow::SavePersisten
ownerXULDoc->Persist(windowElementId, MODE_ATTRIBUTE, err);
}
}
if (persistString.Find("zlevel") >= 0) {
uint32_t zLevel;
nsCOMPtr<nsIWindowMediator> mediator(do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
if (mediator) {
mediator->GetZLevel(this, &zLevel);
- SprintfLiteral(sizeBuf, "%" PRIu32, zLevel);
- CopyASCIItoUTF16(sizeBuf, sizeString);
+ sizeString.Truncate();
+ sizeString.AppendInt(zLevel);
docShellElement->SetAttribute(ZLEVEL_ATTRIBUTE, sizeString, rv);
if (shouldPersist) {
IgnoredErrorResult err;
ownerXULDoc->Persist(windowElementId, ZLEVEL_ATTRIBUTE, err);
}
}
}
}