diff options
author | Ruben Rodriguez <ruben@fsf.org> | 2018-05-11 14:05:51 -0400 |
---|---|---|
committer | Ruben Rodriguez <ruben@fsf.org> | 2018-05-11 14:05:51 -0400 |
commit | 673ebdf926260cc3b6c49acc187e0fc28bf482fa (patch) | |
tree | 4826d9541155938b4e579939feda7d5d686103d8 | |
parent | 20c6892732eb36952ebf9314172eb450e631ab21 (diff) |
Do not process non-javascript scripts (json, templates, etc)
-rw-r--r-- | main_background.js | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/main_background.js b/main_background.js index b1c482c..00aae37 100644 --- a/main_background.js +++ b/main_background.js @@ -1230,24 +1230,22 @@ function edit_html(html,url,tabid,wl){ dbg_print("Analyzing "+total_scripts+" inline scripts..."); for(var i = 0; i < scripts.length; i++){ - if(scripts[i].src == ""){ - var edit_script = get_script(scripts[i].innerHTML,url,tabid,wl,i); - edit_script.then(function(edited){ - var edited_source = edited[0]; - var unedited_source = html_doc.scripts[edited[1]].innerHTML.trim(); - - html_doc.scripts[edited[1]].innerHTML = edited_source; - - amt_scripts++; - - if(amt_scripts >= total_scripts){ - resolve(remove_noscripts(html_doc)); - } - - }); + if (scripts[i].src == ""){ + if (scripts[i].type=="" || scripts[i].type=="text/javascript"){ + var edit_script = get_script(scripts[i].innerHTML,url,tabid,wl,i); + edit_script.then(function(edited){ + var edited_source = edited[0]; + var unedited_source = html_doc.scripts[edited[1]].innerHTML.trim(); + html_doc.scripts[edited[1]].innerHTML = edited_source; + + }); + } + amt_scripts++; + if(amt_scripts >= total_scripts){ + resolve(remove_noscripts(html_doc)); + } } } - if(total_scripts == 0){ dbg_print("Nothing to analyze."); resolve(remove_noscripts(html_doc)); |