Bug 1635098 - Allow nullish coalescing and optional chaining operators in newtab jsm code r=k88hudson

Include babel plugins to allow unit testing of files using the operators.
Reverts "Bug 1635054 - stop using ?. operator in newtab download manager code, r=aryx"

Differential Revision: https://phabricator.services.mozilla.com/D73739
This commit is contained in:
Ed Lee 2020-05-28 00:56:13 +00:00
Родитель 3cb405965c
Коммит 7de983a9b3
4 изменённых файлов: 43 добавлений и 3 удалений

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

@ -161,6 +161,8 @@ module.exports = function(config) {
replace: true, replace: true,
}, },
], // require("babel-plugin-jsm-to-commonjs") ], // require("babel-plugin-jsm-to-commonjs")
"@babel/plugin-proposal-nullish-coalescing-operator",
"@babel/plugin-proposal-optional-chaining",
], ],
}, },
}, },

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

@ -35,9 +35,7 @@ this.DownloadsManager = class DownloadsManager {
} }
formatDownload(download) { formatDownload(download) {
let { referrerInfo } = download.source; let referrer = download.source.referrerInfo?.originalReferrer?.spec || null;
let referrer = (referrerInfo && referrerInfo.originalReferrer) || null;
referrer = (referrer && referrer.spec) || null;
return { return {
hostname: new URL(download.source.url).hostname, hostname: new URL(download.source.url).hostname,
url: download.source.url, url: download.source.url,

38
browser/components/newtab/package-lock.json сгенерированный
Просмотреть файл

@ -121,6 +121,26 @@
"integrity": "sha512-0fKu/QqildpXmPVaRBoXOlyBb3MC+J0A66x97qEfLOMkn3u6nfY5esWogQwi/K0BjASYy4DbnsEWnpNL6qT5Mw==", "integrity": "sha512-0fKu/QqildpXmPVaRBoXOlyBb3MC+J0A66x97qEfLOMkn3u6nfY5esWogQwi/K0BjASYy4DbnsEWnpNL6qT5Mw==",
"dev": true "dev": true
}, },
"@babel/plugin-proposal-nullish-coalescing-operator": {
"version": "7.8.3",
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.8.3.tgz",
"integrity": "sha512-TS9MlfzXpXKt6YYomudb/KU7nQI6/xnapG6in1uZxoxDghuSMZsPb6D2fyUwNYSAp4l1iR7QtFOjkqcRYcUsfw==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.8.3",
"@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.0"
}
},
"@babel/plugin-proposal-optional-chaining": {
"version": "7.9.0",
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.9.0.tgz",
"integrity": "sha512-NDn5tu3tcv4W30jNhmc2hyD5c56G6cXx4TesJubhxrJeCvuuMpttxr0OnNCqbZGhFjLrg+NIhxxC+BK5F6yS3w==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.8.3",
"@babel/plugin-syntax-optional-chaining": "^7.8.0"
}
},
"@babel/plugin-syntax-jsx": { "@babel/plugin-syntax-jsx": {
"version": "7.8.3", "version": "7.8.3",
"resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.8.3.tgz", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.8.3.tgz",
@ -130,6 +150,24 @@
"@babel/helper-plugin-utils": "^7.8.3" "@babel/helper-plugin-utils": "^7.8.3"
} }
}, },
"@babel/plugin-syntax-nullish-coalescing-operator": {
"version": "7.8.3",
"resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz",
"integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.8.0"
}
},
"@babel/plugin-syntax-optional-chaining": {
"version": "7.8.3",
"resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz",
"integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.8.0"
}
},
"@babel/plugin-transform-react-display-name": { "@babel/plugin-transform-react-display-name": {
"version": "7.8.3", "version": "7.8.3",
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.8.3.tgz", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.8.3.tgz",

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

@ -18,6 +18,8 @@
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "7.8.4", "@babel/core": "7.8.4",
"@babel/plugin-proposal-nullish-coalescing-operator": "7.8.3",
"@babel/plugin-proposal-optional-chaining": "7.9.0",
"@babel/preset-react": "7.8.3", "@babel/preset-react": "7.8.3",
"acorn": "7.1.0", "acorn": "7.1.0",
"babel-loader": "8.0.6", "babel-loader": "8.0.6",