зеркало из https://github.com/mozilla/gecko-dev.git
Fix bug # 48320: Directories displayed twice in file:/// URLs. r=me
This commit is contained in:
Родитель
4cf2feb015
Коммит
ff4cf79e0a
|
@ -48,22 +48,26 @@ function Init()
|
||||||
{
|
{
|
||||||
debug("directory.js: Init()\n");
|
debug("directory.js: Init()\n");
|
||||||
|
|
||||||
|
var tree = document.getElementById('tree');
|
||||||
|
|
||||||
// Initialize the tree's base URL to whatever the HTTPIndex is rooted at
|
// Initialize the tree's base URL to whatever the HTTPIndex is rooted at
|
||||||
var baseURI = HTTPIndex.BaseURL;
|
var baseURI = HTTPIndex.BaseURL;
|
||||||
|
|
||||||
|
if (baseURI && (baseURI.indexOf("ftp://") == 0))
|
||||||
|
{
|
||||||
// fix bug # 37102: if its a FTP directory
|
// fix bug # 37102: if its a FTP directory
|
||||||
// ensure it ends with a trailing slash
|
// ensure it ends with a trailing slash
|
||||||
if (baseURI && (baseURI.indexOf("ftp://") == 0) &&
|
if (baseURI.substr(baseURI.length - 1) != "/")
|
||||||
(baseURI.substr(baseURI.length - 1) != "/"))
|
|
||||||
{
|
{
|
||||||
debug("append traiing slash to FTP directory URL\n");
|
debug("append traiing slash to FTP directory URL\n");
|
||||||
baseURI += "/";
|
baseURI += "/";
|
||||||
}
|
}
|
||||||
debug("base URL = " + baseURI + "\n");
|
|
||||||
|
|
||||||
// Note: Add the HTTPIndex datasource into the tree
|
// Note: DON'T add the HTTPIndex datasource into the tree
|
||||||
var tree = document.getElementById('tree');
|
// for file URLs, only do it for FTP URLs; the "rdf:files"
|
||||||
|
// datasources handles file URLs
|
||||||
tree.database.AddDataSource(HTTPIndex.DataSource);
|
tree.database.AddDataSource(HTTPIndex.DataSource);
|
||||||
|
}
|
||||||
|
|
||||||
// Note: set encoding BEFORE setting "ref" (important!)
|
// Note: set encoding BEFORE setting "ref" (important!)
|
||||||
var RDF = Components.classes["component://netscape/rdf/rdf-service"].getService();
|
var RDF = Components.classes["component://netscape/rdf/rdf-service"].getService();
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
<script src="chrome://communicator/content/directory/directory.js"></script>
|
<script src="chrome://communicator/content/directory/directory.js"></script>
|
||||||
|
|
||||||
<tree id="tree" datasources="rdf:files" flex="1" style="height:0px;"
|
<tree id="tree" datasources="rdf:files" flex="1" style="height:0px;"
|
||||||
container="true" open="true"
|
container="true" open="true" flags="dont-test-empty"
|
||||||
ondraggesture="return BeginDragTree(event);">
|
ondraggesture="return BeginDragTree(event);">
|
||||||
<template>
|
<template>
|
||||||
<treechildren flex="1">
|
<treechildren flex="1">
|
||||||
|
|
Загрузка…
Ссылка в новой задаче