media.mediasource.enabled = false breaks NoScript

Bug reports and enhancement requests
Post Reply
DerpMcDerp
Posts: 2
Joined: Sat Jul 30, 2016 2:14 am

media.mediasource.enabled = false breaks NoScript

Post by DerpMcDerp » Fri Nov 16, 2018 10:53 pm

If you have "media.mediasource.enabled" set to "false" in about:config, Keep2Share doesn't work in NoScript even if you "disable restrictions for this tab". You have to completely disable the NoScript addon or set the setting to "true" to view the page. e.g.

https://k2s.cc/file/ae2c0b44a2bd4

Will display the web page's loading indicator animation forever.
Mozilla/5.0 (Windows NT 10.0; rv:63.0) Gecko/20100101 Firefox/63.0

User avatar
therube
Ambassador
Posts: 7268
Joined: Thu Mar 19, 2009 4:17 pm
Location: Maryland USA

Re: media.mediasource.enabled = false breaks NoScript

Post by therube » Sat Nov 17, 2018 5:54 am

Confirmed.

Why do you want to set media.mediasource.enabled to false?
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball NoScript FlashGot AdblockPlus
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.5

skriptimaahinen
Senior Member
Posts: 127
Joined: Wed Jan 10, 2018 7:37 am

Re: media.mediasource.enabled = false breaks NoScript

Post by skriptimaahinen » Sat Nov 17, 2018 6:47 am

therube wrote:Why do you want to set media.mediasource.enabled to false?
Because saving videos is simpler ;)

media.js:12

Code: Select all

patch(window.URL.prototype, "createObjectURL",  function(o, ...args) {
  let url = unpatched.get(window.URL.prototype).createObjectURL.call(this, o, ...args);
  if (o instanceof MediaSource) {
    let urls = urlMap.get(o);
    if (!urls) urlMap.set(o, urls = new Set());
    urls.add(url);
  }
  return url;
});
window.URL -> window.URL.prototype
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0

User avatar
therube
Ambassador
Posts: 7268
Joined: Thu Mar 19, 2009 4:17 pm
Location: Maryland USA

Re: media.mediasource.enabled = false breaks NoScript

Post by therube » Sat Nov 17, 2018 7:44 am

Because saving videos is simpler ;)
Oh yeah, I remember that, I found that "fix" too, https://forums.informaction.com/viewtop ... 468#p87468.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball NoScript FlashGot AdblockPlus
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.5

skriptimaahinen
Senior Member
Posts: 127
Joined: Wed Jan 10, 2018 7:37 am

Re: media.mediasource.enabled = false breaks NoScript

Post by skriptimaahinen » Thu Nov 22, 2018 8:05 am

OK, lets forget I suggested the above. Sure, it fixes the page, but that's because it breaks NoScript... :oops:

Already forgotten? Good.

Revisiting the problem, it appears that the page failure is due to NS causing a exception as it fails to take into account that MediaSource might not be available.

Solution: in media.js:

Code: Select all

if ('MediaSource' in window) { //rest of media.js }
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0

Post Reply