Closed Bug 1602079 Opened 5 years ago Closed 5 years ago

Create a WebChannel between Gecko and profiler.firefox.com

Categories

(DevTools :: Performance Tools (Profiler/Timeline), enhancement, P2)

enhancement

Tracking

(firefox75 fixed)

RESOLVED FIXED
Firefox 75
Tracking Status
firefox75 --- fixed

People

(Reporter: gregtatum, Assigned: gregtatum)

References

(Blocks 2 open bugs)

Details

Attachments

(3 files, 1 obsolete file)

console.log("Hook the WebChannel");

// Create a new WebChannel.
const channel = new WebChannel(
  "profiler",
  Services.io.newURI("https://profiler.firefox.com")
);

// Listen for messages.
channel.listen(function(id, message, target) {
  console.log("Found a message", { id, message, target });
  channel.send({ data: "This is the data of the response." }, target);
});

// From profiler.firefox.com
//
// Add a listener:
//
//   window.addEventListener("WebChannelMessageToContent", event => {
//     console.log(event.detail);
//   }, true);
//
// Send a message:
//
//   window.dispatchEvent(new CustomEvent("WebChannelMessageToChrome", {
//     detail: JSON.stringify({
//       id: "profiler",
//       message: "Data from profiler.firefox.com,
//     }),
//   }));

This is a small example showing how we can send events between the browser and the content page. It might be worth removing some of our frame scripts for this, as well as handling the mechanism to to tell profiler.firefox.com that it can use the profiler popup.

Assignee: nobody → gtatum
Blocks: 1603232

Specifically this is fixing up some issues around loading in JSMs.

This commit adds a WebChannel mechanism to the profiler popup workflow.
This will enable us to provide some configuration operations from the
content page in order to ease user onboarding, as well as a mechanism
to migrate away from the extension.

Depends on D57120

We want to be sure that the URL used for the WebChannel is validated to an
allowed set of domains. This test ensures that we are not allowing unknown
domains through.

Depends on D57121

This test covers the basic enabling of the profiler popup menu button.

Depends on D57122

Attachment #9115784 - Attachment description: Bug 1602079 - Fixup some typings that were set to any; r?julienw → Bug 1606472 - Fixup some typings that were set to any; r?julienw

Comment on attachment 9115784 [details]
Bug 1606472 - Fixup some typings that were set to any; r?julienw

Revision D57120 was moved to bug 1606472. Setting attachment 9115784 [details] to obsolete.

Attachment #9115784 - Attachment is obsolete: true

There are some r+ patches which didn't land and no activity in this bug for 2 weeks.
:gregtatum, could you have a look please?
For more information, please visit auto_nag documentation.

Flags: needinfo?(gtatum)

It's waiting on some reviews outside of Bugzilla.

Flags: needinfo?(gtatum)

We discussed this during the All Hands, but we are now OK to land this now in Nightly, and do further review before it goes out to a wider audience. I'll land this when I'm back in the office.

Pushed by gtatum@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/13f63a885c61 Add a WebChannel to profiler.firefox.com; r=julienw,jdescottes https://hg.mozilla.org/integration/autoland/rev/092b3b9760c9 Add a test for profiler.firefox.com WebChannel validation; r=julienw https://hg.mozilla.org/integration/autoland/rev/79b7b94df8b6 Add a mochitest to test the profiler.firefox.com WebChannel; r=julienw
Regressions: 1614667
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: