Bug 696159 - Remove some deprecated Places code.

r=dietrich sr=rstrong
This commit is contained in:
Marco Bonardo 2011-10-27 11:11:43 +02:00
parent d5bdd788f6
commit 7279ff22e3
15 changed files with 117 additions and 346 deletions

View File

@ -131,7 +131,16 @@ let RemoteTabViewer = {
let item = this._tabsList.selectedItems[0];
let uri = Weave.Utils.makeURI(item.getAttribute("url"));
let title = item.getAttribute("title");
PlacesUIUtils.showMinimalAddBookmarkUI(uri, title);
PlacesUIUtils.showBookmarkDialog({ action: "add"
, type: "bookmark"
, uri: uri
, title: title
, hiddenRows: [ "description"
, "location"
, "folderPicker"
, "loadInSidebar"
, "keyword" ]
});
},
bookmarkSelectedTabs: function() {
@ -146,8 +155,13 @@ let RemoteTabViewer = {
URIs.push(uri);
}
}
if (URIs.length)
PlacesUIUtils.showMinimalAddMultiBookmarkUI(URIs);
if (URIs.length) {
PlacesUIUtils.showBookmarkDialog({ action: "add"
, type: "folder"
, URIList: URIs
, hiddenRows: [ "description" ]
});
}
},
_generateTabList: function() {

View File

@ -378,11 +378,23 @@ var PlacesCommandHook = {
bookmarkLink: function PCH_bookmarkLink(aParent, aURL, aTitle) {
var linkURI = makeURI(aURL);
var itemId = PlacesUtils.getMostRecentBookmarkForURI(linkURI);
if (itemId == -1)
PlacesUIUtils.showMinimalAddBookmarkUI(linkURI, aTitle);
if (itemId == -1) {
PlacesUIUtils.showBookmarkDialog({ action: "add"
, type: "bookmark"
, uri: linkURI
, title: aTitle
, hiddenRows: [ "description"
, "location"
, "loadInSidebar"
, "folderPicker"
, "keyword" ]
});
}
else {
PlacesUIUtils.showItemProperties(itemId,
PlacesUtils.bookmarks.TYPE_BOOKMARK);
PlacesUIUtils.showBookmarkDialog({ action: "edit"
, type: "bookmark"
, itemId: itemId
});
}
},
@ -411,7 +423,11 @@ var PlacesCommandHook = {
bookmarkCurrentPages: function PCH_bookmarkCurrentPages() {
let pages = this.uniqueCurrentPages;
if (pages.length > 1) {
PlacesUIUtils.showMinimalAddMultiBookmarkUI(pages);
PlacesUIUtils.showBookmarkDialog({ action: "add"
, type: "folder"
, URIList: pages
, hiddenRows: [ "description" ]
});
}
},
@ -451,10 +467,18 @@ var PlacesCommandHook = {
else
description = PlacesUIUtils.getDescriptionFromDocument(doc);
var toolbarIP =
new InsertionPoint(PlacesUtils.bookmarks.toolbarFolder, -1);
PlacesUIUtils.showMinimalAddLivemarkUI(feedURI, gBrowser.currentURI,
title, description, toolbarIP, true);
var toolbarIP = new InsertionPoint(PlacesUtils.toolbarFolderId, -1);
PlacesUIUtils.showBookmarkDialog({ action: "add"
, type: "livemark"
, feedURI: feedURI
, siteURI: gBrowser.currentURI
, title: title
, description: description
, defaultInsertionPoint: toolbarIP
, hiddenRows: [ "feedLocation"
, "siteLocation"
, "description" ]
});
},
/**

View File

@ -3122,7 +3122,16 @@ var bookmarksButtonObserver = {
let name = { };
let url = browserDragAndDrop.drop(aEvent, name);
try {
PlacesUIUtils.showMinimalAddBookmarkUI(makeURI(url), name);
PlacesUIUtils.showBookmarkDialog({ action: "add"
, type: "bookmark"
, uri: makeURI(url)
, title: name
, hiddenRows: [ "description"
, "location"
, "loadInSidebar"
, "folderPicker"
, "keyword" ]
});
} catch(ex) { }
},
@ -5588,9 +5597,16 @@ function contentAreaClick(event, isPanelClick)
// This is the Opera convention for a special link that, when clicked,
// allows to add a sidebar panel. The link's title attribute contains
// the title that should be used for the sidebar panel.
PlacesUIUtils.showMinimalAddBookmarkUI(makeURI(href),
linkNode.getAttribute("title"),
null, null, true, true);
PlacesUIUtils.showBookmarkDialog({ action: "add"
, type: "bookmark"
, uri: makeURI(href)
, title: linkNode.getAttribute("title")
, loadBookmarkInSidebar: true
, hiddenRows: [ "description"
, "location"
, "folderPicker"
, "keyword" ]
});
event.preventDefault();
return true;
}
@ -6626,8 +6642,18 @@ function AddKeywordForSearchField() {
else
spec += "?" + formData.join("&");
PlacesUIUtils.showMinimalAddBookmarkUI(makeURI(spec), title, description, null,
null, null, "", postData, charset);
PlacesUIUtils.showBookmarkDialog({ action: "add"
, type: "bookmark"
, uri: makeURI(spec)
, title: title
, description: description
, keyword: ""
, postData: postData
, charSet: charset
, hiddenRows: [ "location"
, "loadInSidebar"
, "folderPicker" ]
});
}
function SwitchDocumentDirection(aWindow) {

View File

@ -1397,11 +1397,24 @@ nsContextMenu.prototype = {
if (itemId == -1) {
var title = doc.title;
var description = PlacesUIUtils.getDescriptionFromDocument(doc);
PlacesUIUtils.showMinimalAddBookmarkUI(uri, title, description);
PlacesUIUtils.showBookmarkDialog({ action: "add"
, type: "bookmark"
, uri: uri
, title: title
, description: description
, hiddenRows: [ "description"
, "location"
, "loadInSidebar"
, "folderPicker"
, "keyword" ]
});
}
else {
PlacesUIUtils.showBookmarkDialog({ action: "edit"
, type: "bookmark"
, itemId: itemId
});
}
else
PlacesUIUtils.showItemProperties(itemId,
PlacesUtils.bookmarks.TYPE_BOOKMARK);
},
savePageAs: function CM_savePageAs() {
@ -1443,13 +1456,13 @@ nsContextMenu.prototype = {
media.setAttribute("controls", "true");
break;
case "showstats":
var event = document.createEvent("CustomEvent");
event.initCustomEvent("media-showStatistics", false, true, true);
var event = document.createEvent("CustomEvent");
event.initCustomEvent("media-showStatistics", false, true, true);
media.dispatchEvent(event);
break;
case "hidestats":
var event = document.createEvent("CustomEvent");
event.initCustomEvent("media-showStatistics", false, true, false);
var event = document.createEvent("CustomEvent");
event.initCustomEvent("media-showStatistics", false, true, false);
media.dispatchEvent(event);
break;
}

View File

@ -586,9 +586,6 @@ PlacesViewBase.prototype = {
nodeKeywordChanged: function() { },
sortingChanged: function() { },
batching: function() { },
// Replaced by containerStateChanged.
containerOpened: function() { },
containerClosed: function() { },
nodeInserted:
function PVB_nodeInserted(aParentPlacesNode, aPlacesNode, aIndex) {

View File

@ -137,7 +137,6 @@ PlacesController.prototype = {
},
supportsCommand: function PC_supportsCommand(aCommand) {
//LOG("supportsCommand: " + command);
// Non-Places specific commands that we also support
switch (aCommand) {
case "cmd_undo":
@ -778,17 +777,6 @@ PlacesController.prototype = {
}
},
/**
* Create a new Bookmark folder somewhere. Prompts the user for the name
* of the folder.
*/
newFolder: function PC_newFolder() {
Cu.reportError("PlacesController.newFolder is deprecated and will be \
removed in a future release. Use newItem instead.");
this.newItem("folder");
},
/**
* Create a new Bookmark separator somewhere.
*/

View File

@ -90,7 +90,8 @@ PlacesTreeView.prototype = {
selection.selectEventsSuppressed = true;
if (!this._rootNode.containerOpen) {
// This triggers containerOpened which then builds the visible section.
// This triggers containerStateChanged which then builds the visible
// section.
this._rootNode.containerOpen = true;
}
else
@ -858,16 +859,10 @@ PlacesTreeView.prototype = {
this._invalidateCellValue(aNode, this.COLUMN_TYPE_LASTMODIFIED);
},
containerOpened: function PTV_containerOpened(aNode) {
this.invalidateContainer(aNode);
},
containerClosed: function PTV_containerClosed(aNode) {
this.invalidateContainer(aNode);
},
containerStateChanged:
function PTV_containerStateChanged(aNode, aOldState, aNewState) {},
function PTV_containerStateChanged(aNode, aOldState, aNewState) {
this.invalidateContainer(aNode);
},
invalidateContainer: function PTV_invalidateContainer(aContainer) {
NS_ASSERT(this._result, "Need to have a result to update");

View File

@ -332,238 +332,6 @@ var PlacesUIUtils = {
return null;
},
_reportDeprecatedAddBookmarkMethod:
function PUIU__reportDeprecatedAddBookmarkMethod() {
// Removes "PUIU_".
let oldFuncName = arguments.callee.caller.name.slice(5);
Cu.reportError(oldFuncName + " is deprecated and will be removed in a " +
"future release. Use showBookmarkDialog instead.");
},
/**
* This is here for compatibility reasons, use ShowBookmarkDialog instead.
*/
showAddBookmarkUI: function PUIU_showAddBookmarkUI(
aURI, aTitle, aDescription, aDefaultInsertionPoint, aShowPicker,
aLoadInSidebar, aKeyword, aPostData, aCharSet) {
this._reportDeprecatedAddBookmarkMethod();
var info = {
action: "add",
type: "bookmark"
};
if (aURI)
info.uri = aURI;
// allow default empty title
if (typeof(aTitle) == "string")
info.title = aTitle;
if (aDescription)
info.description = aDescription;
if (aDefaultInsertionPoint) {
info.defaultInsertionPoint = aDefaultInsertionPoint;
if (!aShowPicker)
info.hiddenRows = ["folderPicker"];
}
if (aLoadInSidebar)
info.loadBookmarkInSidebar = true;
if (typeof(aKeyword) == "string") {
info.keyword = aKeyword;
if (typeof(aPostData) == "string")
info.postData = aPostData;
if (typeof(aCharSet) == "string")
info.charSet = aCharSet;
}
return this.showBookmarkDialog(info);
},
/**
* This is here for compatibility reasons, use ShowBookmarkDialog instead.
*/
showMinimalAddBookmarkUI:
function PUIU_showMinimalAddBookmarkUI(
aURI, aTitle, aDescription, aDefaultInsertionPoint, aShowPicker,
aLoadInSidebar, aKeyword, aPostData, aCharSet) {
this._reportDeprecatedAddBookmarkMethod();
var info = {
action: "add",
type: "bookmark",
hiddenRows: ["description"]
};
if (aURI)
info.uri = aURI;
// allow default empty title
if (typeof(aTitle) == "string")
info.title = aTitle;
if (aDescription)
info.description = aDescription;
if (aDefaultInsertionPoint) {
info.defaultInsertionPoint = aDefaultInsertionPoint;
if (!aShowPicker)
info.hiddenRows.push("folderPicker");
}
if (aLoadInSidebar)
info.loadBookmarkInSidebar = true;
else
info.hiddenRows = info.hiddenRows.concat(["location", "loadInSidebar"]);
if (typeof(aKeyword) == "string") {
info.keyword = aKeyword;
// Hide the Tags field if we are adding a keyword.
info.hiddenRows.push("tags");
// Keyword related params.
if (typeof(aPostData) == "string")
info.postData = aPostData;
if (typeof(aCharSet) == "string")
info.charSet = aCharSet;
}
else
info.hiddenRows.push("keyword");
return this.showBookmarkDialog(info, undefined, true);
},
/**
* This is here for compatibility reasons, use ShowBookmarkDialog instead.
*/
showAddLivemarkUI: function PUIU_showAddLivemarkURI(aFeedURI,
aSiteURI,
aTitle,
aDescription,
aDefaultInsertionPoint,
aShowPicker) {
this._reportDeprecatedAddBookmarkMethod();
var info = {
action: "add",
type: "livemark"
};
if (aFeedURI)
info.feedURI = aFeedURI;
if (aSiteURI)
info.siteURI = aSiteURI;
// allow default empty title
if (typeof(aTitle) == "string")
info.title = aTitle;
if (aDescription)
info.description = aDescription;
if (aDefaultInsertionPoint) {
info.defaultInsertionPoint = aDefaultInsertionPoint;
if (!aShowPicker)
info.hiddenRows = ["folderPicker"];
}
return this.showBookmarkDialog(info);
},
/**
* This is here for compatibility reasons, use ShowBookmarkDialog instead.
*/
showMinimalAddLivemarkUI:
function PUIU_showMinimalAddLivemarkURI(
aFeedURI, aSiteURI, aTitle, aDescription, aDefaultInsertionPoint,
aShowPicker) {
this._reportDeprecatedAddBookmarkMethod();
var info = {
action: "add",
type: "livemark",
hiddenRows: ["feedLocation", "siteLocation", "description"]
};
if (aFeedURI)
info.feedURI = aFeedURI;
if (aSiteURI)
info.siteURI = aSiteURI;
// allow default empty title
if (typeof(aTitle) == "string")
info.title = aTitle;
if (aDescription)
info.description = aDescription;
if (aDefaultInsertionPoint) {
info.defaultInsertionPoint = aDefaultInsertionPoint;
if (!aShowPicker)
info.hiddenRows.push("folderPicker");
}
return this.showBookmarkDialog(info, undefined, true);
},
/**
* This is here for compatibility reasons, use ShowBookmarkDialog instead.
*/
showMinimalAddMultiBookmarkUI: function PUIU_showAddMultiBookmarkUI(aURIList) {
this._reportDeprecatedAddBookmarkMethod();
if (aURIList.length == 0)
throw("showAddMultiBookmarkUI expects a list of nsIURI objects");
var info = {
action: "add",
type: "folder",
hiddenRows: ["description"],
URIList: aURIList
};
return this.showBookmarkDialog(info, undefined, true);
},
/**
* This is here for compatibility reasons, use ShowBookmarkDialog instead.
*/
showItemProperties: function PUIU_showItemProperties(aItemId, aType, aReadOnly) {
this._reportDeprecatedAddBookmarkMethod();
var info = {
action: "edit",
type: aType,
itemId: aItemId,
readOnly: aReadOnly
};
return this.showBookmarkDialog(info);
},
/**
* This is here for compatibility reasons, use ShowBookmarkDialog instead.
*/
showAddFolderUI:
function PUIU_showAddFolderUI(aTitle, aDefaultInsertionPoint, aShowPicker) {
this._reportDeprecatedAddBookmarkMethod();
var info = {
action: "add",
type: "folder",
hiddenRows: []
};
// allow default empty title
if (typeof(aTitle) == "string")
info.title = aTitle;
if (aDefaultInsertionPoint) {
info.defaultInsertionPoint = aDefaultInsertionPoint;
if (!aShowPicker)
info.hiddenRows.push("folderPicker");
}
return this.showBookmarkDialog(info);
},
/**
* Shows the bookmark dialog corresponding to the specified info.
*

View File

@ -229,6 +229,7 @@ greprefs/xpinstall.js
install.rdf
modules/ISO8601DateUtils.jsm
modules/JSON.jsm
modules/utils.js
mozilla-runtime@BIN_SUFFIX@
old-homepage-default.properties
README.txt
@ -997,7 +998,6 @@ xpicleanup@BIN_SUFFIX@
modules/tabview/AllTabs.jsm
modules/tabview/groups.jsm
modules/tabview/utils.jsm
modules/utils.js
modules/WindowDraggingUtils.jsm
#ifdef XP_WIN
modules/WindowsJumpLists.jsm

View File

@ -118,7 +118,6 @@ endif
EXTRA_JS_MODULES = \
PlacesDBUtils.jsm \
utils.js \
$(NULL)
EXTRA_PP_JS_MODULES = \

View File

@ -461,7 +461,7 @@ interface nsINavHistoryQueryResultNode : nsINavHistoryContainerResultNode
* according to history and bookmark system events. Register this observer on a
* result using nsINavHistoryResult::addObserver.
*/
[scriptable, uuid(9ea86387-6a30-4ee2-b70d-26fbb718902f)]
[scriptable, uuid(547102c4-ab84-4058-b9d4-6f99f6c80893)]
interface nsINavHistoryResultObserver : nsISupports
{
/**
@ -618,30 +618,6 @@ interface nsINavHistoryResultObserver : nsISupports
in nsINavHistoryResultNode aNewNode,
in unsigned long aIndex);
/**
* Called after a container node went from closed to opened.
*
* @note This method is DEPRECATED. In the future only containerStateChanged
* will notify when a container is opened.
*
* @param aContainerNode
* the container node which was opened
*/
void containerOpened(in nsINavHistoryContainerResultNode aContainerNode);
/**
* Called after a container node went from opened to closed. This will be
* called for the topmost container that is closing, and implies that any
* child containers have closed as well.
*
* @note This method is DEPRECATED. In the future only containerStateChanged
* will notify when a container is closed.
*
* @param aContainerNode
* the container node which was closed
*/
void containerClosed(in nsINavHistoryContainerResultNode aContainerNode);
/**
* Called after a container changes state.
*

View File

@ -628,13 +628,6 @@ nsNavHistoryContainerResultNode::NotifyOnStateChange(PRUint16 aOldState)
// Notify via the new ContainerStateChanged observer method.
NOTIFY_RESULT_OBSERVERS(result,
ContainerStateChanged(this, aOldState, currState));
// Notify via the deprecated observer methods.
if (currState == STATE_OPENED)
NOTIFY_RESULT_OBSERVERS(result, ContainerOpened(this));
else if (currState == STATE_CLOSED)
NOTIFY_RESULT_OBSERVERS(result, ContainerClosed(this));
return NS_OK;
}

View File

@ -242,8 +242,6 @@ Test.prototype = {
do_throw(err);
}
},
containerOpened: function (container) {},
containerClosed: function (container) {}
};
this.result.addObserver(this.observer, false);

View File

@ -94,14 +94,15 @@ var resultObserver = {
this.movedNode = node;
},
openedContainer: null,
containerOpened: function(node) {
this.openedContainer = node;
},
closedContainer: null,
containerClosed: function(node) {
this.closedContainer = node;
containerStateChanged: function (aNode, aOldState, aNewState) {
if (aNewState == Ci.nsINavHistoryContainerResultNode.STATE_OPENED) {
this.openedContainer = aNode;
}
else if (aNewState == Ci.nsINavHistoryContainerResultNode.STATE_CLOSED) {
this.closedContainer = aNode;
}
},
containerStateChanged: function (node, oldState, newState) {},
invalidatedContainer: null,
invalidateContainer: function(node) {
this.invalidatedContainer = node;

View File

@ -1,21 +0,0 @@
/*
* This is a mock file pointing to PlacesUtils.jsm for add-ons backwards
* compatibility.
*
* If you are importing this file, you should instead import PlacesUtils.jsm.
* If you need to support different versions of toolkit, then you can use the
* following code to import PlacesUtils in your scope.
*
* Try {
* Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
* } catch (ex) {
* Components.utils.import("resource://gre/modules/utils.js");
* }
*
*/
var EXPORTED_SYMBOLS = ["PlacesUtils"];
Components.utils.reportError('An add-on is importing utils.js module, this file is deprecated, PlacesUtils.jsm should be used instead. Please notify add-on author of this problem.');
Components.utils.import("resource://gre/modules/PlacesUtils.jsm");