1 /* See license.txt for terms of usage */ 2 3 // ********************************************************************************************* // 4 // Backward compatibility with Extensions 5 6 // xxxHonza: the only global should be Firebug object, but extensions use FBL 7 // to register namespaces (and bindings.xml uses it too). So, FBL must be 8 // available before extension's scripts are loaded. 9 window.FBL = 10 { 11 namespaces: [], 12 13 ns: function(fn) 14 { 15 var ns = {}; 16 this.namespaces.push(fn, ns); 17 return ns; 18 }, 19 20 initialize: function() 21 { 22 if (FBTrace.DBG_INITIALIZE) 23 FBTrace.sysout("FBL.initialize BEGIN "+FBL.namespaces.length+" namespaces\n"); 24 25 for (var i=0; i<FBL.namespaces.length; i+=2) 26 { 27 var fn = FBL.namespaces[i]; 28 var ns = FBL.namespaces[i+1]; 29 30 try 31 { 32 fn.apply(ns); 33 } 34 catch (exc) 35 { 36 FBTrace.sysout("fbl.initialize; EXCEPTION " + exc, exc); 37 38 if (exc.stack) 39 Components.utils.reportError("Firebug initialize FAILS "+exc+" "+exc.stack); 40 else 41 Components.utils.reportError("Firebug initialize FAILS "+exc+" "+ 42 fn.toSource().substr(0,500)); 43 } 44 } 45 46 if (FBTrace.DBG_INITIALIZE) 47 { 48 FBTrace.sysout("FBL.initialize END " + FBL.namespaces.length + " namespaces"); 49 FBTrace.sysout("Modules: " + Firebug.modules.length); 50 FBTrace.sysout("Panel types: " + Firebug.earlyRegPanelTypes.length); 51 } 52 } 53 } 54 55 // ********************************************************************************************* // 56 // Called by firebugFrame main.js to pump global and deprecated API back. 57 58 window.FBL.legacyPatch = function(FBL, Firebug) 59 { 60 if (top === window) 61 return; 62 63 top.FBL = FBL; 64 top.Firebug = Firebug; 65 } 66 67 window.FBL.legacyApiPatch = function(FBL, Firebug, Firefox) 68 { 69 // Backward compatibility with extensions 70 // deprecated 71 Firebug.getTabIdForWindow = FBL.getWindowProxyIdForWindow; 72 Firebug.getTabForWindow = FBL.getTabForWindow; 73 74 Firebug.chrome.getBrowsers = Firefox.getBrowsers; 75 Firebug.chrome.getCurrentBrowsers = Firefox.getCurrentBrowsers; 76 Firebug.chrome.getCurrentURI = Firefox.getCurrentURI; 77 } 78 79 // ********************************************************************************************* // 80