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

Martin Giger martin at
Sat Aug 5 08:56:25 UTC 2017

Hi Manuel

The reason the object can't be accessed by the callback is that, like
the function, it is created in the context of the content script and
thus not allowed to be used by the page unless explictly exported. What
you'd have to do here is to use the cloneInto() function[1] on the
object before passing it to the callback.



On 05.08.2017 10:47, Manuel Reimer wrote:
> 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
> _______________________________________________
> Dev-addons mailing list
> Dev-addons at

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the Dev-addons mailing list