Skip to content

Commit 4895323

Browse files
committed
Bug 1996347 - Newtab move feature gate for tests and automation into activitystream r=whimboo,home-newtab-reviewers,nbarrett
Differential Revision: https://phabricator.services.mozilla.com/D271335 UltraBlame original commit: 40b383e82dcdf9b1936267e9987a275423385e1a
1 parent df4047e commit 4895323

File tree

11 files changed

+222
-455
lines changed

11 files changed

+222
-455
lines changed

browser/extensions/newtab/content-src/components/Weather/Weather.jsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,6 +1345,16 @@ values
13451345
[
13461346
PREF_SYSTEM_SHOW_WEATHER
13471347
]
1348+
&
1349+
&
1350+
values
1351+
[
1352+
"
1353+
feeds
1354+
.
1355+
weatherfeed
1356+
"
1357+
]
13481358
;
13491359
const
13501360
experimentValue

browser/extensions/newtab/data/content/activity-stream.bundle.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82263,6 +82263,16 @@ values
8226382263
[
8226482264
PREF_SYSTEM_SHOW_WEATHER
8226582265
]
82266+
&
82267+
&
82268+
values
82269+
[
82270+
"
82271+
feeds
82272+
.
82273+
weatherfeed
82274+
"
82275+
]
8226682276
;
8226782277
const
8226882278
experimentValue

browser/extensions/newtab/lib/ActivityStream.sys.mjs

Lines changed: 175 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,6 +1107,23 @@ urlbar
11071107
placeholderName
11081108
"
11091109
;
1110+
const
1111+
PREF_SHOULD_AS_INITIALIZE_FEEDS
1112+
=
1113+
"
1114+
browser
1115+
.
1116+
newtabpage
1117+
.
1118+
activity
1119+
-
1120+
stream
1121+
.
1122+
testing
1123+
.
1124+
shouldInitializeFeeds
1125+
"
1126+
;
11101127
export
11111128
const
11121129
WEATHER_OPTIN_REGIONS
@@ -1397,6 +1414,67 @@ value
13971414
)
13981415
;
13991416
}
1417+
export
1418+
function
1419+
shouldInitializeFeeds
1420+
(
1421+
defaultValue
1422+
=
1423+
true
1424+
)
1425+
{
1426+
/
1427+
/
1428+
For
1429+
tests
1430+
/
1431+
automation
1432+
:
1433+
when
1434+
false
1435+
newtab
1436+
won
1437+
'
1438+
t
1439+
initialize
1440+
/
1441+
/
1442+
select
1443+
feeds
1444+
in
1445+
this
1446+
session
1447+
.
1448+
/
1449+
/
1450+
Flipping
1451+
after
1452+
initialization
1453+
has
1454+
no
1455+
effect
1456+
on
1457+
the
1458+
current
1459+
session
1460+
.
1461+
const
1462+
shouldInitialize
1463+
=
1464+
Services
1465+
.
1466+
prefs
1467+
.
1468+
getBoolPref
1469+
(
1470+
PREF_SHOULD_AS_INITIALIZE_FEEDS
1471+
defaultValue
1472+
)
1473+
;
1474+
return
1475+
shouldInitialize
1476+
;
1477+
}
14001478
function
14011479
useInferredPersonalization
14021480
(
@@ -8097,12 +8175,6 @@ Store
80978175
;
80988176
this
80998177
.
8100-
feeds
8101-
=
8102-
FEEDS_CONFIG
8103-
;
8104-
this
8105-
.
81068178
_defaultPrefs
81078179
=
81088180
new
@@ -8114,6 +8186,103 @@ PREFS_CONFIG
81148186
)
81158187
;
81168188
}
8189+
get
8190+
feeds
8191+
(
8192+
)
8193+
{
8194+
if
8195+
(
8196+
shouldInitializeFeeds
8197+
(
8198+
)
8199+
)
8200+
{
8201+
return
8202+
FEEDS_CONFIG
8203+
;
8204+
}
8205+
/
8206+
/
8207+
We
8208+
currently
8209+
make
8210+
excpetions
8211+
for
8212+
topsites
8213+
and
8214+
prefs
8215+
feeds
8216+
/
8217+
/
8218+
because
8219+
they
8220+
currently
8221+
impacts
8222+
tests
8223+
timing
8224+
for
8225+
places
8226+
initialization
8227+
.
8228+
/
8229+
/
8230+
See
8231+
bug
8232+
1999166
8233+
.
8234+
const
8235+
feeds
8236+
=
8237+
new
8238+
Map
8239+
(
8240+
[
8241+
[
8242+
"
8243+
feeds
8244+
.
8245+
system
8246+
.
8247+
topsites
8248+
"
8249+
FEEDS_CONFIG
8250+
.
8251+
get
8252+
(
8253+
"
8254+
feeds
8255+
.
8256+
system
8257+
.
8258+
topsites
8259+
"
8260+
)
8261+
]
8262+
[
8263+
"
8264+
feeds
8265+
.
8266+
prefs
8267+
"
8268+
FEEDS_CONFIG
8269+
.
8270+
get
8271+
(
8272+
"
8273+
feeds
8274+
.
8275+
prefs
8276+
"
8277+
)
8278+
]
8279+
]
8280+
)
8281+
;
8282+
return
8283+
feeds
8284+
;
8285+
}
81178286
init
81188287
(
81198288
)

browser/extensions/newtab/test/unit/content-src/components/Weather.test.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,13 @@ PREF_SYS_SHOW_WEATHER_OPT_IN
297297
]
298298
:
299299
false
300+
"
301+
feeds
302+
.
303+
weatherfeed
304+
"
305+
:
306+
true
300307
}
301308
}
302309
Weather

browser/extensions/newtab/test/unit/utils.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,7 @@ value
780780
getBoolPref
781781
(
782782
prefName
783+
defaultValue
783784
)
784785
{
785786
return
@@ -788,6 +789,7 @@ this
788789
get
789790
(
790791
prefName
792+
defaultValue
791793
)
792794
;
793795
}

browser/modules/AboutNewTab.sys.mjs

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -245,17 +245,6 @@ before
245245
change
246246
"
247247
;
248-
const
249-
PREF_SHOULD_INITIALIZE
250-
=
251-
"
252-
browser
253-
.
254-
newtabpage
255-
.
256-
shouldInitialize
257-
"
258-
;
259248
export
260249
const
261250
AboutNewTab
@@ -339,59 +328,6 @@ initialized
339328
return
340329
;
341330
}
342-
/
343-
/
344-
For
345-
tests
346-
/
347-
automation
348-
:
349-
when
350-
false
351-
newtab
352-
won
353-
'
354-
t
355-
initialize
356-
in
357-
this
358-
session
359-
.
360-
/
361-
/
362-
Flipping
363-
after
364-
initialization
365-
has
366-
no
367-
effect
368-
on
369-
the
370-
current
371-
session
372-
.
373-
const
374-
shouldInitialize
375-
=
376-
Services
377-
.
378-
prefs
379-
.
380-
getBoolPref
381-
(
382-
PREF_SHOULD_INITIALIZE
383-
true
384-
)
385-
;
386-
if
387-
(
388-
!
389-
shouldInitialize
390-
)
391-
{
392-
return
393-
;
394-
}
395331
Services
396332
.
397333
obs

browser/modules/test/browser/browser.toml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -414,13 +414,6 @@ https_first_disabled
414414
true
415415
[
416416
"
417-
browser_aboutnewtab_init_gate
418-
.
419-
js
420-
"
421-
]
422-
[
423-
"
424417
browser_preloading_tab_moving
425418
.
426419
js

0 commit comments

Comments
 (0)