Closed Bug 1483657 Opened 6 years ago Closed 6 years ago

Enable UA Widget on Reftest

Categories

(Core :: XBL, task, P5)

task

Tracking

()

RESOLVED DUPLICATE of bug 1483656

People

(Reporter: timdream, Assigned: timdream)

References

Details

Attachments

(1 file)

This is a bit tricky because I don't see an obvious place to add a frame script in the reftest window frame, but it should work if something akin to UAWidgetsChild.jsm gets to run there.
Hi David, how do you feel about putting a frame script in the Reftest browser? Where would be a right place to put it?

UA Widget is a replacement to web content XBL bindings that will be initialized from a frame script. Before I put it on Fennec in bug 1483656, I would like to see if you have a strong opinion about it. The alternative would be to port it to C++ (which is mentioned on bug 1483656 also).
Flags: needinfo?(dbaron)
Is there a doc somewhere that explains what these things are and what they're for?  I'm not all that familiar with them...
(In reply to David Baron :dbaron: 🏴󠁵󠁳󠁣󠁡󠁿 ⌚UTC-7 from comment #2)
> Is there a doc somewhere that explains what these things are and what
> they're for?  I'm not all that familiar with them...

They are a replacement for our in-content XBL bindings - a way to register custom DOM / JS in the content process for a set of complex widgets (videocontrols, plugin problem UI, date/time inputs). A summary of how they work technically is here: https://bugzilla.mozilla.org/show_bug.cgi?id=1431255#c8 and https://bugzilla.mozilla.org/show_bug.cgi?id=1431255#c11.
Sorry, I should have pointed you to the code or the bugs.

The impl is done in bug 1431255. The approach is as such:

1. Instead of loading scripts in an XML from parsing -moz-binding value in layout, DOM sets up a Shadow Root, dispatch an event when the element is bind to the tree:
https://searchfox.org/mozilla-central/rev/55da592d85c2baf8d8818010c41d9738c97013d2/dom/html/HTMLMediaElement.cpp#4534-4560

2. The frame script will catch the event, and creates a JS sandbox and loads the script:
https://searchfox.org/mozilla-central/rev/55da592d85c2baf8d8818010c41d9738c97013d2/browser/actors/UAWidgetsChild.jsm#42-75

3. The script will create the Widget UI (in this case, videocontrols UI) as Shadow DOM:
https://searchfox.org/mozilla-central/rev/55da592d85c2baf8d8818010c41d9738c97013d2/toolkit/content/widgets/videocontrols.js

My question being, where is the best place to put UAWidgetsChild.jsm or its equivalent in the Reftest runtime?
So... I guess I don't think I'm the right person to ask.  You have a better perspective on what the good practices are for writing Chrome code than I do, so I think I should trust you to maintain the chrome side of the reftest harness as you think is best, as long as you're not changing what's being tested by it.  Or is there something in particular here that you think I'd be knowledgeable about?
Flags: needinfo?(dbaron)
OK. I'll take that as "do whatever you see fit". I asked you because your name is on the Reftest README :)
You should be able to import UAWidgetsChild.jsm inside whatever the main reftest runtime file is, and then initialize the actor class manually with a message manager and addMessageListener.

But I bet Kris will have better ideas on how to make the actor infrastructure available to reftests.
Assignee: nobody → timdream
Status: NEW → ASSIGNED
The patch I have right now does comment 7 as ntim suggested, but it would need patches from bug 1483656.
Depends on: 1483656
Comment on attachment 9009734 [details]
Bug 1483657 - Load toolkit JS IPC Actors in the Reftest browser. r=kmag

Kris Maglione [:kmag] has approved the revision.
Attachment #9009734 - Flags: review+
OK. This is embarrassing.

It turned out the reftest browser load everything in toolkit as well, so I don't really need the patch here but just the patch in bug 1483656 that takes UAWidgetsChild to toolkit.

I am going to fix reftest failure there instead.
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
Type: enhancement → task
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: