Asynchronous Experiment/WebExtension communication incompatible with XPCOM overrides?

Shane Caraveo scaraveo at mozilla.com
Thu Aug 3 19:49:46 UTC 2017


On 8/3/17 12:28 PM, Jeremy Rand wrote:
> Andrew Swan:
>> On Mon, Jul 31, 2017 at 2:30 AM, Jeremy Rand <jeremyrand at airmail.cc> wrote:
>>
>>> I'm trying to build a WebExtensions Experiment that overrides an XPCOM
>>> contract with a custom implementation.  The custom implementation of the
>>> XPCOM contract is intended to call a function in a WebExtension, and use
>>> the return value to decide what the XPCOM contract function
>>> implementation should return.
>>>
>>> Unfortunately, based on my testing, it looks like whenever an Experiment
>>> calls a function in a WebExtension, the thing that gets returned is
>>> actually a Promise rather than the raw value.  Furthermore, it looks
>>> like the XPCOM contract that I'm overriding isn't designed to process a
>>> Promise properly as a return value, so the WebExtension can't actually
>>> influence what the XPCOM contract function returns.

What is the xpcom interface you're using?  What exactly are you attempting?

> You understood and answered my question perfectly (despite my clumsy
> wording), no worries.  It sounds like the approach I was going for is
> not feasible, so I guess I'll be looking into alternative approaches
> that modify the C/C++ source code instead of solely using a
> WebExtensions Experiment.  Thanks for the answer.  :)

That is the harder path to take, and likely in some instances it might 
be the only option, however given a more concrete use case you're trying 
to build we might be able to suggest an option that could be done 
without c++ work.

Shane


More information about the Dev-addons mailing list