From 9bb4f1d886f66bd85e607c1ddbf4b41ebbea3327 Mon Sep 17 00:00:00 2001 From: Ruben Daniels Date: Wed, 28 Oct 2015 17:36:59 -0700 Subject: [PATCH] fix tab tests --- plugins/c9.ide.editors/pane.js | 10 ++++++++-- plugins/c9.ide.editors/tab.js | 8 ++++---- plugins/c9.ide.editors/tabmanager.js | 5 ++++- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/plugins/c9.ide.editors/pane.js b/plugins/c9.ide.editors/pane.js index aeb17e1a..9a040d9c 100644 --- a/plugins/c9.ide.editors/pane.js +++ b/plugins/c9.ide.editors/pane.js @@ -108,10 +108,16 @@ define(function(require, module, exports) { } else { tab.aml.on("afterclose", function(){ - setTimeout(function(){ + if (tab.meta.$closeSync) { tab.unload(e); closing--; - }); + } + else { + setTimeout(function(){ + tab.unload(e); + closing--; + }); + } }); } }, diff --git a/plugins/c9.ide.editors/tab.js b/plugins/c9.ide.editors/tab.js index dfb022b2..83f07223 100644 --- a/plugins/c9.ide.editors/tab.js +++ b/plugins/c9.ide.editors/tab.js @@ -280,7 +280,9 @@ define(function(require, module, exports) { // @todo Explain difference with unload in docs function close(noAnim) { + if (!amlPane.remove) return false; amlPane.remove(amlTab, null, noAnim); + return true; } /***** Lifecycle *****/ @@ -291,10 +293,8 @@ define(function(require, module, exports) { plugin.on("beforeUnload", function(){ if (!plugin.meta.$closing) { - plugin.document.meta.$ignoreSave = true; - close(); - delete plugin.document.meta.$ignoreSave; - return false; + if (close()) + return false; } }); diff --git a/plugins/c9.ide.editors/tabmanager.js b/plugins/c9.ide.editors/tabmanager.js index fd210a5a..fa60a1b9 100644 --- a/plugins/c9.ide.editors/tabmanager.js +++ b/plugins/c9.ide.editors/tabmanager.js @@ -787,7 +787,10 @@ define(function(require, module, exports) { var pane = list[i], nodes = pane.getTabs(); for (var j = nodes.length - 1; j >= 0; j--) { var tab = nodes[j]; - if (!soft) tab.unload(); + if (!soft) { + tab.meta.$closeSync = true; + tab.unload(); + } else { tab.aml.parentNode.removeChild(tab.aml); tab.pane = null;