From e098b85128dffc9bcbb9e749b9cf6f7d72697e03 Mon Sep 17 00:00:00 2001 From: Heather Arthur Date: Wed, 17 Oct 2012 18:18:56 -0700 Subject: [PATCH] Backed out changeset 0c63519f8e41 due to failing test (bug 801982) --- browser/devtools/scratchpad/scratchpad.js | 8 +++++ ...ser_scratchpad_bug_653427_confirm_close.js | 30 +------------------ 2 files changed, 9 insertions(+), 29 deletions(-) diff --git a/browser/devtools/scratchpad/scratchpad.js b/browser/devtools/scratchpad/scratchpad.js index 4fd45efac73..51a8e0dfa9c 100644 --- a/browser/devtools/scratchpad/scratchpad.js +++ b/browser/devtools/scratchpad/scratchpad.js @@ -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) { diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_bug_653427_confirm_close.js b/browser/devtools/scratchpad/test/browser_scratchpad_bug_653427_confirm_close.js index 3491cab8d0b..6145fb9f615 100644 --- a/browser/devtools/scratchpad/test/browser_scratchpad_bug_653427_confirm_close.js +++ b/browser/devtools/scratchpad/test/browser_scratchpad_bug_653427_confirm_close.js @@ -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) {