Merge remote-tracking branch 'mozilla/central'

This commit is contained in:
Ed Lee 2019-05-29 11:36:34 -07:00
Родитель 9808476e87 d46dc3268c
Коммит 4162a25064
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 40B7250312F03605
7 изменённых файлов: 49 добавлений и 64 удалений

Просмотреть файл

@ -1,11 +1,5 @@
activity-streams-env/
dist/
firefox/
bin/prerender.js
data/
logs/
stats.json
prerendered/
vendor/
data/
bin/prerender.js
bin/prerender.js.map
aboutlibrary/content/

Просмотреть файл

@ -13,11 +13,12 @@ module.exports = {
},
"plugins": [
"import", // require("eslint-plugin-import")
"json", // require("eslint-plugin-json")
"promise", // require("eslint-plugin-promise")
"react", // require("eslint-plugin-react")
"react-hooks", // require("react-hooks")
"fetch-options", // require("eslint-plugin-fetch-options")
"jsx-a11y" // require("eslint-plugin-jsx-a11y")
// Temporarily disabled since they aren't vendored into in mozilla central yet
// "react-hooks", // require("react-hooks")
// "fetch-options", // require("eslint-plugin-fetch-options")
],
"settings": {
"react": {
@ -25,7 +26,9 @@ module.exports = {
}
},
"extends": [
"eslint:recommended",
"plugin:jsx-a11y/recommended", // require("eslint-plugin-jsx-a11y")
"plugin:mozilla/recommended", // require("eslint-plugin-mozilla")
"plugin:mozilla/browser-test",
"plugin:mozilla/mochitest-test",
@ -36,26 +39,36 @@ module.exports = {
"RPMSendAsyncMessage": true,
"NewTabPagePreloading": true,
},
"overrides": [{
// Use a configuration that's more appropriate for JSMs
"files": "**/*.jsm",
"parserOptions": {
"sourceType": "script"
"overrides": [
{
// These files use fluent-dom to insert content
"files": [
"content-src/asrouter/templates/OnboardingMessage/**",
"content-src/asrouter/templates/Trailhead/**",
],
"rules": {
"jsx-a11y/anchor-has-content": 0,
"jsx-a11y/heading-has-content": 0,
}
},
"env": {
"node": false
},
"rules": {
"no-implicit-globals": 0
{
// Use a configuration that's more appropriate for JSMs
"files": "**/*.jsm",
"parserOptions": {
"sourceType": "script"
},
"env": {
"node": false
},
"rules": {
"no-implicit-globals": 0
}
}
}],
],
"rules": {
"react-hooks/rules-of-hooks": 2,
// "react-hooks/rules-of-hooks": 2,
"fetch-options/no-fetch-credentials": 2,
"promise/catch-or-return": 2,
"promise/param-names": 2,
// "fetch-options/no-fetch-credentials": 2,
"react/jsx-boolean-value": [2, "always"],
"react/jsx-closing-bracket-location": [2, "after-props"],

Просмотреть файл

@ -1,17 +0,0 @@
module.exports = {
"plugins": [
"jsx-a11y" // require("eslint-plugin-jsx-a11y")
],
"extends": "plugin:jsx-a11y/recommended",
"overrides": [{
// These files use fluent-dom to insert content
"files": [
"content-src/asrouter/templates/OnboardingMessage/**",
"content-src/asrouter/templates/Trailhead/**",
],
"rules": {
"jsx-a11y/anchor-has-content": 0,
"jsx-a11y/heading-has-content": 0,
}
}],
};

Просмотреть файл

@ -26,18 +26,18 @@ const BASE_URL = "resource://activity-stream/";
const ACTIVITY_STREAM_PAGES = new Set(["home", "newtab", "welcome"]);
const IS_MAIN_PROCESS = Services.appinfo.processType === Services.appinfo.PROCESS_TYPE_DEFAULT;
const IS_PRIVILEGED_PROCESS = Services.appinfo.remoteType === E10SUtils.PRIVILEGED_REMOTE_TYPE;
const IS_PRIVILEGED_PROCESS = Services.appinfo.remoteType === E10SUtils.PRIVILEGEDABOUT_REMOTE_TYPE;
const IS_RELEASE_OR_BETA = AppConstants.RELEASE_OR_BETA;
const PREF_SEPARATE_PRIVILEGED_CONTENT_PROCESS = "browser.tabs.remote.separatePrivilegedContentProcess";
const PREF_SEPARATE_PRIVILEGEDABOUT_CONTENT_PROCESS = "browser.tabs.remote.separatePrivilegedContentProcess";
const PREF_ACTIVITY_STREAM_PRERENDER_ENABLED = "browser.newtabpage.activity-stream.prerender";
const PREF_ACTIVITY_STREAM_DEBUG = "browser.newtabpage.activity-stream.debug";
function AboutNewTabService() {
Services.obs.addObserver(this, TOPIC_APP_QUIT);
Services.obs.addObserver(this, TOPIC_LOCALES_CHANGE);
Services.prefs.addObserver(PREF_SEPARATE_PRIVILEGED_CONTENT_PROCESS, this);
Services.prefs.addObserver(PREF_SEPARATE_PRIVILEGEDABOUT_CONTENT_PROCESS, this);
Services.prefs.addObserver(PREF_ACTIVITY_STREAM_PRERENDER_ENABLED, this);
if (!IS_RELEASE_OR_BETA) {
Services.prefs.addObserver(PREF_ACTIVITY_STREAM_DEBUG, this);
@ -93,7 +93,7 @@ AboutNewTabService.prototype = {
_activityStreamPrerender: false,
_activityStreamPath: "",
_activityStreamDebug: false,
_privilegedContentProcess: false,
_privilegedAboutContentProcess: false,
_overridden: false,
willNotifyUser: false,
@ -106,8 +106,8 @@ AboutNewTabService.prototype = {
observe(subject, topic, data) {
switch (topic) {
case "nsPref:changed":
if (data === PREF_SEPARATE_PRIVILEGED_CONTENT_PROCESS) {
this._privilegedContentProcess = Services.prefs.getBoolPref(PREF_SEPARATE_PRIVILEGED_CONTENT_PROCESS);
if (data === PREF_SEPARATE_PRIVILEGEDABOUT_CONTENT_PROCESS) {
this._privilegedAboutContentProcess = Services.prefs.getBoolPref(PREF_SEPARATE_PRIVILEGEDABOUT_CONTENT_PROCESS);
this.updatePrerenderedPath();
this.notifyChange();
} else if (data === PREF_ACTIVITY_STREAM_PRERENDER_ENABLED) {
@ -216,7 +216,7 @@ AboutNewTabService.prototype = {
} else {
this._activityStreamEnabled = false;
}
this._privilegedContentProcess = Services.prefs.getBoolPref(PREF_SEPARATE_PRIVILEGED_CONTENT_PROCESS);
this._privilegedAboutContentProcess = Services.prefs.getBoolPref(PREF_SEPARATE_PRIVILEGEDABOUT_CONTENT_PROCESS);
this._activityStreamPrerender = Services.prefs.getBoolPref(PREF_ACTIVITY_STREAM_PRERENDER_ENABLED);
if (!IS_RELEASE_OR_BETA) {
this._activityStreamDebug = Services.prefs.getBoolPref(PREF_ACTIVITY_STREAM_DEBUG, false);
@ -233,7 +233,7 @@ AboutNewTabService.prototype = {
// Debug files are specially packaged in a non-localized directory, but with
// dynamic script loading, localized debug is supported.
this._activityStreamPath = `${this._activityStreamDebug &&
!this._privilegedContentProcess ? "static" : this.activityStreamLocale}/`;
!this._privilegedAboutContentProcess ? "static" : this.activityStreamLocale}/`;
},
/*
@ -253,8 +253,8 @@ AboutNewTabService.prototype = {
"activity-stream",
this._activityStreamPrerender ? "-prerendered" : "",
// Debug version loads dev scripts but noscripts separately loads scripts
this._activityStreamDebug && !this._privilegedContentProcess ? "-debug" : "",
this._privilegedContentProcess ? "-noscripts" : "",
this._activityStreamDebug && !this._privilegedAboutContentProcess ? "-debug" : "",
this._privilegedAboutContentProcess ? "-noscripts" : "",
".html",
].join("");
},
@ -351,7 +351,7 @@ AboutNewTabService.prototype = {
}
Services.obs.removeObserver(this, TOPIC_APP_QUIT);
Services.obs.removeObserver(this, TOPIC_LOCALES_CHANGE);
Services.prefs.removeObserver(PREF_SEPARATE_PRIVILEGED_CONTENT_PROCESS, this);
Services.prefs.removeObserver(PREF_SEPARATE_PRIVILEGEDABOUT_CONTENT_PROCESS, this);
Services.prefs.removeObserver(PREF_ACTIVITY_STREAM_PRERENDER_ENABLED, this);
if (!IS_RELEASE_OR_BETA) {
Services.prefs.removeObserver(PREF_ACTIVITY_STREAM_DEBUG, this);

Просмотреть файл

@ -14,7 +14,7 @@ cd /activity-stream && npm install . && npm run buildmc
# Build latest m-c with Activity Stream changes
cd /mozilla-central && ./mach build \
&& ./mach lint -l codespell browser/components/newtab \
&& ./mach lint browser/components/newtab \
&& ./mach test browser/components/newtab/test/browser --headless \
&& ./mach test browser/components/newtab/test/xpcshell \
&& ./mach test --log-tbpl test_run_log \

Просмотреть файл

@ -33,14 +33,11 @@
"eslint": "5.16.0",
"eslint-plugin-fetch-options": "0.0.4",
"eslint-plugin-import": "2.17.2",
"eslint-plugin-json": "1.4.0",
"eslint-plugin-jsx-a11y": "6.2.1",
"eslint-plugin-mozilla": "1.2.1",
"eslint-plugin-no-unsanitized": "3.0.2",
"eslint-plugin-promise": "4.1.1",
"eslint-plugin-react": "7.12.4",
"eslint-plugin-react-hooks": "1.6.0",
"eslint-watch": "5.1.2",
"istanbul-instrumenter-loader": "3.0.1",
"joi-browser": "13.4.0",
"karma": "4.1.0",
@ -131,8 +128,7 @@
"tddmc": "karma start karma.mc.config.js --tdd",
"debugcoverage": "open logs/coverage/index.html",
"lint": "npm-run-all lint:*",
"lint:eslint": "esw --ext=.js,.jsm,.json,.jsx .",
"lint:jsx-a11y": "esw --config=.eslintrc.jsx-a11y.js --ext=.jsx content-src/",
"lint:eslint": "eslint --ext=.js,.jsm,.jsx .",
"lint:sasslint": "sass-lint -v -q",
"strings-import": "node ./bin/strings-import.js",
"test": "npm run testmc",

Просмотреть файл

@ -63,8 +63,7 @@ scripts:
# lint: Run eslint and sass-lint
lint:
eslint: esw --ext=.js,.jsm,.json,.jsx .
jsx-a11y: esw --config=.eslintrc.jsx-a11y.js --ext=.jsx content-src/
eslint: eslint --ext=.js,.jsm,.jsx .
sasslint: sass-lint -v -q
# strings-import: Replace local strings with those from l10n-central