-
Notifications
You must be signed in to change notification settings - Fork 339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: WiP - Allow connecting to an existing Firefox instance #1122
Conversation
Sounds reasonable but I don't know if it's possible. If it's complicated, don't worry about it. |
I think you already added that, right? |
Just throw a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't fully understand why you need this feature. I left a comment on the issue asking for some clarifications on the use case.
However, I suppose we could accept the patch. I'm still thinking on it. The downsides are that there are a lot of things that can go wrong which may be hard for the user to fix. For example, the other Firefox will prompt them to accept the debugger connection but this prompt gets hidden easily. Also, it seems like a lot of features will not work in this mode.
That said, if you can make a solid case for it then it's a pretty simple patch. It will need automated tests and the usual cleanup (code needs to be indented two spaces, etc).
}); | ||
// TODO mock running info. Turn into something real or allow | ||
// FirefoxProcess to be null | ||
this.runningInfo = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty good. We might want to rename kill
in the interface to finishSession
or something but that's minor.
Did you not need to add firefox.stderr
and firefox.stdout
? It looks like we'll need that. If so, you could just set each to an event emitter that does nothing so that at least web-ext can bind to them.
@@ -341,6 +341,15 @@ Example: $0 --help run. | |||
demand: false, | |||
type: 'string', | |||
}, | |||
'firefox-port': { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This name should make it more obvious that you are connecting to a remote Firefox instance. Maybe remote-firefox-port
.
'firefox-port': { | ||
alias: 'P', | ||
describe: 'Attach to a running Firefox on this developer tools ' + | ||
'port. To do so, open the developer toolbar and enter ' + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also show these instructions on the console in case a connection cannot be made
@@ -341,6 +341,15 @@ Example: $0 --help run. | |||
demand: false, | |||
type: 'string', | |||
}, | |||
'firefox-port': { | |||
alias: 'P', | |||
describe: 'Attach to a running Firefox on this developer tools ' + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should explain things more from the perspective of what web-ext will do. Maybe something like "Connect to this debugger port on a running Firefox instance to install the browser extension."
Closing as "status: do not merge", the related issue is still technically not covered by web-ext but this PR has been branched out quite some time ago and so it may be easier to recreate it from scratch by cherry picking the proposed changes from this PR than rebasing this branch. |
Hey @kumar303, this is my WiP for #1100. It is mostly unpolished because I do have a few design questions open:
FirefoxInfo
has aFirefoxProcess
member that is checked againstnull
in some of the code. When connecting to a remote port without a process, there is nothing sensible to setFirefoxProcess
to. Right now what I am doing is creating a mockrunningInfo
that just has the debuggerPort and the process'kill
function which is used for cleanup. I can imagine better ways to fix this, but I'd appreciate your input on what you prefer. There could be some refactoring involved in this.kill
function and would be asynchronous instead. I'd likely have to adapt theFirefoxDesktopExtensionRunner::exit
function to take care of the asynchronous shutdown. Does this sound right?--firefox-port
option, e.g.--firefox-profile
,--firefox-binary
,--keep-profile-changes
, and--pre-install
. I could reasonably make--pref
,--browser-console
, and--start-url
work, but I think that would be bonus. Is there an existing way to flag incompatible options, and if not anything I should consider while implementing?