Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/master' into chris/issue-53
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbank committed Feb 9, 2012
2 parents 03d1450 + c686963 commit 46df044
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/CommandManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ define(function (require, exports, module) {
var command = _commands[id];
if (command) {
var result = command.apply(null, Array.prototype.slice.call(arguments, 1));
if (result === undefined) {
if (!result) {
return (new $.Deferred()).resolve();
} else {
return result;
Expand Down
12 changes: 6 additions & 6 deletions src/DocumentManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ define(function (require, exports, module) {
if (!(this instanceof Document)) { // error if constructor called without 'new'
throw new Error("Document constructor must be called with 'new'");
}
if (getDocumentForFile(file) !== null) {
if (getDocumentForFile(file)) {
throw new Error("Creating a document + editor when one already exists, for: " + file);
}

Expand Down Expand Up @@ -415,7 +415,7 @@ define(function (require, exports, module) {
*/
Document.prototype._setEditor = function (editor, initialTimestamp) {
// Editor can only be assigned once per Document
console.assert(this._editor === null);
console.assert(!this._editor);

this._editor = editor;
this.diskTimestamp = initialTimestamp;
Expand Down Expand Up @@ -487,7 +487,7 @@ define(function (require, exports, module) {

/** Marks the document not dirty. Should be called after the document is saved to disk. */
Document.prototype._markClean = function () {
if (this._editor === null) {
if (!this._editor) {
return;
}

Expand Down Expand Up @@ -530,7 +530,7 @@ define(function (require, exports, module) {
function _init() {
var prefs = PreferencesManager.getPreferences(PREFERENCES_CLIENT_ID);

if (prefs.files === undefined) {
if (!prefs.files) {
return;
}

Expand Down Expand Up @@ -594,11 +594,11 @@ define(function (require, exports, module) {
});

// Initialize the active editor
if (activeDoc === null && _workingSet.length > 0) {
if (!activeDoc && _workingSet.length > 0) {
activeDoc = _workingSet[0];
}

if (activeDoc !== null) {
if (activeDoc) {
CommandManager.execute(Commands.FILE_OPEN, { fullPath: activeDoc.file.fullPath });
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/FileCommandHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ define(function (require, exports, module) {
function _handleWindowGoingAway(commandData, postCloseHandler) {
if (_windowGoingAway) {
//if we get called back while we're closing, then just return
return (new $.Deferred()).resolved();
return (new $.Deferred()).resolve();
}

//prevent the default action of closing the window until we can save all the files
Expand Down
2 changes: 1 addition & 1 deletion src/FileViewController.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ define(function (require, exports, module) {
// The the cause of the doc change was not openAndSelectDocument, so pick the best fileSelectionFocus
if (!_curDocChangedDueToMe) {
var curDoc = DocumentManager.getCurrentDocument();
if (curDoc !== null && DocumentManager.findInWorkingSet(curDoc.file.fullPath) !== -1) {
if (curDoc && DocumentManager.findInWorkingSet(curDoc.file.fullPath) !== -1) {
_fileSelectionFocus = WORKING_SET_VIEW;
} else {
_fileSelectionFocus = PROJECT_MANAGER;
Expand Down
7 changes: 4 additions & 3 deletions src/NativeFileSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ define(function (require, exports, module) {

// TODO (jasonsj): handle Blob data instead of string
FileWriter.prototype.write = function (data) {
if (data === undefined) {
if (!data) {
throw new Error();
}

Expand Down Expand Up @@ -442,8 +442,9 @@ define(function (require, exports, module) {
NativeFileSystem.DirectoryEntry.prototype.getFile = function (path, options, successCallback, errorCallback) {
var fileFullPath = path;

// assume relative paths are relative to this directory
if (path.charAt(0) !== '/') {
// resolve relative paths relative to the DirectoryEntry
// most absolute paths have a leading slash except Windows which has a drive letter followed by :/
if (path.charAt(0) !== '/' && path.charAt(1) !== ":") {
fileFullPath = this.fullPath + "/" + path;
}

Expand Down
2 changes: 1 addition & 1 deletion src/ProjectManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ define(function (require, exports, module) {

$(FileViewController).on("documentSelectionFocusChange", function (event) {
var curDoc = DocumentManager.getCurrentDocument();
if ((curDoc !== null)
if (curDoc
&& (FileViewController.getFileSelectionFocus() !== FileViewController.WORKING_SET_VIEW)) {
$("#project-files-container li").is(function (index) {
var entry = $(this).data("entry");
Expand Down
2 changes: 1 addition & 1 deletion src/brackets.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ define(function (require, exports, module) {
}
}

if (testWindow === null) {
if (!testWindow) {
testWindow = window.open("../test/SpecRunner.html");
testWindow.location.reload(); // if it was opened before, we need to reload because it will be cached
}
Expand Down

0 comments on commit 46df044

Please sign in to comment.