Closed Bug 1699627 Opened 3 years ago Closed 3 years ago

Require MOZ_MARIONETTE=1 to enable Marionette

Categories

(Remote Protocol :: Marionette, defect, P3)

Default
defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: whimboo, Assigned: whimboo)

References

Details

Attachments

(3 obsolete files)

Follow-up from bug 1593343 since then we only enable Marionette when MOZ_MARIONETTE or --marionette is specified.

Currently it is still possible to enable Marionette by setting a falsy value for MOZ_MARIONETTE. Similar to other environment variables we should check the actual value for truthiness.

I think to make it clear we should only allow MOZ_MARIONETTE=1 to enable Marionette and not any other values.

Summary: Falsy values for MOZ_MARIONETTE should not enable Marionette → Require MOZ_MARIONETTE=1 to enable Marionette
Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Pushed by hskupin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/270e0f9613a6
Use nsIMarionette service to get enabled state of Marionette within the Content Security Manager. r=freddyb
https://hg.mozilla.org/integration/autoland/rev/02e74b497dfc
[marionette] Only enable Marionette when MOZ_MARIONETTE is set to "1". r=marionette-reviewers,freddyb

So there are two failures:

Unexpected modules loaded during content process startup: resource://gre/modules/ComponentUtils.jsm
Unexpected modules loaded during content process startup: chrome://marionette/content/prefs.js

The changes to dom/security/nsContentSecurityManager.cpp were causing that. Given that this code runs within a content process, getting the Marionette service and it's running property causes the marionette.js module loaded in the content process.

Given that ComponentUtils and both imports from prefs.js aren't lazily loaded, we see the above two failures.

The recent fix was not enough because ChromeUtils is always used at the end of the module in this line:

this.NSGetFactory = ComponentUtils.generateNSGetFactory([Marionette])

It looks like that this is very old code and nowadays could be avoided. I will see if a refactoring of the component will help here.

Flags: needinfo?(hskupin)

Without the xpconnect knowledge it's actually hard to figure out if this code is still needed the way it has been implemented years ago. Nika, maybe you could give some advice? I would kinda appreciate.

So as I get the nsIMarionette service can also be queried / used by code that runs in a child process. In those cases we create a limited instance of the Marionette component that communicates with the instance in the parent class to just query the running state:

https://searchfox.org/mozilla-central/rev/cc4a17cea338fe236626d838ca96e9bf6a775675/testing/marionette/components/marionette.js#560-593

Is there a way to get rid of the ComponentUtils usage here? We still get a test failure in the test browser/base/content/test/performance/browser_startup_content.js.

Flags: needinfo?(nika)

After the discussion with Nika yesterday it turned out that we should avoid creating an instance of the Marionette JS component in content. See details on https://phabricator.services.mozilla.com/D109363.

Right now I checked the behavior of MOZ_HEADLESS and it also accepts any value including 0, and doesn't check for truthiness. So whenever it is set, it will cause Firefox to start in headless mode. To keep consistency with all the existent MOZ_* environments and their behavior I would propose that we actually also follow that behavior with Marionette.

@jdescottes, are you fine with that?

Flags: needinfo?(jdescottes)

Yes fine with me!

Flags: needinfo?(jdescottes)
Attachment #9210221 - Attachment is obsolete: true
Attachment #9210778 - Attachment is obsolete: true
Flags: needinfo?(nika)

As discussed marking the bug as wontfix. I'll move the one remaining patch to a new bug for clarity.

Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → WONTFIX

Comment on attachment 9211106 [details]
Bug 1699627 - [marionette] Always lazy-load dependent modules for the Marionette component.

Revision D109538 was moved to bug 1700959. Setting attachment 9211106 [details] to obsolete.

Attachment #9211106 - Attachment is obsolete: true
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: