avoid prompting if there's only one tab, also bump version to 1.0.4 and maxVersion to 3.6a1pre
authorGavin Sharp <gavin@mozilla.com>
Tue, 17 Mar 2009 17:48:48 -0400
changeset 8 abcd022fe7bf
parent 7 5bdf69b4d134
child 9 4d8c4ad7eb3b
push id9
push usergsharp@mozilla.com
push dateTue, 17 Mar 2009 21:49:21 +0000
avoid prompting if there's only one tab, also bump version to 1.0.4 and maxVersion to 3.6a1pre
content/overlay.js
install.rdf
--- a/content/overlay.js
+++ b/content/overlay.js
@@ -83,24 +83,25 @@ var tabcloser = {
       } catch (ex) {
         // Ignore failure to get .host
         continue;
       }
       if (host == tabHost) {
         tabsToClose.push(tab);
       }
     }
-    
-    // prompt?
+
     var message = this.strings.getFormattedString("areYouSure.message",
-                                                [tabsToClose.length, host]);
+                                                  [tabsToClose.length, host]);
     var title = this.strings.getString("areYouSure");
     var promptService = Cc["@mozilla.org/embedcomp/prompt-service;1"].
                         getService(Ci.nsIPromptService);
-    if (promptService.confirm(null, title, message)) {
+    
+    // don't prompt if there's only one tab
+    if (tabsToClose.length == 1 || promptService.confirm(window, title, message)) {
       tabsToClose.forEach(function (t) {
         // work around some strange bug in 3.0.x that causes removeTab to fail
         // silently when closing the last tab this way. This isn't needed on
         // trunk...
         if (gBrowser.mTabs.length == 1)
           closeWindow(true);
         else
           gBrowser.removeTab(t);
--- a/install.rdf
+++ b/install.rdf
@@ -1,18 +1,18 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
  xmlns:em="http://www.mozilla.org/2004/em-rdf#">
   <Description about="urn:mozilla:install-manifest">
     <em:id>tabcloser@gavinsharp.com</em:id>
     <em:name>TabCloser</em:name>
-    <em:version>1.03</em:version>
+    <em:version>1.04</em:version>
     <em:creator>Gavin Sharp</em:creator>
     <em:description>Close all tabs for a given site.</em:description>
     <em:targetApplication>
       <Description>
         <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <!-- firefox -->
         <em:minVersion>3.0</em:minVersion>
-        <em:maxVersion>3.2a1pre</em:maxVersion>
+        <em:maxVersion>3.6a1pre</em:maxVersion>
       </Description>
     </em:targetApplication>
   </Description>
 </RDF>