diff --git a/browser/devtools/commandline/gcli.jsm b/browser/devtools/commandline/gcli.jsm
index 28388103323..c3128027df6 100644
--- a/browser/devtools/commandline/gcli.jsm
+++ b/browser/devtools/commandline/gcli.jsm
@@ -3038,13 +3038,23 @@ function hash(str) {
return hash;
}
for (var i = 0; i < str.length; i++) {
- var char = str.charCodeAt(i);
- hash = ((hash << 5) - hash) + char;
+ var character = str.charCodeAt(i);
+ hash = ((hash << 5) - hash) + character;
hash = hash & hash; // Convert to 32bit integer
}
return hash;
}
+/**
+ * Shortcut for clearElement/createTextNode/appendChild to make up for the lack
+ * of standards around textContent/innerText
+ */
+exports.setTextContent = function(elem, text) {
+ exports.clearElement(elem);
+ var child = elem.ownerDocument.createTextNode(text);
+ elem.appendChild(child);
+};
+
/**
* There are problems with innerHTML on XML documents, so we need to do a dance
* using document.createRange().createContextualFragment() when in XML mode
@@ -5411,7 +5421,7 @@ function UnassignedAssignment(requisition, arg) {
name: 'param',
requisition: requisition,
isIncompleteName: (arg.text.charAt(0) === '-')
- },
+ }
});
this.paramIndex = -1;
this.onAssignmentChange = util.createEvent('UnassignedAssignment.onAssignmentChange');
@@ -5905,7 +5915,7 @@ Requisition.prototype.toCanonicalString = function() {
* to display this typed input. It's a bit like toString on steroids.
*
@@ -7681,7 +7690,7 @@ ArrayField.prototype._onAdd = function(ev, subConversion) {
var delButton = util.createElement(this.document, 'button');
delButton.classList.add('gcli-array-member-del');
delButton.addEventListener('click', this._onDel, false);
- delButton.innerHTML = l10n.lookup('fieldArrayDel');
+ delButton.textContent = l10n.lookup('fieldArrayDel');
element.appendChild(delButton);
var member = {
@@ -7795,10 +7804,7 @@ Field.prototype.setMessageElement = function(element) {
*/
Field.prototype.setMessage = function(message) {
if (this.messageElement) {
- if (message == null) {
- message = '';
- }
- util.setContents(this.messageElement, message);
+ util.setTextContent(this.messageElement, message || '');
}
};
@@ -8458,7 +8464,7 @@ SelectionField.prototype._addOption = function(item) {
this.items.push(item);
var option = util.createElement(this.document, 'option');
- option.innerHTML = item.name;
+ option.textContent = item.name;
option.value = item.index;
this.element.appendChild(option);
};
@@ -8599,7 +8605,7 @@ var helpCommandSpec = {
name: 'search',
type: 'string',
description: l10n.lookup('helpSearchDesc'),
- manual: l10n.lookup('helpSearchManual2'),
+ manual: l10n.lookup('helpSearchManual3'),
defaultValue: null
}
],
@@ -8684,7 +8690,7 @@ function getListTemplateData(args, context) {
ondblclick: function(ev) {
util.executeCommand(ev.currentTarget, context);
- },
+ }
};
}
@@ -8704,11 +8710,8 @@ function getManTemplateData(command, context) {
util.executeCommand(ev.currentTarget, context);
},
- describe: function(item, element) {
- var text = item.manual || item.description;
- var parent = element.ownerDocument.createElement('div');
- util.setContents(parent, text);
- return parent.childNodes;
+ describe: function(item) {
+ return item.manual || item.description;
},
getTypeDescription: function(param) {
@@ -8760,7 +8763,7 @@ define("text!gcli/commands/help_man.html", [], "\n" +
"\n" +
" \n" +
"\n" +
- "
${describe(command, __element)}
\n" +
+ "
${describe(command)}
\n" +
"\n" +
"
\n" +
" \n" +
@@ -8770,7 +8773,7 @@ define("text!gcli/commands/help_man.html", [], "\n" +
"
\n" +
" ${param.name} ${getTypeDescription(param)}\n" +
"
\n" +
- " ${describe(param, __element)}\n" +
+ " ${describe(param)}\n" +
" \n" +
" \n" +
" \n" +
@@ -8909,7 +8912,7 @@ var prefSetCmdSpec = {
activate: function() {
context.exec('pref set ' + exports.allowSet.name + ' true');
}
- },
+ }
});
}
args.setting.value = args.value;
@@ -10380,7 +10383,7 @@ Tooltip.prototype.assignmentContentsChanged = function(ev) {
}
this.field.setConversion(ev.conversion);
- util.setContents(this.descriptionEle, this.description);
+ util.setTextContent(this.descriptionEle, this.description);
this._updatePosition();
};
@@ -10434,19 +10437,7 @@ Object.defineProperty(Tooltip.prototype, 'description', {
return '';
}
- var output = this.assignment.param.manual;
- if (output) {
- var wrapper = this.document.createElement('span');
- util.setContents(wrapper, output);
- if (!this.assignment.param.isDataRequired) {
- var optional = this.document.createElement('span');
- optional.appendChild(this.document.createTextNode(' (Optional)'));
- wrapper.appendChild(optional);
- }
- return wrapper;
- }
-
- return this.assignment.param.description;
+ return this.assignment.param.manual || this.assignment.param.description;
},
enumerable: true
});
diff --git a/browser/locales/en-US/chrome/browser/devtools/gcli.properties b/browser/locales/en-US/chrome/browser/devtools/gcli.properties
index ff21415b1b1..c6fd0da612f 100644
--- a/browser/locales/en-US/chrome/browser/devtools/gcli.properties
+++ b/browser/locales/en-US/chrome/browser/devtools/gcli.properties
@@ -123,16 +123,15 @@ helpDesc=Get help on the available commands
helpManual=Provide help either on a specific command (if a search string is provided and an exact match is found) or on the available commands (if a search string is not provided, or if no exact match is found).
# LOCALIZATION NOTE (helpSearchDesc): A very short description of the 'search'
-# parameter to the 'help' command. See helpSearchManual2 for a fuller
+# parameter to the 'help' command. See helpSearchManual3 for a fuller
# description of what it does. This string is designed to be shown in a dialog
# with restricted space, which is why it should be as short as possible.
helpSearchDesc=Search string
-# LOCALIZATION NOTE (helpSearchManual2): A fuller description of the 'search'
+# LOCALIZATION NOTE (helpSearchManual3): A fuller description of the 'search'
# parameter to the 'help' command. Displayed when the user asks for help on
-# what it does. Inline HTML (e.g.
) can be used to emphasize the core
-# concept.
-helpSearchManual2=search string to use in narrowing down the displayed commands. Regular expressions not supported.
+# what it does.
+helpSearchManual3=search string to use in narrowing down the displayed commands. Regular expressions not supported.
# LOCALIZATION NOTE (helpManSynopsis): A heading shown at the top of a help
# page for a command in the console It labels a summary of the parameters to