Skip to content

Commit

Permalink
lint for spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
ericawright committed May 12, 2016
1 parent 35708c7 commit baf97fe
Show file tree
Hide file tree
Showing 7 changed files with 480 additions and 490 deletions.
12 changes: 3 additions & 9 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@
"es6": true
},
"extends": "eslint:recommended",
"installedESLint": true,
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true
}
},
"plugins": [
"mozilla"
],
Expand All @@ -18,8 +12,6 @@
"Services": false,
"Cc": false,
"Ci": false,
"VTTabDataStore": false,
"VerticalTabs": false,
"TAB_DROP_TYPE": false,
"TabsInTitlebar": false
},
Expand All @@ -30,6 +22,7 @@
"comma-dangle": 0,
"comma-spacing": 2,
"computed-property-spacing": [2, "never"],
"curly": 2,
"default-case": 0,
"eqeqeq": [2, "smart"],
"func-names": 0,
Expand All @@ -39,6 +32,7 @@
"id-blacklist": 0,
"id-length": 0,
"id-match": 0,
"indent": [2, 2],
"init-declarations": 0,
"max-len": 0,
"max-params": 0,
Expand All @@ -49,14 +43,14 @@
"no-inline-comments": 0,
"no-invalid-this": 0,
"no-magic-numbers": 0,
"no-mixed-spaces-and-tabs": [2, "smart-tabs"],
"no-negated-condition": 0,
"no-shadow": 0,
"no-trailing-spaces": [2, {"skipBlankLines": false}],
"no-underscore-dangle": 0,
"no-unused-vars": [2, {"vars": "local", "args": "none"}],
"no-warning-comments": 0,
"object-curly-spacing": [2, "never"],
"curly": 2,
"no-var": 2,
"prefer-const": 0,
"prefer-reflect": 0,
Expand Down
1 change: 0 additions & 1 deletion bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ function include(src) {
}

function setDefaultPrefs() {
// let branch = Services.prefs.getDefaultBranch('');
for (let [name, value] in Iterator(DEFAULT_PREFS)) {
switch (typeof value) {
case 'boolean':
Expand Down
2 changes: 1 addition & 1 deletion groups.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
* - But we have to make sure that groups don't behave like tabs at
* all.
*/

/*eslint-disable */
/*exported EXPORTED_SYMBOLS*/
const EXPORTED_SYMBOLS = ['VTGroups'];
Components.utils.import('resource://tabcenter/tabdatastore.jsm');
Expand Down
221 changes: 109 additions & 112 deletions tabdatastore.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -49,131 +49,128 @@ const EXPORTED_SYMBOLS = ['VTTabDataStore', 'VTTabIDs'];
Components.utils.import('resource://gre/modules/XPCOMUtils.jsm');

let VTTabDataStore = {
getTabValue: function(aTab, aKey) {
let value = null;
try {
value = this.sessionStore.getTabValue(aTab, aKey);
} catch(ex) {
// Ignore
}
return value;
},

setTabValue: function(aTab, aKey, aValue) {
if (!aValue) {
this.deleteTabValue(aTab, aKey);
}

getTabValue: function(aTab, aKey) {
let value = null;
try {
value = this.sessionStore.getTabValue(aTab, aKey);
} catch(ex) {
// Ignore
}
return value;
},

setTabValue: function(aTab, aKey, aValue) {
if (!aValue) {
this.deleteTabValue(aTab, aKey);
}

aTab.setAttribute(aKey, aValue);
try {
this.checkCachedSessionDataExpiration(aTab);
this.sessionStore.setTabValue(aTab, aKey, aValue);
} catch(ex) {
// Ignore
}
},

deleteTabValue: function(aTab, aKey) {
aTab.removeAttribute(aKey);
try {
this.checkCachedSessionDataExpiration(aTab);
this.sessionStore.setTabValue(aTab, aKey, '');
this.sessionStore.deleteTabValue(aTab, aKey);
} catch(ex) {
// Ignore
}
},

// workaround for http://piro.sakura.ne.jp/latest/blosxom/mozilla/extension/treestyletab/2009-09-29_debug.htm
checkCachedSessionDataExpiration: function(aTab) {
let data = aTab.linkedBrowser.__SS_data;
if (data &&
data._tabStillLoading &&
aTab.getAttribute('busy') !== 'true')
data._tabStillLoading = false;
aTab.setAttribute(aKey, aValue);
try {
this.checkCachedSessionDataExpiration(aTab);
this.sessionStore.setTabValue(aTab, aKey, aValue);
} catch(ex) {
// Ignore
}
},

deleteTabValue: function(aTab, aKey) {
aTab.removeAttribute(aKey);
try {
this.checkCachedSessionDataExpiration(aTab);
this.sessionStore.setTabValue(aTab, aKey, '');
this.sessionStore.deleteTabValue(aTab, aKey);
} catch(ex) {
// Ignore
}
},

// workaround for http://piro.sakura.ne.jp/latest/blosxom/mozilla/extension/treestyletab/2009-09-29_debug.htm
checkCachedSessionDataExpiration: function(aTab) {
let data = aTab.linkedBrowser.__SS_data;
if (data &&
data._tabStillLoading &&
aTab.getAttribute('busy') !== 'true') {
data._tabStillLoading = false;
}
}
};
XPCOMUtils.defineLazyServiceGetter(VTTabDataStore, 'sessionStore',
'@mozilla.org/browser/sessionstore;1',
'nsISessionStore');
XPCOMUtils.defineLazyServiceGetter(VTTabDataStore, 'sessionStore', '@mozilla.org/browser/sessionstore;1', 'nsISessionStore');


/*
* Assign tabs a persistent unique identifier.
*
* Necessary until https://bugzilla.mozilla.org/show_bug.cgi?id=529477
* is implemented.
*/
* Assign tabs a persistent unique identifier.
*
* Necessary until https://bugzilla.mozilla.org/show_bug.cgi?id=529477
* is implemented.
*/

function VTTabIDs(tabs) {
this.tabs = tabs;
this.init();
this.tabs = tabs;
this.init();
}
VTTabIDs.prototype = {

init: function() {
const tabs = this.tabs;
tabs.VTTabIDs = this;
tabs.addEventListener('TabOpen', this, true);
tabs.addEventListener('SSTabRestoring', this, true);
for (let i = 0; i < tabs.childNodes.length; i++) {
this.initTab(tabs.childNodes[i]);
}
},

unload: function unload() {
const tabs = this.tabs;
delete tabs.VTTabIDs;
tabs.removeEventListener('TabOpen', this, true);
tabs.removeEventListener('SSTabRestoring', this, true);
},

kId: 'verticaltabs-id',

id: function(aTab) {
return aTab.getAttribute(this.kId);
},

get: function(aID) {
let elements = this.tabs.getElementsByAttribute(this.kId, aID);
return elements.length ? elements[0] : undefined;
},

/*** Event handlers ***/

handleEvent: function(aEvent) {
switch (aEvent.type) {
case 'TabOpen':
this.initTab(aEvent.originalTarget);
return;
case 'SSTabRestoring':
this.restoreTab(aEvent.originalTarget);
return;
}
},

makeNewId: function() {
return this.uuidGen.generateUUID().toString();
},

initTab: function(aTab) {
if (aTab.hasAttribute(this.kId)) {
return;
}
// Assign an ID. This may be temporary if the tab is being restored.
let id = VTTabDataStore.getTabValue(aTab, this.kId) || this.makeNewId();
VTTabDataStore.setTabValue(aTab, this.kId, id);
},

restoreTab: function(aTab) {
// Restore the original ID
let newId = VTTabDataStore.getTabValue(aTab, this.kId);
if (newId) {
aTab.setAttribute(this.kId, newId);
}
init: function() {
const tabs = this.tabs;
tabs.VTTabIDs = this;
tabs.addEventListener('TabOpen', this, true);
tabs.addEventListener('SSTabRestoring', this, true);
for (let i = 0; i < tabs.childNodes.length; i++) {
this.initTab(tabs.childNodes[i]);
}
},

unload: function unload() {
const tabs = this.tabs;
delete tabs.VTTabIDs;
tabs.removeEventListener('TabOpen', this, true);
tabs.removeEventListener('SSTabRestoring', this, true);
},

kId: 'verticaltabs-id',

id: function(aTab) {
return aTab.getAttribute(this.kId);
},

get: function(aID) {
let elements = this.tabs.getElementsByAttribute(this.kId, aID);
return elements.length ? elements[0] : undefined;
},

/*** Event handlers ***/

handleEvent: function(aEvent) {
switch (aEvent.type) {
case 'TabOpen':
this.initTab(aEvent.originalTarget);
return;
case 'SSTabRestoring':
this.restoreTab(aEvent.originalTarget);
return;
}
},

makeNewId: function() {
return this.uuidGen.generateUUID().toString();
},

initTab: function(aTab) {
if (aTab.hasAttribute(this.kId)) {
return;
}
// Assign an ID. This may be temporary if the tab is being restored.
let id = VTTabDataStore.getTabValue(aTab, this.kId) || this.makeNewId();
VTTabDataStore.setTabValue(aTab, this.kId, id);
},

restoreTab: function(aTab) {
// Restore the original ID
let newId = VTTabDataStore.getTabValue(aTab, this.kId);
if (newId) {
aTab.setAttribute(this.kId, newId);
}
}
};
XPCOMUtils.defineLazyServiceGetter(VTTabIDs.prototype, 'uuidGen',
'@mozilla.org/uuid-generator;1',
Expand Down
6 changes: 2 additions & 4 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
function unload(callback, container) {
// Initialize the array of unloaders on the first usage
let unloaders = unload.unloaders;
if (unloaders == null){
if (unloaders == null) {
unloaders = unload.unloaders = [];
}
// Calling with no arguments runs all the unloader callbacks
Expand Down Expand Up @@ -139,7 +139,7 @@ function watchWindows(callback) {
if (window.document.readyState === 'complete'){
watcher(window);
// Wait for the window to load before continuing
}else {
} else {
runOnLoad(window);
}
}
Expand Down Expand Up @@ -211,8 +211,6 @@ function sendPing() {
});
payload = newPayload();
// Send metrics to the main Test Pilot add-on.
// let console = (Components.utils.import('resource://gre/modules/devtools/Console.jsm', {})).console;
// console.log('Sending ping', ping);
observerService.notifyObservers(subject, 'testpilot::send-metric', ping);
// Clear out the metrics for next time…
}
Loading

0 comments on commit baf97fe

Please sign in to comment.