add dumpscripts command to list all js files on the current window.
This commit is contained in:
rginda%netscape.com 2002-02-16 11:01:06 +00:00
Родитель 83f80309b6
Коммит 825e68b529
1 изменённых файлов: 20 добавлений и 0 удалений

Просмотреть файл

@ -39,6 +39,7 @@ function initDev()
[["dumpcontexts", cmdDumpContexts, CMD_CONSOLE | CMD_NO_HELP], [["dumpcontexts", cmdDumpContexts, CMD_CONSOLE | CMD_NO_HELP],
["dumpfilters", cmdDumpFilters, CMD_CONSOLE | CMD_NO_HELP], ["dumpfilters", cmdDumpFilters, CMD_CONSOLE | CMD_NO_HELP],
["dumptree", cmdDumpTree, CMD_CONSOLE | CMD_NO_HELP], ["dumptree", cmdDumpTree, CMD_CONSOLE | CMD_NO_HELP],
["dumpscripts", cmdDumpScripts, CMD_CONSOLE | CMD_NO_HELP],
["reloadui", cmdReloadUI, CMD_CONSOLE | CMD_NO_HELP], ["reloadui", cmdReloadUI, CMD_CONSOLE | CMD_NO_HELP],
["sync-debug", cmdSyncDebug, CMD_CONSOLE | CMD_NO_HELP], ["sync-debug", cmdSyncDebug, CMD_CONSOLE | CMD_NO_HELP],
["testargs", cmdTestArgs, CMD_CONSOLE | CMD_NO_HELP], ["testargs", cmdTestArgs, CMD_CONSOLE | CMD_NO_HELP],
@ -118,6 +119,25 @@ function cmdDumpTree(e)
dd(e.tree + ":\n" + tov_formatBranch (eval(e.tree), "", e.depth)); dd(e.tree + ":\n" + tov_formatBranch (eval(e.tree), "", e.depth));
} }
function cmdDumpScripts(e)
{
var nl;
if ("frames" in console)
{
frame = getCurrentFrame();
var targetWindow = frame.executionContext.globalObject.getWrappedValue();
nl = targetWindow.document.getElementsByTagName("script");
}
else
{
nl = document.getElementsByTagName("script");
}
for (var i = 0; i < nl.length; ++i)
dd("src: " + nl.item(i).getAttribute ("src"));
}
function cmdReloadUI() function cmdReloadUI()
{ {
var bs = Components.classes["@mozilla.org/intl/stringbundle;1"]; var bs = Components.classes["@mozilla.org/intl/stringbundle;1"];