Is it possible to have arguments in callbacks sent to a exported function

Manuel Reimer manuel.reimer at gmx.de
Sat Aug 5 08:47:27 UTC 2017


Hello,

I just want to add, that I'm able to use "JSON.stringify" and pass the 
stringified object to the callback. I'm able to recreate the javascript 
object from there.
That's ugly but works...
But I'm still interested why I'm not able to pass a object or array 
directly.

Manuel

On 08/05/2017 10:28 AM, Manuel Reimer wrote:
> Hello,
> 
> in my WebExtension, I export a function from "content script" to the 
> page javascript like so:
> 
> 
> function Test(aCallback) {
>    var my_return = {test: "test"};
>    aCallback(my_return);
> }
> exportFunction(Test, window, {defineAs: "my_addon_test"});
> 
> 
> I export a function and this function is expected to get a callback 
> function from page javascript. I want to pass a javascript object as 
> parameter to this callback.
> 
> If I try to do so, I get the following in browser console as soon as I 
> try to access the javascript object from my page script:
> 
> 
> Permission denied to access property Symbol.toPrimitive
> 
> 
> Is there any *secure* way to do what I need? Is there any way to pass a 
> parameter to such callback functions?
> 
> Thanks in advance
> 
> Manuel
> _______________________________________________
> Dev-addons mailing list
> Dev-addons at mozilla.org
> https://mail.mozilla.org/listinfo/dev-addons



More information about the Dev-addons mailing list