Files
tubestation/browser/base/content/test/general
Andrew McCreight 1abf078154 Bug 1917892, part 3 - Use SpecialPower.spawn in browser_remoteTroubleshoot.js. r=mconley
This is a test of the remote trouble shooting API, which uses a
permission-based WebChannel to allow a website to request about:support
information. The test uses the WebChannelMessageToContent feature of
WebChannels to initiate a request for support information in the webpage,
which then gets the information from the parent and sends it back for
checking.

Before this patch, the information was sent back via a new WebChannel,
test-remote-troubleshooting-backchannel, which has access based on a
principal rather than a permission. This is a problem because the final
subtest checks that the trouble shooting request won't work on an http
webpage, so if we want to block principal-based WebChannels on http
sites as well as permission-based WebChannels, then we won't be able
to report the result.

Therefore, this patch replaces the WebChannel-based backchannel with
a more conventional SpecialPowers.spawn()-based result retrieval. The
web page requests the information, sticks it on a global variable
(behind a promise that waits for the result) and then the parent
process uses SpecialPowers.spawn() to pass it back to the parent.

Before the landing of bug 1275612, there was an additional subtest
that was checking certain properties of the backchannel itself,
so it had to be a WebChannel, but that is removed so now it doesn't
matter how it is implemented.

Differential Revision: https://phabricator.services.mozilla.com/D221694
2024-09-12 20:25:48 +00:00
..