Bug 627328 - ###!!! ASSERTION: This is unsafe! Fix the caller!: 'Error' when changing a personas. r=bz a=blocking-final

This commit is contained in:
Mounir Lamouri 2011-02-04 13:59:33 +01:00
Родитель 1d8f77b954
Коммит b28c75659b
2 изменённых файлов: 50 добавлений и 18 удалений

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

@ -2414,12 +2414,33 @@ nsXULElement::SetTitlebarColor(nscolor aColor, PRBool aActive)
}
}
class SetDrawInTitleBarEvent : public nsRunnable
{
public:
SetDrawInTitleBarEvent(nsIWidget* aWidget, PRBool aState)
: mWidget(aWidget)
, mState(aState)
{}
NS_IMETHOD Run() {
NS_ASSERTION(mWidget, "You shouldn't call this runnable with a null widget!");
mWidget->SetDrawsInTitlebar(mState);
return NS_OK;
}
private:
nsCOMPtr<nsIWidget> mWidget;
PRBool mState;
};
void
nsXULElement::SetDrawsInTitlebar(PRBool aState)
{
nsIWidget* mainWidget = GetWindowWidget();
if (mainWidget) {
mainWidget->SetDrawsInTitlebar(aState);
nsCOMPtr<nsIRunnable> event = new SetDrawInTitleBarEvent(mainWidget, aState);
NS_DispatchToCurrentThread(event);
}
}

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

@ -28,29 +28,40 @@ function isnot(aLeft, aRight, aMessage)
window.opener.wrappedJSObject.SimpleTest.isnot(aLeft, aRight, aMessage);
}
function executeSoon(aFct)
{
window.opener.wrappedJSObject.SimpleTest.executeSoon(aFct);
}
function start() {
window.onfocus = function () {
window.onfocus = null;
var oldOuterWidth = window.outerWidth, oldOuterHeight = window.outerHeight;
var oldInnerWidth = window.innerWidth, oldInnerHeight = window.innerHeight;
document.documentElement.setAttribute("drawintitlebar", "true");
is(window.outerWidth, oldOuterWidth, "drawintitlebar shouldn't change the window's outerWidth");
is(window.outerHeight, oldOuterHeight, "drawintitlebar shouldn't change the window's outerHeight");
is(window.innerWidth, oldOuterWidth, "if drawintitlebar is set, innerWidth and outerWidth should be the same");
is(window.innerHeight, oldOuterHeight, "if drawintitlebar is set, innerHeight and outerHeight should be the same");
window.fullScreen = true;
window.fullScreen = false;
is(window.outerWidth, oldOuterWidth, "wrong outerWidth after fullscreen mode");
is(window.outerHeight, oldOuterHeight, "wrong outerHeight after fullscreen mode");
is(window.innerWidth, oldOuterWidth, "wrong innerWidth after fullscreen mode");
is(window.innerHeight, oldOuterHeight, "wrong innerHeight after fullscreen mode");
document.documentElement.removeAttribute("drawintitlebar");
is(window.outerWidth, oldOuterWidth, "wrong outerWidth after removing drawintitlebar");
is(window.outerHeight, oldOuterHeight, "wrong outerHeight after removing drawintitlebar");
is(window.innerWidth, oldInnerWidth, "wrong innerWidth after removing drawintitlebar");
is(window.innerHeight, oldInnerHeight, "wrong innerHeight after removing drawintitlebar");
window.opener.wrappedJSObject.SimpleTest.finish();
window.close();
executeSoon(function() {
is(window.outerWidth, oldOuterWidth, "drawintitlebar shouldn't change the window's outerWidth");
is(window.outerHeight, oldOuterHeight, "drawintitlebar shouldn't change the window's outerHeight");
is(window.innerWidth, oldOuterWidth, "if drawintitlebar is set, innerWidth and outerWidth should be the same");
is(window.innerHeight, oldOuterHeight, "if drawintitlebar is set, innerHeight and outerHeight should be the same");
window.fullScreen = true;
window.fullScreen = false;
is(window.outerWidth, oldOuterWidth, "wrong outerWidth after fullscreen mode");
is(window.outerHeight, oldOuterHeight, "wrong outerHeight after fullscreen mode");
is(window.innerWidth, oldOuterWidth, "wrong innerWidth after fullscreen mode");
is(window.innerHeight, oldOuterHeight, "wrong innerHeight after fullscreen mode");
document.documentElement.removeAttribute("drawintitlebar");
executeSoon(function() {
is(window.outerWidth, oldOuterWidth, "wrong outerWidth after removing drawintitlebar");
is(window.outerHeight, oldOuterHeight, "wrong outerHeight after removing drawintitlebar");
is(window.innerWidth, oldInnerWidth, "wrong innerWidth after removing drawintitlebar");
is(window.innerHeight, oldInnerHeight, "wrong innerHeight after removing drawintitlebar");
window.opener.wrappedJSObject.SimpleTest.finish();
window.close();
});
});
}
}