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 »

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: 7924
Joined: Thu Mar 19, 2009 4:17 pm
Location: Maryland USA

Re: media.mediasource.enabled = false breaks NoScript

Post by therube »

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
Master Bug Buster
Posts: 244
Joined: Wed Jan 10, 2018 7:37 am

Re: media.mediasource.enabled = false breaks NoScript

Post by skriptimaahinen »

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: 7924
Joined: Thu Mar 19, 2009 4:17 pm
Location: Maryland USA

Re: media.mediasource.enabled = false breaks NoScript

Post by therube »

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
Master Bug Buster
Posts: 244
Joined: Wed Jan 10, 2018 7:37 am

Re: media.mediasource.enabled = false breaks NoScript

Post by skriptimaahinen »

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
User avatar
infria
Posts: 14
Joined: Thu Nov 27, 2014 7:56 am

Re: media.mediasource.enabled = false breaks NoScript

Post by infria »

This is the most recent topic I could find about media.mediasource.enabled = false and its relationship with NoScript, so I'm posting here.

I recently discovered that the media.mediasource.enabled = false problem described in OP extends beyond videos.

See here, for example:

hXXps://mangaplus.shueisha.co.jp/viewer/1000397

When I look in the Developer Tools Console, it says "MediaSource is not defined". The images on the page will not load at all unless I either completely disable NoScript, or set media.mediasource.enabled = true, just like in OP.

I don't understand how to implement skriptimaahinen's solution above. Could somebody kindly explain it to a tech dumb-dumb like myself? I'm using NoScript 10.6.1.
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0
skriptimaahinen
Master Bug Buster
Posts: 244
Joined: Wed Jan 10, 2018 7:37 am

Re: media.mediasource.enabled = false breaks NoScript

Post by skriptimaahinen »

Unfortunately there is not much you can do with that solution unless you want to fork and patch NoScript yourself.

Let's hope Giorgio notices this soon and makes an official patch.
Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0
User avatar
infria
Posts: 14
Joined: Thu Nov 27, 2014 7:56 am

Re: media.mediasource.enabled = false breaks NoScript

Post by infria »

I've been doing some testing and, as it turns out, media.mediasource.enabled = false together with NoScript breaks a lot of sites. Obviously media sites like Youtube and Twitch won't work. But it also breaks sites that I wouldn't consider 'media' content, like Google Maps and Mega.nz.

In the pre-Quantum NoScript, I could get this type of content to appear by going to Options... > Embeddings > uncheck Apply these restrictions to whitelisted sites too. But Quantum NoScript doesn't have that option anymore.

I'm probably way behind the ball in just noticing all this.

Anyway, thanks for the reply, skriptimaahinen. I hope there's a fix in the near future.
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0
User avatar
Giorgio Maone
Site Admin
Posts: 9454
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: media.mediasource.enabled = false breaks NoScript

Post by Giorgio Maone »

Fixed in latest development build, thanks!

v 10.6.2rc1
=============================================================
x Fixed media.mediasource.enabled breakage (thanks
skriptimaahinen for patch)
x Reference internal pages as absolute URLs for Chromium
compatibility
x Updated TLDs
x [Locale] Updated Transifex-managed locales (es, ms, tr)
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0
User avatar
infria
Posts: 14
Joined: Thu Nov 27, 2014 7:56 am

Re: media.mediasource.enabled = false breaks NoScript

Post by infria »

That was fast! Thank you Giorgio and skriptimaahinen!
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0
Post Reply