Backed out changeset 0c63519f8e41 due to failing test (bug 801982)

This commit is contained in:
Heather Arthur 2012-10-17 18:18:56 -07:00
parent e1ddb0d723
commit e098b85128
2 changed files with 9 additions and 29 deletions

View File

@ -676,6 +676,8 @@ var Scratchpad = {
}
if (shouldOpen) {
this._skipClosePrompt = true;
let file;
if (aFile) {
file = aFile;
@ -1314,6 +1316,10 @@ var Scratchpad = {
*/
onClose: function SP_onClose(aEvent)
{
if (this._skipClosePrompt) {
return;
}
this.promptSave(function(aShouldClose, aSaved, aStatus) {
let shouldClose = aShouldClose;
if (aSaved && !Components.isSuccessCode(aStatus)) {
@ -1321,6 +1327,7 @@ var Scratchpad = {
}
if (shouldClose) {
this._skipClosePrompt = true;
window.close();
}
}.bind(this));
@ -1343,6 +1350,7 @@ var Scratchpad = {
}
if (shouldClose) {
this._skipClosePrompt = true;
window.close();
}
if (aCallback) {

View File

@ -9,7 +9,7 @@ let NetUtil = tempScope.NetUtil;
let FileUtils = tempScope.FileUtils;
// only finish() when correct number of tests are done
const expected = 6;
const expected = 5;
var count = 0;
function done()
{
@ -69,7 +69,6 @@ function testSavedFile()
function testUnsaved()
{
testUnsavedFileCancel();
testCancelAfterLoad();
testUnsavedFileSave();
testUnsavedFileDontSave();
}
@ -90,33 +89,6 @@ function testUnsavedFileCancel()
}, {noFocus: true});
}
// Test a regression where our confirmation dialog wasn't appearing
// after openFile calls. See bug 801982.
function testCancelAfterLoad()
{
openScratchpad(function(win) {
win.Scratchpad.setRecentFile(gFile);
win.Scratchpad.openFile(0);
win.Scratchpad.editor.dirty = true;
promptButton = win.BUTTON_POSITION_CANCEL;
let EventStub = {
called: false,
preventDefault: function() {
EventStub.called = true;
}
};
win.Scratchpad.onClose(EventStub);
ok(!win.closed, "cancelling dialog shouldn't close scratchpad");
ok(EventStub.called, "aEvent.preventDefault was called");
win.Scratchpad.editor.dirty = false;
win.close();
done();
}, {noFocus: true});
}
function testUnsavedFileSave()
{
openScratchpad(function(win) {