From 5b4653e0af78bc1d14a8b115fe183d59faa00ec8 Mon Sep 17 00:00:00 2001 From: Trevor Bender Date: Sat, 11 Mar 2017 16:10:36 -0500 Subject: [PATCH] fix for deprecated xhr.open synchronously --- core/extensions/chrome/contentscript.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/core/extensions/chrome/contentscript.js b/core/extensions/chrome/contentscript.js index f1d369f8..8474bafb 100644 --- a/core/extensions/chrome/contentscript.js +++ b/core/extensions/chrome/contentscript.js @@ -71,11 +71,16 @@ function insertScript(url) { // the main page. // script.src = url; var xhr = new XMLHttpRequest(); - xhr.open('GET', url, false); - xhr.send(''); - script.text = xhr.responseText; + xhr.open('GET', url, true); + xhr.send(); + xhr.onreadystatechange = function () { + if (this.readyState === this.DONE) { + script.text = this.responseText; + insertHeaderNode(script); + notifyPresent(); + } + }; - insertHeaderNode(script); return script; }; @@ -99,8 +104,6 @@ if (sessionStorage[sessionKey] == "yes") { insertStylesheet(cssurl); insertScript(jsurl); } - - notifyPresent(); } // Once the DOM is ready, bind to the content event