Bug 453793 - Remove XUL directory listing leftovers from browser/. r=gavin

This commit is contained in:
Dão Gottwald 2008-10-26 00:03:54 +02:00
Родитель a52f7a990f
Коммит a285cfb493
2 изменённых файлов: 5 добавлений и 54 удалений

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

@ -132,14 +132,10 @@ __defineGetter__("gPrefService", function() {
* We can avoid adding multiple load event listeners and save some time by adding
* one listener that calls all real handlers.
*/
function pageShowEventHandlers(event)
{
function pageShowEventHandlers(event) {
// Filter out events that are not about the document load we are interested in
if (event.originalTarget == content.document) {
checkForDirectoryListing();
charsetLoadListener(event);
XULBrowserWindow.asyncUpdateUI();
}
}
@ -2001,15 +1997,6 @@ function traceVerbose(verbose)
}
#endif
function checkForDirectoryListing()
{
if ( "HTTPIndex" in content &&
content.HTTPIndex instanceof Components.interfaces.nsIHTTPIndex ) {
content.wrappedJSObject.defaultCharacterset =
getMarkupDocumentViewer().defaultCharacterSet;
}
}
function URLBarSetURI(aURI, aValid) {
var value = gBrowser.userTypedValue;
var valid = false;

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

@ -84,7 +84,6 @@ function nsContextMenu(aXulMenu, aBrowser) {
this.hasBGImage = false;
this.isTextSelected = false;
this.isContentSelected = false;
this.inDirList = false;
this.shouldDisplay = true;
this.isDesignMode = false;
this.possibleSpellChecking = false;
@ -144,8 +143,7 @@ nsContextMenu.prototype = {
mailtoHandler.preferredAction == Ci.nsIHandlerInfo.useHelperApp &&
(mailtoHandler.preferredApplicationHandler instanceof Ci.nsIWebHandlerApp));
}
var shouldShow = this.onSaveableLink || isMailtoInternal ||
(this.inDirList && this.onLink);
var shouldShow = this.onSaveableLink || isMailtoInternal;
this.showItem("context-openlink", shouldShow);
this.showItem("context-openlinkintab", shouldShow);
this.showItem("context-sep-open", shouldShow);
@ -166,7 +164,7 @@ nsContextMenu.prototype = {
},
initSaveItems: function CM_initSaveItems() {
var shouldShow = !(this.inDirList || this.onTextInput || this.onLink ||
var shouldShow = !(this.onTextInput || this.onLink ||
this.isContentSelected || this.onImage ||
this.onCanvas || this.onVideo || this.onAudio);
this.showItem("context-savepage", shouldShow);
@ -193,7 +191,7 @@ nsContextMenu.prototype = {
this.showItem("context-viewpartialsource-mathml",
this.onMathML && !this.isContentSelected);
var shouldShow = !(this.inDirList || this.isContentSelected ||
var shouldShow = !(this.isContentSelected ||
this.onImage || this.onCanvas ||
this.onVideo || this.onAudio ||
this.onLink || this.onTextInput);
@ -201,7 +199,7 @@ nsContextMenu.prototype = {
this.showItem("context-viewinfo", shouldShow);
this.showItem("context-sep-properties",
!(this.inDirList || this.isContentSelected ||
!(this.isContentSelected ||
this.onTextInput || this.onCanvas ||
this.onVideo || this.onAudio));
@ -501,40 +499,6 @@ nsContextMenu.prototype = {
}
}
}
else if ("HTTPIndex" in content &&
content.HTTPIndex instanceof Ci.nsIHTTPIndex) {
this.inDirList = true;
// Bubble outward till we get to an element with URL attribute
// (which should be the href).
var root = this.target;
while (root && !this.link) {
if (root.tagName == "tree") {
// Hit root of tree; must have clicked in empty space;
// thus, no link.
break;
}
if (root.getAttribute("URL")) {
// Build pseudo link object so link-related functions work.
this.onLink = true;
this.link = { href : root.getAttribute("URL"),
getAttribute: function (aAttr) {
if (aAttr == "title") {
return root.firstChild.firstChild
.getAttribute("label");
}
else
return "";
}
};
// If element is a directory, then you can't save it.
this.onSaveableLink = root.getAttribute("container") != "true";
}
else
root = root.parentNode;
}
}
}
// Second, bubble out, looking for items of interest that can have childen.