Hello,
so this is quite a specific bug, but his impact may go far beyond this specific case, and so i’ve got a question about it.
(Also, i apologize for my english, i’m french, so not a native speaker at all…)
But first, let me explain the context.
I’ve been using Discourse for a while for a french forum about the raspberry pi (forum.raspberry-pi.fr). This forum use advertising management (themoneytizer). As you probably know, Europe compel us to implement RGPD for user’s privacy protection. The major actor (at least in France) for RGPD consent is Quantcast and their “Choice” solution.
So, i’ve been using Quantcast solution for quite a time, with no problems, until recently when i noticed that the “Accept all” button is not working properly anymore. On click, nothing happen, and looking in dev console i got this error : “Uncaught TypeError: can’t define property “status”: Function is not extensible”.
What happen (at least to the best of my understanding) :
Trust me when i say that it taked me a loooooonnng time to find the source of the problem. Apparently ember.js (which i’m very not familiar with) extend some Javascript native objects, such as Array, String and Function. And for some reason seems to also somehow prevent extension of thoses objects in a way (i’ve not yet fully understand this part).
Quantcast’s solution on his part try, probably on the function FunctionAcceptAll (explaining the bug only occur when clicking on accept all button and reject all button), to extend an object, i presume an array, which normal behavior have been modified by ember.js.
After a lot of research for understanding this bug, i’ve also found that it is possible to modify Ember.js behavior to not extend javascript prototypes, as explained in this page Disabling Prototype Extensions - Configuration - Ember Guides.
I’ve been making a few tests, and the bug do disappear if i add the line window.EmberENV.EXTEND_PROTOTYPES = {String: true, Array: false};
in file _ember_jquery-189e46ebcb33594b835e782fd1ce916ec750bc0cf980ebc4fb7796649161a18d.js after the line window.EmberENV.FORCE_JQUERY = true;
For thoses of you how would want to try it out, you can take a look at the /tst/index.html page on the forum (you may need an european ip in order to the script to start, i have no idea).
Now, i think you got all the informations i may give you.
So, now here is my question.
Even though this is quite a specific bug, RGPD is more and more present in europe right now, and it will not go easier.
Quantcast is in a quite monopolistic position, at least for actors that cannot afford to pay hundred of dollars for implemting RGPD. This bug prevent any usage of Quantcast, and so of advertising on Discourse in europe, which seem’s to me a big problem.
Also, even if I’ve only find the bug using Quantcast, this kind of bug may actually happen for a lot of third party scripts that we must embed for ads or other, that we have no control over at all, and that are relying on javascript “normal” behavior for Array, String and Function objects.
I do not know Discourse code enough, so i’m asking you, are the properties add by ember.js over Array, String and Function objects (see the link before) used by Discourse or not ? If not, maybe we should consider disabling prototype extensions from ember.js, in order to prevent side-effect like this one ?
I hope someone can give me info on this one,
thanks