[Pkg-mozext-commits] [firebug] 46/59: Undo adding the loadmode addon.
David Prévot
taffit at moszumanska.debian.org
Thu Aug 14 14:52:57 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository firebug.
commit 9a612a1b5c1eb8c5d4de2d4bce03dae290b9c739
Author: Farshid Beheshti <farshid.beheshti at gmail.com>
Date: Sat Aug 9 17:57:43 2014 +0430
Undo adding the loadmode addon.
---
.../editor/codemirror/addon/mode/loadmode.js | 61 ----------------------
extension/content/firebug/editor/sourceEditor.js | 32 +++---------
2 files changed, 6 insertions(+), 87 deletions(-)
diff --git a/extension/content/firebug/editor/codemirror/addon/mode/loadmode.js b/extension/content/firebug/editor/codemirror/addon/mode/loadmode.js
deleted file mode 100644
index 65e51bf..0000000
--- a/extension/content/firebug/editor/codemirror/addon/mode/loadmode.js
+++ /dev/null
@@ -1,61 +0,0 @@
-// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
-
-(function (mod) {
- if (typeof exports == "object" && typeof module == "object") // CommonJS
- mod(require("../../lib/codemirror"));
- else if (typeof define == "function" && define.amd) // AMD
- define(["../../lib/codemirror"], mod);
- else // Plain browser env
- mod(CodeMirror);
-})(function (CodeMirror) {
- if (!CodeMirror.modeURL) CodeMirror.modeURL = "../mode/%N/%N.js";
-
- var loading = {};
- function splitCallback(cont, n) {
- var countDown = n;
- return function () { if (--countDown == 0) cont(); };
- }
- function ensureDeps(mode, cont) {
- var deps = CodeMirror.modes[mode].dependencies;
- if (!deps) return cont();
- var missing = [];
- for (var i = 0; i < deps.length; ++i) {
- if (!CodeMirror.modes.hasOwnProperty(deps[i]))
- missing.push(deps[i]);
- }
- if (!missing.length) return cont();
- var split = splitCallback(cont, missing.length);
- for (var i = 0; i < missing.length; ++i)
- CodeMirror.requireMode(missing[i], split);
- }
-
- CodeMirror.requireMode = function (mode, cont) {
- if (typeof mode != "string") mode = mode.name;
- if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont);
- if (loading.hasOwnProperty(mode)) return loading[mode].push(cont);
-
- var script = document.createElement("script");
- script.src = CodeMirror.modeURL.replace(/%N/g, mode);
- var others = document.getElementsByTagName("script")[0];
- others.parentNode.insertBefore(script, others);
- var list = loading[mode] = [cont];
- var count = 0, poll = setInterval(function () {
- if (++count > 100) return clearInterval(poll);
- if (CodeMirror.modes.hasOwnProperty(mode)) {
- clearInterval(poll);
- loading[mode] = null;
- ensureDeps(mode, function () {
- for (var i = 0; i < list.length; ++i) list[i]();
- });
- }
- }, 200);
- };
-
- CodeMirror.autoLoadMode = function (instance, mode) {
- if (!CodeMirror.modes.hasOwnProperty(mode))
- CodeMirror.requireMode(mode, function () {
- instance.setOption("mode", instance.getOption("mode"));
- });
- };
-});
diff --git a/extension/content/firebug/editor/sourceEditor.js b/extension/content/firebug/editor/sourceEditor.js
index c456375..96d90a9 100644
--- a/extension/content/firebug/editor/sourceEditor.js
+++ b/extension/content/firebug/editor/sourceEditor.js
@@ -31,7 +31,6 @@ var Cu = Components.utils;
var codeMirrorSrc = "chrome://firebug/content/editor/codemirror/codemirror.js";
var showHintSrc = "chrome://firebug/content/editor/codemirror/addon/show-hint.js";
var searchCursorSrc = "chrome://firebug/content/editor/codemirror/addon/search/searchcursor.js";
-var loadmodeSrc = "chrome://firebug/content/editor/codemirror/addon/mode/loadmode.js";
var jsModeSrc = "chrome://firebug/content/editor/codemirror/mode/javascript.js";
var htmlMixedModeSrc = "chrome://firebug/content/editor/codemirror/mode/htmlmixed.js";
var xmlModeSrc = "chrome://firebug/content/editor/codemirror/mode/xml.js";
@@ -271,16 +270,11 @@ SourceEditor.prototype =
loader.addScript(doc, "cm", codeMirrorSrc);
loader.addScript(doc, "cm-showhint", showHintSrc);
loader.addScript(doc, "cm-searchcursor", searchCursorSrc);
- loader.addScript(doc, "cm-loadmode", loadmodeSrc);
-
- // As the modes load asynchronously on the demand(see setText()),
- // they don't need to load at the start-up.
- /*
loader.addScript(doc, "cm-js", jsModeSrc);
loader.addScript(doc, "cm-xml", xmlModeSrc);
loader.addScript(doc, "cm-css", cssModeSrc);
loader.addScript(doc, "cm-htmlmixed", htmlMixedModeSrc);
- */
+
if (loader == this)
callback();
},
@@ -427,37 +421,23 @@ SourceEditor.prototype =
// xxxHonza: the default 'mixedmode' mode should be set only if the text
// is actually a markup (first letter == '<'?). Note that applying mixed mode
// on plain JS doesn't work (no color syntax at all).
- var mode = {name: "htmlmixed", src: htmlMixedModeSrc };
+ var mode = "htmlmixed";
switch (type)
{
case "js":
- mode.name = "javascript";
- mode.src = jsModeSrc;
+ mode = "javascript";
break;
case "css":
- mode.name = "css";
- mode.src = cssModeSrc;
+ mode = "css";
break;
case "xml":
- mode.name = "xml";
- mode.src = xmlModeSrc;
+ mode = "xml";
break;
}
+ this.editorObject.setOption("mode", mode);
text = text || "";
this.editorObject.setValue(text);
-
- // set |modeURL| to show CM the path where
- // the mode can be loaded from.
- var cmSingleton = this.getCodeMirrorSingleton();
- cmSingleton.modeURL = mode.src;
-
- // Although it doesn't works just now, because of lien #40 in
- // codemirror/addon/mode/loadmode.js(|others| value is undefind),
- // I didn't spend more time to write my own method(see the comment
- // in the onModeLoaded()).
- cmSingleton.requireMode(mode.name,
- this.onModeLoaded.bind(this, mode.name));
},
onModeLoaded: function(modeName) {
// @reviewer(s): The performance penalty is here. The time taken to
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firebug.git
More information about the Pkg-mozext-commits
mailing list