mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 601619 - page title shows up on urlbar when flipping through awesomescreen panes [r=mfinkle]
This commit is contained in:
parent
6a3afed6a5
commit
1fc65cf72a
@ -17,7 +17,9 @@
|
||||
<property name="mIgnoreClick" onget="return true;" onset="val;"/>
|
||||
<property name="readOnly" onget="return this.inputField.readOnly;">
|
||||
<setter><![CDATA[
|
||||
this._ignoreController = true;
|
||||
if (val == this.inputField.readOnly)
|
||||
return;
|
||||
|
||||
this.inputField.readOnly = val;
|
||||
val ? this.setAttribute("readonly", "true")
|
||||
: this.removeAttribute("readonly");
|
||||
@ -26,19 +28,10 @@
|
||||
// to be set properly (bug 488420)
|
||||
this.inputField.blur();
|
||||
this.inputField.focus();
|
||||
|
||||
this._ignoreController = false;
|
||||
return val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<method name="attachController">
|
||||
<body><![CDATA[
|
||||
if (!this._ignoreController && this.mController.input != this)
|
||||
this.mController.input = this;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="openPopup">
|
||||
<body><![CDATA[
|
||||
this.popup.openAutocompletePopup(this, null);
|
||||
@ -248,7 +241,6 @@
|
||||
<!-- Helper used by active dialog system -->
|
||||
<method name="close">
|
||||
<body><![CDATA[
|
||||
this.input.reset();
|
||||
this.closePopup();
|
||||
]]></body>
|
||||
</method>
|
||||
|
@ -168,13 +168,6 @@ var BrowserUI = {
|
||||
this.updateStar();
|
||||
},
|
||||
|
||||
showToolbar: function showToolbar(aEdit) {
|
||||
this.hidePanel();
|
||||
this._editURI(aEdit);
|
||||
if (aEdit)
|
||||
this.showAutoComplete();
|
||||
},
|
||||
|
||||
_toolbarLocked: 0,
|
||||
|
||||
isToolbarLocked: function isToolbarLocked() {
|
||||
@ -198,35 +191,31 @@ var BrowserUI = {
|
||||
},
|
||||
|
||||
_setURI: function _setURI(aCaption) {
|
||||
if (this._edit.hasAttribute("open"))
|
||||
if (this.activePanel)
|
||||
this._edit.defaultValue = aCaption;
|
||||
else
|
||||
this._edit.value = aCaption;
|
||||
},
|
||||
|
||||
_editURI: function _editURI(aEdit) {
|
||||
if (aEdit) {
|
||||
// If the urlbar is not opened yet, inform the broadcaster and then
|
||||
// save the current value as a default value to display once the awesome
|
||||
// panel will be dismissed
|
||||
let isOpened = this._edit.hasAttribute("open");
|
||||
if (!isOpened) {
|
||||
Elements.urlbarState.setAttribute("mode", "edit");
|
||||
this._edit.defaultValue = this._edit.value;
|
||||
Elements.urlbarState.setAttribute("mode", "edit");
|
||||
this._edit.defaultValue = this._edit.value;
|
||||
|
||||
// Now, replace the web page title by the url of the page
|
||||
let urlString = this.getDisplayURI(Browser.selectedBrowser);
|
||||
if (Util.isURLEmpty(urlString))
|
||||
urlString = "";
|
||||
this._edit.value = urlString;
|
||||
}
|
||||
}
|
||||
else if (!aEdit) {
|
||||
this._updateToolbar();
|
||||
}
|
||||
this._showURI();
|
||||
},
|
||||
|
||||
_showURI: function _showURI() {
|
||||
// Replace the web page title by the url of the page
|
||||
let urlString = this.getDisplayURI(Browser.selectedBrowser);
|
||||
if (Util.isURLEmpty(urlString))
|
||||
urlString = "";
|
||||
|
||||
this._edit.value = urlString;
|
||||
},
|
||||
|
||||
updateAwesomeHeader: function updateAwesomeHeader(aString) {
|
||||
document.getElementById("awesome-header").hidden = (aString != "");
|
||||
|
||||
// During an awesome search we always show the popup_autocomplete/AllPagesList
|
||||
// panel since this looks in every places and the rationale behind typing
|
||||
// is to find something, whereever it is.
|
||||
@ -244,7 +233,9 @@ var BrowserUI = {
|
||||
return;
|
||||
}
|
||||
|
||||
document.getElementById("awesome-header").hidden = (aString != "");
|
||||
let event = document.createEvent("Events");
|
||||
event.initEvent("onsearchbegin", true, true);
|
||||
this._edit.dispatchEvent(event);
|
||||
},
|
||||
|
||||
_closeOrQuit: function _closeOrQuit() {
|
||||
@ -269,24 +260,48 @@ var BrowserUI = {
|
||||
if (this._activePanel == aPanel)
|
||||
return;
|
||||
|
||||
let container = document.getElementById("awesome-panels");
|
||||
let awesomePanel = document.getElementById("awesome-panels");
|
||||
let awesomeHeader = document.getElementById("awesome-header");
|
||||
|
||||
let willShowPanel = (!this._activePanel && aPanel);
|
||||
if (willShowPanel) {
|
||||
this.pushDialog(aPanel);
|
||||
this._edit.attachController();
|
||||
this._editURI();
|
||||
awesomePanel.hidden = awesomeHeader.hidden = false;
|
||||
};
|
||||
|
||||
if (aPanel) {
|
||||
container.hidden = false;
|
||||
aPanel.open();
|
||||
} else {
|
||||
container.hidden = true;
|
||||
this.showToolbar(false);
|
||||
document.getElementById("awesome-header").hidden = false;
|
||||
if (this._edit.value == "")
|
||||
this._showURI();
|
||||
}
|
||||
|
||||
this._edit.readOnly = !(aPanel == AllPagesList && Util.isPortrait());
|
||||
if (this._edit.readOnly)
|
||||
this._edit.blur();
|
||||
let willHidePanel = (this._activePanel && !aPanel);
|
||||
if (willHidePanel) {
|
||||
awesomePanel.hidden = true;
|
||||
awesomeHeader.hidden = false;
|
||||
this._updateToolbar();
|
||||
this._edit.reset();
|
||||
this._edit.detachController();
|
||||
this.popDialog();
|
||||
}
|
||||
|
||||
if (this._activePanel)
|
||||
this._activePanel.close();
|
||||
|
||||
// The readOnly state of the field enabled/disabled the VKB
|
||||
let isReadOnly = !(aPanel == AllPagesList && Util.isPortrait());
|
||||
this._edit.readOnly = isReadOnly;
|
||||
if (isReadOnly)
|
||||
this._edit.blur();
|
||||
|
||||
this._activePanel = aPanel;
|
||||
if (willHidePanel || willShowPanel) {
|
||||
let event = document.createEvent("UIEvents");
|
||||
event.initUIEvent("NavigationPanel" + (willHidePanel ? "Hidden" : "Shown"), true, true, window, false);
|
||||
window.dispatchEvent(event);
|
||||
}
|
||||
},
|
||||
|
||||
get activeDialog() {
|
||||
@ -428,6 +443,8 @@ var BrowserUI = {
|
||||
messageManager.addMessageListener("DOMTitleChanged", this);
|
||||
messageManager.addMessageListener("DOMWillOpenModalDialog", this);
|
||||
messageManager.addMessageListener("DOMWindowClose", this);
|
||||
// XXX bug 604192
|
||||
messageManager.addMessageListener("pagehide", this);
|
||||
|
||||
messageManager.addMessageListener("Browser:OpenURI", this);
|
||||
messageManager.addMessageListener("Browser:SaveAs:Return", this);
|
||||
@ -542,7 +559,7 @@ var BrowserUI = {
|
||||
|
||||
/* Set the location to the current content */
|
||||
updateURI: function() {
|
||||
var browser = Browser.selectedBrowser;
|
||||
let browser = Browser.selectedBrowser;
|
||||
|
||||
// FIXME: deckbrowser should not fire TabSelect on the initial tab (bug 454028)
|
||||
if (!browser.currentURI)
|
||||
@ -554,7 +571,7 @@ var BrowserUI = {
|
||||
// Check for a bookmarked page
|
||||
this.updateStar();
|
||||
|
||||
var urlString = this.getDisplayURI(browser);
|
||||
let urlString = this.getDisplayURI(browser);
|
||||
if (Util.isURLEmpty(urlString))
|
||||
urlString = "";
|
||||
|
||||
@ -571,7 +588,7 @@ var BrowserUI = {
|
||||
|
||||
// Give the new page lots of room
|
||||
Browser.hideSidebars();
|
||||
this.closeAutoComplete(true);
|
||||
this.closeAutoComplete();
|
||||
|
||||
this._edit.value = aURI;
|
||||
|
||||
@ -592,13 +609,9 @@ var BrowserUI = {
|
||||
this.activePanel = AllPagesList;
|
||||
},
|
||||
|
||||
closeAutoComplete: function closeAutoComplete(aResetInput) {
|
||||
if (this.isAutoCompleteOpen()) {
|
||||
if (aResetInput)
|
||||
this._edit.popup.close();
|
||||
else
|
||||
this._edit.popup.closePopup();
|
||||
}
|
||||
closeAutoComplete: function closeAutoComplete() {
|
||||
if (this.isAutoCompleteOpen())
|
||||
this._edit.popup.closePopup();
|
||||
|
||||
this.activePanel = null;
|
||||
},
|
||||
@ -613,7 +626,7 @@ var BrowserUI = {
|
||||
|
||||
// Give the new page lots of room
|
||||
Browser.hideSidebars();
|
||||
this.closeAutoComplete(false);
|
||||
this.closeAutoComplete();
|
||||
|
||||
// Make sure we're online before attempting to load
|
||||
Util.forceOnline();
|
||||
@ -643,12 +656,12 @@ var BrowserUI = {
|
||||
|
||||
if (aURI == "about:blank") {
|
||||
// Display awesomebar UI
|
||||
this.showToolbar(true);
|
||||
this.showAutoComplete();
|
||||
}
|
||||
else {
|
||||
// Give the new page lots of room
|
||||
Browser.hideSidebars();
|
||||
this.closeAutoComplete(true);
|
||||
this.closeAutoComplete();
|
||||
}
|
||||
|
||||
return tab;
|
||||
@ -829,7 +842,7 @@ var BrowserUI = {
|
||||
this.doCommand("cmd_menu");
|
||||
break;
|
||||
case "Search":
|
||||
this.doCommand("cmd_openLocation");
|
||||
AllPagesList.doCommand();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -841,7 +854,7 @@ var BrowserUI = {
|
||||
if (this.activePanel && this._edit.readOnly)
|
||||
this._edit.readOnly = false;
|
||||
else if (!this.activePanel)
|
||||
this.doCommand("cmd_openLocation");
|
||||
AllPagesList.doCommand();
|
||||
break;
|
||||
case "mousedown":
|
||||
if (!this._isEventInsidePopup(aEvent))
|
||||
@ -884,6 +897,15 @@ var BrowserUI = {
|
||||
if (Browser.selectedBrowser == browser)
|
||||
this._updateIcon(Browser.selectedBrowser.mIconURL);
|
||||
break;
|
||||
case "pagehide":
|
||||
// XXX bug 60419, when a content web page is close the content sometimes
|
||||
// dismiss the VKB, we're trying to avoid that by adding it back again.
|
||||
let utils = Util.getWindowUtils(window);
|
||||
if (this.activePanel && !this._edit.readOnly && browser.currentURI.spec != "about:blank" && utils.IMEStatus == utils.IME_STATUS_DISABLED) {
|
||||
this._edit.readOnly = !this._edit.readOnly;
|
||||
this._edit.readOnly = !this._edit.readOnly;
|
||||
}
|
||||
break;
|
||||
case "Browser:SaveAs:Return":
|
||||
if (json.type != Ci.nsIPrintSettings.kOutputFormatPDF)
|
||||
return;
|
||||
@ -993,7 +1015,8 @@ var BrowserUI = {
|
||||
this.goToURI();
|
||||
break;
|
||||
case "cmd_openLocation":
|
||||
this.showToolbar(true);
|
||||
this.hidePanel();
|
||||
this.showAutoComplete();
|
||||
break;
|
||||
case "cmd_star":
|
||||
{
|
||||
@ -1471,9 +1494,6 @@ var AwesomePanel = function(aElementId, aCommandId) {
|
||||
this.panel = document.getElementById(aElementId),
|
||||
|
||||
this.open = function aw_open() {
|
||||
if (!BrowserUI.activePanel)
|
||||
BrowserUI.pushDialog(this);
|
||||
|
||||
command.setAttribute("checked", "true");
|
||||
this.panel.hidden = false;
|
||||
|
||||
@ -1497,8 +1517,10 @@ var AwesomePanel = function(aElementId, aCommandId) {
|
||||
|
||||
this.panel.hidden = true;
|
||||
command.removeAttribute("checked", "true");
|
||||
if (!BrowserUI.activePanel)
|
||||
BrowserUI.popDialog();
|
||||
},
|
||||
|
||||
this.doCommand = function aw_doCommand() {
|
||||
BrowserUI.doCommand(aCommandId);
|
||||
},
|
||||
|
||||
this.openLink = function aw_openLink(aEvent) {
|
||||
|
@ -2490,7 +2490,7 @@ Tab.prototype = {
|
||||
this._chromeTab = null;
|
||||
this._destroyBrowser();
|
||||
},
|
||||
|
||||
|
||||
resurrect: function resurrect() {
|
||||
let dead = this._browser;
|
||||
|
||||
@ -2550,8 +2550,9 @@ Tab.prototype = {
|
||||
|
||||
_destroyBrowser: function _destroyBrowser() {
|
||||
if (this._browser) {
|
||||
var browser = this._browser;
|
||||
let browser = this._browser;
|
||||
browser.removeProgressListener(this._listener);
|
||||
browser.messageManager.sendAsyncMessage("Browser:Blur", {});
|
||||
|
||||
this._browser = null;
|
||||
this._listener = null;
|
||||
|
@ -337,12 +337,19 @@ Content.prototype = {
|
||||
let modifiers = json.modifiers;
|
||||
|
||||
switch (aMessage.name) {
|
||||
case "Browser:Blur":
|
||||
gFocusManager.clearFocus(content);
|
||||
case "Browser:Blur": {
|
||||
//XXX bug 604192, the focus should be cleared _only_ if the element is
|
||||
// into this particular window while content process can dimiss the VKB
|
||||
// dislayed for the chrome UI
|
||||
let utils = Util.getWindowUtils(content);
|
||||
let focusedElement = gFocusManager.focusedElement;
|
||||
if (utils.IMEStatus != utils.IME_STATUS_DISABLED && (focusedElement && focusedElement.mozIsTextField && focusedElement.mozIsTextField(false)))
|
||||
gFocusManager.clearFocus(content);
|
||||
|
||||
docShell.isActive = false;
|
||||
this._selected = false;
|
||||
break;
|
||||
|
||||
}
|
||||
case "Browser:Focus":
|
||||
docShell.isActive = true;
|
||||
this._selected = true;
|
||||
|
@ -3,8 +3,11 @@
|
||||
* differents part of the awesome panel
|
||||
*/
|
||||
|
||||
let testURL_01 = chromeRoot + "browser_blank_01.html";
|
||||
|
||||
let gTests = [];
|
||||
let gCurrentTest = null;
|
||||
let Panels = [AllPagesList, HistoryList, BookmarkList];
|
||||
|
||||
function test() {
|
||||
// The "runNextTest" approach is async, so we need to call "waitForExplicitFinish()"
|
||||
@ -25,11 +28,93 @@ function runNextTest() {
|
||||
gCurrentTest.run();
|
||||
}
|
||||
else {
|
||||
BrowserUI.closeAutoComplete(true);
|
||||
BrowserUI.closeAutoComplete();
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Case: Test typing a character should dismiss the awesome header
|
||||
gTests.push({
|
||||
desc: "Test typing a character should dismiss the awesome header",
|
||||
|
||||
run: function() {
|
||||
window.addEventListener("NavigationPanelShown", function(aEvent) {
|
||||
window.removeEventListener(aEvent.type, arguments.callee, true);
|
||||
gCurrentTest.onPopupReady();
|
||||
}, true);
|
||||
|
||||
AllPagesList.doCommand();
|
||||
},
|
||||
|
||||
onPopupReady: function() {
|
||||
is(BrowserUI.activePanel == AllPagesList, true, "AllPagesList should be visible");
|
||||
|
||||
let awesomeHeader = document.getElementById("awesome-header");
|
||||
is(awesomeHeader.hidden, false, "Awesome header should be visible");
|
||||
|
||||
BrowserUI._edit.addEventListener("onsearchbegin", function(aEvent) {
|
||||
BrowserUI._edit.removeEventListener(aEvent.type, arguments.callee, true);
|
||||
let awesomeHeader = document.getElementById("awesome-header");
|
||||
is(awesomeHeader.hidden, true, "Awesome header should be hidden");
|
||||
gCurrentTest.onKeyPress();
|
||||
}, true);
|
||||
EventUtils.synthesizeKey("A", {}, window);
|
||||
},
|
||||
|
||||
onKeyPress: function(aKey, aHidden) {
|
||||
window.addEventListener("NavigationPanelHidden", function(aEvent) {
|
||||
window.removeEventListener(aEvent.type, arguments.callee, false);
|
||||
let awesomeHeader = document.getElementById("awesome-header");
|
||||
is(awesomeHeader.hidden, false, "Awesome header should be visible");
|
||||
runNextTest();
|
||||
}, false);
|
||||
|
||||
EventUtils.synthesizeKey("VK_ESCAPE", {}, window);
|
||||
}
|
||||
});
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Case: Test typing a character should open the awesome bar
|
||||
gTests.push({
|
||||
desc: "Test typing a character should open the All Pages List",
|
||||
|
||||
run: function() {
|
||||
window.addEventListener("NavigationPanelShown", function(aEvent) {
|
||||
window.removeEventListener(aEvent.type, arguments.callee, true);
|
||||
gCurrentTest.onPopupReady();
|
||||
}, true);
|
||||
BookmarkList.doCommand();
|
||||
},
|
||||
|
||||
onPopupReady: function() {
|
||||
BrowserUI._edit.addEventListener("onsearchbegin", function(aEvent) {
|
||||
BrowserUI._edit.removeEventListener(aEvent.type, arguments.callee, false);
|
||||
gCurrentTest.onSearchBegin();
|
||||
}, false);
|
||||
EventUtils.synthesizeKey("I", {}, window);
|
||||
},
|
||||
|
||||
onSearchBegin: function() {
|
||||
let awesomeHeader = document.getElementById("awesome-header");
|
||||
is(awesomeHeader.hidden, true, "Awesome header should be hidden");
|
||||
is(BrowserUI.activePanel == AllPagesList, true, "AllPagesList should be opened on a keydown");
|
||||
is(BrowserUI._edit.readOnly, false, "urlbar should not be readonly after an input");
|
||||
|
||||
window.addEventListener("NavigationPanelHidden", function(aEvent) {
|
||||
window.removeEventListener(aEvent.type, arguments.callee, true);
|
||||
gCurrentTest.onPopupHidden();
|
||||
}, true);
|
||||
|
||||
EventUtils.synthesizeKey("VK_ESCAPE", {}, window);
|
||||
},
|
||||
|
||||
onPopupHidden: function() {
|
||||
is(BrowserUI.activePanel == null, true, "VK_ESCAPE should have dismissed the awesome panel");
|
||||
runNextTest();
|
||||
}
|
||||
});
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Case: Test opening the awesome panel and checking the urlbar readonly state
|
||||
gTests.push({
|
||||
@ -38,22 +123,100 @@ gTests.push({
|
||||
run: function() {
|
||||
is(BrowserUI._edit.readOnly, true, "urlbar input textbox should be readonly");
|
||||
|
||||
let popup = document.getElementById("popup_autocomplete");
|
||||
popup.addEventListener("popupshown", function(aEvent) {
|
||||
popup.removeEventListener("popupshown", arguments.callee, true);
|
||||
window.addEventListener("NavigationPanelShown", function(aEvent) {
|
||||
window.removeEventListener(aEvent.type, arguments.callee, true);
|
||||
gCurrentTest.onPopupReady();
|
||||
}, true);
|
||||
|
||||
BrowserUI.doCommand("cmd_openLocation");
|
||||
AllPagesList.doCommand();
|
||||
},
|
||||
|
||||
onPopupReady: function() {
|
||||
is(Elements.urlbarState.getAttribute("mode"), "edit", "bcast_urlbarState mode attribute should be equal to 'edit'");
|
||||
is(BrowserUI._edit.readOnly, true, "urlbar input textbox be readonly once it is open in landscape");
|
||||
|
||||
BrowserUI._edit.click();
|
||||
is(BrowserUI._edit.readOnly, false, "urlbar input textbox should not be readonly once it is open in landscape and click again");
|
||||
let edit = BrowserUI._edit;
|
||||
is(edit.readOnly, true, "urlbar input textbox be readonly once it is open in landscape");
|
||||
|
||||
runNextTest();
|
||||
let urlString = BrowserUI.getDisplayURI(Browser.selectedBrowser);
|
||||
if (Util.isURLEmpty(urlString))
|
||||
urlString = "";
|
||||
|
||||
Panels.forEach(function(aPanel) {
|
||||
aPanel.doCommand();
|
||||
is(BrowserUI.activePanel, aPanel, "The panel " + aPanel.panel.id + " should be selected");
|
||||
is(edit.readOnly, true, "urlbar input textbox be readonly once it is open in landscape");
|
||||
edit.click();
|
||||
is(edit.readOnly, false, "urlbar input textbox should not be readonly once it is open in landscape and click again");
|
||||
|
||||
is(edit.value, urlString, "urlbar value should be equal to the page uri");
|
||||
});
|
||||
|
||||
setTimeout(function() {
|
||||
BrowserUI.activePanel = null;
|
||||
runNextTest();
|
||||
}, 0);
|
||||
}
|
||||
});
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Case: Test opening the awesome panel and checking the urlbar selection
|
||||
gTests.push({
|
||||
desc: "Test opening the awesome panel and checking the urlbar selection",
|
||||
|
||||
run: function() {
|
||||
this._currentTab = BrowserUI.newTab(testURL_01);
|
||||
|
||||
// Need to wait until the page is loaded
|
||||
messageManager.addMessageListener("pageshow",
|
||||
function(aMessage) {
|
||||
if (gCurrentTest._currentTab.browser.currentURI.spec != "about:blank") {
|
||||
messageManager.removeMessageListener(aMessage.name, arguments.callee);
|
||||
gCurrentTest.onPageReady();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
onPageReady: function() {
|
||||
window.addEventListener("NavigationPanelShown", function(aEvent) {
|
||||
window.removeEventListener(aEvent.type, arguments.callee, true);
|
||||
gCurrentTest.onPopupReady();
|
||||
}, true);
|
||||
|
||||
AllPagesList.doCommand();
|
||||
},
|
||||
|
||||
onPopupReady: function() {
|
||||
let edit = BrowserUI._edit;
|
||||
|
||||
Panels.forEach(function(aPanel) {
|
||||
aPanel.doCommand();
|
||||
// XXX for some reason the selectionStart == 0 && selectionEnd = edit.textLength
|
||||
// even if visually there is no selection at all
|
||||
todo_is(edit.selectionStart == edit.textLenght && edit.selectionEnd == edit.textLength, true, "urlbar text should not be selected on a simple show");
|
||||
|
||||
edit.click();
|
||||
is(edit.selectionStart == 0 && edit.selectionEnd == edit.textLength, true, "urlbar text should be selected on a click");
|
||||
|
||||
});
|
||||
|
||||
let oldClickSelectsAll = edit.clickSelectsAll;
|
||||
edit.clickSelectsAll = false;
|
||||
Panels.forEach(function(aPanel) {
|
||||
aPanel.doCommand();
|
||||
// XXX for some reason the selectionStart == 0 && selectionEnd = edit.textLength
|
||||
// even if visually there is no selection at all
|
||||
todo_is(edit.selectionStart == edit.textLenght && edit.selectionEnd == edit.textLength, true, "urlbar text should not be selected on a simple show");
|
||||
edit.click();
|
||||
is(edit.selectionStart == 0 && edit.selectionEnd == edit.textLength, true, "urlbar text should be selected on a click");
|
||||
});
|
||||
edit.clickSelectsAll = oldClickSelectsAll;
|
||||
|
||||
BrowserUI.closeTab(this._currentTab);
|
||||
|
||||
Util.executeSoon(function() {
|
||||
BrowserUI.activePanel = null;
|
||||
runNextTest();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -94,13 +94,14 @@ gTests.push({
|
||||
},
|
||||
|
||||
onPageReady: function() {
|
||||
// Open the bookmark list
|
||||
// Wait for the bookmarks to load, then do the test
|
||||
window.addEventListener("NavigationPanelShown", gCurrentTest.onBookmarksReady, false);
|
||||
BrowserUI.doCommand("cmd_bookmarks");
|
||||
|
||||
waitFor(gCurrentTest.onBookmarksReady, function() { return BrowserUI.activePanel == BookmarkList });
|
||||
},
|
||||
|
||||
onBookmarksReady: function() {
|
||||
window.removeEventListener("NavigationPanelShown", gCurrentTest.onBookmarksReady, false);
|
||||
|
||||
let bookmarkitem = document.getAnonymousElementByAttribute(BookmarkList.panel, "uri", testURL_01);
|
||||
bookmarkitem.control.scrollBoxObject.ensureElementIsVisible(bookmarkitem);
|
||||
|
||||
@ -128,17 +129,22 @@ gTests.push({
|
||||
desc: "Test editing URI of existing bookmark",
|
||||
|
||||
run: function() {
|
||||
// Open the bookmark list
|
||||
// Wait for the bookmarks to load, then do the test
|
||||
window.addEventListener("NavigationPanelShown", gCurrentTest.onBookmarksReady, false);
|
||||
BrowserUI.doCommand("cmd_bookmarks");
|
||||
},
|
||||
|
||||
onBookmarksReady: function() {
|
||||
window.removeEventListener("NavigationPanelShown", gCurrentTest.onBookmarksReady, false);
|
||||
|
||||
// Go into edit mode
|
||||
let bookmark = BookmarkList.panel.items[0];
|
||||
bookmark.startEditing();
|
||||
|
||||
waitFor(gCurrentTest.onBookmarksReady, function() { return bookmark.isEditing == true; });
|
||||
waitFor(gCurrentTest.onEditorReady, function() { return bookmark.isEditing == true; });
|
||||
},
|
||||
|
||||
onBookmarksReady: function() {
|
||||
onEditorReady: function() {
|
||||
let bookmarkitem = document.getAnonymousElementByAttribute(BookmarkList.panel, "uri", testURL_01);
|
||||
EventUtils.synthesizeMouse(bookmarkitem, bookmarkitem.width / 2, bookmarkitem.height / 2, {});
|
||||
|
||||
@ -165,17 +171,22 @@ gTests.push({
|
||||
desc: "Test editing title of existing bookmark",
|
||||
|
||||
run: function() {
|
||||
// Open the bookmark list
|
||||
// Wait for the bookmarks to load, then do the test
|
||||
window.addEventListener("NavigationPanelShown", gCurrentTest.onBookmarksReady, false);
|
||||
BrowserUI.doCommand("cmd_bookmarks");
|
||||
},
|
||||
|
||||
onBookmarksReady: function() {
|
||||
window.removeEventListener("NavigationPanelShown", gCurrentTest.onBookmarksReady, false);
|
||||
|
||||
// Go into edit mode
|
||||
let bookmark = BookmarkList.panel.items[0];
|
||||
bookmark.startEditing();
|
||||
|
||||
waitFor(gCurrentTest.onBookmarksReady, function() { return bookmark.isEditing == true; });
|
||||
waitFor(gCurrentTest.onEditorReady, function() { return bookmark.isEditing == true; });
|
||||
},
|
||||
|
||||
onBookmarksReady: function() {
|
||||
onEditorReady: function() {
|
||||
let bookmark = PlacesUtils.getMostRecentBookmarkForURI(makeURI(testURL_02));
|
||||
is(PlacesUtils.bookmarks.getItemTitle(bookmark), "Browser Blank Page 01", "Title remains the same.");
|
||||
|
||||
@ -205,17 +216,22 @@ gTests.push({
|
||||
bookmarkitem: null,
|
||||
|
||||
run: function() {
|
||||
// Open the bookmark list
|
||||
// Wait for the bookmarks to load, then do the test
|
||||
window.addEventListener("NavigationPanelShown", gCurrentTest.onBookmarksReady, false);
|
||||
BrowserUI.doCommand("cmd_bookmarks");
|
||||
},
|
||||
|
||||
onBookmarksReady: function() {
|
||||
window.removeEventListener("NavigationPanelShown", gCurrentTest.onBookmarksReady, false);
|
||||
|
||||
// Go into edit mode
|
||||
let bookmark = BookmarkList.panel.items[0];
|
||||
bookmark.startEditing();
|
||||
|
||||
waitFor(gCurrentTest.onBookmarksReady, function() { return bookmark.isEditing == true; });
|
||||
waitFor(gCurrentTest.onEditorReady, function() { return bookmark.isEditing == true; });
|
||||
},
|
||||
|
||||
onBookmarksReady: function() {
|
||||
onEditorReady: function() {
|
||||
let bookmark = document.getAnonymousElementByAttribute(BookmarkList.panel, "uri", testURL_02);
|
||||
bookmark.remove();
|
||||
|
||||
@ -244,8 +260,13 @@ gTests.push({
|
||||
Ci.nsINavBookmarksService.DEFAULT_INDEX,
|
||||
testURL_02);
|
||||
|
||||
// Open the bookmark list
|
||||
// Wait for the bookmarks to load, then do the test
|
||||
window.addEventListener("NavigationPanelShown", gCurrentTest.onBookmarksReady, false);
|
||||
BrowserUI.doCommand("cmd_bookmarks");
|
||||
},
|
||||
|
||||
onBookmarksReady: function() {
|
||||
window.removeEventListener("NavigationPanelShown", gCurrentTest.onBookmarksReady, false);
|
||||
|
||||
// Go into edit mode
|
||||
let bookmarksPanel = BookmarkList.panel;
|
||||
@ -272,9 +293,9 @@ gTests.push({
|
||||
// But it should be one of the other readonly bookmark roots
|
||||
isnot(bookmarksPanel._readOnlyFolders.indexOf(parseInt(first.itemId)), -1, "Desktop subfolder is showing after mouse click");
|
||||
|
||||
BrowserUI.activePanel = null;
|
||||
PlacesUtils.bookmarks.removeItem(gCurrentTest.bmId);
|
||||
|
||||
BrowserUI.activePanel = null;
|
||||
runNextTest();
|
||||
}
|
||||
});
|
||||
|
@ -65,8 +65,13 @@ gTests.push({
|
||||
let bookmarkItem = PlacesUtils.getMostRecentBookmarkForURI(makeURI(testURL_02));
|
||||
ok(bookmarkItem != -1, testURL_02 + " should be added.");
|
||||
|
||||
// Open the bookmark list
|
||||
// Wait for the bookmarks to load, then do the test
|
||||
window.addEventListener("NavigationPanelShown", gCurrentTest.onBookmarksReady, false);
|
||||
BrowserUI.doCommand("cmd_bookmarks");
|
||||
},
|
||||
|
||||
onBookmarksReady: function() {
|
||||
window.removeEventListener("NavigationPanelShown", gCurrentTest.onBookmarksReady, false);
|
||||
|
||||
// Go into edit mode
|
||||
let bookmark = document.getAnonymousElementByAttribute(BookmarkList.panel, "uri", testURL_02);
|
||||
@ -100,8 +105,14 @@ gTests.push({
|
||||
desc: "Test editing tags to bookmark",
|
||||
|
||||
run: function() {
|
||||
// Open the bookmark list
|
||||
// Wait for the bookmarks to load, then do the test
|
||||
window.addEventListener("NavigationPanelShown", gCurrentTest.onBookmarksReady, false);
|
||||
BrowserUI.doCommand("cmd_bookmarks");
|
||||
},
|
||||
|
||||
onBookmarksReady: function() {
|
||||
window.removeEventListener("NavigationPanelShown", gCurrentTest.onBookmarksReady, false);
|
||||
|
||||
|
||||
// Go into edit mode
|
||||
let bookmark = document.getAnonymousElementByAttribute(BookmarkList.panel, "uri", testURL_02);
|
||||
@ -143,8 +154,13 @@ gTests.push({
|
||||
_currentTab: null,
|
||||
|
||||
run: function() {
|
||||
// Open the bookmark list
|
||||
// Wait for the bookmarks to load, then do the test
|
||||
window.addEventListener("NavigationPanelShown", gCurrentTest.onBookmarksReady, false);
|
||||
BrowserUI.doCommand("cmd_bookmarks");
|
||||
},
|
||||
|
||||
onBookmarksReady: function() {
|
||||
window.removeEventListener("NavigationPanelShown", gCurrentTest.onBookmarksReady, false);
|
||||
|
||||
// Go into edit mode
|
||||
let bookmark = document.getAnonymousElementByAttribute(BookmarkList.panel, "uri", testURL_02);
|
||||
|
@ -75,14 +75,14 @@ gTests.push({
|
||||
|
||||
// Focus the url edit
|
||||
let urlbarEdit = document.getElementById("urlbar-edit");
|
||||
EventUtils.synthesizeMouse(urlbarEdit, urlbarEdit.width / 2, urlbarEdit.height / 2, {});
|
||||
|
||||
// Wait for the awesomebar to load, then do the test
|
||||
window.addEventListener("popupshown", gCurrentTest.onFocusReady, false);
|
||||
window.addEventListener("NavigationPanelShown", gCurrentTest.onFocusReady, false);
|
||||
EventUtils.synthesizeMouse(urlbarEdit, urlbarEdit.width / 2, urlbarEdit.height / 2, {});
|
||||
},
|
||||
|
||||
onFocusReady: function() {
|
||||
window.removeEventListener("popupshown", gCurrentTest.onFocusReady, false);
|
||||
window.removeEventListener("NavigationPanelShown", gCurrentTest.onFocusReady, false);
|
||||
|
||||
// Test mode
|
||||
let urlIcons = document.getElementById("urlbar-icons");
|
||||
@ -202,14 +202,14 @@ gTests.push({
|
||||
onPageReady3: function(){
|
||||
let urlbarEdit = document.getElementById("urlbar-edit");
|
||||
is(urlbarEdit.value, "Browser Blank Page 01", "The title of the first page must be displayed");
|
||||
EventUtils.synthesizeMouse(urlbarEdit, urlbarEdit.width / 2, urlbarEdit.height / 2, {});
|
||||
|
||||
// Wait for the awesomebar to load, then do the test
|
||||
window.addEventListener("popupshown", gCurrentTest.onFocusReady, false);
|
||||
window.addEventListener("NavigationPanelShown", gCurrentTest.onFocusReady, false);
|
||||
EventUtils.synthesizeMouse(urlbarEdit, urlbarEdit.width / 2, urlbarEdit.height / 2, {});
|
||||
},
|
||||
|
||||
onFocusReady: function() {
|
||||
window.removeEventListener("popupshown", gCurrentTest.onFocusReady, false);
|
||||
window.removeEventListener("NavigationPanelShown", gCurrentTest.onFocusReady, false);
|
||||
EventUtils.synthesizeString(testURL_02, window);
|
||||
EventUtils.synthesizeKey("VK_RETURN", {}, window)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user