Enterprise Felt-is-Firefox with addons#10
Conversation
c123214 to
8ec612e
Compare
8ec612e to
af7e6b8
Compare
af7e6b8 to
69261eb
Compare
c2cd2fd to
f841947
Compare
f841947 to
e84b61d
Compare
| [profile.release.build-override] | ||
| opt-level = 1 | ||
|
|
||
| # optimizing glsl more makes a big difference in swgl build times |
There was a problem hiding this comment.
This feels totally random? Merge error?
There was a problem hiding this comment.
it was rebased so i need to check that
|
|
||
| case "FeltParent:FirefoxAbnormalExit": | ||
| Services.ppmm.removeMessageListener("FeltParent:FirefoxAbnormalExit", this); | ||
| // TODO: What should we do, restart Firefox? |
There was a problem hiding this comment.
The launcher needs to do this I think to set up the IPC channel correctly.
browser/extensions/felt/api.js
Outdated
| ); | ||
|
|
||
| if (this.feltXPCOM.isFeltUI()) { | ||
| this.feltXPCOM.setConsoleAddr("http://localhost:8000"); |
There was a problem hiding this comment.
Have we thought about how to supply this in production?
There was a problem hiding this comment.
Not yet, that is something I'd like we discuss next monday
There was a problem hiding this comment.
Can add it to the doc so we can go over it (probably Tuesday with fiji).
There was a problem hiding this comment.
One idea I had is that this is just setting a pref so it could be set at install time somehow ? ac21fc7#diff-6d0fd0afe07ce9bcbb6ddb882c13066bcbb500ab4bfcc96792c8005fd4b6fd99R375
| "use strict"; | ||
|
|
||
| browser.runtime.onUpdateAvailable.addListener(_details => { | ||
| // The New Tab built-in add-on is not designed to be updated at runtime. |
|
@1rneh I'd like your review on the UI part and maybe on the tests as well |
|
@mkaply I'd like your review on the Live Policies changes |
mkaply
left a comment
There was a problem hiding this comment.
A few comments, but from my perspective this looks sound as long as tests pass.
I'm going to build it locally this week.
| ) | ||
| ); | ||
| } | ||
| _maybeCallbackPolicy(policyImpl, parsedParameters = undefined) { |
There was a problem hiding this comment.
Can you comment as to what this function does?Can you add a comment as to what this function does?
There was a problem hiding this comment.
This is code that was here and I moved out of the function because at some point it proved to be useful.
| this._policies = lazy.macOSPoliciesParser.readPolicies(prefReader); | ||
| } | ||
|
|
||
| onPoliciesChanges(handler) { |
There was a problem hiding this comment.
Nit, but grammatically this doesn't make sense. What exactly is changing here?
1rneh
left a comment
There was a problem hiding this comment.
Just some comments and questions. No blockers though, since our goal is to get this landed. But I'd like to re-visit this with a bit more time on our hands.
| addJSWindowActors(actors) { | ||
| this._addActors(actors, "JSWindowActor"); | ||
| }, | ||
| }; |
There was a problem hiding this comment.
We can use ChromeUtils.registerWindowActor in onStartUp like we do with ChromeUtils.unregisterWindowActor in onShutDown. It's not clear to me why we need to register and unregister the felt actors via preference?
There was a problem hiding this comment.
That was complicated because we were depending on the matches pref and the JSWindowActor C++ code expects things to be set once. So we could not really register until we had the proper information.
With the recent evolutions, this might not be required anymore?
There was a problem hiding this comment.
Yes, now we have all prefs on startup and we can register them right away.
browser/extensions/felt/api.js
Outdated
| ); | ||
|
|
||
| if (this.feltXPCOM.isFeltUI()) { | ||
| this.feltXPCOM.setConsoleAddr("http://localhost:8000"); |
| Services.cpmm.addMessageListener("FeltMain:RedirectURL", this); | ||
| Services.cpmm.sendAsyncMessage("FeltChild:Loaded", {}); | ||
| }, 0); | ||
| } |
There was a problem hiding this comment.
We can use actorCreated here, so we don't need setTimeout.
| return; | ||
| } | ||
|
|
||
| this.sendAsyncMessage("FeltChild:StartFirefox", {}); |
There was a problem hiding this comment.
We should avoid that the user sees a glimpse of the dashboard in the sso frame before we start another Firefox instance.
There was a problem hiding this comment.
I think it's macOS specific as I dont get what you mean :)
There was a problem hiding this comment.
I'll raise this again once I merged my UI changes.
| Services.ppmm.removeMessageListener("FeltChild:Loaded", this); | ||
| const redirect_after_sso = Services.prefs.getStringPref("browser.felt.redirect_after_sso"); | ||
| Services.ppmm.broadcastAsyncMessage("FeltMain:RedirectURL", redirect_after_sso); | ||
| break; |
There was a problem hiding this comment.
Is there a reason why FeltChild doesn't just get the preference once it receives the FeltParent:Done message? This way we could save ourselves the FeltChildLoaded and FeltMain:RedirectURL messages.
There was a problem hiding this comment.
I just realized that the child never receives the message FeltParent:Done because the parent doesn't send it anywhere, so we never redirect.
There was a problem hiding this comment.
Yep, I broke things at some point and the FeltParent:Done message went missing. Writing tests made me catch this.
For the prefs it's likely a consequences of the old way of fetching prefs from console. I'll see if we can simplify this right now.
Hard to promisify the http requests from rust code, and we can do those queries in places where it's easier to deal with.
Use c4d-highcpu-48 for builds Use 4d-highcpu-2 for tests
| addJSWindowActors(actors) { | ||
| this._addActors(actors, "JSWindowActor"); | ||
| }, | ||
| }; |
There was a problem hiding this comment.
Yes, now we have all prefs on startup and we can register them right away.
| let JSWINDOWACTORS = {}; | ||
|
|
||
| JSWINDOWACTORS.Felt = { | ||
| parent: { | ||
| esModuleURI: "chrome://felt/content/FeltParent.sys.mjs", | ||
| }, | ||
|
|
||
| child: { | ||
| esModuleURI: "chrome://felt/content/FeltChild.sys.mjs", | ||
| events: { | ||
| DOMContentLoaded: {}, | ||
| load: {}, | ||
| }, | ||
| }, | ||
|
|
||
| allFrames: true, | ||
| matches: [""], | ||
|
|
||
| onAddActor(register, unregister) { | ||
| let isRegistered = false; | ||
|
|
||
| const maybeRegister = () => { | ||
| const isEnabled = Services.prefs.getBoolPref( | ||
| "browser.felt.enabled", | ||
| false | ||
| ); | ||
| if (isEnabled) { | ||
| JSWINDOWACTORS.Felt.matches = Services.prefs | ||
| .getStringPref("browser.felt.matches") | ||
| .split(","); | ||
| if (!isRegistered) { | ||
| register(); | ||
| isRegistered = true; | ||
| } | ||
| } else if (isRegistered) { | ||
| unregister(); | ||
| isRegistered = false; | ||
| } | ||
| }; | ||
|
|
||
| Services.prefs.addObserver("browser.felt.enabled", maybeRegister); | ||
| maybeRegister(); | ||
| }, | ||
| }; | ||
|
|
||
| let ActorManagerParent = { | ||
| _addActors(actors, kind) { | ||
| let register, unregister; | ||
| switch (kind) { | ||
| case "JSWindowActor": | ||
| register = ChromeUtils.registerWindowActor; | ||
| unregister = ChromeUtils.unregisterWindowActor; | ||
| break; | ||
| default: | ||
| throw new Error("Invalid JSActor kind " + kind); | ||
| } | ||
| for (let [actorName, actor] of Object.entries(actors)) { | ||
| // The actor defines its own register/unregister logic. | ||
| if (actor.onAddActor) { | ||
| actor.onAddActor( | ||
| () => register(actorName, actor), | ||
| () => unregister(actorName, actor) | ||
| ); | ||
| continue; | ||
| } | ||
|
|
||
| // If enablePreference is set, only register the actor while the | ||
| // preference is set to true. | ||
| if (actor.enablePreference) { | ||
| Services.prefs.addObserver(actor.enablePreference, () => { | ||
| const isEnabled = Services.prefs.getBoolPref( | ||
| actor.enablePreference, | ||
| false | ||
| ); | ||
| if (isEnabled) { | ||
| register(actorName, actor); | ||
| } else { | ||
| unregister(actorName, actor); | ||
| } | ||
| if (actor.onPreferenceChanged) { | ||
| actor.onPreferenceChanged(isEnabled); | ||
| } | ||
| }); | ||
|
|
||
| if (!Services.prefs.getBoolPref(actor.enablePreference, false)) { | ||
| continue; | ||
| } | ||
| } | ||
|
|
||
| register(actorName, actor); | ||
| } | ||
| }, | ||
|
|
||
| addJSWindowActors(actors) { | ||
| this._addActors(actors, "JSWindowActor"); | ||
| }, | ||
| }; |
There was a problem hiding this comment.
I don't see any use of enablePreference on our actors, so the whole actor registration logic can be streamlined to
registerActors() {
ChromeUtils.registerWindowActor("Felt", {
parent: {
esModuleURI: "chrome://felt/content/FeltParent.sys.mjs",
},
child: {
esModuleURI: "chrome://felt/content/FeltChild.sys.mjs",
events: {
DOMContentLoaded: {},
load: {},
},
},
allFrames: true,
matches: Services.prefs.getStringPref("browser.felt.matches").split(","),
});
}
and then calling this.registerActors() instead of ActorManagerParent.addJSWindowActors(JSWINDOWACTORS); in onStartUp.
There was a problem hiding this comment.
yes, now we should be able to do it. I'll look at that in a follow up, or if you want to fold it in your patches it's fine as well
| return; | ||
| } | ||
|
|
||
| this.sendAsyncMessage("FeltChild:StartFirefox", {}); |
There was a problem hiding this comment.
I'll raise this again once I merged my UI changes.
No description provided.