Backed out changeset 9fce755a1262 (bug 1505929) for causing browser chrome nightly failures when tryin to connect to snippets.cdn.mozilla.net. a=backout

This commit is contained in:
Cosmin Sabou
2018-11-10 16:45:39 +02:00
parent 345fc34126
commit d477f94be3
85 changed files with 1122 additions and 1509 deletions

View File

@@ -247,6 +247,10 @@ export class SnippetsProvider {
}
}
_noSnippetFallback() {
// TODO
}
_showRemoteSnippets() {
const snippetsEl = document.getElementById(this.elementId);
const payload = this.snippetsMap.get("snippets");
@@ -268,8 +272,6 @@ export class SnippetsProvider {
// eslint-disable-next-line no-unsanitized/property
snippetsEl.innerHTML = payload;
this._logIfDevtools("Successfully added snippets.");
// Scripts injected by innerHTML are inactive, so we have to relocate them
// through DOM manipulation to activate their contents.
for (const scriptEl of snippetsEl.getElementsByTagName("script")) {
@@ -288,13 +290,6 @@ export class SnippetsProvider {
}
}
// istanbul ignore next
_logIfDevtools(text) {
if (this.devtoolsEnabled) {
console.log("Legacy snippets:", text); // eslint-disable-line no-console
}
}
/**
* init - Fetch the snippet payload and show snippets
*
@@ -309,11 +304,8 @@ export class SnippetsProvider {
appData: {},
elementId: "snippets",
connect: true,
devtoolsEnabled: false,
}, options);
this._logIfDevtools("Initializing...");
// Add listener so we know when snippets are blocked on other pages
if (global.RPMAddMessageListener) {
global.RPMAddMessageListener("ActivityStream:MainToContent", this._onAction);
@@ -345,14 +337,12 @@ export class SnippetsProvider {
try {
this._showRemoteSnippets();
} catch (e) {
this._logIfDevtools("Problem inserting remote snippets!");
console.error(e); // eslint-disable-line no-console
this._noSnippetFallback(e);
}
window.dispatchEvent(new Event(SNIPPETS_ENABLED_EVENT));
this.initialized = true;
this._logIfDevtools("Finished initializing.");
}
uninit() {
@@ -407,7 +397,11 @@ export function addSnippetsSubscriber(store) {
location.hash !== "#asrouter"
) {
initializing = true;
await snippets.init({appData: state.Snippets, devtoolsEnabled: state.Prefs.values["asrouter.devtoolsEnabled"]});
await snippets.init({appData: state.Snippets});
// istanbul ignore if
if (state.Prefs.values["asrouter.devtoolsEnabled"]) {
console.log("Legacy snippets initialized"); // eslint-disable-line no-console
}
initializing = false;
/** If we should remove snippets... */