Firebug 1.8 API Changes

From FirebugWiki

(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
 +
Firebug 1.8 introduces set of API changes that can impact existing Firebug extensions. This page summarizes these changes and offers solution how to fix broken extensions.
 +
 +
== RequireJS and AMD ==
 +
Firebug source files are no longer loaded using <script> tags placed in a xul overlay (browserOverlay.xul). Firebug 1.8 uses [http://requirejs.org/ RequireJS] and Asynchronous Module Definition [http://wiki.commonjs.org/wiki/Modules/AsynchronousDefinition AMD]. All file (there are still a few exception) follow the AMD syntax now (see an [http://getfirebug.com/wiki/index.php/Firebug_Coding_Style#Example_Module_File_.28AMD.29 example].
 +
 +
== Globals ==
 +
* FirebugChrome doesn't exist anymore, you need to use Firebug.chrome
 +
* FBTrace still exist
 +
* Firebug still exist
 +
* FBL still exist
 +
* Domplate still exist
 +
 +
== Removed Components ==
 +
* firebug-http-observer is obsolete, use "firebug/http/requestObserver" module
 +
* firebug-trace-service is obsolete, use "firebug/lib/trace" module
 +
 +
== Removed API==
TODO: This is only a rough list of changes, more explanation needed.
TODO: This is only a rough list of changes, more explanation needed.
-
* Firebug source files use Asynchronous Module Definition (AMD)
 
-
* firebug-http-observer (JS module) is obsolete. Use "firebug/http/requestObserver"
 
* FBL.CCIN, FBL.CCSV and FBL.QI are obsolete, use "firebug/lib/xpcom"
* FBL.CCIN, FBL.CCSV and FBL.QI are obsolete, use "firebug/lib/xpcom"
-
* firebug-trace-service is obsolete, use "firebug/lib/trace"
+
* HTMLLib is not part of Firebug namespace, you need to include "firebug/lib/htmlLib"
-
* HTMLLib is not part of Firebug namespace, you need to include "firebug/lib/htmlLib.js
+
* $STR, $STRP, $STRP, registerStringBundle, getStringBundle, getDefaultStringBundle, getPluralRule, internationalize and internationalizeElements are part of "firebug/lib/locale"
* $STR, $STRP, $STRP, registerStringBundle, getStringBundle, getDefaultStringBundle, getPluralRule, internationalize and internationalizeElements are part of "firebug/lib/locale"
* dispatch and dispatch2 are part of "firebug/lib/events" module
* dispatch and dispatch2 are part of "firebug/lib/events" module
-
* All preferences should be accessed through firebug/lib/options module
+
* All preferences should be accessed through "firebug/lib/options" module
* FBL.deprecated is now Deprecated.deprecated (firebug/lib/deprecated)
* FBL.deprecated is now Deprecated.deprecated (firebug/lib/deprecated)
* FBTrace comes from "firebug/lib/trace"
* FBTrace comes from "firebug/lib/trace"
Line 15: Line 29:
* FirebugChrome namespace: getBrowsers, getCurrentBrowsers, getCurrentURI API removed and part of firefox/firefox module
* FirebugChrome namespace: getBrowsers, getCurrentBrowsers, getCurrentURI API removed and part of firefox/firefox module
* There is a new <code>&lt;div&gt;</code> fbMainFrame (wrapping fbContentBox)
* There is a new <code>&lt;div&gt;</code> fbMainFrame (wrapping fbContentBox)
-
* New $ API: http://groups.google.com/group/firebug-working-group/browse_thread/thread/c8081f66a5139312
+
 
-
* FirebugChrome is obsolete global (still available in 1.8 perhaps) and replaced by Firebug.chrome
+
* Firebug.getTabForWindow and getTabIdForWindow is removed, use firefox/window module (getWindowProxyIdForWindow).
-
* Firebug.getTabForWindow and getTabIdForWindow is removed, use firefox/window getWindowProxyIdForWindow
+
 
* FBL.openWindow, FBL.viewSource, FBL.getBrowserForWindow are part of firefox/firefox
* FBL.openWindow, FBL.viewSource, FBL.getBrowserForWindow are part of firefox/firefox
* FBL.ToggleBranch is now ToggleBranch.ToggleBranch
* FBL.ToggleBranch is now ToggleBranch.ToggleBranch
Line 28: Line 42:
* FBL.Property -> FirebugReps.PropertyObj
* FBL.Property -> FirebugReps.PropertyObj
-
FBL.findScripts = Firebug.SourceFile.findScripts;
+
* FBL.findScripts -> Firebug.SourceFile.findScripts;
-
FBL.findScriptForFunctionInContext = Firebug.SourceFile.findScriptForFunctionInContext;
+
* FBL.findScriptForFunctionInContext -> Firebug.SourceFile.findScriptForFunctionInContext;
-
FBL.findSourceForFunction = Firebug.SourceFile.findSourceForFunction;
+
* FBL.findSourceForFunction -> Firebug.SourceFile.findSourceForFunction;
-
FBL.getSourceLinkForScript = Firebug.SourceFile.getSourceLinkForScript;
+
* FBL.getSourceLinkForScript -> Firebug.SourceFile.getSourceLinkForScript;
-
FBL.getSourceFileByHref = Firebug.SourceFile.getSourceFileByHref;
+
* FBL.getSourceFileByHref -> Firebug.SourceFile.getSourceFileByHref;
-
FBL.sourceURLsAsArray = Firebug.SourceFile.sourceURLsAsArray;
+
* FBL.sourceURLsAsArray -> Firebug.SourceFile.sourceURLsAsArray;
-
FBL.sourceFilesAsArray = Firebug.SourceFile.sourceFilesAsArray;
+
* FBL.sourceFilesAsArray -> Firebug.SourceFile.sourceFilesAsArray;
-
FBL.mapAsArray = Firebug.SourceFile.mapAsArray;
+
* FBL.mapAsArray -> Firebug.SourceFile.mapAsArray;
 +
* FBL.NetFileLink -> Firebug.NetMonitor.NetFileLink
-
* If you using FBL in separate XUL windows, make sure you don't include files like (you need to pass FBL and Firebug globals through window arguments.
+
== FBL.$ ==
 +
* FBL.$ is deprecate, if you use it you should explicitly provide the document where the element is expected as the second parameter.
 +
 
 +
<source lang="javascript">
 +
var elem = FBL.$("myElem", document);
 +
</source>
 +
 
 +
* See also: http://groups.google.com/group/firebug-working-group/browse_thread/thread/c8081f66a5139312
 +
 
 +
 
 +
== FBL in XUL Windows ==
 +
 
 +
* If you using FBL in separate XUL windows/dialogs, make sure you don't include files  
<script type="application/x-javascript" src="chrome://firebug/content/xpcom.js"/>
<script type="application/x-javascript" src="chrome://firebug/content/xpcom.js"/>
<script type="application/x-javascript" src="chrome://firebug/content/lib.js"/>
<script type="application/x-javascript" src="chrome://firebug/content/lib.js"/>
-
Or accessing it from the browser window:
+
You need to pass FBL and Firebug globals through [https://developer.mozilla.org/en/DOM/window.openDialog window arguments].
 +
Or access it from the browser window:
 +
 +
<source lang="javascript">
const windowMediator = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
const windowMediator = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
var FBL = windowMediator.getMostRecentWindow("navigator:browser").FBL;
var FBL = windowMediator.getMostRecentWindow("navigator:browser").FBL;
-
 
+
</source>
-
* FBL.NetFileLink doesn't exist, use Firebug.NetMonitor.NetFileLink
+

Revision as of 12:22, 24 May 2011

Firebug 1.8 introduces set of API changes that can impact existing Firebug extensions. This page summarizes these changes and offers solution how to fix broken extensions.

Contents

RequireJS and AMD

Firebug source files are no longer loaded using <script> tags placed in a xul overlay (browserOverlay.xul). Firebug 1.8 uses RequireJS and Asynchronous Module Definition AMD. All file (there are still a few exception) follow the AMD syntax now (see an example.

Globals

  • FirebugChrome doesn't exist anymore, you need to use Firebug.chrome
  • FBTrace still exist
  • Firebug still exist
  • FBL still exist
  • Domplate still exist

Removed Components

  • firebug-http-observer is obsolete, use "firebug/http/requestObserver" module
  • firebug-trace-service is obsolete, use "firebug/lib/trace" module

Removed API

TODO: This is only a rough list of changes, more explanation needed.

  • FBL.CCIN, FBL.CCSV and FBL.QI are obsolete, use "firebug/lib/xpcom"
  • HTMLLib is not part of Firebug namespace, you need to include "firebug/lib/htmlLib"
  • $STR, $STRP, $STRP, registerStringBundle, getStringBundle, getDefaultStringBundle, getPluralRule, internationalize and internationalizeElements are part of "firebug/lib/locale"
  • dispatch and dispatch2 are part of "firebug/lib/events" module
  • All preferences should be accessed through "firebug/lib/options" module
  • FBL.deprecated is now Deprecated.deprecated (firebug/lib/deprecated)
  • FBTrace comes from "firebug/lib/trace"
  • New modules: url, wrapper (don't use the API from FBL)
  • FBL.findNext and FBL.findPrevious no longer exist.
  • FirebugChrome namespace: getBrowsers, getCurrentBrowsers, getCurrentURI API removed and part of firefox/firefox module
  • There is a new <div> fbMainFrame (wrapping fbContentBox)
  • Firebug.getTabForWindow and getTabIdForWindow is removed, use firefox/window module (getWindowProxyIdForWindow).
  • FBL.openWindow, FBL.viewSource, FBL.getBrowserForWindow are part of firefox/firefox
  • FBL.ToggleBranch is now ToggleBranch.ToggleBranch
  • FBL.Continued removed.
  • FBL.isAncestorIgnored removed
  • FBL.ErrorMessage -> FirebugReps.ErrorMessageObj
  • FBL.fatalError removed
  • FBL.ErrorCopy -> FirebugReps.ErrorCopy
  • FBL.EventCopy -> DOM.EventCopy
  • FBL.Property -> FirebugReps.PropertyObj
  • FBL.findScripts -> Firebug.SourceFile.findScripts;
  • FBL.findScriptForFunctionInContext -> Firebug.SourceFile.findScriptForFunctionInContext;
  • FBL.findSourceForFunction -> Firebug.SourceFile.findSourceForFunction;
  • FBL.getSourceLinkForScript -> Firebug.SourceFile.getSourceLinkForScript;
  • FBL.getSourceFileByHref -> Firebug.SourceFile.getSourceFileByHref;
  • FBL.sourceURLsAsArray -> Firebug.SourceFile.sourceURLsAsArray;
  • FBL.sourceFilesAsArray -> Firebug.SourceFile.sourceFilesAsArray;
  • FBL.mapAsArray -> Firebug.SourceFile.mapAsArray;
  • FBL.NetFileLink -> Firebug.NetMonitor.NetFileLink

FBL.$

  • FBL.$ is deprecate, if you use it you should explicitly provide the document where the element is expected as the second parameter.
var elem = FBL.$("myElem", document);


FBL in XUL Windows

  • If you using FBL in separate XUL windows/dialogs, make sure you don't include files

<script type="application/x-javascript" src="chrome://firebug/content/xpcom.js"/> <script type="application/x-javascript" src="chrome://firebug/content/lib.js"/>

You need to pass FBL and Firebug globals through window arguments.

Or access it from the browser window:

const windowMediator = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
var FBL = windowMediator.getMostRecentWindow("navigator:browser").FBL;
Personal tools