Files
firefox/devtools/client/commandline/test/browser_cmd_pref3.js
T
Nicholas Nethercote 2c805ac89f Bug 1414096 (attempt 2) - Remove support for nsISupportsString values in nsPrefBranch::{get,set}ComplexValue(). r=florian.
Bug 1345294 introduced nsPrefBranch::{get,set}StringPref(), which allowed the
getting of utf8 strings from prefs, which previously required using
nsISupportsString with {get,set}ComplexValue. That bug also converted most
uses.

This patch finishes the job.

- It removes the nsISupportsString support.

- It converts existing code that relied on the nsISupportsString.

- It removes the lint that was set up to detect such uses of nsISupportsString.
2017-11-10 09:07:48 +11:00

106 lines
2.9 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests that the pref commands work
var prefBranch = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefService).getBranch(null)
.QueryInterface(Ci.nsIPrefBranch);
const TEST_URI = "data:text/html;charset=utf-8,gcli-pref3";
function test() {
return Task.spawn(spawnTest).then(finish, helpers.handleError);
}
function* spawnTest() {
let options = yield helpers.openTab(TEST_URI);
yield helpers.openToolbar(options);
let remoteHostOrig = prefBranch.getStringPref("devtools.debugger.remote-host");
info("originally: devtools.debugger.remote-host = " + remoteHostOrig);
yield helpers.audit(options, [
{
setup: "pref show devtools.debugger.remote-host",
check: {
args: {
setting: {
value: options.requisition.system.settings.get("devtools.debugger.remote-host")
}
},
},
exec: {
output: new RegExp("^devtools\.debugger\.remote-host: " + remoteHostOrig + "$"),
},
},
{
setup: "pref set devtools.debugger.remote-host e.com",
check: {
args: {
setting: {
value: options.requisition.system.settings.get("devtools.debugger.remote-host")
},
value: { value: "e.com" }
},
},
exec: {
output: "",
},
},
{
setup: "pref show devtools.debugger.remote-host",
check: {
args: {
setting: {
value: options.requisition.system.settings.get("devtools.debugger.remote-host")
}
},
},
exec: {
output: new RegExp("^devtools\.debugger\.remote-host: e.com$"),
},
post: function () {
var ecom = prefBranch.getStringPref("devtools.debugger.remote-host");
is(ecom, "e.com", "devtools.debugger.remote-host is e.com");
}
},
{
setup: "pref set devtools.debugger.remote-host moz.foo",
check: {
args: {
setting: {
value: options.requisition.system.settings.get("devtools.debugger.remote-host")
},
value: { value: "moz.foo" }
},
},
exec: {
output: "",
},
},
{
setup: "pref show devtools.debugger.remote-host",
check: {
args: {
setting: {
value: options.requisition.system.settings.get("devtools.debugger.remote-host")
}
},
},
exec: {
output: new RegExp("^devtools\.debugger\.remote-host: moz.foo$"),
},
post: function () {
var mozfoo = prefBranch.getStringPref("devtools.debugger.remote-host");
is(mozfoo, "moz.foo", "devtools.debugger.remote-host is moz.foo");
}
},
]);
prefBranch.setStringPref("devtools.debugger.remote-host", remoteHostOrig);
yield helpers.closeToolbar(options);
yield helpers.closeTab(options);
}