diff --git a/src/LiveDevelopment/Agents/RemoteAgent.js b/src/LiveDevelopment/Agents/RemoteAgent.js index dbfe78511d7..fb03c24beff 100644 --- a/src/LiveDevelopment/Agents/RemoteAgent.js +++ b/src/LiveDevelopment/Agents/RemoteAgent.js @@ -91,7 +91,7 @@ define(function RemoteAgent(require, exports, module) { args[i] = args[i].resolve(); } } - $.when.apply(undefined, args).then(function onResolvedAllNodes() { + $.when.apply(undefined, args).done(function onResolvedAllNodes() { var i, arg, params = []; for (i in arguments) { arg = args[i]; @@ -131,4 +131,4 @@ define(function RemoteAgent(require, exports, module) { exports.call = call; exports.load = load; exports.unload = unload; -}); \ No newline at end of file +}); diff --git a/src/LiveDevelopment/LiveDevelopment.js b/src/LiveDevelopment/LiveDevelopment.js index f11d3654ac2..ca1b883a76f 100644 --- a/src/LiveDevelopment/LiveDevelopment.js +++ b/src/LiveDevelopment/LiveDevelopment.js @@ -434,7 +434,7 @@ define(function LiveDevelopment(require, exports, module) { // Load agents _setStatus(STATUS_LOADING_AGENTS); var promises = loadAgents(); - $.when.apply(undefined, promises).then(_onLoad, _onError); + $.when.apply(undefined, promises).done(_onLoad).fail(_onError); // Load the right document (some agents are waiting for the page's load event) var doc = _getCurrentDocument(); @@ -457,7 +457,7 @@ define(function LiveDevelopment(require, exports, module) { unloadAgents(); var promises = loadAgents(); _setStatus(STATUS_LOADING_AGENTS); - $.when.apply(undefined, promises).then(_onLoad, _onError); + $.when.apply(undefined, promises).done(_onLoad).fail(_onError); } /** Open the Connection and go live */ @@ -512,7 +512,7 @@ define(function LiveDevelopment(require, exports, module) { var url = doc.root.url; _setStatus(STATUS_CONNECTING); - Inspector.connectToURL(url).then(result.resolve, function onConnectFail(err) { + Inspector.connectToURL(url).done(result.resolve).fail(function onConnectFail(err) { if (err === "CANCEL") { result.reject(err); return; @@ -531,7 +531,7 @@ define(function LiveDevelopment(require, exports, module) { .done(function () { browserStarted = false; window.setTimeout(function () { - open().then(result.resolve, result.reject); + open().done(result.resolve).fail(result.reject); }); }) .fail(function (err) { @@ -591,7 +591,7 @@ define(function LiveDevelopment(require, exports, module) { if (exports.status !== STATUS_ERROR) { window.setTimeout(function retryConnect() { - Inspector.connectToURL(url).then(result.resolve, onConnectFail); + Inspector.connectToURL(url).done(result.resolve).fail(onConnectFail); }, 500); } }); diff --git a/src/editor/Editor.js b/src/editor/Editor.js index 300daf7ca1e..243acd50c43 100644 --- a/src/editor/Editor.js +++ b/src/editor/Editor.js @@ -271,12 +271,10 @@ define(function (require, exports, module) { * @param {!string} mode Syntax-highlighting language mode; "" means plain-text mode. * See {@link EditorUtils#getModeFromFileExtension()}. * @param {!jQueryObject} container Container to add the editor to. - * @param {!Object} additionalKeys Mapping of keyboard shortcuts to - * custom handler functions. Mapping is in CodeMirror format * @param {{startLine: number, endLine: number}=} range If specified, range of lines within the document * to display in this editor. Inclusive. */ - function Editor(document, makeMasterEditor, mode, container, additionalKeys, range) { + function Editor(document, makeMasterEditor, mode, container, range) { var self = this; _instances.push(this); @@ -332,8 +330,6 @@ define(function (require, exports, module) { "'/'": function (cm) { cm.closeTag(cm, '/'); } }; - EditorManager.mergeExtraKeys(self, codeMirrorKeyMap, additionalKeys); - // We'd like null/"" to mean plain text mode. CodeMirror defaults to plaintext for any // unrecognized mode, but it complains on the console in that fallback case: so, convert // here so we're always explicit, avoiding console noise. diff --git a/src/editor/EditorManager.js b/src/editor/EditorManager.js index b59c6023996..c33f353f5af 100644 --- a/src/editor/EditorManager.js +++ b/src/editor/EditorManager.js @@ -97,30 +97,6 @@ define(function (require, exports, module) { $indentWidthLabel, $indentWidthInput; - /** - * Adds keyboard command handlers to an Editor instance. - * @param {Editor} editor - * @param {!Object.} to destination key mapping - * @param {!Object.} from source key mapping - */ - function mergeExtraKeys(editor, to, from) { - // Merge in the additionalKeys we were passed - function wrapEventHandler(externalHandler) { - return function (instance) { - externalHandler(editor); - }; - } - var key; - for (key in from) { - if (from.hasOwnProperty(key)) { - if (to.hasOwnProperty(key)) { - console.log("Warning: overwriting standard Editor shortcut " + key); - } - to[key] = (editor !== null) ? wrapEventHandler(from[key]) : from[key]; - } - } - } - /** * Creates a new Editor bound to the given Document. The editor's mode is inferred based on the * file extension. The editor is appended to the given container as a visible child. @@ -132,10 +108,10 @@ define(function (require, exports, module) { * to display in this editor. Inclusive. * @return {Editor} the newly created editor. */ - function _createEditorForDocument(doc, makeMasterEditor, container, range, additionalKeys) { + function _createEditorForDocument(doc, makeMasterEditor, container, range) { var mode = EditorUtils.getModeFromFileExtension(doc.file.fullPath); - return new Editor(doc, makeMasterEditor, mode, container, additionalKeys, range); + return new Editor(doc, makeMasterEditor, mode, container, range); } /** @@ -275,9 +251,9 @@ define(function (require, exports, module) { * * @return {{content:DOMElement, editor:Editor}} */ - function createInlineEditorForDocument(doc, range, inlineContent, additionalKeys) { + function createInlineEditorForDocument(doc, range, inlineContent) { // Create the Editor - var inlineEditor = _createEditorForDocument(doc, false, inlineContent, range, additionalKeys); + var inlineEditor = _createEditorForDocument(doc, false, inlineContent, range); return { content: inlineContent, editor: inlineEditor }; } @@ -812,5 +788,4 @@ define(function (require, exports, module) { exports.registerInlineEditProvider = registerInlineEditProvider; exports.getInlineEditors = getInlineEditors; exports.closeInlineWidget = closeInlineWidget; - exports.mergeExtraKeys = mergeExtraKeys; }); diff --git a/src/editor/InlineTextEditor.js b/src/editor/InlineTextEditor.js index c4684507dd5..6bf1e107096 100644 --- a/src/editor/InlineTextEditor.js +++ b/src/editor/InlineTextEditor.js @@ -207,7 +207,7 @@ define(function (require, exports, module) { * @param {number} endLine of text to show in inline editor * @param {HTMLDivElement} container container to hold the inline editor */ - InlineTextEditor.prototype.createInlineEditorFromText = function (doc, startLine, endLine, container, additionalKeys) { + InlineTextEditor.prototype.createInlineEditorFromText = function (doc, startLine, endLine, container) { var self = this; var range = { @@ -250,7 +250,7 @@ define(function (require, exports, module) { // Create actual Editor instance - var inlineInfo = EditorManager.createInlineEditorForDocument(doc, range, wrapperDiv, additionalKeys); + var inlineInfo = EditorManager.createInlineEditorForDocument(doc, range, wrapperDiv); this.editors.push(inlineInfo.editor); container.appendChild(wrapperDiv); diff --git a/src/extensions/default/HTMLCodeHints/unittests.js b/src/extensions/default/HTMLCodeHints/unittests.js index bf68e54581b..176dffe71ab 100644 --- a/src/extensions/default/HTMLCodeHints/unittests.js +++ b/src/extensions/default/HTMLCodeHints/unittests.js @@ -58,7 +58,7 @@ define(function (require, exports, module) { // create Editor instance (containing a CodeMirror instance) $("body").append("
"); - testEditor = new Editor(testDocument, true, "htmlmixed", $("#editor").get(0), {}); + testEditor = new Editor(testDocument, true, "htmlmixed", $("#editor").get(0)); }); afterEach(function () { @@ -640,4 +640,4 @@ define(function (require, exports, module) { }); // describe("HTML Attribute Hinting" -}); \ No newline at end of file +}); diff --git a/src/file/NativeFileSystem.js b/src/file/NativeFileSystem.js index f5fb3147e91..87032917af8 100644 --- a/src/file/NativeFileSystem.js +++ b/src/file/NativeFileSystem.js @@ -991,8 +991,7 @@ define(function (require, exports, module) { var timeoutWrapper = Async.withTimeout(masterPromise, NativeFileSystem.ASYNC_TIMEOUT); // Add the callbacks to this top-level Promise, which wraps all the individual deferred objects - timeoutWrapper.then( - function () { // success + timeoutWrapper.done(function () { // success // The entries array may have null values if stat returned things that were // neither a file nor a dir. So, we need to clean those out. var cleanedEntries = [], i; @@ -1002,8 +1001,8 @@ define(function (require, exports, module) { } } successCallback(cleanedEntries); - }, - function (err) { // error + }) + .fail(function (err) { // error if (err === Async.ERROR_TIMEOUT) { // SECURITY_ERR is the HTML5 File catch-all error, and there isn't anything // more fitting for a timeout. diff --git a/test/spec/CodeHintUtils-test.js b/test/spec/CodeHintUtils-test.js index 9a03d9142b7..0e71680c6c1 100644 --- a/test/spec/CodeHintUtils-test.js +++ b/test/spec/CodeHintUtils-test.js @@ -43,7 +43,7 @@ define(function (require, exports, module) { // init Editor instance (containing a CodeMirror instance) $("body").append("
"); myDocument = SpecRunnerUtils.createMockDocument(""); - myEditor = new Editor(myDocument, true, "", $("#editor").get(0), {}); + myEditor = new Editor(myDocument, true, "", $("#editor").get(0)); }); afterEach(function () { diff --git a/test/spec/SpecRunnerUtils.js b/test/spec/SpecRunnerUtils.js index bdc0075280a..a49f412d4a9 100644 --- a/test/spec/SpecRunnerUtils.js +++ b/test/spec/SpecRunnerUtils.js @@ -189,7 +189,7 @@ define(function (require, exports, module) { var doc = createMockDocument(initialContent); // create Editor instance - var editor = new Editor(doc, true, mode, $editorHolder.get(0), {}, visibleRange); + var editor = new Editor(doc, true, mode, $editorHolder.get(0), visibleRange); return { doc: doc, editor: editor }; }