forked from janodvarko/fireless
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit. Basic structure for bootstrapped Firebug extension
- Loading branch information
1 parent
4658e3e
commit 83088fe
Showing
12 changed files
with
412 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
# Junk that could exist anywhere: | ||
.DS_Store | ||
*.swp | ||
*.tmp | ||
.*.gz | ||
*.patch | ||
|
||
# Temporary files created by Eclipse | ||
.tmp* | ||
|
||
# Editor junk | ||
*.project | ||
/.pydevproject | ||
/.settings/ | ||
/.settings.xml | ||
/.settings.xml.old | ||
/.idea/ | ||
|
||
# Build Files | ||
/extension/build/ | ||
/extension/release/ | ||
/tests/FBTest/release/ | ||
*.graphml | ||
/extension/bz-locale/ | ||
|
||
# Files from NPM | ||
/extension/node_modules/ | ||
|
||
# Extensions | ||
/extension/firebug@software.joehewitt.com | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# DO NOT MERGE INTO TRUNK | ||
RELEASE=.1 | ||
VERSION=0.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
/* See license.txt for terms of usage */ | ||
|
||
// ********************************************************************************************* // | ||
// XPCOM | ||
|
||
var {classes: Cc, interfaces: Ci, utils: Cu} = Components; | ||
|
||
// ********************************************************************************************* // | ||
// Constants | ||
|
||
// Extension installation path. Set within startup callback. | ||
var installPath; | ||
|
||
// ********************************************************************************************* // | ||
// Firefox Bootstrap API | ||
|
||
function install(data, reason) {} | ||
function uninstall(data, reason) {} | ||
|
||
function startup(data, reason) | ||
{ | ||
// Remember so, we can use later within firebugStartup callback. | ||
installPath = data.installPath; | ||
|
||
// Firebug extension start-up callback. Since extension load order isn't guaranteed | ||
// the code needs to be ready for two alternatives: | ||
// 1) Firebug is already loaded - good, let's just execute firebugStartup() callback | ||
// that will ensure proper Firebug related initialization for this extension. | ||
// 2) Firebug is not loaded yet - as soon as Firebug is loaded it'll execute this | ||
// method automatially. | ||
firebugStartup(); | ||
} | ||
|
||
function shutdown(data, reason) | ||
{ | ||
firebugShutdown(); | ||
} | ||
|
||
function isFirebugLoaded() | ||
{ | ||
try | ||
{ | ||
// Import Firebug modules into this scope. It fails if Firebug isn't loaded yet. | ||
Cu.import("resource://firebug/loader.js"); | ||
Cu.import("resource://firebug/prefLoader.js"); | ||
|
||
return true; | ||
} | ||
catch (e) | ||
{ | ||
} | ||
|
||
return true; | ||
} | ||
|
||
// ********************************************************************************************* // | ||
// Firebug Bootstrap API | ||
|
||
/** | ||
* Executed by Firebug framework when Firebug is started. Since the order of Firebug | ||
* and its bootstrapped extensions is not guaranteed this function is executed twice. | ||
* 1) When Firebug is loaded | ||
* 2) When this extension is loaded | ||
*/ | ||
function firebugStartup() | ||
{ | ||
// If Firebu isn't loade just bail out, Firebug will execute this method | ||
// as soon as it loads. | ||
if (!isFirebugLoaded()) | ||
return; | ||
|
||
FirebugLoader.registerBootstrapScope(this); | ||
|
||
// Load default preferences | ||
PrefLoader.loadDefaultPrefs(installPath, "prefs.js"); | ||
} | ||
|
||
/** | ||
* Executed by Firefox when this extension shutdowns. | ||
*/ | ||
function firebugShutdown() | ||
{ | ||
try | ||
{ | ||
FirebugLoader.unregisterBootstrapScope(this); | ||
} | ||
catch (e) | ||
{ | ||
Cu.reportError(e); | ||
} | ||
} | ||
|
||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
||
/** | ||
* Executed by Firebug framework for every browser window. Use this function to append | ||
* any new elements into the browser window (browser.xul). Don't forget to remove | ||
* these elements in topWindowUnload. | ||
* | ||
* @param {Window} win The browser window | ||
*/ | ||
function topWindowLoad(win) | ||
{ | ||
// TODO: overlay global browser window | ||
} | ||
|
||
/** | ||
* Executed by Firebug framework when this extension | ||
* @param {Object} win | ||
*/ | ||
function topWindowUnload(win) | ||
{ | ||
// TODO: remove global browser window overlays | ||
} | ||
|
||
/** | ||
* Entire Firebug UI is running inside an iframe (firebugFrame.xul). This function | ||
* is executed by Firebug framework when the frame is loaded. This happens when | ||
* the user requires Firebug for the first time (doesn't have to happen during the | ||
* Firefox session at all) | ||
* | ||
* @param {Window} win The Firebug window | ||
*/ | ||
function firebugFrameLoad(Firebug) | ||
{ | ||
// Register trace listener the customizes trace logs coming from this extension | ||
// * fireless; is unique prefix of all messages that should be customized. | ||
// * DBG_FIRELESS is a class name with style defined in the specified stylesheet. | ||
Firebug.registerTracePrefix("fireless;", "DBG_FIRELESS", true, | ||
"chrome://fireless/skin/fireless.css"); | ||
|
||
// The registration process will automatically look for 'main' module and load it. | ||
// The is the same what happens in a XUL overlay applied on: | ||
// chrome://firebug/content/firebugOverlay.xul | ||
var config = {id: "fireless@getfirebug.com"}; | ||
Firebug.registerExtension("fireless", config); | ||
} | ||
|
||
function firebugFrameUnload(Firebug) | ||
{ | ||
if (!Firebug.isInitialized) | ||
return; | ||
|
||
Firebug.unregisterExtension("fireless"); | ||
Firebug.unregisterTracePrefix("fireless;"); | ||
} | ||
|
||
// ********************************************************************************************* // |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?xml version="1.0" ?> | ||
|
||
<!-- Run ant in the extension's directory and look for: fireless-0.5.1.xpi --> | ||
<project name="fireless" basedir="." default="build"> | ||
|
||
<!-- Properties --> | ||
<property file="ant.properties"/> | ||
<property name="build.dir" value="./release"/> | ||
<property name="file-name" value="fireless-${VERSION}${RELEASE}.xpi"/> | ||
|
||
<!-- Clean --> | ||
<target name="clean"> | ||
<delete dir="${build.dir}"/> | ||
</target> | ||
|
||
<!-- Build --> | ||
<target name="build" depends="clean"> | ||
|
||
<!-- Copy files --> | ||
<copy todir="${build.dir}"> | ||
<fileset dir="."> | ||
<include name="**/*.js"/> | ||
<include name="**/*.xul"/> | ||
<include name="**/*.properties"/> | ||
<include name="**/*.css"/> | ||
<include name="**/*.manifest"/> | ||
<include name="**/*.rdf"/> | ||
<include name="**/*.txt"/> | ||
</fileset> | ||
</copy> | ||
|
||
<!-- Copy install.rdf with updated release version info --> | ||
<replace file="${build.dir}/install.rdf" propertyFile="ant.properties"> | ||
<replacefilter token="@VERSION@" property="VERSION"/> | ||
<replacefilter token="@RELEASE@" property="RELEASE"/> | ||
</replace> | ||
|
||
<!-- Compress files (ZIP) --> | ||
<zip destfile="${file-name}" basedir="${build.dir}" update="true" /> | ||
|
||
<echo message="FireLess version: ${VERSION}${RELEASE} created!"/> | ||
</target> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
content fireless chrome/content/ | ||
skin fireless classic/1.0 chrome/skin/classic/ | ||
locale fireless en-US chrome/locale/en-US/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* See license.txt for terms of usage */ | ||
|
||
define([ | ||
"firebug/lib/object", | ||
"firebug/lib/trace", | ||
"firebug/css/stylePanel", | ||
], | ||
function(Obj, FBTrace, CSSStylePanel) { | ||
|
||
// ********************************************************************************************* // | ||
// Custom Module Implementation | ||
|
||
Firebug.LessModule = Obj.extend(Firebug.Module, | ||
{ | ||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
// Initialization | ||
|
||
initialize: function(owner) | ||
{ | ||
Firebug.Module.initialize.apply(this, arguments); | ||
|
||
// TODO: Module initialization (there is one module instance per browser window) | ||
|
||
if (FBTrace.DBG_FIRELESS) | ||
FBTrace.sysout("fireless; LessModule.initialize"); | ||
}, | ||
|
||
shutdown: function() | ||
{ | ||
Firebug.Module.shutdown.apply(this, arguments); | ||
|
||
if (FBTrace.DBG_FIRELESS) | ||
FBTrace.sysout("fireless; LessModule.shutdown"); | ||
}, | ||
|
||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
// CSSStylePanel Patch | ||
|
||
onCreatePanel: function(context, panel, panelType) | ||
{ | ||
// Monkey patch the Style side panel. | ||
if (panel instanceof CSSStylePanel) | ||
{ | ||
this.styleGetSourceLink = panel.getSourceLink; | ||
panel.getSourceLink = this.getSourceLink; | ||
} | ||
}, | ||
|
||
getSourceLink: function(target, rule) | ||
{ | ||
if (FBTrace.DBG_FIRELESS) | ||
FBTrace.sysout("fireless; LessModule.getSourceLink"); | ||
|
||
Firebug.LessModule.styleGetSourceLink.apply(this, arguments); | ||
} | ||
}); | ||
|
||
// ********************************************************************************************* // | ||
// Registration | ||
|
||
Firebug.registerModule(Firebug.LessModule); | ||
|
||
return Firebug.LessModule; | ||
|
||
// ********************************************************************************************* // | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* See license.txt for terms of usage */ | ||
|
||
define([ | ||
"firebug/lib/trace", | ||
"fireless/lessModule", | ||
], | ||
function(FBTrace, LessModule) { | ||
|
||
// ********************************************************************************************* // | ||
// The application/extension object | ||
|
||
var theExtension = | ||
{ | ||
initialize: function() | ||
{ | ||
if (FBTrace.DBG_FIRELESS) | ||
FBTrace.sysout("fireless; FireLess extension initialize"); | ||
|
||
// Registration of Firebug panels and modules is made within appropriate files, | ||
// but it could be also done here. | ||
|
||
// TODO: Extension initialization | ||
}, | ||
|
||
shutdown: function() | ||
{ | ||
if (FBTrace.DBG_FIRELESS) | ||
FBTrace.sysout("fireless; FireLess extension shutdown"); | ||
|
||
// Unregister all registered Firebug components | ||
Firebug.unregisterModule(Firebug.LessModule); | ||
Firebug.unregisterStylesheet("chrome://fireless/skin/fireless.css"); | ||
Firebug.unregisterStringBundle("chrome://fireless/locale/fireless.properties"); | ||
|
||
// TODO: Extension shutdown | ||
} | ||
} | ||
|
||
// ********************************************************************************************* // | ||
|
||
return theExtension; | ||
|
||
// ********************************************************************************************* // | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# All UI should be here | ||
# Example: | ||
# fireless.label.cssError=CSS Error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* See license.txt for terms of usage */ | ||
|
||
/*************************************************************************************************/ | ||
|
||
/* Firebug Tracing Console customization. All messages from this example use this color. | ||
This helps to distinguish logs from those coming from Firebug | ||
Rule syntax: .DBG_<ext-id> | ||
See: http://getfirebug.com/wiki/index.php/FBTrace for more details */ | ||
.DBG_FIRELESS { | ||
color: rgb(101, 0, 114); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pref("extensions.firebug.DBG_FIRELESS", true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
xmlns:em="http://www.mozilla.org/2004/em-rdf#"> | ||
|
||
<Description about="urn:mozilla:install-manifest"> | ||
<em:id>fireless@getfirebug.com</em:id> | ||
<em:version>0.5</em:version> | ||
<em:type>2</em:type> | ||
<em:bootstrap>true</em:bootstrap> | ||
|
||
<!-- Target Application this extension can install into, | ||
with minimum and maximum supported versions. --> | ||
<em:targetApplication> | ||
<Description> | ||
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> | ||
<em:minVersion>10.0</em:minVersion> | ||
<em:maxVersion>20.*</em:maxVersion> | ||
</Description> | ||
</em:targetApplication> | ||
|
||
<!-- Front End MetaData --> | ||
<em:name>FireLess</em:name> | ||
<em:description>Support for LESS CSS in Firebug</em:description> | ||
<em:creator>Jan Odvarko</em:creator> | ||
<em:homepageURL>http://getfirebug.com</em:homepageURL> | ||
</Description> | ||
</RDF> |
Oops, something went wrong.