Backed out 2 changesets (bug 1486931, bug 1486631) for browser_onboarding_accessibility.js failures CLOSED TREE

Backed out changeset 8a25fc40764a (bug 1486931)
Backed out changeset a89328c87888 (bug 1486631)
This commit is contained in:
Ciure Andrei
2018-08-29 01:55:19 +03:00
parent 492d4d46ce
commit e8aeceaa3d
88 changed files with 644 additions and 1748 deletions

View File

@@ -7,6 +7,7 @@ const SNIPPETS_ENABLED_EVENT = "Snippets:Enabled";
const SNIPPETS_DISABLED_EVENT = "Snippets:Disabled";
import {actionCreators as ac, actionTypes as at} from "common/Actions.jsm";
import {ASRouterContent} from "content-src/asrouter/asrouter-content";
/**
* SnippetsMap - A utility for cacheing values related to the snippet. It has
@@ -376,16 +377,13 @@ export class SnippetsProvider {
*/
export function addSnippetsSubscriber(store) {
const snippets = new SnippetsProvider(store.dispatch);
const asrouterContent = new ASRouterContent();
let initializing = false;
store.subscribe(async () => {
const state = store.getState();
let snippetsEnabled = false;
try {
snippetsEnabled = JSON.parse(state.Prefs.values["asrouter.messageProviders"]).find(i => i.id === "snippets").enabled;
} catch (e) {}
const isASRouterEnabled = state.Prefs.values.asrouterExperimentEnabled && snippetsEnabled;
const isASRouterEnabled = state.Prefs.values.asrouterExperimentEnabled && state.Prefs.values.asrouterOnboardingCohort > 0;
// state.Prefs.values["feeds.snippets"]: Should snippets be shown?
// state.Snippets.initialized Is the snippets data initialized?
// snippets.initialized: Is SnippetsProvider currently initialised?
@@ -409,8 +407,22 @@ export function addSnippetsSubscriber(store) {
) {
snippets.uninit();
}
// Turn on AS Router snippets if the experiment is enabled and the snippets pref is on;
// otherwise, turn it off.
if (
(state.Prefs.values.asrouterExperimentEnabled || state.Prefs.values.asrouterOnboardingCohort > 0) &&
state.Prefs.values["feeds.snippets"] &&
!asrouterContent.initialized) {
asrouterContent.init();
} else if (
((!state.Prefs.values.asrouterExperimentEnabled && state.Prefs.values.asrouterOnboardingCohort === 0) || !state.Prefs.values["feeds.snippets"]) &&
asrouterContent.initialized
) {
asrouterContent.uninit();
}
});
// Returned for testing purposes
return {snippets};
// These values are returned for testing purposes
return {snippets, asrouterContent};
}