-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Installing the Spector.js add-on in Firefox will cause the shader editor to stop working #37
Comments
Thank you for reporting, I will see how i could fix it ? probably preventing the use of both at the same time. |
Perhaps, these two tools (Spector.js and shader editor) may not be available at the same time. case1):
case2):
The following contents are displayed on the console.
|
interesting indeed thx for the investigation. I really need to improve the overall compatibility with other extensions as well. |
@cx20 I am still trying to figure the best approach concerning this issue. |
I created a ticket on the Mozilla tracker as I am not sure this should happen (at least definitely not when the script is embedded in the page): |
As a workaround, you could avoid call/apply by storing the original functions in the same object. I usually do something like this: gl._uniform4fv = gl.uniform4fv;
gl.uniform4fv = function(loc, v){
if(isNaN(v[0])) debugger;
return this._uniform4fv(loc, v);
} but of course iterating through all functions, sometimes even using |
Let me give it a try :-) |
It seems it could work but the main issue is I would have to remap all the calls manually which sounds pretty error prone. Do you have any other workarounds @DiThi ? |
@sebavan I think functions happily accept extra undefined arguments. Try just wrapping all functions before spector wraps them: for(var key in gl){
var f = gl[key];
if(typeof f === 'function' && !/^_orig_/.test(key)){
gl['_orig_'+key] = gl['_orig_'+key] || f;
gl[key] = new Function('a','b','c','d','e','f','g','h','i',
'if(i!==void 0) return this._orig_'+key+'(a,b,c,d,e,f,g,h,i);'+
'if(h!==void 0) return this._orig_'+key+'(a,b,c,d,e,f,g,h);'+
'if(g!==void 0) return this._orig_'+key+'(a,b,c,d,e,f,g);'+
'if(f!==void 0) return this._orig_'+key+'(a,b,c,d,e,f);'+
'if(e!==void 0) return this._orig_'+key+'(a,b,c,d,e);'+
'if(d!==void 0) return this._orig_'+key+'(a,b,c,d);'+
'if(c!==void 0) return this._orig_'+key+'(a,b,c);'+
'if(b!==void 0) return this._orig_'+key+'(a,b);'+
'if(a!==void 0) return this._orig_'+key+'(a);'+
'return this._orig_'+key+'();'
);
}
} edit: Oops, it's not working, let me update it |
Yup, should not answer before sleeping ;-) I ll try it tonight, Thx. |
@DiThi It seems I ll be able to fix it with your workaround. Just out of curiosity, any idea or pointers to why it works this way and not by relying on apply call or bind ? I ll push the fix soon, still some cleanup and testing required. |
@sebavan My guess is that functions created in a privileged context forbid access to web contexts to anything but the most basic usage of these functions, to avoid sandbox escapes. |
@DiThi thanks for the explanation. |
I tried installing Spector.js add-on in Firefox.
https://addons.mozilla.org/en-US/firefox/addon/spector-js/
However, Spector.js works but Firefox's shader editor does not work.
Disabling Spector.js add-on will cause the shader editor to work.
OS / Browser : Windows 10 + Firefox 53.0.3 + Spector.js v0.1.2
The text was updated successfully, but these errors were encountered: