Bug 150158 clean up after nsIFile.delete was renamed to .remove p=stevechapel@earthlink.net r=shliang sr=brendan a=asa

This commit is contained in:
neil%parkwaycc.co.uk 2003-05-14 14:30:12 +00:00
Родитель 1184d8cb0c
Коммит 626fef6cb8
3 изменённых файлов: 2 добавлений и 181 удалений

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

@ -109,8 +109,6 @@ const JSFILE_READ_MODE = "r";
const JSFILE_WRITE_MODE = "w";
const JSFILE_APPEND_MODE = "a";
const JSFILE_DELETE = "delete";
const JSFILE_FILETYPE = 0x00; // 0
const JSFILE_CHUNK = 1024; // buffer for readline => set to 1k
@ -181,7 +179,7 @@ var fileExists = this.exists();
{
try
{
this.fileInst[JSFILE_DELETE](false);
this.fileInst.remove(false);
fileExists=false;
}

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

@ -1,176 +0,0 @@
<?xml version="1.0"?>
<search
title="Find Unused Images in Current Theme"
defaultIcon="chrome://inspector/skin/ImageSearchItem.gif"
xmlns="http://www.mozilla.org/inspector/isml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<dialog elements="txfSearchPath" resizable="true"
href="chrome://inspector/content/search/modules/junkImgs/dialog.xul"/>
<columns delimiter="">
<column title="Path" name="path" flex="1" copy="true"/>
</columns>
<contextmenu>
<xul:menuitem label="View..." oncommand="this.search.cmdViewItem()" isEnabled="return true"/>
<xul:menuitem label="Delete File" oncommand="this.search.cmdDeleteItems()" isEnabled="return true"/>
</contextmenu>
<implementation>
<method name="constructor">
<body><![CDATA[
mHashTable = null;
]]></body>
</method>
<property name="progressPercent">
<getter><![CDATA[
return (100 * (this.mFileSearch.directoriesSearched+1)) / this.mDirDepth
]]></getter>
</property>
<property name="progressText">
<getter><![CDATA[
return "blah"
]]></getter>
</property>
<property name="isPastMilestone">
<getter><![CDATA[
var search = this.mFileSearch.directoriesSearched;
var is = search > this.mDirsSearched;
if (is)
this.mDirsSearched = search;
return is;
]]></getter>
</property>
<method name="searchStart">
<parameter name="aMap"/>
<body><![CDATA[
this.mParams = aMap;
this.mDirsSearched = 0;
// hash every image url in the css tree
this.buildCSSImageURLHash();
var fsearch = inSearchUtils.createSearchHelper("file");
this.mFileSearch = fsearch;
var root = inSearchUtils.createLocalFile(aMap.txfSearchPath);
fsearch.searchPath = root;
fsearch.filenameCriteria = "*.gif,*.png,*.jpg";
fsearch.holdResults = false;
fsearch.basePath = aMap.txfSearchPath;
fsearch.returnRelativePaths = true;
this.mDirDepth = fsearch.getDirectoryDepth(root);
var observer = inSearchUtils.createSearchObserver(this, "File");
fsearch.searchAsync(observer);
]]></body>
</method>
<method name="searchStop">
<body><![CDATA[
if (this.mFileSearch)
this.mFileSearch.searchStop();
]]></body>
</method>
<method name="buildCSSImageURLHash">
<body><![CDATA[
var cssSearch = inSearchUtils.createSearchHelper("cssvalue");
cssSearch.returnRelativeURLs = true;
cssSearch.normalizeChromeURLs = true; //this.mParams.cbIsSkin;
cssSearch.addPropertyCriteria("background-image");
cssSearch.addPropertyCriteria("list-style-image");
cssSearch.document = inspector.document;
cssSearch.searchSync(this);
var count = cssSearch.resultCount;
var hash = {};
for (var i = 0; i < count; i++) {
//debug(cssSearch.getStringResultAt(i)+"\n");
hash[cssSearch.getStringResultAt(i)] = 1;
}
this.mHashTable = hash;
]]></body>
</method>
<method name="returnSearchResult">
<parameter name="aFile"/>
<body><![CDATA[
this.module.setResultProperty("path", aFile.path);
this.module.searchResultReady();
]]></body>
</method>
<!-- context menu commands -->
<method name="cmdDeleteItems">
<body><![CDATA[
var mod = this.module;
var svc = mod.searchService;
var count = svc.selectedItemCount;
var idx, path, file;
for (var i = 0; i < count; ++i) {
idx = svc.getSelectedIndex(i);
path = mod.getResultPropertyAt(idx, "path");
file = inSearchUtils.createLocalFile(path);
if (file) {
file["delete"](false);
}
}
]]></body>
</method>
<method name="cmdViewItem" defaultCommand="true">
<body><![CDATA[
alert("view");
]]></body>
</method>
<!-- FileSearch observer -->
<method name="onFileSearchStart">
<parameter name="aProcess"/>
<body/>
</method>
<method name="onFileSearchResult">
<parameter name="aProcess"/>
<body><![CDATA[
var fs = this.mFileSearch;
var idx = fs.resultCount-1;
// get the relative-ized path for the file
var path = fs.getStringResultAt(idx);
// check if this path is in the css value hash
if (!this.mHashTable[path])
this.returnSearchResult(fs.getFileResultAt(idx));
]]></body>
</method>
<method name="onFileSearchEnd">
<parameter name="aProcess"/>
<parameter name="aResult"/>
<body><![CDATA[
this.module.searchEnd();
]]></body>
</method>
<method name="onFileSearchError">
<parameter name="aProcess"/>
<parameter name="aMsg"/>
<body/>
</method>
</implementation>
</search>

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

@ -904,8 +904,7 @@ function sidebar_revert_to_default_panels() {
try {
var sidebar_file = sidebar_get_panels_file();
// Calling delete() with array notation (workaround for bug 37406).
sidebar_file["delete"](false);
sidebar_file.remove(false);
// Since we just removed the panels file,
// this should copy the defaults over.