Skip to content
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

Swank protocol port #24

Open
erjoalgo opened this issue Jul 30, 2015 · 5 comments
Open

Swank protocol port #24

erjoalgo opened this issue Jul 30, 2015 · 5 comments

Comments

@erjoalgo
Copy link

Would it be possible to port this remote debugging protocol to a swank protocol and to provide a swank server for remote debugging? This would enable all slime-based front ends to make a remote debugging connection.

@fitzgen
Copy link
Collaborator

fitzgen commented Jul 30, 2015

Although I used to use slime and swank quite a bit, I have never dug into the protocol. But I don't imagine that it would be too difficult to write a proxy/adaptor that sits between slime and the devtools. That's pretty much what Valence is, except that it adapts other protocols to this one, rather than the other way around.

@erjoalgo
Copy link
Author

erjoalgo commented Aug 1, 2015

I was able to get swank-js to work (my own fork of it at least: https://github.com/erjoalgo/swank-js), and I get a connection to the browser. However, the Components object, although it exists, does not contain any useful attributes. In fact, only contains an "interfaces" attribute,

FIREFOX-31.0> JSON.stringify(Components)
{"interfaces":{"nsIDOMCSSRule":{"UNKNOWN_RULE":0,"STYLE_RULE":1,"CHARSET_RULE":2,"IMPORT_RULE":3,"MEDIA_RULE":4,"FONT_FACE_RULE":5,"PAGE_RULE":6,"KEYFRAMES_RULE":7,"KEYFRAME_RULE":8,"MOZ_KEYFRAMES_RULE":7,"MOZ_KEYFRAME_RULE":8,"NAMESPACE_RULE":10,"SUPPORTS_RULE":12,"FONT_FEATURE_VALUES_RULE":14},"nsIDOMXPathResult":{"ANY_TYPE":0,"NUMBER_TYPE":1,"STRING_TYPE":2,"BOOLEAN_TYPE":3,"UNORDERED_NODE_ITERATOR_TYPE":4,"ORDERED_NODE_ITERATOR_TYPE":5,"UNORDERED_NODE_SNAPSHOT_TYPE":6,"ORDERED_NODE_SNAPSHOT_TYPE":7,"ANY_UNORDERED_NODE_TYPE":8,"FIRST_ORDERED_NODE_TYPE":9}}}

This means I cannot use, for example Components.utils.import, since utils is undefined.

I'm actually really confused by all this. In what context is this swank-js server running the expressions from the REPL? Any ideas on how to, say, restart an extension from this REPL?

@erjoalgo
Copy link
Author

erjoalgo commented Aug 3, 2015

Ok, so swank-js allows me to run code in the context of a browser tab. But what I need is to do things like:

  1. Restart my extension
  2. Run code within the context of extension (IE the remote debugging context)

I think this requires the browser-side swank server to run in either the browser console context, or the extension remote debugging context.

I have unpacked the source, I will try to get swank-js to work from the browser console context. Any pointers for this? I imagine that tabs are a sandboxed environment and that there is no way to gain the privileges accessible in the browser console context.

@fitzgen
Copy link
Collaborator

fitzgen commented Aug 4, 2015

You need to connect to an addon scoped actor rather than a tab scoped actor. This is done by listAddons rather than listTabs.

Alternatively, if you want access to everything, connect to the chromeActor rather than a tab or addon actor.

See here for some more: https://dxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/docs/actor-hierarchy.md?from=actor-hierarchy.md#1

@erjoalgo
Copy link
Author

erjoalgo commented Aug 6, 2015

I desisted of this for now and I ended up using mozrepl https://github.com/bard/mozrepl , which does give me access to the browser console (Which I assume is the chromeActor?). But I still can't figure out how to reload. Do you have any pointers as to how to reload an extension directly from the browser console?

Right now I'm using jpm run but this is too slow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants