DevTools/Hacking: Difference between revisions

Jump to navigation Jump to search
Chrome Content
(JavaScript modules)
(Chrome Content)
Line 137: Line 137:
** <tt>loader.lazyImporter(this, "gDevTools", "resource:///modules/devtools/client/framework/gDevTools.jsm")</tt>
** <tt>loader.lazyImporter(this, "gDevTools", "resource:///modules/devtools/client/framework/gDevTools.jsm")</tt>
** <tt>Cu.import("resource:///modules/devtools/client/framework/gDevTools.jsm")</tt>
** <tt>Cu.import("resource:///modules/devtools/client/framework/gDevTools.jsm")</tt>
== Chrome Content ==
Much of the DevTools front-end / UI is currently loaded using <tt>chrome://</tt> (meaning "browser chrome" as in the UI, no relation to the Chrome browser) URLs which allow those files to have privileged access to platform internals.  (We'd like to move away from this on the DevTools and be more like regular web sites, but most tools are using <tt>chrome://</tt> URLs for now.)
=== Packaging ===
If you add a new file that should be loaded via <tt>chrome://</tt> (such as a new script file for a tool UI), you need to update a manifest file at <tt>/devtools/client/jar.mn</tt> so that it's packaged correctly.
Please ensure that any new files are added so their entire source tree path is part of the URL. To do so, the jar.mn entry should look like:
    content/<X> (<X>)
where <tt><X></tt> is the path to your file after removing the <tt>/devtools/client</tt> prefix.
Example:
* File: <tt>/devtools/client/webaudioeditor/models.js</tt>
* Entry: <tt>content/webaudioeditor/models.js (webaudioeditor/models.js)</tt>
=== Usage ===
Chrome content URLs almost match their source tree path, with one difference: the segment <tt>client</tt> is replaced by <tt>content</tt>.  This is a requirement of the <tt>chrome://</tt> protocol handler.
Example:
* File: <tt>/devtools/client/webaudioeditor/models.js</tt>
* Usage: <tt>chrome://devtools/content/webaudioeditor/models.js</tt>
For files within a single tool, consider relative URLs. They're shorter!


= Making and Submitting a Patch =
= Making and Submitting a Patch =
Confirmed users
177

edits

Navigation menu