Page 1 of 1

media.mediasource.enabled = false breaks NoScript

Posted: Fri Nov 16, 2018 10:53 pm
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.

Re: media.mediasource.enabled = false breaks NoScript

Posted: Sat Nov 17, 2018 5:54 am
by therube
Confirmed.

Why do you want to set media.mediasource.enabled to false?

Re: media.mediasource.enabled = false breaks NoScript

Posted: Sat Nov 17, 2018 6:47 am
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

Re: media.mediasource.enabled = false breaks NoScript

Posted: Sat Nov 17, 2018 7:44 am
by therube
Because saving videos is simpler ;)
Oh yeah, I remember that, I found that "fix" too, https://forums.informaction.com/viewtop ... 468#p87468.

Re: media.mediasource.enabled = false breaks NoScript

Posted: Thu Nov 22, 2018 8:05 am
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 }

Re: media.mediasource.enabled = false breaks NoScript

Posted: Fri Apr 26, 2019 1:41 pm
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.

Re: media.mediasource.enabled = false breaks NoScript

Posted: Sun Apr 28, 2019 9:17 am
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.

Re: media.mediasource.enabled = false breaks NoScript

Posted: Sun Apr 28, 2019 9:24 am
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.

Re: media.mediasource.enabled = false breaks NoScript

Posted: Mon Apr 29, 2019 4:40 pm
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)

Re: media.mediasource.enabled = false breaks NoScript

Posted: Tue Apr 30, 2019 1:57 pm
by infria
That was fast! Thank you Giorgio and skriptimaahinen!