[Pkg-mozext-commits] [itsalltext] 411/459: Re-indented. Whew!

David Prévot taffit at moszumanska.debian.org
Tue Feb 24 23:26:43 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository itsalltext.

commit 8516c261dbe4227acc4addd606bba10c9e6b32cf
Author: Christian Höltje <docwhat at gerf.org>
Date:   Mon May 13 22:56:53 2013 -0400

    Re-indented. Whew!
---
 src/chrome/content/API.js          |  99 ++++----
 src/chrome/content/Color.js        |  75 +++---
 src/chrome/content/badeditor.js    |  35 +--
 src/chrome/content/cacheobj.js     | 455 +++++++++++++++++++------------------
 src/chrome/content/itsalltext.js   | 188 +++++++--------
 src/chrome/content/monitor.js      |  53 ++---
 src/chrome/content/newextension.js |   3 +-
 src/chrome/content/preferences.js  |  73 +++---
 8 files changed, 503 insertions(+), 478 deletions(-)

diff --git a/src/chrome/content/API.js b/src/chrome/content/API.js
index e3d37b3..07df42b 100644
--- a/src/chrome/content/API.js
+++ b/src/chrome/content/API.js
@@ -1,56 +1,55 @@
-/*extern Components, itsalltext, XPathResult */
-/*jslint undef: true, nomen: true, evil: false, browser: true, white: true */
+// vim: ts=4 sw=4 sts=4
 
 /*
-  This file is used to allow external editors to work inside your chrome XUL.
-
-  ***** How To Use This API *****
-  Add this script line to your .xul file:
-  <script type="application/javascript" src="chrome://itsalltext/content/API.js"/>
-
-  If "It's All Text!" isn't installed in the browser, it will fail safely.
-  It only generates an info message in the error console.
-
-  You then have two choices.  You can call itsalltextopenEditor() directly
-  via JavaScript or you can add one or two attributes to a XUL element and
-  it'll automatically be set up right.
-
-  The suggested method is to add the correct attributes to your XUL button
-  or menuitem and let "It's All Text!" do it for you.
-
-  Attributes:
-    'itsalltext-control' -- This should be set to the id of the textbox
-                            that you want to edit when command is executed
-                            on this XUL element. This is required.
-    'itsalltext-extension' -- This is the file extension.  Include the
-                              leading dot character.  Example: '.css'
-                              It defaults to '.txt' and is optional.
-
-  If you don't want this XUL element to be visible unless "It's All Text!"
-  is installed, then you should set it's CSS style display to 'none'.
-
-  Example using attributes (recommended method):
-      <hbox>
-        <spacer flex="1"/>
-        <button label="It's All Text!"
-                itsalltext-control="code"
-                itsalltext-extension=".css"
-                style="display: none;"
-        />
-      </hbox>
-
-  Example calling openEditor() directly:
-     if(some_condition && itsalltext) {
-         itsalltext.openEditor('id-of-textarea', '.extension');
-     }
-
+ *  This file is used to allow external editors to work inside your chrome XUL.
+ *
+ *  ***** How To Use This API *****
+ *  Add this script line to your .xul file:
+ *  <script type="application/javascript" src="chrome://itsalltext/content/API.js"/>
+ *
+ *  If "It's All Text!" isn't installed in the browser, it will fail safely.
+ *  It only generates an info message in the error console.
+ *
+ *  You then have two choices.  You can call itsalltextopenEditor() directly
+ *  via JavaScript or you can add one or two attributes to a XUL element and
+ *  it'll automatically be set up right.
+ *
+ *  The suggested method is to add the correct attributes to your XUL button
+ *  or menuitem and let "It's All Text!" do it for you.
+ *
+ *  Attributes:
+ *    'itsalltext-control' -- This should be set to the id of the textbox
+ *                            that you want to edit when command is executed
+ *                            on this XUL element. This is required.
+ *    'itsalltext-extension' -- This is the file extension.  Include the
+ *                              leading dot character.  Example: '.css'
+ *                              It defaults to '.txt' and is optional.
+ *
+ *  If you don't want this XUL element to be visible unless "It's All Text!"
+ *  is installed, then you should set it's CSS style display to 'none'.
+ *
+ *  Example using attributes (recommended method):
+ *      <hbox>
+ *        <spacer flex="1"/>
+ *        <button label="It's All Text!"
+ *                itsalltext-control="code"
+ *                itsalltext-extension=".css"
+ *                style="display: none;"
+ *        />
+ *      </hbox>
+ *
+ *  Example calling openEditor() directly:
+ *     if(some_condition && itsalltext) {
+ *         itsalltext.openEditor('id-of-textarea', '.extension');
+ *     }
+ *
  */
 
 (function () {
     /* Load up the main It's All Text! file */
     var objScriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader),
-        openEditorCommand,
-        onload;
+    openEditorCommand,
+    onload;
     objScriptLoader.loadSubScript('chrome://itsalltext/content/itsalltext.js');
 
     /**
@@ -91,9 +90,11 @@
         itsalltext.monitor.startPage({originalTarget: document}, true);
 
         /* Turn on all the hidden CSS */
-        nodesIter = document.evaluate("//node()[@itsalltext-control]",
-                                          document, null,
-                                          XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null);
+        nodesIter = document.evaluate(
+            "//node()[@itsalltext-control]",
+            document, null,
+            XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null
+        );
 
         node = nodesIter.iterateNext();
         while (node) {
diff --git a/src/chrome/content/Color.js b/src/chrome/content/Color.js
index 86ee287..c73ba13 100644
--- a/src/chrome/content/Color.js
+++ b/src/chrome/content/Color.js
@@ -1,4 +1,5 @@
 "use strict";
+// vim: ts=4 sw=4 sts=4
 /**
  * Author: Lachlan Hunt
  * Date: 2005-11-24
@@ -19,19 +20,19 @@
  */
 var Color = function () {
     var keyword,
-        func,
-        clamp,
-        alphaBlend,
-        value,
-        components,
-        pattern,
-        key,
-        base,
-        m,
-        r,
-        g,
-        b,
-        a;
+    func,
+    clamp,
+    alphaBlend,
+    value,
+    components,
+    pattern,
+    key,
+    base,
+    m,
+    r,
+    g,
+    b,
+    a;
 
     // CSS 2.1 Colour Keywords
     keyword = {
@@ -92,11 +93,11 @@ var Color = function () {
      */
     this.hex = function (bg) {
         var r,
-            g,
-            b,
-            strHexR,
-            strHexG,
-            strHexB;
+        g,
+        b,
+        strHexR,
+        strHexG,
+        strHexB;
         if (bg) {
             r = alphaBlend(this.red, bg.red, this.alpha);
             g = alphaBlend(this.green, bg.green, this.alpha);
@@ -131,8 +132,8 @@ var Color = function () {
      */
     this.rgb = function (bg) {
         var r,
-            g,
-            b;
+        g,
+        b;
         if (bg) {
             r = alphaBlend(this.red, bg.red, this.alpha);
             g = alphaBlend(this.green, bg.green, this.alpha);
@@ -172,11 +173,11 @@ var Color = function () {
      */
     this.blend = function (color, steps) {
         var pallet = [],
-            r,
-            g,
-            b,
-            i,
-            step = {
+        r,
+        g,
+        b,
+        i,
+        step = {
             red   : (alphaBlend(color.red, this.red, color.alpha) - this.red) / steps,
             green : (alphaBlend(color.green, this.green, color.alpha) - this.green) / steps,
             blue  : (alphaBlend(color.blue,  this.blue,  color.alpha) - this.blue) / steps
@@ -221,26 +222,26 @@ var Color = function () {
         m = 1; // Multiplier for percentage values
 
         switch (pattern) {
-        case "rgb%":
-        case "rgba%":
-            m = 2.55;
+            case "rgb%":
+                case "rgba%":
+                m = 2.55;
             base = 10;
             break;
-        case "rgb":
-        case "rgba":
-            base = 10;
+            case "rgb":
+                case "rgba":
+                base = 10;
             break;
-        case "hex3":
-            components[1] = components[1] + "" + components[1];
+            case "hex3":
+                components[1] = components[1] + "" + components[1];
             components[2] = components[2] + "" + components[2];
             components[3] = components[3] + "" + components[3];
             base = 16;
             break;
-        case "hex6":
-            base = 16;
+            case "hex6":
+                base = 16;
             break;
-        default:
-            components = [0, "255", "255", "255", "1.0"];
+            default:
+                components = [0, "255", "255", "255", "1.0"];
         }
 
         this.red   = clamp(Math.round(parseInt(components[1], base) * m), 0, 255);
diff --git a/src/chrome/content/badeditor.js b/src/chrome/content/badeditor.js
index eb27ad0..9dba4de 100644
--- a/src/chrome/content/badeditor.js
+++ b/src/chrome/content/badeditor.js
@@ -1,4 +1,5 @@
 "use strict";
+// vim: ts=4 sw=4 sts=4
 
 /**
  * Pass back the values that that the user selected.
@@ -11,25 +12,31 @@ function onOK() {
 }
 function doOnload() {
     var locale = document.getElementById("strings"),
-        params = window['arguments'][0],
-        reason = document.getElementById('reason'),
-        textnode = '**error**';
+    params = window['arguments'][0],
+    reason = document.getElementById('reason'),
+    textnode = '**error**';
     /* Errors are from
      * http://lxr.mozilla.org/seamonkey/source/xpcom/base/nsError.h#262 */
-    if (params.exception == 'NS_ERROR_FILE_INVALID_PATH' ||
-       params.exception == 'NS_ERROR_FILE_UNRECOGNIZED_PATH' ||
-       params.exception == 'NS_ERROR_FILE_TARGET_DOES_NOT_EXIST' ||
-       params.exception == 'NS_ERROR_FILE_INVALID_PATH' ||
-       params.exception == 'NS_ERROR_FILE_NOT_FOUND' ||
-       params.exception == 'NS_ERROR_FILE_NAME_TOO_LONG') {
+    noent_errors = [
+        'NS_ERROR_FILE_INVALID_PATH',
+        'NS_ERROR_FILE_UNRECOGNIZED_PATH',
+        'NS_ERROR_FILE_TARGET_DOES_NOT_EXIST',
+        'NS_ERROR_FILE_INVALID_PATH',
+        'NS_ERROR_FILE_NOT_FOUND',
+        'NS_ERROR_FILE_NAME_TOO_LONG'
+    ];
+    noexec_errors = [
+        'NS_ERROR_FILE_ACCESS_DENIED',
+        'NS_ERROR_FILE_IS_DIRECTORY',
+        'NS_ERROR_FILE_IS_LOCKED'
+    ];
+    if (noent_errors.indexOf(params.exception) >= 0) {
         textnode = locale.getFormattedString('bad.noent', [params.path]);
-    } else if (params.exception == 'NS_ERROR_FILE_ACCESS_DENIED' ||
-              params.exception == 'NS_ERROR_FILE_IS_DIRECTORY' ||
-              params.exception == 'NS_ERROR_FILE_IS_LOCKED') {
+    } else if (noexec_errors.indexOf(params.exception)) {
         textnode = locale.getFormattedString('bad.noexec', []);
 
-    /* At this point, we don't know exactly why it failed...
-     * Try some heuristics. */
+        /* At this point, we don't know exactly why it failed...
+         * Try some heuristics. */
     } else if (!params.path) {
         textnode = locale.getFormattedString('bad.noset', []);
     } else if (params.exists) {
diff --git a/src/chrome/content/cacheobj.js b/src/chrome/content/cacheobj.js
index 1bbbc6f..63530dd 100644
--- a/src/chrome/content/cacheobj.js
+++ b/src/chrome/content/cacheobj.js
@@ -1,4 +1,5 @@
 "use strict";
+// vim: ts=4 sw=4 sts=4
 /*
  *  It's All Text! - Easy external editing of web forms.
  *
@@ -24,12 +25,12 @@
  */
 function CacheObj(node) {
     var that = this,
-        hitch_re = /^hitched_/,
-        doc = node.ownerDocument,
-        host,
-        hash,
-        method,
-        extension;
+    hitch_re = /^hitched_/,
+    doc = node.ownerDocument,
+    host,
+    hash,
+    method,
+    extension;
 
     this.uuid = Math.floor(Math.random()*2000);
     //disabled-debug -- itsalltext.debug('CacheObject ', this.uuid, node);
@@ -65,9 +66,11 @@ function CacheObj(node) {
      * web page from knowing what it's connected to.
      * @type String
      */
-    that.uid = itsalltext.hashString([ doc.location.toString(),
-                                       Math.random(),
-                                       that.node_id ].join(':'));
+    that.uid = itsalltext.hashString(
+        [ doc.location.toString(),
+            Math.random(),
+            that.node_id ].join(':')
+    );
     // @todo [security] Add a serial to the uid hash.
 
     node.setUserData(itsalltext.MYSTRING + '_UID', that.uid, null);
@@ -77,11 +80,13 @@ function CacheObj(node) {
      * change, the directory that the file is stored in should not!
      */
     host = window.escape(doc.location.hostname);
-    hash = itsalltext.hashString([ doc.location.protocol,
-				   doc.location.port,
-				   doc.location.search ? doc.location.search : '?',
-				   doc.location.pathname,
-				   that.node_id].join(':'));
+    hash = itsalltext.hashString(
+        [ doc.location.protocol,
+            doc.location.port,
+            doc.location.search ? doc.location.search : '?',
+            doc.location.pathname,
+            that.node_id].join(':')
+    );
     that.base_filename = [host, hash.slice(0, 10)].join('.');
     /* The current extension.
      * @type String
@@ -135,13 +140,13 @@ function CacheObj(node) {
         that.is_focused = false;
 
         var style = that.button?that.button.style:null,
-            f,
-            cur  = 0.7,
-            dest = 0,
-            fps  = 12,
-            num_frames = (itsalltext.preferences.fade_time * fps),
-            increment = (cur - dest) / num_frames,
-            wait = (1 / fps) / 1000;
+        f,
+        cur  = 0.7,
+        dest = 0,
+        fps  = 12,
+        num_frames = (itsalltext.preferences.fade_time * fps),
+        increment = (cur - dest) / num_frames,
+        wait = (1 / fps) / 1000;
         if (style) {
             f = function () {
                 cur -= increment;
@@ -163,8 +168,8 @@ function CacheObj(node) {
 CacheObj.prototype.destroy = function () {
     //disabled-debug -- itsalltext.debug('destroying', this.node_id, this.uid);
     var node = this.node,
-        doc  = this.node.ownerDocument,
-        html = doc.getElementsByTagName('html')[0];
+    doc  = this.node.ownerDocument,
+    html = doc.getElementsByTagName('html')[0];
 
     //node.removeAttribute(itsalltext.MYSTRING + '_UID');
     //html.removeAttribute(itsalltext.MYSTRING + '_id_serial');
@@ -227,11 +232,11 @@ CacheObj.prototype.getFile = function () {
  */
 CacheObj.prototype.initFromExistingFile = function () {
     var base = this.base_filename,
-        fobj = itsalltext.factoryFile(itsalltext.getWorkingDir()),
-        entries,
-        ext = null,
-        tmpfiles = /(\.bak|.tmp|~)$/,
-        entry;
+    fobj = itsalltext.factoryFile(itsalltext.getWorkingDir()),
+    entries,
+    ext = null,
+    tmpfiles = /(\.bak|.tmp|~)$/,
+    entry;
     if (fobj.exists() && fobj.isDirectory()) {
         entries = fobj.directoryEntries;
         while (entries.hasMoreElements()) {
@@ -263,10 +268,10 @@ CacheObj.prototype.initFromExistingFile = function () {
  */
 CacheObj.prototype.getNodeIdentifier = function (node) {
     var id   = node.getAttribute('id'),
-        name,
-        doc,
-        attr,
-        serial;
+    name,
+    doc,
+    attr,
+    serial;
     if (!id) {
         name = node.getAttribute('name');
         doc = node.ownerDocument.getElementsByTagName('html')[0];
@@ -292,9 +297,9 @@ CacheObj.prototype.getNodeIdentifier = function (node) {
  */
 CacheObj.prototype.toString = function () {
     return [ "CacheObj",
-             " uid=", this.uid,
-             " timestamp=", this.timestamp,
-             " size=", this.size].join('');
+        " uid=", this.uid,
+        " timestamp=", this.timestamp,
+        " size=", this.size].join('');
 };
 
 /**
@@ -315,19 +320,19 @@ CacheObj.prototype.write = function (clobber) {
         foStream.init(file, 0x02 | 0x08 | 0x20,
                       parseInt('0600', 8), 0);
 
-        /* We convert to charset */
-        conv = Components.
-            classes["@mozilla.org/intl/scriptableunicodeconverter"].
-            createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
-        conv.charset = itsalltext.getCharset();
+                      /* We convert to charset */
+                      conv = Components.
+                          classes["@mozilla.org/intl/scriptableunicodeconverter"].
+                          createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
+                      conv.charset = itsalltext.getCharset();
 
-        text = conv.ConvertFromUnicode(this.node.value);
-        foStream.write(text, text.length);
-        foStream.close();
+                      text = conv.ConvertFromUnicode(this.node.value);
+                      foStream.write(text, text.length);
+                      foStream.close();
 
-        /* Reset Timestamp and filesize, to prevent a spurious refresh */
-        this.timestamp = file.lastModifiedTime;
-        this.size      = file.fileSize;
+                      /* Reset Timestamp and filesize, to prevent a spurious refresh */
+                      this.timestamp = file.lastModifiedTime;
+                      this.size      = file.fileSize;
     } else {
         this.timestamp = this.size = null; // force refresh of textarea
     }
@@ -343,7 +348,7 @@ CacheObj.prototype.write = function (clobber) {
  */
 CacheObj.prototype.getStyle = function (node, attr) {
     var view  = node ? node.ownerDocument.defaultView : null,
-        style = view.getComputedStyle(node, '');
+    style = view.getComputedStyle(node, '');
     return  style.getPropertyCSSValue(attr).cssText;
 };
 
@@ -355,104 +360,104 @@ CacheObj.prototype.getStyle = function (node, attr) {
  * @param {String} extension The extension of the file to edit.
  * @param {boolean} clobber Should an existing file be clobbered?
  */
- CacheObj.prototype.edit = function (extension, clobber) {
-   itsalltext.debug(this.uuid, 'edit(', extension, ', ', clobber, ')', this.uid);
-   extension = typeof(extension) === 'string'?extension:this.getExtension();
-   this.setExtension(extension);
-
-   var filename = this.write(clobber),
-   program = null,
-   command,
-   process,
-   args,
-   result,
-   ec,
-   params,
-   procutil;
-   procutil = Components.classes["@mozilla.org/process/util;1"];
-   this.initial_background = this.node.style.backgroundColor;
-   this.initial_color      = this.node.style.color;
-
-
-   try {
-     program = itsalltext.getEditor();
-
-     // checks
-     if (program === null) {
-       throw {name: "Editor is not set."};
-     }
-
-     if (!program.exists()) {
-       throw {name: "NS_ERROR_FILE_NOT_FOUND"};
-     }
-
-     if (itsalltext.isDarwin() &&
-     program.isDirectory() &&
-     program.leafName.match(/\.app$/i)) {
-       // OS-X .app bundles should be run with open.
-       args = ['-a', program.path, filename];
-       program = itsalltext.factoryFile('/usr/bin/open');
-     } else {
-       /* Mac check because of
-       * https://bugzilla.mozilla.org/show_bug.cgi?id=322865 */
-       if (!(itsalltext.isDarwin() || program.isExecutable())) {
-         throw {name: "NS_ERROR_FILE_ACCESS_DENIED"};
-       }
-       args = [filename];
-     }
-
-     // Create an observer.
-     var observer          = {
-       observe: function (subject, topic, data) {
-         // Topic moved as last argument to callbacks since we don't need it (we already know what it is)
-         if (topic==='process-finished') {
-           if (typeof(subject.exitValue) != 'undefined' && subject.exitValue != 0) {
-             var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
-             .getService(Components.interfaces.nsIPromptService);
-             prompts.alert(null, "Editor exited with status of " + subject.exitValue,
-             "I ran this command: " + program.path + " " + (args.join(' ')) + "\n\n...and it exited with a status of " + subject.exitValue + ".");
-           }
-           itsalltext.debug("Process exited successfully: ", subject, data);
-         }
-         else if (topic === 'process-failed') {
-           itsalltext.debug("Process exited unsuccessfully: ", subject, data);
-         } else {
-           itsalltext.debug("Observer had a hard time: ", subject, topic, data);
-         }
-       }
-     };
-
-     // create an nsIProcess
-     process = procutil.createInstance(Components.interfaces.nsIProcess);
-     process.init(program);
-
-     // Run the process.
-     if (typeof process.runwAsync == 'undefined') {
-       // FF < 4.0
-       process.runAsync(args, args.length, observer, false);
-     } else {
-       // FF >= 4.0 - Wide character support.
-       process.runwAsync(args, args.length, observer, false);
-     }
-
-     this.private_is_watching = true;
-     this.edit_count++;
-   } catch (e) {
-     itsalltext.debug("Caught error launching editor: ", e);
-     params = { out: null,
-       exists: program ? program.exists() : false,
-       path: itsalltext.preferences.editor,
-       exception: e.name };
-       window.openDialog('chrome://itsalltext/content/badeditor.xul',
-       null,
-       "chrome, titlebar, toolbar, centerscreen, modal",
-       params);
-       if (params.out !== null && params.out.do_preferences) {
-         itsalltext.openPreferences(true);
-         this.edit(extension);
-       }
-     }
-   };
+CacheObj.prototype.edit = function (extension, clobber) {
+    itsalltext.debug(this.uuid, 'edit(', extension, ', ', clobber, ')', this.uid);
+    extension = typeof(extension) === 'string'?extension:this.getExtension();
+    this.setExtension(extension);
+
+    var filename = this.write(clobber),
+    program = null,
+    command,
+    process,
+    args,
+    result,
+    ec,
+    params,
+    procutil;
+    procutil = Components.classes["@mozilla.org/process/util;1"];
+    this.initial_background = this.node.style.backgroundColor;
+    this.initial_color      = this.node.style.color;
+
+
+    try {
+        program = itsalltext.getEditor();
+
+        // checks
+        if (program === null) {
+            throw {name: "Editor is not set."};
+        }
+
+        if (!program.exists()) {
+            throw {name: "NS_ERROR_FILE_NOT_FOUND"};
+        }
+
+        if (itsalltext.isDarwin() &&
+            program.isDirectory() &&
+                program.leafName.match(/\.app$/i)) {
+            // OS-X .app bundles should be run with open.
+            args = ['-a', program.path, filename];
+            program = itsalltext.factoryFile('/usr/bin/open');
+        } else {
+            /* Mac check because of
+             * https://bugzilla.mozilla.org/show_bug.cgi?id=322865 */
+            if (!(itsalltext.isDarwin() || program.isExecutable())) {
+                throw {name: "NS_ERROR_FILE_ACCESS_DENIED"};
+            }
+            args = [filename];
+        }
+
+        // Create an observer.
+        var observer          = {
+            observe: function (subject, topic, data) {
+                // Topic moved as last argument to callbacks since we don't need it (we already know what it is)
+                if (topic==='process-finished') {
+                    if (typeof(subject.exitValue) != 'undefined' && subject.exitValue != 0) {
+                        var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
+                        .getService(Components.interfaces.nsIPromptService);
+                        prompts.alert(null, "Editor exited with status of " + subject.exitValue,
+                                      "I ran this command: " + program.path + " " + (args.join(' ')) + "\n\n...and it exited with a status of " + subject.exitValue + ".");
+                    }
+                    itsalltext.debug("Process exited successfully: ", subject, data);
+                }
+                else if (topic === 'process-failed') {
+                    itsalltext.debug("Process exited unsuccessfully: ", subject, data);
+                } else {
+                    itsalltext.debug("Observer had a hard time: ", subject, topic, data);
+                }
+            }
+        };
+
+        // create an nsIProcess
+        process = procutil.createInstance(Components.interfaces.nsIProcess);
+        process.init(program);
+
+        // Run the process.
+        if (typeof process.runwAsync == 'undefined') {
+            // FF < 4.0
+            process.runAsync(args, args.length, observer, false);
+        } else {
+            // FF >= 4.0 - Wide character support.
+            process.runwAsync(args, args.length, observer, false);
+        }
+
+        this.private_is_watching = true;
+        this.edit_count++;
+    } catch (e) {
+        itsalltext.debug("Caught error launching editor: ", e);
+        params = { out: null,
+            exists: program ? program.exists() : false,
+            path: itsalltext.preferences.editor,
+            exception: e.name };
+            window.openDialog('chrome://itsalltext/content/badeditor.xul',
+                              null,
+                              "chrome, titlebar, toolbar, centerscreen, modal",
+                              params);
+                              if (params.out !== null && params.out.do_preferences) {
+                                  itsalltext.openPreferences(true);
+                                  this.edit(extension);
+                              }
+    }
+};
 
 /**
  * Delete the file from disk.
@@ -476,11 +481,11 @@ CacheObj.prototype.remove = function () {
 CacheObj.prototype.read = function () {
     /* read file, reset ts & size */
     var DEFAULT_REPLACEMENT_CHARACTER = 65533,
-        file = this.getFile(),
-        buffer = [],
-        fis,
-        istream,
-        str;
+    file = this.getFile(),
+    buffer = [],
+    fis,
+    istream,
+    str;
 
     try {
         fis = Components.classes["@mozilla.org/network/file-input-stream;1"].
@@ -517,10 +522,10 @@ CacheObj.prototype.hasChanged = function () {
     var file = this.getFile();
     /* Check exists.  Check ts and size. */
     return this.private_is_watching &&
-           file.exists() &&
-           file.isReadable() &&
-           (file.lastModifiedTime != this.timestamp ||
-            file.fileSize         != this.size);
+        file.exists() &&
+        file.isReadable() &&
+        (file.lastModifiedTime != this.timestamp ||
+         file.fileSize         != this.size);
 };
 
 /**
@@ -551,14 +556,14 @@ CacheObj.prototype.fadeStep = function (background_pallet, color_pallet, step, d
  */
 CacheObj.prototype.fade = function (steps, delay) {
     var color             = this.getStyle(this.node, 'color'),
-        color_stop        = new itsalltext.Color(color),
-        color_start       = new itsalltext.Color('black'),
-        color_pallet      = color_start.blend(color_stop, steps),
-
-        background        = this.getStyle(this.node, 'background-color'),
-        background_stop   = new itsalltext.Color(background),
-        background_start  = new itsalltext.Color('yellow'),
-        background_pallet = background_start.blend(background_stop, steps);
+    color_stop        = new itsalltext.Color(color),
+    color_start       = new itsalltext.Color('black'),
+    color_pallet      = color_start.blend(color_stop, steps),
+
+    background        = this.getStyle(this.node, 'background-color'),
+    background_stop   = new itsalltext.Color(background),
+    background_start  = new itsalltext.Color('yellow'),
+    background_pallet = background_start.blend(background_stop, steps);
     setTimeout(this.fadeStep(background_pallet, color_pallet, 0, delay), delay);
 };
 
@@ -574,9 +579,9 @@ CacheObj.prototype.update = function () {
             this.fade(20, 100);
             this.node.value = value;
 
-	    var event = document.createEvent("HTMLEvents");
-	    event.initEvent('change', true, false);
-	    this.node.dispatchEvent(event);
+            var event = document.createEvent("HTMLEvents");
+            event.initEvent('change', true, false);
+            this.node.dispatchEvent(event);
 
             return true;
         }
@@ -629,15 +634,15 @@ CacheObj.prototype.onContext = function (event) {
      * sane....openPopup()
      */
     var cobj = CacheObj.get(event.target),
-        popup = itsalltext.rebuildMenu(cobj.uid);
+    popup = itsalltext.rebuildMenu(cobj.uid);
 
     popup.openPopup(cobj.button, 'end_before',
                     0, 0,
                     true, false);
 
-    event.stopPropagation();
-    event.preventDefault();
-    return false;
+                    event.stopPropagation();
+                    event.preventDefault();
+                    return false;
 };
 
 
@@ -647,11 +652,11 @@ CacheObj.prototype.onContext = function (event) {
  */
 CacheObj.prototype.addGumDrop = function () {
     var cache_object = this,
-        node,
-        doc,
-        gumdrop,
-        parent,
-        nextSibling;
+    node,
+    doc,
+    gumdrop,
+    parent,
+    nextSibling;
 
     try {
         itsalltext.monitor.incrementLock();
@@ -740,15 +745,15 @@ CacheObj.prototype.addGumDrop = function () {
  */
 CacheObj.prototype.adjust = function () {
     var gumdrop  = this.button,
-        el       = this.node,
-        doc      = el.ownerDocument,
-        style,
-        display,
-        cstyle,
-        left,
-        top,
-        coord,
-        pos;
+    el       = this.node,
+    doc      = el.ownerDocument,
+    style,
+    display,
+    cstyle,
+    left,
+    top,
+    coord,
+    pos;
 
     if (itsalltext.getDisableGumdrops()) {
         if (gumdrop && gumdrop.style.display != 'none') {
@@ -765,49 +770,49 @@ CacheObj.prototype.adjust = function () {
     cstyle = doc.defaultView && doc.defaultView.getComputedStyle(el, '');
     if ((cstyle && (cstyle.display == 'none' ||
                     cstyle.visibility == 'hidden')) ||
-        el.getAttribute('readonly') ||
-        el.readOnly ||
-        el.getAttribute('disabled')
-        ) {
-        display = 'none';
-    }
-    if (display === 'none' && style.display != display) {
-        style.setProperty('display', display, 'important');
-    }
+                        el.getAttribute('readonly') ||
+                            el.readOnly ||
+                                el.getAttribute('disabled')
+       ) {
+           display = 'none';
+       }
+       if (display === 'none' && style.display != display) {
+           style.setProperty('display', display, 'important');
+       }
 
-    /**
-     * Position the gumdrop.
-     * Updates in case the DOM changes.
-     */
-    pos = itsalltext.preferences.gumdrop_position;
-    if (pos === 'upper-right' || pos === 'lower-right') {
-        left = Math.max(1, el.offsetWidth - this.gumdrop_width);
-    } else {
-        left = 0;
-    }
-    if (pos === 'lower-left' || pos === 'lower-right') {
-        top  = el.offsetHeight;
-    } else {
-        top  = 0 - this.gumdrop_height;
-    }
-    if (el.offsetParent === gumdrop.offsetParent) {
-        left += el.offsetLeft;
-        top  += el.offsetTop;
-    } else {
-        coord = itsalltext.getContainingBlockOffset(el, gumdrop.offsetParent);
-        left += coord[0];
-        top  += coord[1];
-    }
-    if (left && top) {
-        left = [left, 'px'].join('');
-        top  = [top, 'px'].join('');
-        if (style.left != left) {
-            style.setProperty('left', left, 'important');
-        }
-        if (style.top != top) {
-            style.setProperty('top',  top, 'important');
-        }
-    }
+       /**
+        * Position the gumdrop.
+        * Updates in case the DOM changes.
+        */
+       pos = itsalltext.preferences.gumdrop_position;
+       if (pos === 'upper-right' || pos === 'lower-right') {
+           left = Math.max(1, el.offsetWidth - this.gumdrop_width);
+       } else {
+           left = 0;
+       }
+       if (pos === 'lower-left' || pos === 'lower-right') {
+           top  = el.offsetHeight;
+       } else {
+           top  = 0 - this.gumdrop_height;
+       }
+       if (el.offsetParent === gumdrop.offsetParent) {
+           left += el.offsetLeft;
+           top  += el.offsetTop;
+       } else {
+           coord = itsalltext.getContainingBlockOffset(el, gumdrop.offsetParent);
+           left += coord[0];
+           top  += coord[1];
+       }
+       if (left && top) {
+           left = [left, 'px'].join('');
+           top  = [top, 'px'].join('');
+           if (style.left != left) {
+               style.setProperty('left', left, 'important');
+           }
+           if (style.top != top) {
+               style.setProperty('top',  top, 'important');
+           }
+       }
 };
 
 /**
diff --git a/src/chrome/content/itsalltext.js b/src/chrome/content/itsalltext.js
index 1d750a3..3f5f8c9 100644
--- a/src/chrome/content/itsalltext.js
+++ b/src/chrome/content/itsalltext.js
@@ -1,6 +1,5 @@
 "use strict";
-// vim: ts=4 sw=4
-
+// vim: ts=4 sw=4 sts=4
 /*
  *  It's All Text! - Easy external editing of web forms.
  *
@@ -31,7 +30,7 @@ var ItsAllText = function () {
      * @type Object
      */
     var that = this,
-        loadthings;
+    loadthings;
 
     /**
      * A factory method to make an nsIFile object.
@@ -77,9 +76,9 @@ var ItsAllText = function () {
          */
         private_get: function (aData) {
             var po = that.preference_observer,
-                real_type = po.types[aData],
-                type = real_type === 'Float' ? 'Char' : real_type,
-                retval = '';
+            real_type = po.types[aData],
+            type = real_type === 'Float' ? 'Char' : real_type,
+            retval = '';
             retval = po.private_branch['get' + type + 'Pref'](aData);
             return real_type === 'Float' ? parseFloat(retval) : retval;
         },
@@ -91,8 +90,8 @@ var ItsAllText = function () {
          */
         private_set: function (aData, value) {
             var po = that.preference_observer,
-                real_type = po.types[aData],
-                type = real_type === 'Float' ? 'Char' : real_type;
+            real_type = po.types[aData],
+            type = real_type === 'Float' ? 'Char' : real_type;
             if (real_type === 'Float') {
                 value = '' + parseFloat(value);
             }
@@ -129,7 +128,7 @@ var ItsAllText = function () {
             var prefService = Components.
                 classes["@mozilla.org/preferences-service;1"].
                 getService(Components.interfaces.nsIPrefService),
-                type;
+            type;
             this.private_branch = prefService.getBranch("extensions." + that.MYSTRING + ".");
             this.private_branch.QueryInterface(Components.interfaces.nsIPrefBranch2);
             this.private_branch.addObserver("", this, false);
@@ -198,11 +197,11 @@ var ItsAllText = function () {
         var id = that.preferences.tracker_id;
         if (!id) {
             id = [that.MYSTRING,
-            Math.floor(Math.random()*999999).toString(),
-            Math.round(new Date().getTime()),
-           ].join(':')
+                Math.floor(Math.random()*999999).toString(),
+                Math.round(new Date().getTime()),
+            ].join(':')
             id = that.hashString(id);
-                  that.preferences.private_set('tracker_id', id);
+            that.preferences.private_set('tracker_id', id);
         }
         return id;
     }
@@ -214,8 +213,8 @@ var ItsAllText = function () {
      */
     that.isDarwin = function () {
         /* more help:
-         http://developer.mozilla.org/en/docs/Code_snippets:Miscellaneous#Operating_system_detection
-        */
+http://developer.mozilla.org/en/docs/Code_snippets:Miscellaneous#Operating_system_detection
+*/
 
         var is_darwin = that.private_is_darwin;
         if (typeof(is_darwin) == 'undefined') {
@@ -237,7 +236,7 @@ var ItsAllText = function () {
      */
     that.getEditor = function () {
         var editor = that.preferences.editor,
-            retval = null;
+        retval = null;
 
         if (editor === '' && that.isDarwin()) {
             editor = '/Applications/TextEdit.app';
@@ -256,8 +255,8 @@ var ItsAllText = function () {
      */
     that.getWorkingDir = function () {
         var workingdir = that.preferences.workingdir,
-            default_workingdir,
-            fobj;
+        default_workingdir,
+        fobj;
 
         if (!workingdir) {
             default_workingdir = that.getDefaultWorkingDir();
@@ -300,7 +299,7 @@ var ItsAllText = function () {
      */
     that.getExtensions = function () {
         var string = that.preferences.extensions.replace(/[\n\t ]+/g, ''),
-            extensions = string.split(',');
+        extensions = string.split(',');
         if (extensions.length === 0) {
             return ['.txt'];
         } else {
@@ -318,13 +317,13 @@ var ItsAllText = function () {
     that.openPreferences = function (wait) {
         wait = typeof(wait) == 'boolean' ? wait : false;
         var paneID = that.MYSTRING + '_preferences',
-            psvc = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch),
-            instantApply = psvc.getBoolPref("browser.preferences.instantApply", false) && !wait,
-            features = "chrome,titlebar,toolbar,centerscreen" + (instantApply ? ",dialog" : ",modal"),
-            xpcom_wm = Components.classes["@mozilla.org/appshell/window-mediator;1"],
-            wm = xpcom_wm.getService(Components.interfaces.nsIWindowMediator),
-            win = wm.getMostRecentWindow("Browser:Preferences"),
-            pane;
+        psvc = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch),
+        instantApply = psvc.getBoolPref("browser.preferences.instantApply", false) && !wait,
+        features = "chrome,titlebar,toolbar,centerscreen" + (instantApply ? ",dialog" : ",modal"),
+        xpcom_wm = Components.classes["@mozilla.org/appshell/window-mediator;1"],
+        wm = xpcom_wm.getService(Components.interfaces.nsIWindowMediator),
+        win = wm.getMostRecentWindow("Browser:Preferences"),
+        pane;
 
         if (win) {
             win.focus();
@@ -344,8 +343,8 @@ var ItsAllText = function () {
      */
     that.appendExtensions = function (ext) {
         var current = that.getExtensions(),
-            value,
-            i;
+        value,
+        i;
         ext = ext.replace(/[\n\t ]+/g, '');
         for (i = 0; i < current.length; i++) {
             if (ext == current[i]) {
@@ -378,9 +377,9 @@ var ItsAllText = function () {
             doc.setUserData(that.getTrackerId(), tracker, null);
         }
         return tracker[id];
-        }
+    }
 
-        that.addToTracker = function (id, cobj) {
+    that.addToTracker = function (id, cobj) {
         var tracker, doc;
         if (typeof gBrowser !== 'undefined') {
             doc = gBrowser.contentDocument;
@@ -413,7 +412,7 @@ var ItsAllText = function () {
             container = node.offsetParent;
         }
         var pos = [node.offsetLeft, node.offsetTop],
-            pnode = node.offsetParent;
+        pnode = node.offsetParent;
         while (pnode && (container === null || pnode != container)) {
             pos[0] += pnode.offsetLeft || 0;
             pos[1] += pnode.offsetTop  || 0;
@@ -430,13 +429,13 @@ var ItsAllText = function () {
      */
     that.marshalKeyEvent = function (event) {
         var marshal = [event.altKey  ? 1 : 0,
-                       event.ctrlKey ? 1 : 0,
-                       event.metaKey ? 1 : 0,
-                       event.shiftKey ? 1 : 0,
-                       event.charCode,
-                       event.keyCode];
-        marshal = marshal.join(':');
-        return marshal;
+            event.ctrlKey ? 1 : 0,
+            event.metaKey ? 1 : 0,
+            event.shiftKey ? 1 : 0,
+            event.charCode,
+            event.keyCode];
+            marshal = marshal.join(':');
+            return marshal;
     };
 
     that.keyMap = {
@@ -476,8 +475,8 @@ var ItsAllText = function () {
      */
     that.keyMarshalToString = function (km) {
         var e = km.split(':'),
-            out = [],
-            c = parseInt(e[5], 10);
+        out = [],
+        c = parseInt(e[5], 10);
         if (e[0] === '1') {
             out.push('alt');
         }
@@ -526,27 +525,28 @@ var ItsAllText = function () {
             if (tid == "itsalltext-context-popup" ||
                 tid == "contentAreaContextMenu") {
                 node = document.popupNode;
-                tag = node.nodeName.toLowerCase();
-                doc = node.ownerDocument;
-                cstyle = doc.defaultView.getComputedStyle(node, '');
-                is_disabled = (!(tag == 'textarea' ||
-                                 tag == 'textbox') ||
-                               node.style.display == 'none' ||
-                               (cstyle && (cstyle.display == 'none' ||
-                                           cstyle.visibility == 'hidden')) ||
-                               node.getAttribute('readonly') ||
-                               node.getAttribute('disabled')
-                               );
-                if (tid == "itsalltext-context-popup") {
-                    cobj = that.CacheObj.get(node);
-                    that.rebuildMenu(cobj.uid,
-                                     'itsalltext-context-popup',
-                                     is_disabled);
-                } else {
-                    // tid == "contentAreaContextMenu"
-                    menu = document.getElementById("itsalltext-contextmenu");
-                    menu.setAttribute('hidden', is_disabled);
-                }
+            tag = node.nodeName.toLowerCase();
+            doc = node.ownerDocument;
+            cstyle = doc.defaultView.getComputedStyle(node, '');
+            is_disabled = (
+                !(tag == 'textarea' ||
+                  tag == 'textbox') ||
+                  node.style.display == 'none' ||
+                  (cstyle && (cstyle.display == 'none' ||
+                              cstyle.visibility == 'hidden')) ||
+                              node.getAttribute('readonly') ||
+                              node.getAttribute('disabled')
+            );
+            if (tid == "itsalltext-context-popup") {
+                cobj = that.CacheObj.get(node);
+                that.rebuildMenu(cobj.uid,
+                                 'itsalltext-context-popup',
+                                 is_disabled);
+            } else {
+                // tid == "contentAreaContextMenu"
+                menu = document.getElementById("itsalltext-contextmenu");
+                menu.setAttribute('hidden', is_disabled);
+            }
 
             }
         }
@@ -761,7 +761,7 @@ ItsAllText.prototype.hitch = function (object, method) {
         // make a copy of staticArgs (don't modify it because it gets reused for
         // every invocation).
         var args = staticArgs.concat(),
-            i;
+        i;
 
         // add all the new arguments
         for (i = 0; i < arguments.length; i++) {
@@ -799,13 +799,13 @@ ItsAllText.prototype.listen = function (source, event, listener, opt_capture) {
  */
 ItsAllText.prototype.hashString = function (some_string) {
     var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Components.interfaces.nsIScriptableUnicodeConverter),
-        result = {},
-        data,
-        ch,
-        hash,
-        toHexString,
-        retval = [],
-        i;
+    result = {},
+    data,
+    ch,
+    hash,
+    toHexString,
+    retval = [],
+    i;
     converter.charset = "UTF-8";
 
     /* result is the result of the hashing.  It's not yet a string,
@@ -861,11 +861,11 @@ ItsAllText.prototype.unlisten = function (source, event, listener, opt_capture)
  */
 ItsAllText.prototype.eventToKeyprint = function (event) {
     return [ event.ctrlKey,
-             event.altKey,
-             event.metaKey,
-             event.shiftKey,
-             event.keyCode,
-             event.charCode ].join(':');
+        event.altKey,
+        event.metaKey,
+        event.shiftKey,
+        event.keyCode,
+        event.charCode ].join(':');
 };
 
 /**
@@ -875,7 +875,7 @@ ItsAllText.prototype.eventToKeyprint = function (event) {
  */
 ItsAllText.prototype.keyprintToString = function (keyprint) {
     var split = keyprint.split(':'),
-        string = [];
+    string = [];
     if (split[0] === 'true') {
         string.push('Ctrl');
     }
@@ -929,12 +929,14 @@ ItsAllText.prototype.cleanWorkingDir = function (force) {
  */
 ItsAllText.prototype.menuNewExtEdit = function (event) {
     var that = this,
-        uid = this.private_current_uid,
-        cobj = that.CacheObj.get(uid),
-        params = {out: null},
-        ext;
-    window.openDialog("chrome://itsalltext/content/newextension.xul", "",
-    "chrome, dialog, modal, resizable=yes", params).focus();
+    uid = this.private_current_uid,
+    cobj = that.CacheObj.get(uid),
+    params = {out: null},
+    ext;
+    window.openDialog(
+        "chrome://itsalltext/content/newextension.xul", "",
+        "chrome, dialog, modal, resizable=yes", params
+    ).focus();
     if (params.out) {
         ext = params.out.extension.replace(/[\n\t ]+/g, '');
         if (params.out.do_save) {
@@ -952,7 +954,7 @@ ItsAllText.prototype.menuNewExtEdit = function (event) {
  */
 ItsAllText.prototype.menuExtEdit = function (ext, clobber, event) {
     var uid = this.private_current_uid,
-        cobj = this.CacheObj.get(uid);
+    cobj = this.CacheObj.get(uid);
     if (ext !== null) {
         ext = typeof(ext) === 'string'?ext:event.target.getAttribute('label');
     }
@@ -969,16 +971,16 @@ ItsAllText.prototype.rebuildMenu = function (uid, menu_id, is_disabled) {
     menu_id = typeof(menu_id) == 'string'?menu_id:'itsalltext-optionmenu';
     is_disabled = (typeof(is_disabled) === 'undefined' || !is_disabled) ? false : (is_disabled && true);
     var i,
-        that = this,
-        exts = that.getExtensions(),
-        menu = document.getElementById(menu_id),
-        items = menu.childNodes,
-        items_length = items.length - 1, /* We ignore the preferences item */
-        node,
-        magic_stop_node = null,
-        magic_start = null,
-        magic_stop = null,
-        cobj = that.CacheObj.get(uid);
+    that = this,
+    exts = that.getExtensions(),
+    menu = document.getElementById(menu_id),
+    items = menu.childNodes,
+    items_length = items.length - 1, /* We ignore the preferences item */
+    node,
+    magic_stop_node = null,
+    magic_start = null,
+    magic_stop = null,
+    cobj = that.CacheObj.get(uid);
     that.private_current_uid = uid;
 
     // Find the beginning and end of the magic replacement parts.
@@ -1025,7 +1027,7 @@ ItsAllText.prototype.rebuildMenu = function (uid, menu_id, is_disabled) {
  */
 ItsAllText.prototype.getLocale = function () {
     var string_bundle = Components.classes["@mozilla.org/intl/stringbundle;1"],
-        obj = string_bundle.getService(Components.interfaces.nsIStringBundleService);
+    obj = string_bundle.getService(Components.interfaces.nsIStringBundleService);
     /**
      * A localization bundle.  Use it like so:
      * itsalltext.locale.getStringFromName('blah');
diff --git a/src/chrome/content/monitor.js b/src/chrome/content/monitor.js
index 5332250..2832d18 100644
--- a/src/chrome/content/monitor.js
+++ b/src/chrome/content/monitor.js
@@ -1,4 +1,5 @@
 "use strict";
+// vim: ts=4 sw=4 sts=4
 /*
  *  It's All Text! - Easy external editing of web forms.
  *
@@ -19,7 +20,7 @@
 
 function Monitor() {
     var hitch_re = /^hitched_/,
-        method;
+    method;
     itsalltext.debug('Monitor', itsalltext);
 
     for (method in this) {
@@ -38,7 +39,7 @@ Monitor.prototype.hitched_destroy = function () {
 
 Monitor.prototype.hitched_restart = function () {
     var rate = itsalltext.getRefresh(),
-        id   = this.id;
+    id   = this.id;
     if (id) {
         clearInterval(id);
     }
@@ -71,12 +72,12 @@ Monitor.prototype.hitched_findnodes = function (doc) {
         return [];
     }
     var is_html = this.isHTML(doc),
-        is_xul  = this.isXUL(doc),
-        i,
-        tmp,
-        nodes = [],
-        iframes,
-        frames;
+    is_xul  = this.isXUL(doc),
+    i,
+    tmp,
+    nodes = [],
+    iframes,
+    frames;
     if (is_html) {
         /* HTML */
         tmp = doc.getElementsByTagName('textarea');
@@ -85,7 +86,7 @@ Monitor.prototype.hitched_findnodes = function (doc) {
         }
 
         /* Now that we got the nodes in this document,
-             * look for other documents. */
+         * look for other documents. */
         iframes = doc.getElementsByTagName('iframe');
         for (i = 0; i < iframes.length; i++) {
             nodes.push.apply(nodes, (this.findnodes(iframes[i].contentDocument)));
@@ -118,12 +119,12 @@ Monitor.prototype.hitched_watcher = function (offset, init) {
         init = true;
     }
     var rate = itsalltext.getRefresh(),
-        now = Date.now(),
-        doc,
-        nodes = [],
-        i,
-        cobj,
-        node;
+    now = Date.now(),
+    doc,
+    nodes = [],
+    i,
+    cobj,
+    node;
 
     if (!init && now - this.last_watcher_call < Math.round(rate * 0.9)) {
         //disabled-debug -- itsalltext.debug('watcher(', offset, '/', (now - this.last_watcher_call), ') -- skipping catchup refresh');
@@ -188,7 +189,7 @@ Monitor.prototype.hitched_handleSubtreeModified = function (event) {
 
 Monitor.prototype.hitched_startPage = function (event, force) {
     var doc = event.originalTarget,
-        unsafeWin;
+    unsafeWin;
     //disabled-debug -- itsalltext.debug('startPage', doc && doc.location, force);
     if (!(force || this.isHTML(doc))) {
         this.stopPage(event);
@@ -214,7 +215,7 @@ Monitor.prototype.hitched_startPage = function (event, force) {
 
 Monitor.prototype.hitched_stopPage = function (event) {
     var doc = event.originalTarget,
-        unsafeWin;
+    unsafeWin;
     //disabled-debug -- itsalltext.debug('stopPage', doc && doc.location);
 
     unsafeWin = doc.defaultView.wrappedJSObject;
@@ -225,8 +226,8 @@ Monitor.prototype.hitched_stopPage = function (event) {
 
 Monitor.prototype.isXUL = function (doc) {
     var contentType = doc && doc.contentType,
-        is_xul = (contentType == 'application/vnd.mozilla.xul+xml'),
-        is_my_readme;
+    is_xul = (contentType == 'application/vnd.mozilla.xul+xml'),
+    is_my_readme;
     try {
         is_my_readme = location && location.href == itsalltext.README;
     } catch (e) {
@@ -237,10 +238,10 @@ Monitor.prototype.isXUL = function (doc) {
 
 Monitor.prototype.isHTML = function (doc) {
     var contentType,
-        location,
-        is_html,
-        is_usable,
-        is_my_readme;
+    location,
+    is_html,
+    is_usable,
+    is_my_readme;
     /* Check that this is a document we want to play with. */
     contentType = doc.contentType;
     location = doc.location;
@@ -248,9 +249,9 @@ Monitor.prototype.isHTML = function (doc) {
                contentType == 'text/xhtml' ||
                contentType == 'application/xhtml+xml');
     is_usable = is_html &&
-                location &&
-                location.protocol !== 'about:' &&
-                location.protocol !== 'chrome:';
+        location &&
+        location.protocol !== 'about:' &&
+        location.protocol !== 'chrome:';
     try {
         is_my_readme = location && location.href == itsalltext.README;
         /*
diff --git a/src/chrome/content/newextension.js b/src/chrome/content/newextension.js
index 594c3bb..a162859 100644
--- a/src/chrome/content/newextension.js
+++ b/src/chrome/content/newextension.js
@@ -1,4 +1,5 @@
 "use strict";
+// vim: ts=4 sw=4 sts=4
 /**
  * Pass back the values that that the user selected.
  */
@@ -7,5 +8,5 @@ function onOK() {
         extension: document.getElementById('new_ext').value,
         do_save: document.getElementById('do_save').checked
     };
-   return true;
+    return true;
 }
diff --git a/src/chrome/content/preferences.js b/src/chrome/content/preferences.js
index 7739fa0..914a04d 100644
--- a/src/chrome/content/preferences.js
+++ b/src/chrome/content/preferences.js
@@ -1,4 +1,5 @@
 "use strict";
+// vim: ts=4 sw=4 sts=4
 // @todo [6] [pref] Better strategy for getting the default editor: EDITOR env variable or view_source.editor.path
 // @todo [8] [pref] Option to make the textarea uneditable when using editor.
 
@@ -7,19 +8,21 @@
  */
 function pref_editor_select() {
     var locale = document.getElementById("strings"),
-        pref_editor = document.getElementById('pref_editor'),
-        nsIFilePicker = Components.interfaces.nsIFilePicker,
-        fp,
-        editor_file,
-        rv,
-        file,
-        editor;
+    pref_editor = document.getElementById('pref_editor'),
+    nsIFilePicker = Components.interfaces.nsIFilePicker,
+    fp,
+    editor_file,
+    rv,
+    file,
+    editor;
 
     fp = Components.classes["@mozilla.org/filepicker;1"].
         createInstance(nsIFilePicker);
-    fp.init(window,
-            locale.getString('picker.window.title'),
-            nsIFilePicker.modeOpen);
+    fp.init(
+        window,
+        locale.getString('picker.window.title'),
+        nsIFilePicker.modeOpen
+    );
     fp.appendFilters(nsIFilePicker.filterApps);
 
     try {
@@ -46,19 +49,21 @@ function pref_editor_select() {
 
 function pref_workingdir_select() {
     var locale = document.getElementById("strings"),
-        pref_workingdir = document.getElementById('pref_workingdir'),
-        nsIFilePicker = Components.interfaces.nsIFilePicker,
-        fp,
-        workingdir,
-        rv,
-        file,
-        editor;
+    pref_workingdir = document.getElementById('pref_workingdir'),
+    nsIFilePicker = Components.interfaces.nsIFilePicker,
+    fp,
+    workingdir,
+    rv,
+    file,
+    editor;
 
     fp = Components.classes["@mozilla.org/filepicker;1"].
         createInstance(nsIFilePicker);
-    fp.init(window,
-            locale.getString('workingdir.picker.window.title'),
-            nsIFilePicker.modeGetFolder);
+    fp.init(
+        window,
+        locale.getString('workingdir.picker.window.title'),
+        nsIFilePicker.modeGetFolder
+    );
 
     try {
         workingdir = itsalltext.factoryFile(pref_workingdir.value);
@@ -81,11 +86,11 @@ function pref_workingdir_select() {
 
 function update_hotkey(disp) {
     var str,
-        km = itsalltext.preferences.hotkey;
+    km = itsalltext.preferences.hotkey;
     if (typeof(km) === 'undefined') {
         setTimeout(function () {
-                update_hotkey(disp);
-            }, 100);
+            update_hotkey(disp);
+        }, 100);
         return;
     }
     if (km === '') {
@@ -100,10 +105,12 @@ function pref_grab(disp, e) {
     e.preventDefault();
     var km  = itsalltext.marshalKeyEvent(e);
     const empty_re = /:0:0$/;
-    if (empty_re.test(km)    ||   // Various Alt/Meta keys
-        km === '0:0:0:0:0:8' ||   // Backspace
-        km === '0:0:0:0:0:27' ||  // Escape
-        km === '0:0:0:0:0:46') {  // Del
+    if (
+        empty_re.test(km)           // Various Alt/Meta keys
+            || km === '0:0:0:0:0:8' // Backspace
+        || km === '0:0:0:0:0:27'    // Escape
+        || km === '0:0:0:0:0:46'    // Del
+    ) {
         km = '';
     }
     itsalltext.preferences.private_set('hotkey', km);
@@ -112,7 +119,7 @@ function pref_grab(disp, e) {
 
 function setHelp(text) {
     var help = document.getElementById('help'),
-        textnode = document.createTextNode(text);
+    textnode = document.createTextNode(text);
     while (help.firstChild) {
         help.removeChild(help.firstChild);
     }
@@ -121,11 +128,11 @@ function setHelp(text) {
 
 function pref_onload() {
     var locale = document.getElementById("strings"),
-        editor,
-        workingdir,
-        box,
-        desc,
-        textnode;
+    editor,
+    workingdir,
+    box,
+    desc,
+    textnode;
     document.getElementById('browse').focus();
     if (window['arguments'] && window.arguments[0] && window.arguments[0] == 'badeditor') {
         editor = document.getElementById('editor');

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/itsalltext.git



More information about the Pkg-mozext-commits mailing list