Skip to content

Commit

Permalink
Bug 1561435 - Format chrome/, a=automatic-formatting
Browse files Browse the repository at this point in the history
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D35898
  • Loading branch information
Victor Porof committed Jul 5, 2019
1 parent ec2d712 commit 1f53bb9
Show file tree
Hide file tree
Showing 15 changed files with 198 additions and 148 deletions.
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ module.exports = {
],
"overrides": [{
"files": [
"chrome/**",
"config/**",
"devtools/**",
"docshell/**",
Expand Down
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ toolkit/components/telemetry/datareporting-prefs.js
toolkit/components/telemetry/healthreport-prefs.js

# Ignore all top-level directories for now.
chrome/**
config/**
docshell/**
dom/**
Expand Down
5 changes: 3 additions & 2 deletions chrome/test/unit/head_crtestutils.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
const XULAPPINFO_CONTRACTID = "@mozilla.org/xre/app-info;1";
const XULAPPINFO_CID = Components.ID("{4ba645d3-be6f-40d6-a42a-01b2f40091b8}");

var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");

function registerManifests(manifests) {
var reg = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
for (var manifest of manifests)
for (var manifest of manifests) {
reg.autoRegister(manifest);
}
}
9 changes: 4 additions & 5 deletions chrome/test/unit/test_bug292789.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

const MANIFESTS = [
do_get_file("data/test_bug292789.manifest"),
];
const MANIFESTS = [do_get_file("data/test_bug292789.manifest")];

registerManifests(MANIFESTS);

Expand All @@ -18,8 +16,9 @@ function check_accessibility(spec, desired) {
}

function run_test() {
gCR = Cc["@mozilla.org/chrome/chrome-registry;1"].
getService(Ci.nsIXULChromeRegistry);
gCR = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
Ci.nsIXULChromeRegistry
);
gCR.checkForNewChrome();

check_accessibility("chrome://test1/content/", false);
Expand Down
13 changes: 5 additions & 8 deletions chrome/test/unit/test_bug380398.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/


var MANIFESTS = [
do_get_file("data/test_bug380398.manifest"),
];
var MANIFESTS = [do_get_file("data/test_bug380398.manifest")];

registerManifests(MANIFESTS);

Expand All @@ -18,8 +15,9 @@ updateAppInfo({
platformVersion: "1.9",
});

var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]
.getService(Ci.nsIChromeRegistry);
var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
Ci.nsIChromeRegistry
);
chromeReg.checkForNewChrome();

var target = Services.io.newFileURI(do_get_file("data"));
Expand All @@ -40,8 +38,7 @@ function test_failed_mapping(namespace) {
try {
chromeReg.convertChromeURL(uri);
do_throw(namespace);
} catch (ex) {
}
} catch (ex) {}
}

function run_test() {
Expand Down
13 changes: 5 additions & 8 deletions chrome/test/unit/test_bug397073.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

var MANIFESTS = [
do_get_file("data/test_bug397073.manifest"),
];

var MANIFESTS = [do_get_file("data/test_bug397073.manifest")];

registerManifests(MANIFESTS);

Expand All @@ -18,8 +15,9 @@ updateAppInfo({
platformVersion: "1.9",
});

var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]
.getService(Ci.nsIChromeRegistry);
var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
Ci.nsIChromeRegistry
);
chromeReg.checkForNewChrome();

var target = Services.io.newFileURI(do_get_file("data"));
Expand All @@ -40,8 +38,7 @@ function test_failed_mapping(namespace) {
try {
chromeReg.convertChromeURL(uri);
do_throw(namespace);
} catch (ex) {
}
} catch (ex) {}
}

function run_test() {
Expand Down
12 changes: 5 additions & 7 deletions chrome/test/unit/test_bug399707.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

var MANIFESTS = [
do_get_file("data/test_bug399707.manifest"),
];
var MANIFESTS = [do_get_file("data/test_bug399707.manifest")];

registerManifests(MANIFESTS);

Expand All @@ -17,8 +15,9 @@ updateAppInfo({
platformVersion: "1.9",
});

var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]
.getService(Ci.nsIChromeRegistry);
var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
Ci.nsIChromeRegistry
);
chromeReg.checkForNewChrome();

var target = Services.io.newFileURI(do_get_file("data"));
Expand All @@ -39,8 +38,7 @@ function test_failed_mapping(namespace) {
try {
chromeReg.convertChromeURL(uri);
do_throw(namespace);
} catch (ex) {
}
} catch (ex) {}
}

function run_test() {
Expand Down
18 changes: 10 additions & 8 deletions chrome/test/unit/test_bug401153.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

var MANIFESTS = [
do_get_file("data/test_bug401153.manifest"),
];
var MANIFESTS = [do_get_file("data/test_bug401153.manifest")];

registerManifests(MANIFESTS);

Expand All @@ -17,18 +15,22 @@ updateAppInfo({
platformVersion: "1.9",
});

var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]
.getService(Ci.nsIChromeRegistry);
var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
Ci.nsIChromeRegistry
);
chromeReg.checkForNewChrome();

var rph = Services.io.getProtocolHandler("resource")
.QueryInterface(Ci.nsIResProtocolHandler);
var rph = Services.io
.getProtocolHandler("resource")
.QueryInterface(Ci.nsIResProtocolHandler);

function test_succeeded_mapping(namespace, target) {
try {
Assert.ok(rph.hasSubstitution(namespace));
var uri = Services.io.newURI("resource://" + namespace);
dump("### checking for " + target + ", getting " + rph.resolveURI(uri) + "\n");
dump(
"### checking for " + target + ", getting " + rph.resolveURI(uri) + "\n"
);
Assert.equal(rph.resolveURI(uri), target);
} catch (ex) {
dump(ex + "\n");
Expand Down
23 changes: 14 additions & 9 deletions chrome/test/unit/test_bug415367.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ function test_uri(obj) {
message = obj.uri + " should be accepted as a valid URI";
}
}
if (failed)
if (failed) {
do_throw(message);
}
if (obj.result) {
Assert.ok(uri != null);
Assert.equal(uri.spec, obj.uri);
Expand All @@ -29,14 +30,18 @@ function test_uri(obj) {

function run_test() {
var tests = [
{uri: "chrome://blah/content/blah.xul", result: true},
{uri: "chrome://blah/content/:/blah/blah.xul", result: false},
{uri: "chrome://blah/content/%252e./blah/blah.xul", result: false},
{uri: "chrome://blah/content/%252e%252e/blah/blah.xul", result: false},
{uri: "chrome://blah/content/blah.xul?param=%252e./blah/", result: true},
{uri: "chrome://blah/content/blah.xul?param=:/blah/", result: true},
{uri: "chrome://blah/content/blah.xul?param=%252e%252e/blah/", result: true},
{ uri: "chrome://blah/content/blah.xul", result: true },
{ uri: "chrome://blah/content/:/blah/blah.xul", result: false },
{ uri: "chrome://blah/content/%252e./blah/blah.xul", result: false },
{ uri: "chrome://blah/content/%252e%252e/blah/blah.xul", result: false },
{ uri: "chrome://blah/content/blah.xul?param=%252e./blah/", result: true },
{ uri: "chrome://blah/content/blah.xul?param=:/blah/", result: true },
{
uri: "chrome://blah/content/blah.xul?param=%252e%252e/blah/",
result: true,
},
];
for (var i = 0; i < tests.length; ++i)
for (var i = 0; i < tests.length; ++i) {
test_uri(tests[i]);
}
}
10 changes: 7 additions & 3 deletions chrome/test/unit/test_bug564667.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
const UNPACKAGED_ADDON = do_get_file("data/test_bug564667");
const PACKAGED_ADDON = do_get_file("data/test_bug564667.xpi");

var gCR = Cc["@mozilla.org/chrome/chrome-registry;1"].
getService(Ci.nsIChromeRegistry);
var gCR = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
Ci.nsIChromeRegistry
);

/*
* Checks that a mapping was added
Expand Down Expand Up @@ -78,5 +79,8 @@ function run_test() {
testManifest(UNPACKAGED_ADDON, Services.io.newFileURI(UNPACKAGED_ADDON).spec);

// Test a packaged addon
testManifest(PACKAGED_ADDON, "jar:" + Services.io.newFileURI(PACKAGED_ADDON).spec + "!/");
testManifest(
PACKAGED_ADDON,
"jar:" + Services.io.newFileURI(PACKAGED_ADDON).spec + "!/"
);
}
20 changes: 11 additions & 9 deletions chrome/test/unit/test_bug848297.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

var MANIFESTS = [
do_get_file("data/test_bug848297.manifest"),
];
var MANIFESTS = [do_get_file("data/test_bug848297.manifest")];

// Stub in the locale service so we can control what gets returned as the OS locale setting

registerManifests(MANIFESTS);

var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]
.getService(Ci.nsIXULChromeRegistry)
.QueryInterface(Ci.nsIToolkitChromeRegistry);
.getService(Ci.nsIXULChromeRegistry)
.QueryInterface(Ci.nsIToolkitChromeRegistry);
chromeReg.checkForNewChrome();

function enum_to_array(strings) {
Expand All @@ -25,12 +23,16 @@ function run_test() {
Services.locale.requestedLocales = ["de"];
Assert.equal(chromeReg.getSelectedLocale("basepack"), "en-US");
Assert.equal(chromeReg.getSelectedLocale("overpack"), "de");
Assert.deepEqual(enum_to_array(chromeReg.getLocalesForPackage("basepack")),
["en-US", "fr"]);
Assert.deepEqual(enum_to_array(chromeReg.getLocalesForPackage("basepack")), [
"en-US",
"fr",
]);

// with override
Services.prefs.setCharPref("chrome.override_package.basepack", "overpack");
Assert.equal(chromeReg.getSelectedLocale("basepack"), "de");
Assert.deepEqual(enum_to_array(chromeReg.getLocalesForPackage("basepack")),
["de", "en-US"]);
Assert.deepEqual(enum_to_array(chromeReg.getLocalesForPackage("basepack")), [
"de",
"en-US",
]);
}
5 changes: 3 additions & 2 deletions chrome/test/unit/test_crlf.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
registerManifests([do_get_file("data/test_crlf.manifest")]);

function run_test() {
let cr = Cc["@mozilla.org/chrome/chrome-registry;1"].
getService(Ci.nsIChromeRegistry);
let cr = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
Ci.nsIChromeRegistry
);

let sourceURI = Services.io.newURI("chrome://test_crlf/content/");
// this throws for packages that are not registered
Expand Down
Loading

0 comments on commit 1f53bb9

Please sign in to comment.