this.container = dom.createElement(this.document, 'div');
- this.container.className = 'gcliArrayMbrs';
+ this.container.classList.add('gcli-array-members');
this.element.appendChild(this.container);
this.onInputChange = this.onInputChange.bind(this);
@@ -6734,7 +7082,7 @@ ArrayField.prototype.getConversion = function() {
ArrayField.prototype._onAdd = function(ev, subConversion) {
//
var element = dom.createElement(this.document, 'div');
- element.className = 'gcliArrayMbr';
+ element.classList.add('gcli-array-member');
this.container.appendChild(element);
// ${field.element}
@@ -6752,7 +7100,7 @@ ArrayField.prototype._onAdd = function(ev, subConversion) {
//
var delButton = dom.createElement(this.document, 'button');
- delButton.className = 'gcliArrayMbrDel';
+ delButton.classList.add('gcli-array-member-del');
delButton.addEventListener('click', this._onDel, false);
delButton.innerHTML = l10n.lookup('fieldArrayDel');
element.appendChild(delButton);
@@ -6794,7 +7142,7 @@ var Conversion = require('gcli/types').Conversion;
var Argument = require('gcli/argument').Argument;
var canon = require('gcli/canon');
-var Templater = require('gcli/ui/domtemplate').Templater;
+var domtemplate = require('gcli/ui/domtemplate');
var menuCss = require('text!gcli/ui/menu.css');
var menuHtml = require('text!gcli/ui/menu.html');
@@ -6877,7 +7225,7 @@ Menu.prototype.show = function(items, error) {
}
var options = this.optTempl.cloneNode(true);
- new Templater().processNode(options, this);
+ domtemplate.template(options, this, { allowEval: true, stack: 'menu.html' });
dom.clearElement(this.element);
this.element.appendChild(options);
@@ -6984,18 +7332,6 @@ CommandMenu.prototype.onCommandChange = function(ev) {
exports.CommandMenu = CommandMenu;
-});
-/*
- * Copyright 2009-2011 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE.txt or:
- * http://opensource.org/licenses/BSD-3-Clause
- */
-
-define('gcli/ui/domtemplate', ['require', 'exports', 'module' ], function(require, exports, module) {
-
- Components.utils.import("resource:///modules/devtools/Templater.jsm");
- exports.Templater = Templater;
-
});
define("text!gcli/ui/menu.css", [], void 0);
define("text!gcli/ui/menu.html", [], "\n" +
diff --git a/browser/devtools/webconsole/test/browser/browser_gcli_integrate.js b/browser/devtools/webconsole/test/browser/browser_gcli_integrate.js
index a806a8ca09c..1fb37630c54 100644
--- a/browser/devtools/webconsole/test/browser/browser_gcli_integrate.js
+++ b/browser/devtools/webconsole/test/browser/browser_gcli_integrate.js
@@ -83,12 +83,12 @@ function testCallCommands() {
is(gcliterm.completeNode.textContent, " ecd", "Completion for \"ecd\"");
// Test a normal command's life cycle
- gcliterm.opts.display.inputter.setInput("echo hello world");
+ gcliterm.opts.console.inputter.setInput("echo hello world");
gcliterm.opts.requisition.exec();
- let nodes = hud.outputNode.querySelectorAll("description");
+ let nodes = hud.outputNode.querySelectorAll(".gcliterm-msg-body");
- is(nodes.length, 2, "Right number of output nodes");
+ is(nodes.length, 1, "Right number of output nodes");
ok(/hello world/.test(nodes[0].textContent), "the command's output is correct.");
gcliterm.clearOutput();
diff --git a/browser/devtools/webconsole/test/browser/browser_gcli_web.js b/browser/devtools/webconsole/test/browser/browser_gcli_web.js
index ce5fd9ca3c1..06500ddcb06 100644
--- a/browser/devtools/webconsole/test/browser/browser_gcli_web.js
+++ b/browser/devtools/webconsole/test/browser/browser_gcli_web.js
@@ -54,7 +54,7 @@ var Node = Components.interfaces.nsIDOMNode;
* http://opensource.org/licenses/BSD-3-Clause
*/
-define('gclitest/suite', ['require', 'exports', 'module' , 'gcli/index', 'test/examiner', 'gclitest/testTokenize', 'gclitest/testSplit', 'gclitest/testCli', 'gclitest/testHistory', 'gclitest/testRequire', 'gclitest/testJs'], function(require, exports, module) {
+define('gclitest/suite', ['require', 'exports', 'module' , 'gcli/index', 'test/examiner', 'gclitest/testTokenize', 'gclitest/testSplit', 'gclitest/testCli', 'gclitest/testExec', 'gclitest/testKeyboard', 'gclitest/testHistory', 'gclitest/testRequire', 'gclitest/testJs'], function(require, exports, module) {
// We need to make sure GCLI is initialized before we begin testing it
require('gcli/index');
@@ -67,11 +67,15 @@ define('gclitest/suite', ['require', 'exports', 'module' , 'gcli/index', 'test/e
examiner.addSuite('gclitest/testTokenize', require('gclitest/testTokenize'));
examiner.addSuite('gclitest/testSplit', require('gclitest/testSplit'));
examiner.addSuite('gclitest/testCli', require('gclitest/testCli'));
+ examiner.addSuite('gclitest/testExec', require('gclitest/testExec'));
+ examiner.addSuite('gclitest/testKeyboard', require('gclitest/testKeyboard'));
examiner.addSuite('gclitest/testHistory', require('gclitest/testHistory'));
examiner.addSuite('gclitest/testRequire', require('gclitest/testRequire'));
examiner.addSuite('gclitest/testJs', require('gclitest/testJs'));
examiner.run();
+ console.log('Completed test suite');
+ // examiner.log();
});
/*
@@ -167,6 +171,19 @@ examiner.toRemote = function() {
};
};
+/**
+ * Output a test summary to console.log
+ */
+examiner.log = function() {
+ var remote = this.toRemote();
+ remote.suites.forEach(function(suite) {
+ console.log(suite.name);
+ suite.tests.forEach(function(test) {
+ console.log('- ' + test.name, test.status.name, test.message || '');
+ });
+ });
+};
+
/**
* Used by assert to record a failure against the current test
*/
@@ -299,8 +316,8 @@ Test.prototype.run = function() {
this.status = stati.fail;
this.messages.push('' + ex);
console.error(ex);
- if (console.trace) {
- console.trace();
+ if (ex.stack) {
+ console.error(ex.stack);
}
}
@@ -703,11 +720,12 @@ exports.testJavascript = function() {
* http://opensource.org/licenses/BSD-3-Clause
*/
-define('gclitest/commands', ['require', 'exports', 'module' , 'gcli/canon', 'gcli/types/basic', 'gcli/types'], function(require, exports, module) {
+define('gclitest/commands', ['require', 'exports', 'module' , 'gcli/canon', 'gcli/util', 'gcli/types/basic', 'gcli/types'], function(require, exports, module) {
var commands = exports;
var canon = require('gcli/canon');
+var util = require('gcli/util');
var SelectionType = require('gcli/types/basic').SelectionType;
var DeferredType = require('gcli/types/basic').DeferredType;
@@ -725,6 +743,10 @@ commands.setup = function() {
canon.addCommand(commands.tsv);
canon.addCommand(commands.tsr);
+ canon.addCommand(commands.tse);
+ canon.addCommand(commands.tsj);
+ canon.addCommand(commands.tsb);
+ canon.addCommand(commands.tss);
canon.addCommand(commands.tsu);
canon.addCommand(commands.tsn);
canon.addCommand(commands.tsnDif);
@@ -734,11 +756,16 @@ commands.setup = function() {
canon.addCommand(commands.tsnExtend);
canon.addCommand(commands.tselarr);
canon.addCommand(commands.tsm);
+ canon.addCommand(commands.tsg);
};
commands.shutdown = function() {
canon.removeCommand(commands.tsv);
canon.removeCommand(commands.tsr);
+ canon.removeCommand(commands.tse);
+ canon.removeCommand(commands.tsj);
+ canon.removeCommand(commands.tsb);
+ canon.removeCommand(commands.tss);
canon.removeCommand(commands.tsu);
canon.removeCommand(commands.tsn);
canon.removeCommand(commands.tsnDif);
@@ -748,14 +775,15 @@ commands.shutdown = function() {
canon.removeCommand(commands.tsnExtend);
canon.removeCommand(commands.tselarr);
canon.removeCommand(commands.tsm);
+ canon.removeCommand(commands.tsg);
types.deregisterType(commands.optionType);
types.deregisterType(commands.optionValue);
};
-commands.option1 = { };
-commands.option2 = { };
+commands.option1 = { type: types.getType('string') };
+commands.option2 = { type: types.getType('number') };
commands.optionType = new SelectionType({
name: 'optionType',
@@ -789,25 +817,62 @@ commands.optionValue = new DeferredType({
}
});
+commands.commandExec = util.createEvent('commands.commandExec');
+
+function createExec(name) {
+ return function(args, context) {
+ var data = {
+ command: commands[name],
+ args: args,
+ context: context
+ };
+ commands.commandExec(data);
+ return data;
+ };
+}
+
commands.tsv = {
name: 'tsv',
params: [
{ name: 'optionType', type: 'optionType' },
{ name: 'optionValue', type: 'optionValue' }
],
- exec: function(args, context) { }
+ exec: createExec('tsv')
};
commands.tsr = {
name: 'tsr',
params: [ { name: 'text', type: 'string' } ],
- exec: function(args, context) { }
+ exec: createExec('tsr')
+};
+
+commands.tse = {
+ name: 'tse',
+ params: [ { name: 'node', type: 'node' } ],
+ exec: createExec('tse')
+};
+
+commands.tsj = {
+ name: 'tsj',
+ params: [ { name: 'javascript', type: 'javascript' } ],
+ exec: createExec('tsj')
+};
+
+commands.tsb = {
+ name: 'tsb',
+ params: [ { name: 'toggle', type: 'boolean' } ],
+ exec: createExec('tsb')
+};
+
+commands.tss = {
+ name: 'tss',
+ exec: createExec('tss')
};
commands.tsu = {
name: 'tsu',
- params: [ { name: 'num', type: 'number' } ],
- exec: function(args, context) { }
+ params: [ { name: 'num', type: { name: 'number', max: 10, min: -5, step: 3 } } ],
+ exec: createExec('tsu')
};
commands.tsn = {
@@ -817,31 +882,31 @@ commands.tsn = {
commands.tsnDif = {
name: 'tsn dif',
params: [ { name: 'text', type: 'string' } ],
- exec: function(text) { }
+ exec: createExec('tsnDif')
};
commands.tsnExt = {
name: 'tsn ext',
params: [ { name: 'text', type: 'string' } ],
- exec: function(text) { }
+ exec: createExec('tsnExt')
};
commands.tsnExte = {
name: 'tsn exte',
params: [ { name: 'text', type: 'string' } ],
- exec: function(text) { }
+ exec: createExec('')
};
commands.tsnExten = {
name: 'tsn exten',
params: [ { name: 'text', type: 'string' } ],
- exec: function(text) { }
+ exec: createExec('tsnExte')
};
commands.tsnExtend = {
name: 'tsn extend',
params: [ { name: 'text', type: 'string' } ],
- exec: function(text) { }
+ exec: createExec('tsnExtend')
};
commands.tselarr = {
@@ -850,7 +915,7 @@ commands.tselarr = {
{ name: 'num', type: { name: 'selection', data: [ '1', '2', '3' ] } },
{ name: 'arr', type: { name: 'array', subtype: 'string' } },
],
- exec: function(args, context) {}
+ exec: createExec('tselarr')
};
commands.tsm = {
@@ -862,7 +927,31 @@ commands.tsm = {
{ name: 'txt', type: 'string' },
{ name: 'num', type: { name: 'number', max: 42, min: 0 } },
],
- exec: function(args, context) {}
+ exec: createExec('tsm')
+};
+
+commands.tsg = {
+ name: 'tsg',
+ hidden: true,
+ description: 'a param group test',
+ params: [
+ { name: 'solo', type: { name: 'selection', data: [ 'aaa', 'bbb', 'ccc' ] } },
+ {
+ group: 'First',
+ params: [
+ { name: 'txt1', type: 'string', defaultValue: null },
+ { name: 'boolean1', type: 'boolean' }
+ ]
+ },
+ {
+ group: 'Second',
+ params: [
+ { name: 'txt2', type: 'string', defaultValue: 'd' },
+ { name: 'num2', type: { name: 'number', defaultValue: 42 } }
+ ]
+ }
+ ],
+ exec: createExec('tsg')
};
@@ -1211,6 +1300,278 @@ exports.testNestedCommand = function() {
};
+});
+/*
+ * Copyright 2009-2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE.txt or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+
+define('gclitest/testExec', ['require', 'exports', 'module' , 'gcli/cli', 'gcli/types', 'gcli/canon', 'gclitest/commands', 'gcli/types/node', 'test/assert'], function(require, exports, module) {
+
+
+var Requisition = require('gcli/cli').Requisition;
+var Status = require('gcli/types').Status;
+var canon = require('gcli/canon');
+var commands = require('gclitest/commands');
+var nodetype = require('gcli/types/node');
+
+var test = require('test/assert');
+
+var actualExec;
+var actualOutput;
+
+exports.setup = function() {
+ commands.setup();
+ commands.commandExec.add(onCommandExec);
+ canon.commandOutputManager.addListener(onCommandOutput);
+};
+
+exports.shutdown = function() {
+ commands.shutdown();
+ commands.commandExec.remove(onCommandExec);
+ canon.commandOutputManager.removeListener(onCommandOutput);
+};
+
+function onCommandExec(ev) {
+ actualExec = ev;
+}
+
+function onCommandOutput(ev) {
+ actualOutput = ev.output;
+}
+
+function exec(command, expectedArgs) {
+ var environment = {};
+
+ var requisition = new Requisition(environment);
+ var reply = requisition.exec({ typed: command });
+
+ test.is(command.indexOf(actualExec.command.name), 0, 'Command name: ' + command);
+
+ if (reply !== true) {
+ test.ok(false, 'reply = false for command: ' + command);
+ }
+
+ if (expectedArgs == null) {
+ test.ok(false, 'expectedArgs == null for ' + command);
+ return;
+ }
+ if (actualExec.args == null) {
+ test.ok(false, 'actualExec.args == null for ' + command);
+ return;
+ }
+
+ test.is(Object.keys(expectedArgs).length, Object.keys(actualExec.args).length,
+ 'Arg count: ' + command);
+ Object.keys(expectedArgs).forEach(function(arg) {
+ var expectedArg = expectedArgs[arg];
+ var actualArg = actualExec.args[arg];
+
+ if (Array.isArray(expectedArg)) {
+ if (!Array.isArray(actualArg)) {
+ test.ok(false, 'actual is not an array. ' + command + '/' + arg);
+ return;
+ }
+
+ test.is(expectedArg.length, actualArg.length,
+ 'Array length: ' + command + '/' + arg);
+ for (var i = 0; i < expectedArg.length; i++) {
+ test.is(expectedArg[i], actualArg[i],
+ 'Member: "' + command + '/' + arg + '/' + i);
+ }
+ }
+ else {
+ test.is(expectedArg, actualArg, 'Command: "' + command + '" arg: ' + arg);
+ }
+ });
+
+ test.is(environment, actualExec.context.environment, 'Environment');
+
+ test.is(false, actualOutput.error, 'output error is false');
+ test.is(command, actualOutput.typed, 'command is typed');
+ test.ok(typeof actualOutput.canonical === 'string', 'canonical exists');
+
+ test.is(actualExec.args, actualOutput.args, 'actualExec.args is actualOutput.args');
+}
+
+
+exports.testExec = function() {
+ exec('tss', {});
+
+ // Bug 707008 - GCLI defered types don't work properly
+ // exec('tsv option1 10', { optionType: commands.option1, optionValue: '10' });
+ // exec('tsv option2 10', { optionType: commands.option1, optionValue: 10 });
+
+ exec('tsr fred', { text: 'fred' });
+ exec('tsr fred bloggs', { text: 'fred bloggs' });
+ exec('tsr "fred bloggs"', { text: 'fred bloggs' });
+
+ exec('tsb', { toggle: false });
+ exec('tsb --toggle', { toggle: true });
+
+ exec('tsu 10', { num: 10 });
+ exec('tsu --num 10', { num: 10 });
+
+ // Bug 704829 - Enable GCLI Javascript parameters
+ // The answer to this should be 2
+ exec('tsj { 1 + 1 }', { javascript: '1 + 1' });
+
+ var origDoc = nodetype.getDocument();
+ nodetype.setDocument(mockDoc);
+ exec('tse :root', { node: mockBody });
+ nodetype.setDocument(origDoc);
+
+ exec('tsn dif fred', { text: 'fred' });
+ exec('tsn exten fred', { text: 'fred' });
+ exec('tsn extend fred', { text: 'fred' });
+
+ exec('tselarr 1', { num: '1', arr: [ ] });
+ exec('tselarr 1 a', { num: '1', arr: [ 'a' ] });
+ exec('tselarr 1 a b', { num: '1', arr: [ 'a', 'b' ] });
+
+ exec('tsm a 10 10', { abc: 'a', txt: '10', num: 10 });
+
+ // Bug 707009 - GCLI doesn't always fill in default parameters properly
+ // exec('tsg a', { solo: 'a', txt1: null, boolean1: false, txt2: 'd', num2: 42 });
+};
+
+var mockBody = {
+ style: {}
+};
+
+var mockDoc = {
+ querySelectorAll: function(css) {
+ if (css === ':root') {
+ return {
+ length: 1,
+ item: function(i) {
+ return mockBody;
+ }
+ };
+ }
+ throw new Error('mockDoc.querySelectorAll(\'' + css + '\') error');
+ }
+};
+
+
+});
+/*
+ * Copyright 2009-2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE.txt or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+
+define('gclitest/testKeyboard', ['require', 'exports', 'module' , 'gcli/cli', 'gcli/types', 'gcli/canon', 'gclitest/commands', 'gcli/types/node', 'test/assert'], function(require, exports, module) {
+
+
+var Requisition = require('gcli/cli').Requisition;
+var Status = require('gcli/types').Status;
+var canon = require('gcli/canon');
+var commands = require('gclitest/commands');
+var nodetype = require('gcli/types/node');
+
+var test = require('test/assert');
+
+
+exports.setup = function() {
+ commands.setup();
+};
+
+exports.shutdown = function() {
+ commands.shutdown();
+};
+
+var COMPLETES_TO = 'complete';
+var KEY_UPS_TO = 'keyup';
+var KEY_DOWNS_TO = 'keydown';
+
+function check(initial, action, after) {
+ var requisition = new Requisition();
+ requisition.update({
+ typed: initial,
+ cursor: { start: initial.length, end: initial.length }
+ });
+ var assignment = requisition.getAssignmentAt(initial.length);
+ switch (action) {
+ case COMPLETES_TO:
+ assignment.complete();
+ break;
+
+ case KEY_UPS_TO:
+ assignment.increment();
+ break;
+
+ case KEY_DOWNS_TO:
+ assignment.decrement();
+ break;
+ }
+
+ test.is(after, requisition.toString(), initial + ' + ' + action + ' -> ' + after);
+}
+
+exports.testComplete = function() {
+ check('tsela', COMPLETES_TO, 'tselarr ');
+ check('tsn di', COMPLETES_TO, 'tsn dif ');
+ check('tsg a', COMPLETES_TO, 'tsg aaa ');
+
+ check('{ wind', COMPLETES_TO, '{ window');
+ check('{ window.docum', COMPLETES_TO, '{ window.document');
+ check('{ window.document.titl', COMPLETES_TO, '{ window.document.title ');
+};
+
+exports.testIncrDecr = function() {
+ check('tsu -70', KEY_UPS_TO, 'tsu -5');
+ check('tsu -7', KEY_UPS_TO, 'tsu -5');
+ check('tsu -6', KEY_UPS_TO, 'tsu -5');
+ check('tsu -5', KEY_UPS_TO, 'tsu -3');
+ check('tsu -4', KEY_UPS_TO, 'tsu -3');
+ check('tsu -3', KEY_UPS_TO, 'tsu 0');
+ check('tsu -2', KEY_UPS_TO, 'tsu 0');
+ check('tsu -1', KEY_UPS_TO, 'tsu 0');
+ check('tsu 0', KEY_UPS_TO, 'tsu 3');
+ check('tsu 1', KEY_UPS_TO, 'tsu 3');
+ check('tsu 2', KEY_UPS_TO, 'tsu 3');
+ check('tsu 3', KEY_UPS_TO, 'tsu 6');
+ check('tsu 4', KEY_UPS_TO, 'tsu 6');
+ check('tsu 5', KEY_UPS_TO, 'tsu 6');
+ check('tsu 6', KEY_UPS_TO, 'tsu 9');
+ check('tsu 7', KEY_UPS_TO, 'tsu 9');
+ check('tsu 8', KEY_UPS_TO, 'tsu 9');
+ check('tsu 9', KEY_UPS_TO, 'tsu 10');
+ check('tsu 10', KEY_UPS_TO, 'tsu 10');
+ check('tsu 100', KEY_UPS_TO, 'tsu -5');
+
+ check('tsu -70', KEY_DOWNS_TO, 'tsu 10');
+ check('tsu -7', KEY_DOWNS_TO, 'tsu 10');
+ check('tsu -6', KEY_DOWNS_TO, 'tsu 10');
+ check('tsu -5', KEY_DOWNS_TO, 'tsu -5');
+ check('tsu -4', KEY_DOWNS_TO, 'tsu -5');
+ check('tsu -3', KEY_DOWNS_TO, 'tsu -5');
+ check('tsu -2', KEY_DOWNS_TO, 'tsu -3');
+ check('tsu -1', KEY_DOWNS_TO, 'tsu -3');
+ check('tsu 0', KEY_DOWNS_TO, 'tsu -3');
+ check('tsu 1', KEY_DOWNS_TO, 'tsu 0');
+ check('tsu 2', KEY_DOWNS_TO, 'tsu 0');
+ check('tsu 3', KEY_DOWNS_TO, 'tsu 0');
+ check('tsu 4', KEY_DOWNS_TO, 'tsu 3');
+ check('tsu 5', KEY_DOWNS_TO, 'tsu 3');
+ check('tsu 6', KEY_DOWNS_TO, 'tsu 3');
+ check('tsu 7', KEY_DOWNS_TO, 'tsu 6');
+ check('tsu 8', KEY_DOWNS_TO, 'tsu 6');
+ check('tsu 9', KEY_DOWNS_TO, 'tsu 6');
+ check('tsu 10', KEY_DOWNS_TO, 'tsu 9');
+ check('tsu 100', KEY_DOWNS_TO, 'tsu 10');
+
+ // Bug 707007 - GCLI increment and decrement operations cycle through
+ // selection options in the wrong order
+ check('tselarr 1', KEY_DOWNS_TO, 'tselarr 2');
+ check('tselarr 2', KEY_DOWNS_TO, 'tselarr 3');
+ check('tselarr 3', KEY_DOWNS_TO, 'tselarr 1');
+
+ check('tselarr 3', KEY_UPS_TO, 'tselarr 2');
+};
+
});
/*
* Copyright 2009-2011 Mozilla Foundation and contributors
@@ -1544,6 +1905,8 @@ function undefine() {
delete define.modules['gclitest/testSplit'];
delete define.modules['gclitest/commands'];
delete define.modules['gclitest/testCli'];
+ delete define.modules['gclitest/testExec'];
+ delete define.modules['gclitest/testKeyboard'];
delete define.modules['gclitest/testHistory'];
delete define.modules['gclitest/testRequire'];
delete define.modules['gclitest/requirable'];
@@ -1556,6 +1919,8 @@ function undefine() {
delete define.globalDomain.modules['gclitest/testSplit'];
delete define.globalDomain.modules['gclitest/commands'];
delete define.globalDomain.modules['gclitest/testCli'];
+ delete define.globalDomain.modules['gclitest/testExec'];
+ delete define.globalDomain.modules['gclitest/testKeyboard'];
delete define.globalDomain.modules['gclitest/testHistory'];
delete define.globalDomain.modules['gclitest/testRequire'];
delete define.globalDomain.modules['gclitest/requirable'];
diff --git a/browser/locales/en-US/chrome/browser/devtools/gcli.properties b/browser/locales/en-US/chrome/browser/devtools/gcli.properties
index 2f0c73a40a8..1786cc491af 100644
--- a/browser/locales/en-US/chrome/browser/devtools/gcli.properties
+++ b/browser/locales/en-US/chrome/browser/devtools/gcli.properties
@@ -67,12 +67,12 @@ typesNumberNan=Can't convert "%S" to a number.
# LOCALIZATION NOTE (typesNumberMax): When the command line is passed a
# number, but the number is bigger than the largest allowed number, this error
# message is displayed.
-typesNumberMax=%1$S is greater that maximum allowed: %2$S.
+typesNumberMax=%1$S is greater than maximum allowed: %2$S.
# LOCALIZATION NOTE (typesNumberMin): When the command line is passed a
# number, but the number is lower than the smallest allowed number, this error
# message is displayed.
-typesNumberMin=%1$S is smaller that minimum allowed: %2$S.
+typesNumberMin=%1$S is smaller than minimum allowed: %2$S.
# LOCALIZATION NOTE (typesSelectionNomatch): When the command line is passed
# an option with a limited number of correct values, but the passed value is
@@ -94,3 +94,50 @@ nodeParseMultiple=Too many matches (%S)
# displayed.
nodeParseNone=No matches
+# LOCALIZATION NOTE (helpDesc): A very short description of the 'help'
+# command. This string is designed to be shown in a menu alongside the command
+# name, which is why it should be as short as possible. See helpManual for a
+# fuller description of what it does.
+helpDesc=Get help on the available commands
+
+# LOCALIZATION NOTE (helpManual): A fuller description of the 'help' command.
+# Displayed when the user asks for help on what it does.
+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 helpSearchManual 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 (helpSearchManual): A fuller description of the 'search'
+# parameter to the 'help' command. Displayed when the user asks for help on
+# what it does.
+helpSearchManual=A search string to use in narrowing down the list of commands that are displayed to the user. Any part of the string can match, regular expressions are 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
+# the command
+helpManSynopsis=Synopsis
+
+# LOCALIZATION NOTE (helpManDescription): A heading shown in a help page for a
+# command in the console. This heading precedes the top level description.
+helpManDescription=Description
+
+# LOCALIZATION NOTE (helpManParameters): A heading shown above the parameters
+# in a help page for a command in the console.
+helpManParameters=Parameters
+
+# LOCALIZATION NOTE (helpManNone): Some text shown under the parameters
+# heading in a help page for a command which has no parameters.
+helpManNone=None
+
+# LOCALIZATION NOTE (introHeader): The heading displayed at the top of the
+# output for the help command
+introHeader=Welcome to Firefox Developer Tools
+
+# LOCALIZATION NOTE (introBody): The text displayed at the top of the output
+# for the help command, just before the list of commands. This text is wrapped
+# inside a link to a localized MDN article
+introBody=For more information see MDN.
+
diff --git a/browser/locales/en-US/chrome/browser/devtools/gclicommands.properties b/browser/locales/en-US/chrome/browser/devtools/gclicommands.properties
index 6940549ef16..65bdb0dfb5f 100644
--- a/browser/locales/en-US/chrome/browser/devtools/gclicommands.properties
+++ b/browser/locales/en-US/chrome/browser/devtools/gclicommands.properties
@@ -44,8 +44,7 @@ inspectDesc=Inspect a node
# LOCALIZATION NOTE (inspectManual) A fuller description of the 'inspect'
# command, displayed when the user asks for help on what it does.
-inspectManual=Investigate the dimensions and properties of an element using \
-a CSS selector to open the DOM highlighter
+inspectManual=Investigate the dimensions and properties of an element using a CSS selector to open the DOM highlighter
# LOCALIZATION NOTE (inspectNodeDesc) A very short string to describe the
# 'node' parameter to the 'inspect' command, which is displayed in a dialog
@@ -55,5 +54,4 @@ inspectNodeDesc=CSS selector
# LOCALIZATION NOTE (inspectNodeManual) A fuller description of the 'node'
# parameter to the 'inspect' command, displayed when the user asks for help
# on what it does.
-inspectNodeManual=A CSS selector for use with Document.querySelector which \
-identifies a single element
+inspectNodeManual=A CSS selector for use with Document.querySelector which identifies a single element
diff --git a/browser/themes/gnomestripe/devtools/gcli.css b/browser/themes/gnomestripe/devtools/gcli.css
index a1ab57724d0..372d35d034c 100644
--- a/browser/themes/gnomestripe/devtools/gcli.css
+++ b/browser/themes/gnomestripe/devtools/gcli.css
@@ -46,7 +46,6 @@
height: 100%;
vertical-align: middle;
background-color: transparent;
- font: 12px Consolas, "Lucida Console", monospace;
}
.gcliterm-input-node {
@@ -64,24 +63,6 @@
-moz-padding-end: 4px;
}
-.gcli-in-valid {
- border-bottom: none;
-}
-
-.gcli-in-incomplete {
- color: #DDD;
- border-bottom: 1px dotted #999;
-}
-
-.gcli-in-error {
- color: #DDD;
- border-bottom: 1px dotted #F00;
-}
-
-.gcli-in-ontab {
- color: #999;
-}
-
.gcliterm-stack-node {
background: url("chrome://global/skin/icons/commandline.png") 4px center no-repeat;
width: 100%;
@@ -109,19 +90,47 @@
border-bottom: 1px solid threedshadow;
}
-.gcli-help-right {
- text-align: right;
-}
-
.gcliterm-menu {
display: -moz-box;
-moz-box-flex: 1;
+ border-bottom-color: white;
+}
+
+.gcliterm-hint-scroll {
+ overflow-y: scroll;
+ border-bottom-color: threedshadow;
}
.gcliterm-hint-nospace {
display: none;
}
+.gcliterm-msg-body {
+ margin-top: 0;
+ margin-bottom: 3px;
+ -moz-margin-start: 3px;
+ -moz-margin-end: 6px;
+}
+
+/* Extract from display.css, we only want these 2 rules */
+
+.gcli-out-shortcut {
+ border: 1px solid #999;
+ border-radius: 3px;
+ padding: 0 4px;
+ margin: 0 4px;
+ font-size: 70%;
+ color: #666;
+ cursor: pointer;
+ vertical-align: bottom;
+}
+
+.gcli-out-shortcut:before {
+ color: #66F;
+ content: '\bb';
+ padding: 0 2px;
+}
+
/*
* The language of a console is not en_US or any other common language
* (i.e we don't attempt to translate 'console.log(x)')
@@ -151,6 +160,15 @@
/* From: $GCLI/mozilla/gcli/ui/gcliterm-gnomestripe.css */
+.gcliterm-input-node,
+.gcliterm-complete-node {
+ font: 12px "DejaVu Sans Mono", monospace;
+}
+
+.gcli-out-shortcut {
+ font-family: "DejaVu Sans Mono", monospace;
+}
+
/* From: $GCLI/lib/gcli/ui/arg_fetch.css */
.gcli-argfetch {
@@ -181,7 +199,7 @@
.gcli-af-required {
font-size: 90%;
color: #f66;
- padding-left: 5px;
+ -moz-padding-start: 5px;
}
.gcli-af-error {
@@ -197,6 +215,10 @@
width: 100%;
}
+.gcli-field-javascript {
+ margin-bottom: 0;
+}
+
/* From: $GCLI/lib/gcli/ui/menu.css */
.gcli-menu {
@@ -284,3 +306,45 @@
color: #66F;
font-weight: bold;
}
+
+/* From: $GCLI/lib/gcli/commands/help.css */
+
+.gcli-help-name {
+ text-align: end;
+}
+
+.gcli-help-arrow {
+ font-size: 70%;
+ color: #AAA;
+}
+
+.gcli-help-synopsis {
+ font-family: monospace;
+ font-weight: normal;
+ padding: 0 3px;
+ margin: 0 10px;
+ border: 1px solid #999;
+ border-radius: 3px;
+ color: #666;
+ cursor: pointer;
+ display: inline-block;
+}
+
+.gcli-help-synopsis:before {
+ color: #66F;
+ content: '\bb';
+}
+
+.gcli-help-description {
+ margin: 0 20px;
+ padding: 0;
+}
+
+.gcli-help-parameter {
+ margin: 0 30px;
+ padding: 0;
+}
+
+.gcli-help-header {
+ margin: 10px 0 6px;
+}
diff --git a/browser/themes/pinstripe/devtools/gcli.css b/browser/themes/pinstripe/devtools/gcli.css
index 7c262437ffb..e180bbfbb5e 100644
--- a/browser/themes/pinstripe/devtools/gcli.css
+++ b/browser/themes/pinstripe/devtools/gcli.css
@@ -46,7 +46,6 @@
height: 100%;
vertical-align: middle;
background-color: transparent;
- font: 12px Consolas, "Lucida Console", monospace;
}
.gcliterm-input-node {
@@ -64,24 +63,6 @@
-moz-padding-end: 4px;
}
-.gcli-in-valid {
- border-bottom: none;
-}
-
-.gcli-in-incomplete {
- color: #DDD;
- border-bottom: 1px dotted #999;
-}
-
-.gcli-in-error {
- color: #DDD;
- border-bottom: 1px dotted #F00;
-}
-
-.gcli-in-ontab {
- color: #999;
-}
-
.gcliterm-stack-node {
background: url("chrome://global/skin/icons/commandline.png") 4px center no-repeat;
width: 100%;
@@ -109,19 +90,47 @@
border-bottom: 1px solid threedshadow;
}
-.gcli-help-right {
- text-align: right;
-}
-
.gcliterm-menu {
display: -moz-box;
-moz-box-flex: 1;
+ border-bottom-color: white;
+}
+
+.gcliterm-hint-scroll {
+ overflow-y: scroll;
+ border-bottom-color: threedshadow;
}
.gcliterm-hint-nospace {
display: none;
}
+.gcliterm-msg-body {
+ margin-top: 0;
+ margin-bottom: 3px;
+ -moz-margin-start: 3px;
+ -moz-margin-end: 6px;
+}
+
+/* Extract from display.css, we only want these 2 rules */
+
+.gcli-out-shortcut {
+ border: 1px solid #999;
+ border-radius: 3px;
+ padding: 0 4px;
+ margin: 0 4px;
+ font-size: 70%;
+ color: #666;
+ cursor: pointer;
+ vertical-align: bottom;
+}
+
+.gcli-out-shortcut:before {
+ color: #66F;
+ content: '\bb';
+ padding: 0 2px;
+}
+
/*
* The language of a console is not en_US or any other common language
* (i.e we don't attempt to translate 'console.log(x)')
@@ -151,10 +160,19 @@
/* From: $GCLI/mozilla/gcli/ui/gcliterm-pinstripe.css */
+.gcliterm-input-node,
+.gcliterm-complete-node {
+ font: 11px Menlo, Monaco, monospace;
+}
+
.gcliterm-complete-node {
padding-top: 6px !important;
}
+.gcli-out-shortcut {
+ font-family: Menlo, Monaco, monospace;
+}
+
/* From: $GCLI/lib/gcli/ui/arg_fetch.css */
.gcli-argfetch {
@@ -185,7 +203,7 @@
.gcli-af-required {
font-size: 90%;
color: #f66;
- padding-left: 5px;
+ -moz-padding-start: 5px;
}
.gcli-af-error {
@@ -201,6 +219,10 @@
width: 100%;
}
+.gcli-field-javascript {
+ margin-bottom: 0;
+}
+
/* From: $GCLI/lib/gcli/ui/menu.css */
.gcli-menu {
@@ -288,3 +310,45 @@
color: #66F;
font-weight: bold;
}
+
+/* From: $GCLI/lib/gcli/commands/help.css */
+
+.gcli-help-name {
+ text-align: end;
+}
+
+.gcli-help-arrow {
+ font-size: 70%;
+ color: #AAA;
+}
+
+.gcli-help-synopsis {
+ font-family: monospace;
+ font-weight: normal;
+ padding: 0 3px;
+ margin: 0 10px;
+ border: 1px solid #999;
+ border-radius: 3px;
+ color: #666;
+ cursor: pointer;
+ display: inline-block;
+}
+
+.gcli-help-synopsis:before {
+ color: #66F;
+ content: '\bb';
+}
+
+.gcli-help-description {
+ margin: 0 20px;
+ padding: 0;
+}
+
+.gcli-help-parameter {
+ margin: 0 30px;
+ padding: 0;
+}
+
+.gcli-help-header {
+ margin: 10px 0 6px;
+}
diff --git a/browser/themes/winstripe/devtools/gcli.css b/browser/themes/winstripe/devtools/gcli.css
index 044fa7d5cd7..a08f74e040c 100644
--- a/browser/themes/winstripe/devtools/gcli.css
+++ b/browser/themes/winstripe/devtools/gcli.css
@@ -46,7 +46,6 @@
height: 100%;
vertical-align: middle;
background-color: transparent;
- font: 12px Consolas, "Lucida Console", monospace;
}
.gcliterm-input-node {
@@ -64,24 +63,6 @@
-moz-padding-end: 4px;
}
-.gcli-in-valid {
- border-bottom: none;
-}
-
-.gcli-in-incomplete {
- color: #DDD;
- border-bottom: 1px dotted #999;
-}
-
-.gcli-in-error {
- color: #DDD;
- border-bottom: 1px dotted #F00;
-}
-
-.gcli-in-ontab {
- color: #999;
-}
-
.gcliterm-stack-node {
background: url("chrome://global/skin/icons/commandline.png") 4px center no-repeat;
width: 100%;
@@ -109,19 +90,47 @@
border-bottom: 1px solid threedshadow;
}
-.gcli-help-right {
- text-align: right;
-}
-
.gcliterm-menu {
display: -moz-box;
-moz-box-flex: 1;
+ border-bottom-color: white;
+}
+
+.gcliterm-hint-scroll {
+ overflow-y: scroll;
+ border-bottom-color: threedshadow;
}
.gcliterm-hint-nospace {
display: none;
}
+.gcliterm-msg-body {
+ margin-top: 0;
+ margin-bottom: 3px;
+ -moz-margin-start: 3px;
+ -moz-margin-end: 6px;
+}
+
+/* Extract from display.css, we only want these 2 rules */
+
+.gcli-out-shortcut {
+ border: 1px solid #999;
+ border-radius: 3px;
+ padding: 0 4px;
+ margin: 0 4px;
+ font-size: 70%;
+ color: #666;
+ cursor: pointer;
+ vertical-align: bottom;
+}
+
+.gcli-out-shortcut:before {
+ color: #66F;
+ content: '\bb';
+ padding: 0 2px;
+}
+
/*
* The language of a console is not en_US or any other common language
* (i.e we don't attempt to translate 'console.log(x)')
@@ -151,6 +160,15 @@
/* From: $GCLI/mozilla/gcli/ui/gcliterm-winstripe.css */
+.gcliterm-input-node,
+.gcliterm-complete-node {
+ font: 12px Consolas, "Lucida Console", monospace;
+}
+
+.gcli-out-shortcut {
+ font-family: Consolas, Inconsolata, "Courier New", monospace;
+}
+
/* From: $GCLI/lib/gcli/ui/arg_fetch.css */
.gcli-argfetch {
@@ -181,7 +199,7 @@
.gcli-af-required {
font-size: 90%;
color: #f66;
- padding-left: 5px;
+ -moz-padding-start: 5px;
}
.gcli-af-error {
@@ -197,6 +215,10 @@
width: 100%;
}
+.gcli-field-javascript {
+ margin-bottom: 0;
+}
+
/* From: $GCLI/lib/gcli/ui/menu.css */
.gcli-menu {
@@ -284,3 +306,45 @@
color: #66F;
font-weight: bold;
}
+
+/* From: $GCLI/lib/gcli/commands/help.css */
+
+.gcli-help-name {
+ text-align: end;
+}
+
+.gcli-help-arrow {
+ font-size: 70%;
+ color: #AAA;
+}
+
+.gcli-help-synopsis {
+ font-family: monospace;
+ font-weight: normal;
+ padding: 0 3px;
+ margin: 0 10px;
+ border: 1px solid #999;
+ border-radius: 3px;
+ color: #666;
+ cursor: pointer;
+ display: inline-block;
+}
+
+.gcli-help-synopsis:before {
+ color: #66F;
+ content: '\bb';
+}
+
+.gcli-help-description {
+ margin: 0 20px;
+ padding: 0;
+}
+
+.gcli-help-parameter {
+ margin: 0 30px;
+ padding: 0;
+}
+
+.gcli-help-header {
+ margin: 10px 0 6px;
+}
diff --git a/content/base/src/nsTextFragment.h b/content/base/src/nsTextFragment.h
index fe89a1f1e93..fc65231a7a8 100644
--- a/content/base/src/nsTextFragment.h
+++ b/content/base/src/nsTextFragment.h
@@ -176,8 +176,7 @@ public:
if (mState.mIs2b) {
aString.Append(m2b, mState.mLength);
} else {
- AppendASCIItoUTF16(Substring(m1b, m1b + mState.mLength),
- aString);
+ AppendASCIItoUTF16(Substring(m1b, mState.mLength), aString);
}
}
@@ -190,7 +189,7 @@ public:
if (mState.mIs2b) {
aString.Append(m2b + aOffset, aLength);
} else {
- AppendASCIItoUTF16(Substring(m1b + aOffset, m1b + aOffset + aLength), aString);
+ AppendASCIItoUTF16(Substring(m1b + aOffset, aLength), aString);
}
}
diff --git a/modules/libpref/src/Preferences.cpp b/modules/libpref/src/Preferences.cpp
index aec462f7b6b..b55d35990cb 100644
--- a/modules/libpref/src/Preferences.cpp
+++ b/modules/libpref/src/Preferences.cpp
@@ -1019,7 +1019,7 @@ static nsresult pref_InitInitialObjects()
find = findPtr;
while (NS_SUCCEEDED(find->FindNext(&entryName, &entryNameLen))) {
- prefEntries.AppendElement(Substring(entryName, entryName + entryNameLen));
+ prefEntries.AppendElement(Substring(entryName, entryNameLen));
}
prefEntries.Sort();
@@ -1080,7 +1080,7 @@ static nsresult pref_InitInitialObjects()
find = findPtr;
prefEntries.Clear();
while (NS_SUCCEEDED(find->FindNext(&entryName, &entryNameLen))) {
- prefEntries.AppendElement(Substring(entryName, entryName + entryNameLen));
+ prefEntries.AppendElement(Substring(entryName, entryNameLen));
}
prefEntries.Sort();
for (PRUint32 i = prefEntries.Length(); i--; ) {
diff --git a/modules/libpref/src/nsPrefBranch.cpp b/modules/libpref/src/nsPrefBranch.cpp
index 278409b79bb..a64977b1d53 100644
--- a/modules/libpref/src/nsPrefBranch.cpp
+++ b/modules/libpref/src/nsPrefBranch.cpp
@@ -830,7 +830,7 @@ nsPrefLocalizedString::SetDataWithLength(PRUint32 aLength,
{
if (!aData)
return SetData(EmptyString());
- return SetData(Substring(aData, aData + aLength));
+ return SetData(Substring(aData, aLength));
}
//----------------------------------------------------------------------------
diff --git a/netwerk/base/src/nsSerializationHelper.cpp b/netwerk/base/src/nsSerializationHelper.cpp
index feded1966b0..8e8c37c324f 100644
--- a/netwerk/base/src/nsSerializationHelper.cpp
+++ b/netwerk/base/src/nsSerializationHelper.cpp
@@ -93,7 +93,7 @@ NS_DeserializeObject(const nsCSubstring& str, nsISupports** obj)
return NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr stream;
nsresult rv = NS_NewCStringInputStream(getter_AddRefs(stream),
- Substring(buf, buf + size));
+ Substring(buf, size));
PR_Free(buf);
NS_ENSURE_SUCCESS(rv, rv);
diff --git a/netwerk/streamconv/converters/nsIndexedToHTML.cpp b/netwerk/streamconv/converters/nsIndexedToHTML.cpp
index 6ffed3e6fcb..90315aeda46 100644
--- a/netwerk/streamconv/converters/nsIndexedToHTML.cpp
+++ b/netwerk/streamconv/converters/nsIndexedToHTML.cpp
@@ -766,7 +766,7 @@ nsIndexedToHTML::FormatInputStream(nsIRequest* aRequest, nsISupports *aContext,
nsCOMPtr inputData;
if (buffer) {
- rv = NS_NewCStringInputStream(getter_AddRefs(inputData), Substring(buffer, buffer + dstLength));
+ rv = NS_NewCStringInputStream(getter_AddRefs(inputData), Substring(buffer, dstLength));
nsMemory::Free(buffer);
NS_ENSURE_SUCCESS(rv, rv);
rv = mListener->OnDataAvailable(aRequest, aContext,
diff --git a/toolkit/components/prompts/src/nsPrompter.js b/toolkit/components/prompts/src/nsPrompter.js
index a58625c49d9..a507e78cc13 100644
--- a/toolkit/components/prompts/src/nsPrompter.js
+++ b/toolkit/components/prompts/src/nsPrompter.js
@@ -355,22 +355,17 @@ let PromptUtils = {
getTabModalPrompt : function (domWin) {
var promptBox = null;
- // Given a content DOM window, returns the chrome window it's in.
- function getChromeWindow(aWindow) {
- var chromeWin = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIWebNavigation)
- .QueryInterface(Ci.nsIDocShell)
- .chromeEventHandler.ownerDocument.defaultView;
- return chromeWin;
- }
-
try {
// Get the topmost window, in case we're in a frame.
var promptWin = domWin.top;
// Get the chrome window for the content window we're using.
// (Unwrap because we need a non-IDL property below.)
- var chromeWin = getChromeWindow(promptWin).wrappedJSObject;
+ var chromeWin = promptWin.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShell)
+ .chromeEventHandler.ownerDocument
+ .defaultView.wrappedJSObject;
if (chromeWin.getTabModalPromptBox)
promptBox = chromeWin.getTabModalPromptBox(promptWin);
diff --git a/toolkit/locales/l10n.mk b/toolkit/locales/l10n.mk
index 7b8e6338f11..c70e07012fe 100644
--- a/toolkit/locales/l10n.mk
+++ b/toolkit/locales/l10n.mk
@@ -103,7 +103,7 @@ else
STAGEDIST = $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_DIR)
endif
-include $(topsrcdir)/toolkit/mozapps/installer/signing.mk
+include $(MOZILLA_DIR)/toolkit/mozapps/installer/signing.mk
include $(MOZILLA_DIR)/toolkit/mozapps/installer/packager.mk
$(STAGEDIST): AB_CD:=en-US
diff --git a/toolkit/mozapps/installer/windows/nsis/makensis.mk b/toolkit/mozapps/installer/windows/nsis/makensis.mk
index 2b59ab3ff91..fb87635aa4c 100644
--- a/toolkit/mozapps/installer/windows/nsis/makensis.mk
+++ b/toolkit/mozapps/installer/windows/nsis/makensis.mk
@@ -41,7 +41,7 @@ ifndef CONFIG_DIR
$(error CONFIG_DIR must be set before including makensis.mk)
endif
-include $(topsrcdir)/toolkit/mozapps/installer/signing.mk
+include $(MOZILLA_DIR)/toolkit/mozapps/installer/signing.mk
ABS_CONFIG_DIR := $(shell pwd)/$(CONFIG_DIR)
diff --git a/xpcom/build/nsXPCOMStrings.cpp b/xpcom/build/nsXPCOMStrings.cpp
index fcf5f5a39ed..866c751e6ca 100644
--- a/xpcom/build/nsXPCOMStrings.cpp
+++ b/xpcom/build/nsXPCOMStrings.cpp
@@ -174,7 +174,7 @@ NS_StringSetDataRange(nsAString &aStr,
if (aDataLength == PR_UINT32_MAX)
aStr.Replace(aCutOffset, aCutLength, nsDependentString(aData));
else
- aStr.Replace(aCutOffset, aCutLength, Substring(aData, aData + aDataLength));
+ aStr.Replace(aCutOffset, aCutLength, Substring(aData, aDataLength));
}
else
aStr.Cut(aCutOffset, aCutLength);
@@ -333,7 +333,7 @@ NS_CStringSetDataRange(nsACString &aStr,
if (aDataLength == PR_UINT32_MAX)
aStr.Replace(aCutOffset, aCutLength, nsDependentCString(aData));
else
- aStr.Replace(aCutOffset, aCutLength, Substring(aData, aData + aDataLength));
+ aStr.Replace(aCutOffset, aCutLength, Substring(aData, aDataLength));
}
else
aStr.Cut(aCutOffset, aCutLength);
diff --git a/xpcom/ds/nsVariant.cpp b/xpcom/ds/nsVariant.cpp
index 04a21fdd59c..a87f139fd91 100644
--- a/xpcom/ds/nsVariant.cpp
+++ b/xpcom/ds/nsVariant.cpp
@@ -948,7 +948,7 @@ nsVariant::ConvertToACString(const nsDiscriminatedUnion& data,
case nsIDataType::VTYPE_WCHAR:
{
const PRUnichar* str = &data.u.mWCharValue;
- LossyCopyUTF16toASCII(Substring(str, str + 1), _retval);
+ LossyCopyUTF16toASCII(Substring(str, 1), _retval);
return NS_OK;
}
default:
@@ -999,7 +999,7 @@ nsVariant::ConvertToAUTF8String(const nsDiscriminatedUnion& data,
case nsIDataType::VTYPE_WCHAR:
{
const PRUnichar* str = &data.u.mWCharValue;
- CopyUTF16toUTF8(Substring(str, str + 1), _retval);
+ CopyUTF16toUTF8(Substring(str, 1), _retval);
return NS_OK;
}
default:
diff --git a/xpcom/io/nsStringStream.cpp b/xpcom/io/nsStringStream.cpp
index 696f3d6ff1b..28e2c0c4174 100644
--- a/xpcom/io/nsStringStream.cpp
+++ b/xpcom/io/nsStringStream.cpp
@@ -204,7 +204,7 @@ nsStringInputStream::ShareData(const char *data, PRInt32 dataLen)
if (dataLen < 0)
dataLen = strlen(data);
- mData.Rebind(data, data + dataLen);
+ mData.Rebind(data, dataLen);
mOffset = 0;
return NS_OK;
}
diff --git a/xpcom/string/public/nsString.h b/xpcom/string/public/nsString.h
index 46d2296810e..34bacf3fc58 100644
--- a/xpcom/string/public/nsString.h
+++ b/xpcom/string/public/nsString.h
@@ -97,7 +97,7 @@ class NS_LossyConvertUTF16toASCII : public nsCAutoString
NS_LossyConvertUTF16toASCII( const PRUnichar* aString, PRUint32 aLength )
{
- LossyAppendUTF16toASCII(Substring(aString, aString + aLength), *this);
+ LossyAppendUTF16toASCII(Substring(aString, aLength), *this);
}
explicit
@@ -123,7 +123,7 @@ class NS_ConvertASCIItoUTF16 : public nsAutoString
NS_ConvertASCIItoUTF16( const char* aCString, PRUint32 aLength )
{
- AppendASCIItoUTF16(Substring(aCString, aCString + aLength), *this);
+ AppendASCIItoUTF16(Substring(aCString, aLength), *this);
}
explicit
@@ -152,7 +152,7 @@ class NS_ConvertUTF16toUTF8 : public nsCAutoString
NS_ConvertUTF16toUTF8( const PRUnichar* aString, PRUint32 aLength )
{
- AppendUTF16toUTF8(Substring(aString, aString + aLength), *this);
+ AppendUTF16toUTF8(Substring(aString, aLength), *this);
}
explicit
@@ -178,7 +178,7 @@ class NS_ConvertUTF8toUTF16 : public nsAutoString
NS_ConvertUTF8toUTF16( const char* aCString, PRUint32 aLength )
{
- AppendUTF8toUTF16(Substring(aCString, aCString + aLength), *this);
+ AppendUTF8toUTF16(Substring(aCString, aLength), *this);
}
explicit
diff --git a/xpcom/string/public/nsTDependentSubstring.h b/xpcom/string/public/nsTDependentSubstring.h
index be3f93b2c02..bd21ed2b490 100644
--- a/xpcom/string/public/nsTDependentSubstring.h
+++ b/xpcom/string/public/nsTDependentSubstring.h
@@ -59,7 +59,12 @@ class nsTDependentSubstring_CharT : public nsTSubstring_CharT
void Rebind( const substring_type&, PRUint32 startPos, PRUint32 length = size_type(-1) );
- void Rebind( const char_type* start, const char_type* end );
+ void Rebind( const char_type* data, size_type length );
+
+ void Rebind( const char_type* start, const char_type* end )
+ {
+ Rebind(start, size_type(end - start));
+ }
nsTDependentSubstring_CharT( const substring_type& str, PRUint32 startPos, PRUint32 length = size_type(-1) )
: substring_type()
@@ -67,6 +72,9 @@ class nsTDependentSubstring_CharT : public nsTSubstring_CharT
Rebind(str, startPos, length);
}
+ nsTDependentSubstring_CharT( const char_type* data, size_type length )
+ : substring_type(const_cast(data), length, F_NONE) {}
+
nsTDependentSubstring_CharT( const char_type* start, const char_type* end )
: substring_type(const_cast(start), PRUint32(end - start), F_NONE) {}
@@ -98,6 +106,13 @@ Substring( const nsReadingIterator& start, const nsReadingIterator
return nsTDependentSubstring_CharT(start.get(), end.get());
}
+inline
+const nsTDependentSubstring_CharT
+Substring( const CharT* data, PRUint32 length )
+ {
+ return nsTDependentSubstring_CharT(data, length);
+ }
+
inline
const nsTDependentSubstring_CharT
Substring( const CharT* start, const CharT* end )
diff --git a/xpcom/string/src/nsTDependentSubstring.cpp b/xpcom/string/src/nsTDependentSubstring.cpp
index b5c348a05ef..4b70db4ce85 100644
--- a/xpcom/string/src/nsTDependentSubstring.cpp
+++ b/xpcom/string/src/nsTDependentSubstring.cpp
@@ -54,14 +54,14 @@ nsTDependentSubstring_CharT::Rebind( const substring_type& str, PRUint32 startPo
}
void
-nsTDependentSubstring_CharT::Rebind( const char_type* start, const char_type* end )
+nsTDependentSubstring_CharT::Rebind( const char_type* data, size_type length )
{
- NS_ASSERTION(start && end, "nsTDependentSubstring must wrap a non-NULL buffer");
+ NS_ASSERTION(data, "nsTDependentSubstring must wrap a non-NULL buffer");
// If we currently own a buffer, release it.
Finalize();
- mData = const_cast(start);
- mLength = end - start;
+ mData = const_cast(data);
+ mLength = length;
SetDataFlags(F_NONE);
}
diff --git a/xpcom/string/src/nsTStringObsolete.cpp b/xpcom/string/src/nsTStringObsolete.cpp
index b44fbc7e9be..3b8fce90689 100644
--- a/xpcom/string/src/nsTStringObsolete.cpp
+++ b/xpcom/string/src/nsTStringObsolete.cpp
@@ -479,7 +479,7 @@ nsTString_CharT::AssignWithConversion( const incompatible_char_type* aData, PRIn
if (aLength < 0)
aLength = nsCharTraits::length(aData);
- AssignWithConversion(Substring(aData, aData + aLength));
+ AssignWithConversion(Substring(aData, aLength));
}
}
@@ -498,6 +498,6 @@ nsTString_CharT::AppendWithConversion( const incompatible_char_type* aData, PRIn
if (aLength < 0)
aLength = nsCharTraits::length(aData);
- AppendWithConversion(Substring(aData, aData + aLength));
+ AppendWithConversion(Substring(aData, aLength));
}
}