Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 334956 - Simple Firebug integration
Summary: Simple Firebug integration
Status: RESOLVED FIXED
Alias: None
Product: Orion
Classification: ECD
Component: Client (show other bugs)
Version: 0.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 0.2   Edit
Assignee: Mark Macdonald CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 335789
  Show dependency tree
 
Reported: 2011-01-20 17:53 EST by Mark Macdonald CLA
Modified: 2017-08-11 17:48 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Macdonald CLA 2011-01-20 17:53:41 EST
When Orion serves up an editable file, we need to include headers that allow you to construct the URL where that file can be edited. Firebug can use these headers to make links that take you directly to the code editor.
Comment 1 Mark Macdonald CLA 2011-01-20 17:55:35 EST
The suggested approach was to do this using 2 headers:

X-edit-server
X-edit-token
Comment 2 Mark Macdonald CLA 2011-01-25 17:59:32 EST
This is now in the repo. For example, a request for http://localhost:8080/file/A/test.js returns the headers:

X-Edit-Server	http://localhost:8080/coding.html#
X-Edit-Token	/file/A/test.js

Combining server + token gives us http://localhost:8080/coding.html#/file/A/test.js, the editing page for the file.
Comment 3 Mark Macdonald CLA 2011-01-25 18:02:25 EST
(For Orion developers who are self-hosting):

The VM argument "org.eclipse.orion.server.core.selfHostPath" can be provided when launching the server. It gives a default path that will be prepended to resources in the X-Edit-Token header. This solves the issue of, for example, /js/editorContainer.js mapping to something like /A/static/js/editorContainer.js in your Orion filesystem. If you don't supply a value for this argument, then only /file/ URIs will have X-Edit- headers.
Comment 4 Patrick Mueller CLA 2011-01-26 14:34:49 EST
I've opened a bug at WebKit, in case Web Inspector can also take advantage of this:

    https://bugs.webkit.org/show_bug.cgi?id=53181
Comment 5 John J. Barton CLA 2011-01-26 18:46:24 EST
Firebug extn dyne uses this header and opened the Orion editor one time
http://code.google.com/p/fbug/source/detail?r=9061
Comment 6 Boris Bokowski CLA 2011-01-26 19:49:11 EST
(In reply to comment #5)
> Firebug extn dyne uses this header and opened the Orion editor one time

Cool! How can I get/install this extension?
Comment 8 Boris Bokowski CLA 2011-01-26 20:05:10 EST
Mark, can you please give this a try? Does it work with our own files in self-hosting mode as described in comment 3?
Comment 9 Mark Macdonald CLA 2011-01-27 14:12:16 EST
John, what version of Firebug should I be running to try this out? I tested with 1.7X built from trunk, but it gave me a JavaScript error when I clicked Edit:
> Error: isSystemURL is not defined
> Source File: chrome://firebug/content/chrome.js
> Line: 695
Comment 10 John J. Barton CLA 2011-01-27 17:34:50 EST
(In reply to comment #9)
> John, what version of Firebug should I be running to try this out? I tested
> with 1.7X built from trunk, but it gave me a JavaScript error when I clicked

I hope you did not mean literally 'trunk'.  See
http://getfirebug.com/wiki/index.php/Firebug_Internals

> Edit:
> > Error: isSystemURL is not defined
> > Source File: chrome://firebug/content/chrome.js
> > Line: 695

This code is called from the external editors feature, so I'd like to know just how you hit it.  [Edit] on the script panel from dyne should not trigger this code.
Comment 11 John J. Barton CLA 2011-01-28 19:02:55 EST
Well now I am puzzled, because the header does not come out on 
http://localhost:8080/navigate-table.html#
but it does come out when I go to 
http://localhost:8080/file/org.eclipse.orion.client.core/static/navigate-table.html#
Comment 12 John J. Barton CLA 2011-01-28 19:14:08 EST
And http://localhost:8080/file/org.eclipse.orion.client.core/static/navigate-table.html#
has CSS urls like
 http://localhost:8080/ide.css
so they can't be edited either.
Comment 13 Boris Bokowski CLA 2011-01-28 21:50:37 EST
(In reply to comment #11)
> Well now I am puzzled, because the header does not come out on 
> http://localhost:8080/navigate-table.html#
> but it does come out when I go to 
> http://localhost:8080/file/org.eclipse.orion.client.core/static/navigate-table.html#

This is what comment 3 is about - if the file is coming from /file/* we know that this is an editable URL (one that supports PUT) and add the header. For files like /navigate-table.html and /ide.css we only add a header if the server has been started with an additional argument that provides the mapping to where under /file/* these files are editable.
Comment 14 John J. Barton CLA 2011-01-30 00:02:39 EST
Oh, sorry I just did not make the connection.

-Dorg.eclipse.orion.server.core.selfHostPath=<path>
puts <path> into the middle of x-edit-token:
   /file<path>/navigate-table.html

So with a host url of:
http://localhost:8080/navigate-table.html#

You can find the edit url by navigating the self-hosted files: 
http://localhost:8080/coding.html#http://localhost:8080/file/org.eclipse.orion.client.core/static/navigate-tree.html

The file service url you want to mimic is on the end:
http://localhost:8080/file/org.eclipse.orion.client.core/static/navigate-tree.html#

So the config is:
-Dorg.eclipse.orion.server.core.selfHostPath=/org.eclipse.orion.client.core/static

Note that this means only one project can be set on the path at a time.

dyne revision R9087 edits the self-hosting files, but you can only see the results if you open the file-service URL. I think the self-hosting story would be clearer if the home page listed "File service" and "Project Navigator", with the self-hosting entries on the File-service branch
Comment 15 Boris Bokowski CLA 2011-01-30 08:43:47 EST
(In reply to comment #14)
> Note that this means only one project can be set on the path at a time.

Correct - the story on our end is incomplete. We didn't want to invest too much in the self-hosting scenario without also adding value for regular users of Orion. The next step (I think) for us is to implement a way to define a "site" so that we can host it for the user rather than it appearing under "/file".

For example, I could be working on a couple of files for a website, under a directory "mywebsite". I'd want to be able to have the files under that directory hosted such that they appear at the root of the namespace. In this case my "site definition" could be something like:

mysite = [{target: "/", source: "/mywebsite"}]

Once you've defined a "site", Orion should be able to host it for you, either on a different port (http://localhost:8081/) or a different name for the same server (http://127.0.0.2:8080) or a subdomain assuming this is set up properly with DNS and wildcards (http://mysite.boris.orion.eclipse.org).

If you allow more than one mapping from target to source per site definition, we could handle the self-hosting scenario as follows:

selfhostingsite = [
  {target: "/", source: "/org.eclipse.orion.client.core/static/"},
  {target: "/editor", source: "/org.eclipse.orion.client.editor/web/"},
  ...
]

But that's for after we've declared M5.
Comment 16 Boris Bokowski CLA 2011-01-30 08:47:11 EST
I've copied the contents of comment 15 into a new bug 335789 that we can target for M6.
Comment 17 John J. Barton CLA 2011-01-31 00:44:49 EST
at R9098 dyne supports launching Orion from chromebug

http://getfirebug.com/wiki/index.php/Editing#Orion_Web_Editor_in_Chromebug_for_Local_Files

pretty convoluted to setup
Comment 18 Mark Macdonald CLA 2011-01-31 11:02:53 EST
(In reply to comment #10)
> I hope you did not mean literally 'trunk'.  See
> http://getfirebug.com/wiki/index.php/Firebug_Internals
No: I should've said "the 1.7 branch".

> This code is called from the external editors feature, so I'd like to know just
> how you hit it.  [Edit] on the script panel from dyne should not trigger this
> code.

Here's what I did:
1. Create new Firefox profile
2. Checkout Firebug from SVN
3. Link to dyne0.1 and firebug1.7 in my Firefox profile extensions folder.
4. Navigate to a file on the Orion server that has the X-Edit headers.
5. Open Firebug Script panel, click [Edit]
6. Get error from Comment 9

If I use the Firebug 1.7X.0a9 release build instead of the code from SVN, I get a different error in step 6:

Error: Firebug.chrome.getSelectedPanelLocation is not a function
Source File: chrome://dyne/content/dyne.js
Line: 44
Comment 19 Seymur Farziyev CLA 2017-08-11 17:48:20 EDT
(In reply to Mark Macdonald from comment #0)
> When Orion serves up an editable file, we need to include headers that allow
> you to construct the URL where that file can be edited. Firebug can use
> these headers to make links that take you directly to the code editor.