Skip to content

Commit 9415a9f

Browse files
committed
Bug 1866802 - Move ASRouterAdmin tool to about:asrouter and its own component folder. r=pdahiya,Gijs,desktop-theme-reviewers,dao
This tries to maintain stylistic continuity, while also trying to decouple from newtab as much as possible. This is a first foray, and future patches will further this decoupling. This also modifies about:asrouter to show an error message if the ASRouter devtools pref is not set to true. Differential Revision: https://phabricator.services.mozilla.com/D194811
1 parent 19fe553 commit 9415a9f

29 files changed

+12268
-0
lines changed

.eslintrc.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ module.exports = {
233233
"browser/components/Browser*",
234234
"browser/components/aboutlogins/**",
235235
"browser/components/aboutwelcome/**",
236+
"browser/components/asrouter/**",
236237
"browser/components/attribution/**",
237238
"browser/components/customizableui/**",
238239
"browser/components/downloads/**",
@@ -498,6 +499,7 @@ module.exports = {
498499
extends: ["plugin:react-hooks/recommended"],
499500
files: [
500501
"browser/components/aboutwelcome/**",
502+
"browser/components/asrouter/**",
501503
"browser/components/newtab/**",
502504
"browser/components/pocket/**",
503505
"devtools/**",

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,20 @@ security/manager/.nss.checkout
5656
# gecko.log is generated by various test harnesses
5757
/gecko.log
5858

59+
# Ignore all node_modules directories
60+
node_modules/
61+
# ...but allow ones under third_party
62+
!/third_party/**/node_modules/
63+
5964
# Ignore newtab component build assets
6065
browser/components/newtab/logs/
6166

6267
# Ignore about:welcome component build assets
6368
browser/components/aboutwelcome/logs/
6469

70+
# Ignore ASRouter component build assets
71+
browser/components/asrouter/logs/
72+
6573
# Ignore ASRouter generated test files
6674
browser/components/newtab/content-src/asrouter/schemas/corpus/CFRMessageProvider.messages.json
6775
browser/components/newtab/content-src/asrouter/schemas/corpus/OnboardingMessageProvider.messages.json

.hgignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ compile_commands\.json
6060
# Ignore about:welcome build assets
6161
^browser/components/aboutwelcome/logs/
6262

63+
# Ignore ASRouter component build assets
64+
^browser/components/asrouter/logs/
65+
6366
# Ignore ASRouter generated test files
6467
^browser/components/newtab/content-src/asrouter/schemas/corpus/CFRMessageProvider.messages.json
6568
^browser/components/newtab/content-src/asrouter/schemas/corpus/OnboardingMessageProvider.messages.json
@@ -198,6 +201,7 @@ _OPT\.OBJ/
198201
^node_modules/
199202
^tools/browsertime/node_modules/
200203
^tools/lint/eslint/eslint-plugin-mozilla/node_modules/
204+
^browser/components/asrouter/node_modules/
201205
^browser/components/newtab/node_modules/
202206
^browser/components/aboutwelcome/node_modules/
203207
^tools/esmify/node_modules/

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,6 +1449,9 @@ xpcom/io/crc32c.c
14491449

14501450
.gradle/
14511451
browser/components/aboutwelcome/content/aboutwelcome.bundle.js
1452+
browser/components/asrouter/node_modules/
1453+
browser/components/asrouter/content/asrouter-admin.bundle.js
1454+
browser/components/asrouter/logs/
14521455
browser/components/newtab/content-src/asrouter/schemas/BackgroundTaskMessagingExperiment.schema.json
14531456
browser/components/newtab/content-src/asrouter/schemas/MessagingExperiment.schema.json
14541457
browser/components/newtab/logs/

.stylelintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ obj*/
2626
browser/components/pocket/content/panels/css/main.compiled.css
2727
browser/components/newtab/**/*.css
2828
browser/components/aboutwelcome/**/*.css
29+
browser/components/asrouter/**/*.css
2930

3031
# Note that the debugger has its own stylelint setup, but that currently
3132
# produces errors. Bug 1831302 tracks making this better

.stylelintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ module.exports = {
260260
{
261261
files: [
262262
"browser/components/aboutwelcome/**",
263+
"browser/components/asrouter/**",
263264
"browser/components/newtab/**",
264265
],
265266
customSyntax: "postcss-scss",

browser/components/BrowserGlue.sys.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,7 @@ let JSWINDOWACTORS = {
581581
includeChrome: true,
582582
allFrames: true,
583583
matches: [
584+
"about:asrouter",
584585
"about:home",
585586
"about:newtab",
586587
"about:welcome",
@@ -796,6 +797,7 @@ let JSWINDOWACTORS = {
796797
},
797798
},
798799
matches: [
800+
"about:asrouter*",
799801
"about:home*",
800802
"about:newtab*",
801803
"about:welcome*",

browser/components/about/AboutRedirector.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ struct RedirEntry {
4444
browser/components/about/components.conf
4545
*/
4646
static const RedirEntry kRedirMap[] = {
47+
{"asrouter", "chrome://browser/content/asrouter/asrouter-admin.html",
48+
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
49+
nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS |
50+
nsIAboutModule::URI_MUST_LOAD_IN_CHILD | nsIAboutModule::ALLOW_SCRIPT |
51+
nsIAboutModule::HIDE_FROM_ABOUTABOUT},
4752
{"blocked", "chrome://browser/content/blockedSite.xhtml",
4853
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
4954
nsIAboutModule::URI_CAN_LOAD_IN_CHILD | nsIAboutModule::ALLOW_SCRIPT |

browser/components/about/components.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
66

77
pages = [
8+
'asrouter',
89
'blocked',
910
'certerror',
1011
'downloads',
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
5+
module.exports = {
6+
// When adding items to this file please check for effects on sub-directories.
7+
parserOptions: {
8+
ecmaFeatures: {
9+
jsx: true,
10+
},
11+
},
12+
plugins: ["import", "react", "jsx-a11y"],
13+
settings: {
14+
react: {
15+
version: "16.2.0",
16+
},
17+
},
18+
extends: ["plugin:jsx-a11y/recommended"],
19+
overrides: [
20+
{
21+
// Only mark the files as modules which are actually modules.
22+
// TODO: Add "tests/unit/**" to this list once we get our tests built.
23+
files: ["content-src/**"],
24+
parserOptions: {
25+
sourceType: "module",
26+
},
27+
},
28+
{
29+
// TODO: Add ./*.js and tests/unit/** to this list if necessary
30+
files: ["./*.js", "content-src/**"],
31+
env: {
32+
node: true,
33+
},
34+
},
35+
/* TODO: Turn this rule on when I move the tests over.
36+
{
37+
// Use a configuration that's appropriate for modules, workers and
38+
// non-production files.
39+
files: ["modules/*.jsm", "tests/**"],
40+
rules: {
41+
"no-implicit-globals": "off",
42+
},
43+
},
44+
*/
45+
{
46+
// TODO: Add "tests/unit/**" to this list once we get our tests built.
47+
files: ["content-src/**"],
48+
rules: {
49+
// Disallow commonjs in these directories.
50+
"import/no-commonjs": 2,
51+
// Allow JSX with arrow functions.
52+
"react/jsx-no-bind": 0,
53+
},
54+
},
55+
/* TODO: Turn this rule on when I move the tests over.
56+
{
57+
// These tests simulate the browser environment.
58+
files: "tests/unit/**",
59+
env: {
60+
browser: true,
61+
mocha: true,
62+
},
63+
globals: {
64+
assert: true,
65+
chai: true,
66+
sinon: true,
67+
},
68+
},
69+
{
70+
files: "tests/**",
71+
rules: {
72+
"func-name-matching": 0,
73+
"lines-between-class-members": 0,
74+
"require-await": 0,
75+
},
76+
},*/
77+
],
78+
rules: {
79+
"fetch-options/no-fetch-credentials": "error",
80+
81+
"react/jsx-boolean-value": ["error", "always"],
82+
"react/jsx-key": "error",
83+
"react/jsx-no-bind": "error",
84+
"react/jsx-no-comment-textnodes": "error",
85+
"react/jsx-no-duplicate-props": "error",
86+
"react/jsx-no-target-blank": "error",
87+
"react/jsx-no-undef": "error",
88+
"react/jsx-pascal-case": "error",
89+
"react/jsx-uses-react": "error",
90+
"react/jsx-uses-vars": "error",
91+
"react/no-access-state-in-setstate": "error",
92+
"react/no-danger": "error",
93+
"react/no-deprecated": "error",
94+
"react/no-did-mount-set-state": "error",
95+
"react/no-did-update-set-state": "error",
96+
"react/no-direct-mutation-state": "error",
97+
"react/no-is-mounted": "error",
98+
"react/no-unknown-property": "error",
99+
"react/require-render-return": "error",
100+
101+
"accessor-pairs": ["error", { setWithoutGet: true, getWithoutSet: false }],
102+
"array-callback-return": "error",
103+
"block-scoped-var": "error",
104+
"consistent-this": ["error", "use-bind"],
105+
eqeqeq: "error",
106+
"for-direction": "error",
107+
"func-name-matching": "error",
108+
"getter-return": "error",
109+
"guard-for-in": "error",
110+
"handle-callback-err": "error",
111+
"lines-between-class-members": "error",
112+
"max-depth": ["error", 4],
113+
"max-nested-callbacks": ["error", 4],
114+
"max-params": ["error", 6],
115+
"max-statements": ["error", 50],
116+
"max-statements-per-line": ["error", { max: 2 }],
117+
"new-cap": ["error", { newIsCap: true, capIsNew: false }],
118+
"no-alert": "error",
119+
"no-buffer-constructor": "error",
120+
"no-console": ["error", { allow: ["error"] }],
121+
"no-div-regex": "error",
122+
"no-duplicate-imports": "error",
123+
"no-eq-null": "error",
124+
"no-extend-native": "error",
125+
"no-extra-label": "error",
126+
"no-implicit-coercion": ["error", { allow: ["!!"] }],
127+
"no-implicit-globals": "error",
128+
"no-loop-func": "error",
129+
"no-mixed-requires": "error",
130+
"no-multi-assign": "error",
131+
"no-multi-str": "error",
132+
"no-new": "error",
133+
"no-new-func": "error",
134+
"no-new-require": "error",
135+
"no-octal-escape": "error",
136+
"no-param-reassign": "error",
137+
"no-path-concat": "error",
138+
"no-process-exit": "error",
139+
"no-proto": "error",
140+
"no-prototype-builtins": "error",
141+
"no-return-assign": ["error", "except-parens"],
142+
"no-script-url": "error",
143+
"no-shadow": "error",
144+
"no-template-curly-in-string": "error",
145+
"no-undef-init": "error",
146+
"no-unmodified-loop-condition": "error",
147+
"no-unused-expressions": "error",
148+
"no-use-before-define": "error",
149+
"no-useless-computed-key": "error",
150+
"no-useless-constructor": "error",
151+
"no-useless-rename": "error",
152+
"no-var": "error",
153+
"no-void": ["error", { allowAsStatement: true }],
154+
"one-var": ["error", "never"],
155+
"operator-assignment": ["error", "always"],
156+
"prefer-destructuring": [
157+
"error",
158+
{
159+
AssignmentExpression: { array: true },
160+
VariableDeclarator: { array: true, object: true },
161+
},
162+
],
163+
"prefer-numeric-literals": "error",
164+
"prefer-promise-reject-errors": "error",
165+
"prefer-rest-params": "error",
166+
"prefer-spread": "error",
167+
"prefer-template": "error",
168+
radix: ["error", "always"],
169+
"require-await": "error",
170+
"sort-vars": "error",
171+
"symbol-description": "error",
172+
"vars-on-top": "error",
173+
yoda: ["error", "never"],
174+
},
175+
};

0 commit comments

Comments
 (0)