Skip to content

Commit 7de983a

Browse files
committed
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
1 parent 3cb4059 commit 7de983a

File tree

4 files changed

+43
-3
lines changed

4 files changed

+43
-3
lines changed

browser/components/newtab/karma.mc.config.js

+2
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ module.exports = function(config) {
161161
replace: true,
162162
},
163163
], // require("babel-plugin-jsm-to-commonjs")
164+
"@babel/plugin-proposal-nullish-coalescing-operator",
165+
"@babel/plugin-proposal-optional-chaining",
164166
],
165167
},
166168
},

browser/components/newtab/lib/DownloadsManager.jsm

+1-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ this.DownloadsManager = class DownloadsManager {
3535
}
3636

3737
formatDownload(download) {
38-
let { referrerInfo } = download.source;
39-
let referrer = (referrerInfo && referrerInfo.originalReferrer) || null;
40-
referrer = (referrer && referrer.spec) || null;
38+
let referrer = download.source.referrerInfo?.originalReferrer?.spec || null;
4139
return {
4240
hostname: new URL(download.source.url).hostname,
4341
url: download.source.url,

browser/components/newtab/package-lock.json

+38
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

browser/components/newtab/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
},
1919
"devDependencies": {
2020
"@babel/core": "7.8.4",
21+
"@babel/plugin-proposal-nullish-coalescing-operator": "7.8.3",
22+
"@babel/plugin-proposal-optional-chaining": "7.9.0",
2123
"@babel/preset-react": "7.8.3",
2224
"acorn": "7.1.0",
2325
"babel-loader": "8.0.6",

0 commit comments

Comments
 (0)