Add support for OOP B2G chrome to app communication

RESOLVED INVALID

Status

RESOLVED INVALID
6 years ago
9 months ago

People

(Reporter: dchanm+bugzilla, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 years ago
It was possible for a mochitest to listen to and respond to "chrome" events in shell.js before the landing of bug 798580. This is no longer possible, likely as a result of running the test-app OOP.

At the very least, I'm looking for a way to intercept the mozContent and mozChrome events. My main use case is to create allow / deny events for app installs.

Would it be possible to modify the messagemanager at [1] to support this functionality?

[1] - http://mxr.mozilla.org/mozilla-central/source/testing/mochitest/runtestsb2g.py#393
(Reporter)

Comment 1

6 years ago
I was able to implement a hack to listen for mozChromeEvents by modifying runtestsb2g.py.

I added the following into the test_script

window.addEventListener('mozChromeEvent', function (e) {
// ...
});

However this isn't a flexible solution.
(Reporter)

Comment 2

6 years ago
jgriffin: What should I change in specialpowers if I wanted to "proxy" chrome events between the system app and the mochitest app? I don't believe the current implementation of SpecialPowers.addChromeEventListener provides any benefits since it doesn't capture events in the system app.
Flags: needinfo?(jgriffin)
(In reply to David Chan [:dchan] from comment #2)
> jgriffin: What should I change in specialpowers if I wanted to "proxy"
> chrome events between the system app and the mochitest app? I don't believe
> the current implementation of SpecialPowers.addChromeEventListener provides
> any benefits since it doesn't capture events in the system app.

I don't know; let's ask Fabrice.
Flags: needinfo?(jgriffin) → needinfo?(fabrice)
In gaia we have no direct way to let apps communicate with shell.js except the system app which uses mozChromeEvent and mozContentEvent. So I'm a bit surprised by comment 1.

Where is the SpecialPowers implementation that you use for b2g?
Flags: needinfo?(fabrice)
(Reporter)

Comment 5

6 years ago
(In reply to Fabrice Desré [:fabrice] from comment #4)
> Where is the SpecialPowers implementation that you use for b2g?

It is the same SpecialPowers implementation as desktop afaik. My understanding of b2g mochitest is

1. emulator / device runs b2g which loads shell.js
2. mochitests framework (runtestsb2g.py) replaces the homescreen with a special test app which is OOP. In order for this to work, some magic glue script is run in the main b2g process (shell.js). [1]
3. mochitests are run in the context of the test app

The hack I implemented in comment 1 didn't make SpecialPowers.addChromeEventListener work. I hardcoded the functionality which automatically replies to webapps-ask-install mozChromeEvents with a webapps-install-granted event


My current tests work on Firefox Nightly but would require a way of faking user allow/deny install to work on B2G. I wouldn't prioritize this over basecamp work since there isn't a basecamp usecase afaik.


[1] - http://mxr.mozilla.org/mozilla-central/source/testing/mochitest/runtestsb2g.py#393
(In reply to Fabrice Desré [:fabrice] from comment #4)
> In gaia we have no direct way to let apps communicate with shell.js except
> the system app which uses mozChromeEvent and mozContentEvent. So I'm a bit
> surprised by comment 1.
> 
> Where is the SpecialPowers implementation that you use for b2g?

David is correct, we use the one and only SpecialPowers implementation at http://mxr.mozilla.org/mozilla-central/source/testing/specialpowers/.
Mass resolving of B2G mochitest bugs.
Status: NEW → RESOLVED
Last Resolved: 9 months ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.