Bug 337069: inspecting chrome is undiscoverable, patch by Jason Barnabe (np) <jason_barnabe@fastmail.fm>, r=timeless, sr=neil

git-svn-id: svn://10.0.0.236/trunk@213408 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
gavin%gavinsharp.com
2006-10-10 13:22:14 +00:00
parent 5004111ec3
commit 5d7be6c313
21 changed files with 42 additions and 129 deletions

View File

@@ -20,7 +20,6 @@
<command id="cmdShowPrefsDialog" oncommand="inspector.showPrefsDialog()"/>
<command id="cmdToggleBrowser" oncommand="inspector.toggleBrowser(true)"/>
<command id="cmdToggleChrome" oncommand="inspector.toggleChrome()"/>
<command id="cmdEditUndo" global="true" oncommand="inspector.doViewerCommand('cmdEditUndo');"/>
<command id="cmdEditRedo" global="true" oncommand="inspector.doViewerCommand('cmdEditRedo');"/>

View File

@@ -124,11 +124,6 @@ InspectorApp.prototype =
this.mPanelSet.addObserver("panelsetready", this, false);
this.mPanelSet.initialize();
this.mInspectDocumentMenu = document.getElementById("listDocuments-popup");
document.getElementById("cmdToggleChrome").setAttribute("checked",
PrefUtils.getPref("inspector.showChrome"));
// check if accessibility service is available
var cmd = document.getElementById("cmd:toggleAccessibleNodes");
if (cmd) {
@@ -221,17 +216,6 @@ InspectorApp.prototype =
cmd.setAttribute("checked", aValue);
},
/**
* Toggles inspector.showChrome
*/
toggleChrome: function()
{
var newValue = !PrefUtils.getPref("inspector.showChrome");
PrefUtils.setPref("inspector.showChrome", newValue);
var cmd = document.getElementById("cmdToggleChrome");
cmd.setAttribute("checked", newValue);
},
toggleSearch: function(aToggleSplitter)
{
this.setSearch(!this.mShowSearch, aToggleSplitter);
@@ -377,65 +361,48 @@ InspectorApp.prototype =
},
/**
* Creates the submenu for Inspect Document
* Creates the submenu for Inspect Content/Chrome Document
*/
showInspectDocumentList: function()
showInspectDocumentList: function showInspectDocumentList(aEvent, aChrome)
{
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
var showChrome = PrefUtils.getPref("inspector.showChrome");
var menu = aEvent.target;
var ww = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
var windows = ww.getXULWindowEnumerator(null);
var contentDocs = [];
var chromeDocs = [];
var docs = [];
while (windows.hasMoreElements()) {
try {
// Get the window's main docshell
var windowDocShell = windows.getNext()
.QueryInterface(Components.interfaces.nsIXULWindow).docShell;
// Put the window's documents into the appropriate arrays
this.appendContainedDocuments(contentDocs, windowDocShell,
nsIDocShellTreeItem.typeContent);
if (showChrome) {
this.appendContainedDocuments(chromeDocs, windowDocShell,
nsIDocShellTreeItem.typeChrome);
}
.QueryInterface(Components.interfaces.nsIXULWindow)
.docShell;
this.appendContainedDocuments(docs, windowDocShell,
aChrome ? nsIDocShellTreeItem.typeChrome
: nsIDocShellTreeItem.typeContent);
}
catch (ex) {
// We've failed with this window somehow, but we're catching the error so the
// others will still work
dump(ex + "\n");
// We've failed with this window somehow, but we're catching the error
// so the others will still work
Components.utils.reportError(ex);
}
}
// Clear out any previous menu
this.emptyChildren(this.mInspectDocumentMenu);
this.emptyChildren(menu);
// Now add what we found to the menu
var docNumber = 0;
for (var i = 0; i < contentDocs.length; i++) {
this.addInspectDocumentMenuItem(contentDocs[i], ++docNumber);
}
if (showChrome) {
// Put a separator in if there were content docs
if (contentDocs.length > 0) {
this.mInspectDocumentMenu.appendChild(document.createElementNS(XULNS, "menuseparator"));
}
for (var i = 0; i < chromeDocs.length; i++) {
this.addInspectDocumentMenuItem(chromeDocs[i], ++docNumber);
}
if (!docs.length) {
var noneMenuItem = document.createElementNS(XULNS, "menuitem");
noneMenuItem.setAttribute("label",
this.mPanelSet.stringBundle
.getString("inspectWindow.noDocuments.message"));
noneMenuItem.setAttribute("disabled", true);
menu.appendChild(noneMenuItem);
} else {
// If we're not showing chrome, there's a possibility there are no documents
// at all.
if (contentDocs.length == 0) {
var noneMenuItem = document.createElementNS(XULNS, "menuitem");
noneMenuItem.setAttribute("label", this.mPanelSet.stringBundle
.getString("inspectWindow.noDocuments.message"));
noneMenuItem.setAttribute("disabled", true);
this.mInspectDocumentMenu.appendChild(noneMenuItem);
}
for (var i = 0; i < docs.length; i++)
this.addInspectDocumentMenuItem(menu, docs[i], i + 1);
}
},
@@ -447,7 +414,7 @@ InspectorApp.prototype =
* @param docShell the docshell to look for documents in
* @param type one of the types defined in nsIDocShellTreeItem
*/
appendContainedDocuments: function(array, docShell, type)
appendContainedDocuments: function appendContainedDocuments(array, docShell, type)
{
// Load all the window's content docShells
var containedDocShells = docShell.getDocShellEnumerator(type,
@@ -478,7 +445,7 @@ InspectorApp.prototype =
* @param doc document related to this menu item
* @param docNumber the position of the document
*/
addInspectDocumentMenuItem: function(doc, docNumber)
addInspectDocumentMenuItem: function addInspectDocumentMenuItem(parent, doc, docNumber)
{
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
var menuItem = document.createElementNS(XULNS, "menuitem");
@@ -492,7 +459,7 @@ InspectorApp.prototype =
} else {
menuItem.setAttribute("label", title);
}
this.mInspectDocumentMenu.appendChild(menuItem);
parent.appendChild(menuItem);
},
setTargetWindow: function(aWindow)

View File

@@ -27,10 +27,19 @@
</popupset>
<menupopup id="menu_FilePopup">
<menu oncommand="inspector.setTargetDocument(event.target.doc);" id="mnInspectDocumentFile" label="&mnInspectDocument.label;"
accesskey="&mnInspectDocument.accesskey;">
<menupopup id="listDocuments-popup"
onpopupshowing="inspector.showInspectDocumentList()"/>
<menu oncommand="inspector.setTargetDocument(event.target.doc);"
id="mnInspectContentDocumentFile"
label="&mnInspectContentDocument.label;"
accesskey="&mnInspectContentDocument.accesskey;">
<menupopup id="list-content-documents-popup"
onpopupshowing="inspector.showInspectDocumentList(event, false);"/>
</menu>
<menu oncommand="inspector.setTargetDocument(event.target.doc);"
id="mnInspectChromeDocumentFile"
label="&mnInspectChromeDocument.label;"
accesskey="&mnInspectChromeDocument.accesskey;">
<menupopup id="list-chrome-documents-popup"
onpopupshowing="inspector.showInspectDocumentList(event, true);"/>
</menu>
<menuitem label="&cmdShowOpenURLDialog.label;" accesskey="&cmdShowOpenURLDialog.accesskey;"
observes="cmdShowOpenURLDialog"/>
@@ -64,8 +73,6 @@
<menupopup id="mppView">
<menuitem class="menuitem-iconic" type="checkbox" label="&cmdToggleBrowser.label;" observes="cmdToggleBrowser"/>
<menuitem class="menuitem-iconic" type="checkbox" label="&cmdToggleChrome.label;" observes="cmdToggleChrome"
accesskey="&cmdToggleChrome.accesskey;"/>
<!--
<menuitem class="menuitem-iconic" type="checkbox" label="&cmdToggleSearch.label;" observes="cmdToggleSearch"/>
-->

View File

@@ -44,4 +44,3 @@ pref("inspector.blink.invert", false);
pref("inspector.dom.showAnon", true);
pref("inspector.dom.showWhitespaceNodes", true);
pref("inspector.dom.showAccessibleNodes", false);
pref("inspector.showChrome", false);

View File

@@ -8,8 +8,6 @@
<!-- MAIN MENU ITEMS -->
<!ENTITY mnFile.label "Fitxer">
<!ENTITY mnFile.accesskey "F">
<!ENTITY mnInspectDocument.label "Inspect Document">
<!ENTITY mnInspectDocument.accesskey "D">
<!ENTITY cmdShowOpenURLDialog.label "Inspecciona un URL">
<!ENTITY cmdShowOpenURLDialog.accesskey "U">
<!ENTITY cmdClose.label "Tanca">
@@ -38,8 +36,6 @@
<!ENTITY cmdRunSearch.accesskey "a">
<!ENTITY mnView.label "Visualitza">
<!ENTITY mnView.accesskey "V">
<!ENTITY cmdToggleChrome.label "Chrome">
<!ENTITY cmdToggleChrome.accesskey "C">
<!ENTITY cmdToggleBrowser.label "Navegador">
<!ENTITY cmdToggleSearch.label "Cerca els resultats">
<!ENTITY cmdViewSearchItem.label "Visualitza...">

View File

@@ -8,8 +8,6 @@
<!-- MAIN MENU ITEMS -->
<!ENTITY mnFile.label "Soubor">
<!ENTITY mnFile.accesskey "S">
<!ENTITY mnInspectDocument.label "Prozkoumat dokument">
<!ENTITY mnInspectDocument.accesskey "d">
<!ENTITY cmdShowOpenURLDialog.label "Prozkoumat URL">
<!ENTITY cmdShowOpenURLDialog.accesskey "U">
<!ENTITY cmdClose.label "Zavřít">
@@ -40,8 +38,6 @@
<!ENTITY mnView.accesskey "Z">
<!ENTITY cmdToggleBrowser.label "Prohlížeč">
<!ENTITY cmdToggleSearch.label "Výsledky hledání">
<!ENTITY cmdToggleChrome.label "Chrome">
<!ENTITY cmdToggleChrome.accesskey "C">
<!ENTITY cmdViewSearchItem.label "Zobrazit...">
<!ENTITY cmdEditSearchItem.label "Úpravy">
<!ENTITY cmdCopySearchItemLine.label "Kopírovat řádku">

View File

@@ -12,8 +12,6 @@
<!ENTITY mnFile.label "Filer">
<!ENTITY mnFile.accesskey "f">
<!ENTITY mnInspectDocument.label "Inspicer dokument">
<!ENTITY mnInspectDocument.accesskey "d">
<!ENTITY cmdShowOpenURLDialog.label "Inspicer en URL...">
<!ENTITY cmdShowOpenURLDialog.accesskey "u">
<!ENTITY cmdClose.label "Luk">
@@ -47,8 +45,6 @@
<!ENTITY mnView.accesskey "v">
<!ENTITY cmdToggleBrowser.label "Browser">
<!ENTITY cmdToggleSearch.label "Søgeresultater">
<!ENTITY cmdToggleChrome.label "Chrome">
<!ENTITY cmdToggleChrome.accesskey "C">
<!ENTITY cmdViewSearchItem.label "Vis...">
<!ENTITY cmdEditSearchItem.label "Rediger...">

View File

@@ -12,8 +12,6 @@
<!ENTITY mnFile.label "Datei">
<!ENTITY mnFile.accesskey "D">
<!ENTITY mnInspectDocument.label "Dokument inspizieren">
<!ENTITY mnInspectDocument.accesskey "D">
<!ENTITY cmdShowOpenURLDialog.label "URL inspizieren...">
<!ENTITY cmdShowOpenURLDialog.accesskey "U">
<!ENTITY cmdClose.label "Schließen">
@@ -47,8 +45,6 @@
<!ENTITY mnView.accesskey "A">
<!ENTITY cmdToggleBrowser.label "Browser">
<!ENTITY cmdToggleSearch.label "Suchergebnisse">
<!ENTITY cmdToggleChrome.label "Chrome">
<!ENTITY cmdToggleChrome.accesskey "C">
<!ENTITY cmdViewSearchItem.label "Ansicht...">
<!ENTITY cmdEditSearchItem.label "Bearbeiten...">

View File

@@ -61,5 +61,3 @@
<!ENTITY mnInspectDocument.label "Επιθεώρηση εγγράφου">
<!ENTITY mnInspectDocument.accesskey "θ">
<!ENTITY cmdToggleChrome.label "Chrome">
<!ENTITY cmdToggleChrome.accesskey "C">

View File

@@ -12,8 +12,10 @@
<!ENTITY mnFile.label "File">
<!ENTITY mnFile.accesskey "F">
<!ENTITY mnInspectDocument.label "Inspect Document">
<!ENTITY mnInspectDocument.accesskey "D">
<!ENTITY mnInspectContentDocument.label "Inspect Content Document">
<!ENTITY mnInspectContentDocument.accesskey "O">
<!ENTITY mnInspectChromeDocument.label "Inspect Chrome Document">
<!ENTITY mnInspectChromeDocument.accesskey "H">
<!ENTITY cmdShowOpenURLDialog.label "Inspect a URL...">
<!ENTITY cmdShowOpenURLDialog.accesskey "U">
<!ENTITY cmdClose.label "Close">
@@ -47,8 +49,6 @@
<!ENTITY mnView.accesskey "v">
<!ENTITY cmdToggleBrowser.label "Browser">
<!ENTITY cmdToggleSearch.label "Search Results">
<!ENTITY cmdToggleChrome.label "Chrome">
<!ENTITY cmdToggleChrome.accesskey "C">
<!ENTITY cmdViewSearchItem.label "View...">
<!ENTITY cmdEditSearchItem.label "Edit...">

View File

@@ -11,8 +11,6 @@
<!-- MAIN MENU ITEMS -->
<!ENTITY mnFile.label "Fichier">
<!ENTITY mnWindows.label "Examiner une fenêtre">
<!ENTITY mnWindows.accesskey "E">
<!ENTITY mnFile.accesskey "F">
<!ENTITY cmdShowOpenURLDialog.label "Examiner une URL…">
<!ENTITY cmdShowOpenURLDialog.accesskey "u">

View File

@@ -8,8 +8,6 @@
<!-- MAIN MENU ITEMS -->
<!ENTITY mnFile.label "Comhad">
<!ENTITY mnFile.accesskey "C">
<!ENTITY mnInspectDocument.label "Scrúdaigh Cáipéis">
<!ENTITY mnInspectDocument.accesskey "p">
<!ENTITY cmdShowOpenURLDialog.label "Scrúdaigh URL...">
<!ENTITY cmdShowOpenURLDialog.accesskey "U">
<!ENTITY cmdClose.label "Dún">
@@ -40,8 +38,6 @@
<!ENTITY mnView.accesskey "A">
<!ENTITY cmdToggleBrowser.label "Brabhsálaí">
<!ENTITY cmdToggleSearch.label "Torthaí Cuardaigh">
<!ENTITY cmdToggleChrome.label "Snas">
<!ENTITY cmdToggleChrome.accesskey "S">
<!ENTITY cmdViewSearchItem.label "Amharc...">
<!ENTITY cmdEditSearchItem.label "Eagar...">
<!ENTITY cmdCopySearchItemLine.label "Cóipeáil Líne">

View File

@@ -12,8 +12,6 @@
<!ENTITY mnFile.label "Fájl">
<!ENTITY mnFile.accesskey "F">
<!ENTITY mnInspectDocument.label "Dokumentum vizsgálata">
<!ENTITY mnInspectDocument.accesskey "D">
<!ENTITY cmdShowOpenURLDialog.label "URL vizsgálata...">
<!ENTITY cmdShowOpenURLDialog.accesskey "u">
<!ENTITY cmdClose.label "Bezárás">
@@ -47,8 +45,6 @@
<!ENTITY mnView.accesskey "N">
<!ENTITY cmdToggleBrowser.label "Böngésző">
<!ENTITY cmdToggleSearch.label "Találatok">
<!ENTITY cmdToggleChrome.label "Chrome">
<!ENTITY cmdToggleChrome.accesskey "C">
<!ENTITY cmdViewSearchItem.label "Megtekintés...">
<!ENTITY cmdEditSearchItem.label "Szerkesztés...">

View File

@@ -12,10 +12,6 @@
<!ENTITY mnFile.label "Fil">
<!ENTITY mnFile.accesskey "f">
<!ENTITY mnInspectDocument.label "Inspiser dokument ...">
<!ENTITY mnInspectDocument.accesskey "d">
<!ENTITY cmdToggleChrome.label "Chrome">
<!ENTITY cmdToggleChrome.accesskey "C">
<!ENTITY cmdShowOpenURLDialog.label "Inspiser en adresse ...">
<!ENTITY cmdShowOpenURLDialog.accesskey "I">
<!ENTITY cmdClose.label "Lukk">

View File

@@ -11,9 +11,6 @@
<!ENTITY mnFile.label "Plik">
<!ENTITY mnFile.accesskey "P">
<!ENTITY mnInspectDocument.label "Zbadaj dokument">
<!ENTITY mnInspectDocument.accesskey "D">
<!ENTITY cmdShowOpenURLDialog.label "Zbadaj URL...">
<!ENTITY cmdShowOpenURLDialog.accesskey "u">
<!ENTITY cmdClose.label "Zamknij">
@@ -47,8 +44,6 @@
<!ENTITY mnView.accesskey "W">
<!ENTITY cmdToggleBrowser.label "Przeglądarka">
<!ENTITY cmdToggleSearch.label "Wyniki wyszukiwania">
<!ENTITY cmdToggleChrome.label "Chrome">
<!ENTITY cmdToggleChrome.accesskey "C">
<!ENTITY cmdViewSearchItem.label "Widok...">
<!ENTITY cmdEditSearchItem.label "Edycja...">

View File

@@ -11,8 +11,6 @@
<!-- MAIN MENU ITEMS -->
<!ENTITY mnFile.label "Arquivo">
<!ENTITY mnWindows.label "Inspecionar janela">
<!ENTITY mnWindows.accesskey "I">
<!ENTITY mnFile.accesskey "A">
<!ENTITY cmdShowOpenURLDialog.label "Inspecionar URL...">
<!ENTITY cmdShowOpenURLDialog.accesskey "U">

View File

@@ -31,8 +31,6 @@
<!ENTITY cmdShowOpenURLDialog.accesskey "с">
<!ENTITY cmdShowOpenURLDialog.label "Исследовать URL...">
<!ENTITY cmdToggleBrowser.label "Браузер">
<!ENTITY cmdToggleChrome.label "Chrome">
<!ENTITY cmdToggleChrome.accesskey "C">
<!ENTITY cmdToggleSearch.label "Результаты поиска">
<!ENTITY cmdUndo.accesskey "О">
<!ENTITY cmdUndo.label "Отменить">
@@ -42,8 +40,6 @@
<!ENTITY mnEdit.label "Правка">
<!ENTITY mnFile.accesskey "Ф">
<!ENTITY mnFile.label "Файл">
<!ENTITY mnInspectDocument.label "Исследовать документ">
<!ENTITY mnInspectDocument.accesskey "Д">
<!ENTITY mnSearch.accesskey "П">
<!ENTITY mnSearch.label "Поиск">
<!ENTITY mnSearchPlugins.accesskey "Р">

View File

@@ -11,8 +11,6 @@
<!-- MAIN MENU ITEMS -->
<!ENTITY mnFile.label "Súbor">
<!ENTITY mnWindows.label "Preskúmať okno">
<!ENTITY mnWindows.accesskey "o">
<!ENTITY mnFile.accesskey "s">
<!ENTITY cmdShowOpenURLDialog.label "Preskúmať URL">
<!ENTITY cmdShowOpenURLDialog.accesskey "U">

View File

@@ -12,8 +12,6 @@
<!ENTITY mnFile.label "Arkiv">
<!ENTITY mnFile.accesskey "A">
<!ENTITY mnInspectDocument.label "Inspektera ett dokument">
<!ENTITY mnInspectDocument.accesskey "d">
<!ENTITY cmdShowOpenURLDialog.label "Inspektera en URL...">
<!ENTITY cmdShowOpenURLDialog.accesskey "u">
<!ENTITY cmdClose.label "Stäng">
@@ -47,8 +45,6 @@
<!ENTITY mnView.accesskey "v">
<!ENTITY cmdToggleBrowser.label "Webbläsare">
<!ENTITY cmdToggleSearch.label "Sökresultat">
<!ENTITY cmdToggleChrome.label "Chrome">
<!ENTITY cmdToggleChrome.accesskey "C">
<!ENTITY cmdViewSearchItem.label "Visa...">
<!ENTITY cmdEditSearchItem.label "Redigera...">

View File

@@ -30,11 +30,7 @@
<!ENTITY cmdSaveSearchItemText.label "保存...">
<!ENTITY cmdShowOpenURLDialog.accesskey "U">
<!ENTITY cmdShowOpenURLDialog.label "查看一个URL...">
<!ENTITY cmdToggleChrome.accesskey "C">
<!ENTITY cmdToggleChrome.label "Chrome">
<!ENTITY cmdToggleBrowser.label "浏览器">
<!ENTITY cmdToggleChrome.label "Chrome">
<!ENTITY cmdToggleChrome.accesskey "C">
<!ENTITY cmdToggleSearch.label "搜索结果">
<!ENTITY cmdUndo.accesskey "U">
<!ENTITY cmdUndo.label "撤销">
@@ -44,10 +40,6 @@
<!ENTITY mnEdit.label "编辑">
<!ENTITY mnFile.accesskey "F">
<!ENTITY mnFile.label "文件">
<!ENTITY mnInspectDocument.label "Inspect Document">
<!ENTITY mnInspectDocument.accesskey "D">
<!ENTITY mnInspectDocument.accesskey "D">
<!ENTITY mnInspectDocument.label "查看文档">
<!ENTITY mnSearch.accesskey "S">
<!ENTITY mnSearch.label "搜索">
<!ENTITY mnSearchPlugins.accesskey "E">

View File

@@ -7,8 +7,6 @@
<!ENTITY btnSelecting.tooltip "點選節點以觀察之">
<!ENTITY btnFind.tooltip "以 id, tag, 或 attribute 來觀察節點">
<!ENTITY mnFile.label "檔案">
<!ENTITY mnWindows.label "觀察視窗">
<!ENTITY mnWindows.accesskey "w">
<!ENTITY mnFile.accesskey "f">
<!ENTITY cmdShowOpenURLDialog.label "觀察網址 (URL)...">
<!ENTITY cmdShowOpenURLDialog.accesskey "u">