Bug 1069325 - Remove editBookmarksPanel instance from the locationBar. r=aeftimie
--- a/firefox/lib/toolbars.js
+++ b/firefox/lib/toolbars.js
@@ -425,17 +425,16 @@ IdentityPopup.prototype = {
* @param {MozmillController} aController
* MozMillController of the window to operate on
*/
function locationBar(aController) {
assert.ok(aController, "A controller has to be specified");
this._controller = aController;
this._autoCompleteResults = new autoCompleteResults(aController);
- this._editBookmarksPanel = new editBookmarksPanel(aController);
this._identityPopup = new IdentityPopup(aController);
}
/**
* Location Bar class
*/
locationBar.prototype = {
/**
@@ -444,26 +443,16 @@ locationBar.prototype = {
* @returns Autocomplete object
* @type {object}
*/
get autoCompleteResults() {
return this._autoCompleteResults;
},
/**
- * Returns the edit bookmarks panel object
- *
- * @returns editBookmarksPanel object
- * @type {object}
- */
- get editBookmarksPanel() {
- return this._editBookmarksPanel;
- },
-
- /**
* Returns the identity popup object
*
* @returns {object} Identity popup instance
*/
get identityPopup() {
return this._identityPopup;
},
@@ -818,19 +807,16 @@ locationBar.prototype = {
assert.ok(spec.type, "Type of the notification panel is mandatory");
var panel = null;
switch (spec.type) {
case "notification":
panel = this.getElement({type: "notification_popup"});
break;
- case "bookmark":
- panel = this._editBookmarksPanel.getElement({type: "bookmarkPanel"});
- break;
case "identity":
panel = this._identityPopup.getElement({type: "popup"});
break;
default :
assert.fail("Unknown notification panel to wait for: " + spec.type);
}
waitForNotificationPanel(aCallback, {open: spec.open, panel: panel});
--- a/firefox/tests/endurance/testBookmarks_AddAndRemoveBookmarkViaAwesomeBar/test1.js
+++ b/firefox/tests/endurance/testBookmarks_AddAndRemoveBookmarkViaAwesomeBar/test1.js
@@ -15,16 +15,17 @@ var utils = require("../../../../lib/uti
const BASE_URL = collector.addHttpResource('../../../../data/');
const TEST_DATA = BASE_URL + "layout/mozilla_contribute.html";
function setupModule(aModule) {
aModule.controller = mozmill.getBrowserController();
aModule.enduranceManager = new endurance.EnduranceManager(aModule.controller);
aModule.locationBar = new toolbars.locationBar(aModule.controller);
+ aModule.editBookmarksPanel = new toolbars.editBookmarksPanel(aModule.controller);
aModule.tabBrowser = new tabs.tabBrowser(aModule.controller);
// Open test page and wait until it has been finished loading
aModule.controller.open(TEST_DATA);
aModule.controller.waitForPageLoad();
}
function teardownModule(aModule) {
@@ -52,23 +53,24 @@ function testAddRemoveBookmarkViaAwesome
// Wait for the bookmark event
assert.waitFor(function () {
return places.bookmarksService.isBookmarked(URI);
}, "The bookmark was created");
enduranceManager.addCheckpoint("Bookmark added via the Awesomebar");
// Trigger editBookmarksPanel and remove bookmark
- locationBar.waitForNotificationPanel(() => {
+ var bookmarksPanel = editBookmarksPanel.getElement({type: "bookmarkPanel"});
+ toolbars.waitForNotificationPanel(() => {
starButton.click();
- }, {type: "bookmark"});
+ }, {type: "bookmark", panel: bookmarksPanel});
- locationBar.waitForNotificationPanel(() => {
- var removeBookmark = locationBar.editBookmarksPanel.getElement({type: "removeButton"});
+ toolbars.waitForNotificationPanel(() => {
+ var removeBookmark = editBookmarksPanel.getElement({type: "removeButton"});
removeBookmark.click();
- }, {type: "bookmark", open: false});
+ }, {type: "bookmark", open: false, panel: bookmarksPanel});
// Verify the bookmark was removed
assert.ok(!places.bookmarksService.isBookmarked(URI), "The bookmark was removed");
enduranceManager.addCheckpoint("Bookmark has been removed");
});
}
--- a/firefox/tests/functional/testAwesomeBar/testSuggestBookmarks.js
+++ b/firefox/tests/functional/testAwesomeBar/testSuggestBookmarks.js
@@ -16,16 +16,17 @@ const TEST_DATA = {
string: "grants"
};
const PREF_LOCATION_BAR_SUGGEST = "browser.urlbar.default.behavior";
var setupModule = function(aModule) {
aModule.controller = mozmill.getBrowserController();
aModule.locationBar = new toolbars.locationBar(aModule.controller);
+ aModule.editBookmarksPanel = new toolbars.editBookmarksPanel(aModule.controller);
places.removeAllHistory();
// Location bar suggests "History and Bookmarks"
prefs.preferences.setPref(PREF_LOCATION_BAR_SUGGEST, 0);
}
var teardownModule = function(aModule) {
@@ -38,26 +39,27 @@ var teardownModule = function(aModule) {
* Check a star appears in autocomplete list for a bookmarked page.
*/
var testStarInAutocomplete = function() {
// Open the test page
locationBar.loadURL(TEST_DATA.url);
controller.waitForPageLoad();
// Bookmark the test page via bookmarks menu
- locationBar.waitForNotificationPanel(() => {
+ var bookmarksPanel = editBookmarksPanel.getElement({type: "bookmarkPanel"});
+ toolbars.waitForNotificationPanel(() => {
controller.mainMenu.click("#menu_bookmarkThisPage");
- }, {type: "bookmark"});
+ }, {type: "bookmark", panel: bookmarksPanel});
- locationBar.waitForNotificationPanel(() => {
- var doneButton = locationBar.editBookmarksPanel.getElement({type: "doneButton"});
+ toolbars.waitForNotificationPanel(() => {
+ var doneButton = editBookmarksPanel.getElement({type: "doneButton"});
doneButton.click();
- }, {type: "bookmark", open: false});
+ }, {type: "bookmark", open: false, panel: bookmarksPanel});
- // We must open the blank page so the autocomplete result isn't "Swith to tab"
+ // We must open the blank page so the autocomplete result isn't "Switch to tab"
controller.open("about:blank");
controller.waitForPageLoad();
// Clear history
places.removeAllHistory();
// Focus the locationbar, delete any contents there
locationBar.clear();
--- a/firefox/tests/functional/testBookmarks/testAddBookmarkToMenu.js
+++ b/firefox/tests/functional/testBookmarks/testAddBookmarkToMenu.js
@@ -11,42 +11,44 @@ var toolbars = require("../../../lib/too
var utils = require("../../../../lib/utils");
const BASE_URL = collector.addHttpResource("../../../../data/");
const TEST_DATA = BASE_URL + "layout/mozilla_contribute.html";
var setupModule = function(aModule) {
aModule.controller = mozmill.getBrowserController();
aModule.locationBar = new toolbars.locationBar(aModule.controller);
+ aModule.editBookmarksPanel = new toolbars.editBookmarksPanel(aModule.controller);
}
var teardownModule = function(aModule) {
places.restoreDefaultBookmarks();
}
var testAddBookmarkToBookmarksMenu = function() {
var uri = utils.createURI(TEST_DATA);
// Open URI and wait until it has been finished loading
controller.open(uri.spec);
controller.waitForPageLoad();
// Open the bookmark panel via bookmarks menu
- locationBar.waitForNotificationPanel(() => {
+ var bookmarksPanel = editBookmarksPanel.getElement({type: "bookmarkPanel"});
+ toolbars.waitForNotificationPanel(() => {
controller.mainMenu.click("#menu_bookmarkThisPage");
- }, {type: "bookmark"});
+ }, {type: "bookmark", panel: bookmarksPanel});
// Bookmark should automatically be stored under the Bookmark Menu
- var nameField = locationBar.editBookmarksPanel.getElement({type: "nameField"});
- var doneButton = locationBar.editBookmarksPanel.getElement({type: "doneButton"});
+ var nameField = editBookmarksPanel.getElement({type: "nameField"});
+ var doneButton = editBookmarksPanel.getElement({type: "doneButton"});
controller.type(nameField, "Mozilla");
- locationBar.waitForNotificationPanel(() => {
+ toolbars.waitForNotificationPanel(() => {
doneButton.click();
- }, {type: "bookmark", open: false});
+ }, {type: "bookmark", open: false, panel: bookmarksPanel});
// Bug 474486
// Until we can't check via a menu click, call the Places API function for now
var bookmarkFolder = places.bookmarksService.bookmarksMenuFolder;
var bookmarkExists = places.isBookmarkInFolder(uri, bookmarkFolder);
expect.ok(bookmarkExists, "Bookmark was created in the bookmarks menu");
}