Permalink
Browse files

Do not use for-each, uglifyjs parser doesn't understand JS 1.8

  • Loading branch information...
1 parent 4aa5f04 commit 07886e91c7186ed3e6f42088d48fd84555e88c5e @janodvarko janodvarko committed Mar 31, 2012
@@ -46,8 +46,11 @@ Firebug.ShortcutsModel = Obj.extend(Firebug.Module,
keyset.parentNode.insertBefore(keyset, keyset.nextSibling);
});
- for each(var elem in this.disabledKeyElements)
+ for (var i=0; i<this.disabledKeyElements.length; i++)
+ {
+ var elem = this.disabledKeyElements[i];
elem.removeAttribute("disabled");
+ }
this.keysets = this.disabledKeyElements = null;
},
@@ -295,8 +295,11 @@ var gUrlMappingManager = {
"\n"
];
- for each (var transform in this.pathTransformations)
+ for (var i = 0; i < this.pathTransformations.length; i++)
+ {
+ var transform = this.pathTransformations[i];
val.push(transform.regexp.source, splitter, transform.filePath, '\n');
+ }
val.push(splitter, "\n")
@@ -379,32 +382,39 @@ var gUrlMappingManager = {
if (!this.checkHeaderRe)
this.checkHeaderRe = /^$/
},
+
onTestInput: function()
{
var testBox = document.getElementById("test");
var resultBox = document.getElementById("result");
var href = testBox.value;
+
if (this.checkHeaderRe.test(href))
{
resultBox.value = "firebug will send query to server";
}
else
{
- for each (var transform in this.pathTransformations)
+ for (var i = 0; i < this.pathTransformations.length; i++)
{
+ var transform = this.pathTransformations[i];
if (transform.regexp.test(href))
{
var path = href.replace(transform.regexp, transform.filePath);
break;
}
}
- if (path) {
+
+ if (path)
+ {
resultBox.style.cssText = "box-shadow: 0px 0px 1.5px 1px lime;";
href = path;
}
+
resultBox.value = href.replace(/([^:\\\/])[\\\/]+/g, '$1/');
}
},
+
onMainInput: function()
{
this.parse(document.getElementById("urlMappings").value);
@@ -143,9 +143,12 @@ Firebug.ExternalEditors = Obj.extend(Firebug.Module,
return this.getDefaultEditor();
var list = Arr.extendArray(externalEditors, editors);
- for each(var editor in list)
+ for (var i=0; i<list.length; i++)
+ {
+ var editor = list[i];
if (editor.id == id)
return editor;
+ }
},
count: function()
@@ -390,15 +393,18 @@ Firebug.ExternalEditors = Obj.extend(Firebug.Module,
{
var lastI = 0, args = [], argIndex = 0, inGroup;
var subs = "col|line|file|url".split("|");
+
// do not send argument with bogus line number
function checkGroup()
{
var group = args.slice(argIndex), isValid = null;
- for each(var i in subs)
+ for (var i=0; i<subs.length; i++)
{
- if (group.indexOf("%"+i) == -1)
+ var sub = subs[i];
+ if (group.indexOf("%" + sub) == -1)
continue;
- if (options[i] == undefined)
+
+ if (options[sub] == undefined)
{
isValid = false;
}
@@ -408,8 +414,10 @@ Firebug.ExternalEditors = Obj.extend(Firebug.Module,
break;
}
}
+
if (isValid == false)
args = args.slice(0, argIndex);
+
argIndex = args.length;
}
@@ -456,8 +464,9 @@ Firebug.ExternalEditors = Obj.extend(Firebug.Module,
transformHref: function(href)
{
- for each (var transform in this.pathTransformations)
+ for (var i=0; i<this.pathTransformations.length; i++)
{
+ var transform = this.pathTransformations[i];
if (transform.regexp.test(href))
{
var path = href.replace(transform.regexp, transform.filePath);
@@ -632,8 +641,12 @@ Firebug.ExternalEditors.saveUrlMappings = function()
var text = [
"X-Local-File-Path", sp, this.checkHeaderRe.source, "\n\n"
];
- for each (var t in this.pathTransformations)
+
+ for (var i = 0; i < this.pathTransformations.length; i++)
+ {
+ var t = this.pathTransformations[i];
text.push(t.regexp, sp, t.filePath, "\n");
+ }
var file = userFile("urlMappings.txt");
writeToFile(file, text.join(""));
@@ -1691,26 +1691,31 @@ var highlighterCache =
}
};
- var clearBoxModelCache = function(arr) {
- var i, lineName, name, node, highlighter;
-
- for(i = arr.length - 1; i >= 0; i--)
+ var clearBoxModelCache = function(arr)
+ {
+ var node;
+ for (var i = arr.length - 1; i >= 0; i--)
{
- for each (name in ["lines", "offset", "parent"])
+ var names = ["lines", "offset", "parent"];
+ for (var j=0; j<names.length; j++)
{
- if(name === "lines")
+ var name = names[j];
+ if (name === "lines")
{
- for each (lineName in ["bottom", "left", "top", "right"])
+ var lineNames = ["bottom", "left", "top", "right"];
+ for (var k=0; k<lineNames.length; k++)
{
+ var lineName = lineNames[k];
node = arr[i].lines[lineName];
- if(node && node.parentNode)
+
+ if (node && node.parentNode)
node.parentNode.removeChild(node);
}
}
else
{
node = arr[i][name];
- if(node && node.parentNode)
+ if (node && node.parentNode)
node.parentNode.removeChild(node);
}
}
@@ -1720,6 +1725,7 @@ var highlighterCache =
clearBoxModelCache(this.highlighters.boxModelArr);
clearCache(this.highlighters.frameArr);
clearCache(this.highlighters.proxyEltArr);
+
this.highlighters.boxModelArr=[];
this.highlighters.frameArr=[];
this.highlighters.proxyEltArr=[];

0 comments on commit 07886e9

Please sign in to comment.