Skip to content

Commit

Permalink
Merge pull request #2113.
Browse files Browse the repository at this point in the history
Fix SoundCloud widget replacement CSP bypass.
  • Loading branch information
ghostwords committed Jul 24, 2018
2 parents 533eebc + 8bd5305 commit ce4a8be
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/data/socialwidgets.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"SoundCloud": {
"domain": "soundcloud.com",
"buttonSelectors": [
"iframe[src*='api.soundcloud.com']"
"iframe[src^='https://w.soundcloud.com/player']"
],
"replacementButton": {
"details": "",
Expand Down
3 changes: 2 additions & 1 deletion src/js/contentscripts/socialwidgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ function replaceButtonWithHtmlCodeAndUnblockTracker(button, tracker, html) {
* with executable scripts.
*/
function replaceScriptsRecurse(node) {
if (node.getAttribute && node.getAttribute("type") == "text/javascript") {
if (node.nodeName && node.nodeName.toLowerCase() == 'script' &&
node.getAttribute && node.getAttribute("type") == "text/javascript") {
var script = document.createElement("script");
script.text = node.innerHTML;
script.src = node.src;
Expand Down

0 comments on commit ce4a8be

Please sign in to comment.