mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 06:15:43 +00:00
Bug 1444228 - Remove editBookmarkOverlay.xul. r=standard8
Move the main contents of editBookmarkOverlay.xul into an include file and inline the DTD and CSS files where used. Convert several chrome tests to browser tests since the preprocessor is hard to use within the testing framework. MozReview-Commit-ID: DpPBOpZSuBN --HG-- rename : browser/components/places/content/editBookmarkOverlay.js => browser/components/places/content/editBookmark.js rename : browser/components/places/content/editBookmarkOverlay.xul => browser/components/places/content/editBookmarkPanel.inc.xul rename : browser/components/places/tests/chrome/test_bug427633_no_newfolder_if_noip.xul => browser/components/places/tests/browser/browser_bug427633_no_newfolder_if_noip.js rename : browser/components/places/tests/chrome/test_bug485100-change-case-loses-tag.xul => browser/components/places/tests/browser/browser_bug485100-change-case-loses-tag.js rename : browser/components/places/tests/chrome/test_bug631374_tags_selector_scroll.xul => browser/components/places/tests/browser/browser_bug631374_tags_selector_scroll.js rename : browser/components/places/tests/chrome/test_editBookmarkOverlay_keywords.xul => browser/components/places/tests/browser/browser_editBookmark_keywords.js rename : browser/components/places/tests/chrome/test_editBookmarkOverlay_tags_liveUpdate.xul => browser/components/places/tests/browser/browser_editBookmark_tags_liveUpdate.js rename : browser/themes/linux/places/editBookmarkOverlay.css => browser/themes/linux/places/editBookmark.css rename : browser/themes/osx/places/editBookmarkOverlay.css => browser/themes/osx/places/editBookmark.css rename : browser/themes/windows/places/editBookmarkOverlay.css => browser/themes/windows/places/editBookmark.css extra : rebase_source : aca072691251c1a44e82ab8091796abd2b140e22
This commit is contained in:
parent
7af81fab58
commit
c52106c442
@ -21,5 +21,7 @@
|
|||||||
%syncBrandDTD;
|
%syncBrandDTD;
|
||||||
<!ENTITY % reportphishDTD SYSTEM "chrome://browser/locale/safebrowsing/report-phishing.dtd">
|
<!ENTITY % reportphishDTD SYSTEM "chrome://browser/locale/safebrowsing/report-phishing.dtd">
|
||||||
%reportphishDTD;
|
%reportphishDTD;
|
||||||
|
<!ENTITY % editBookmarkOverlayDTD SYSTEM "chrome://browser/locale/places/editBookmarkOverlay.dtd">
|
||||||
|
%editBookmarkOverlayDTD;
|
||||||
]>
|
]>
|
||||||
|
|
||||||
|
@ -201,8 +201,7 @@ var StarUI = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_overlayLoaded: false,
|
_bookmarkPopupInitialized: false,
|
||||||
_overlayLoading: false,
|
|
||||||
async showEditBookmarkPopup(aNode, aAnchorElement, aPosition, aIsNewBookmark, aUrl) {
|
async showEditBookmarkPopup(aNode, aAnchorElement, aPosition, aIsNewBookmark, aUrl) {
|
||||||
// Slow double-clicks (not true double-clicks) shouldn't
|
// Slow double-clicks (not true double-clicks) shouldn't
|
||||||
// cause the panel to flicker.
|
// cause the panel to flicker.
|
||||||
@ -214,20 +213,11 @@ var StarUI = {
|
|||||||
this._isNewBookmark = aIsNewBookmark;
|
this._isNewBookmark = aIsNewBookmark;
|
||||||
this._itemGuids = null;
|
this._itemGuids = null;
|
||||||
|
|
||||||
// Performance: load the overlay the first time the panel is opened
|
if (this._bookmarkPopupInitialized) {
|
||||||
// (see bug 392443).
|
|
||||||
if (this._overlayLoading)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (this._overlayLoaded) {
|
|
||||||
await this._doShowEditBookmarkPanel(aNode, aAnchorElement, aPosition, aUrl);
|
await this._doShowEditBookmarkPanel(aNode, aAnchorElement, aPosition, aUrl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this._bookmarkPopupInitialized = true;
|
||||||
this._overlayLoading = true;
|
|
||||||
document.loadOverlay(
|
|
||||||
"chrome://browser/content/places/editBookmarkOverlay.xul",
|
|
||||||
(aSubject, aTopic, aData) => {
|
|
||||||
// Move the header (star, title, button) into the grid,
|
// Move the header (star, title, button) into the grid,
|
||||||
// so that it aligns nicely with the other items (bug 484022).
|
// so that it aligns nicely with the other items (bug 484022).
|
||||||
let header = this._element("editBookmarkPanelHeader");
|
let header = this._element("editBookmarkPanelHeader");
|
||||||
@ -235,11 +225,7 @@ var StarUI = {
|
|||||||
rows.insertBefore(header, rows.firstChild);
|
rows.insertBefore(header, rows.firstChild);
|
||||||
header.hidden = false;
|
header.hidden = false;
|
||||||
|
|
||||||
this._overlayLoading = false;
|
await this._doShowEditBookmarkPanel(aNode, aAnchorElement, aPosition, aUrl);
|
||||||
this._overlayLoaded = true;
|
|
||||||
this._doShowEditBookmarkPanel(aNode, aAnchorElement, aPosition, aUrl);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async _doShowEditBookmarkPanel(aNode, aAnchorElement, aPosition, aUrl) {
|
async _doShowEditBookmarkPanel(aNode, aAnchorElement, aPosition, aUrl) {
|
||||||
|
@ -117,7 +117,7 @@ XPCOMUtils.defineLazyScriptGetter(this, ["DownloadsButton",
|
|||||||
"DownloadsIndicatorView"],
|
"DownloadsIndicatorView"],
|
||||||
"chrome://browser/content/downloads/indicator.js");
|
"chrome://browser/content/downloads/indicator.js");
|
||||||
XPCOMUtils.defineLazyScriptGetter(this, "gEditItemOverlay",
|
XPCOMUtils.defineLazyScriptGetter(this, "gEditItemOverlay",
|
||||||
"chrome://browser/content/places/editBookmarkOverlay.js");
|
"chrome://browser/content/places/editBookmark.js");
|
||||||
if (AppConstants.NIGHTLY_BUILD) {
|
if (AppConstants.NIGHTLY_BUILD) {
|
||||||
XPCOMUtils.defineLazyScriptGetter(this, "gWebRender",
|
XPCOMUtils.defineLazyScriptGetter(this, "gWebRender",
|
||||||
"chrome://browser/content/browser-webrender.js");
|
"chrome://browser/content/browser-webrender.js");
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
<?xml-stylesheet href="chrome://browser/skin/controlcenter/panel.css" type="text/css"?>
|
<?xml-stylesheet href="chrome://browser/skin/controlcenter/panel.css" type="text/css"?>
|
||||||
<?xml-stylesheet href="chrome://browser/skin/customizableui/panelUI.css" type="text/css"?>
|
<?xml-stylesheet href="chrome://browser/skin/customizableui/panelUI.css" type="text/css"?>
|
||||||
<?xml-stylesheet href="chrome://browser/skin/downloads/downloads.css"?>
|
<?xml-stylesheet href="chrome://browser/skin/downloads/downloads.css"?>
|
||||||
|
<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
|
||||||
|
<?xml-stylesheet href="chrome://browser/skin/places/editBookmark.css"?>
|
||||||
<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
|
<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
|
||||||
<?xml-stylesheet href="chrome://browser/content/tabbrowser.css" type="text/css"?>
|
<?xml-stylesheet href="chrome://browser/content/tabbrowser.css" type="text/css"?>
|
||||||
|
|
||||||
@ -223,7 +225,7 @@
|
|||||||
<description id="editBookmarkPanelDescription"/>
|
<description id="editBookmarkPanelDescription"/>
|
||||||
</vbox>
|
</vbox>
|
||||||
</row>
|
</row>
|
||||||
<vbox id="editBookmarkPanelContent" flex="1" hidden="true"/>
|
#include ../../components/places/content/editBookmarkPanel.inc.xul
|
||||||
<hbox id="editBookmarkPanelBottomButtons" pack="end">
|
<hbox id="editBookmarkPanelBottomButtons" pack="end">
|
||||||
#ifndef XP_UNIX
|
#ifndef XP_UNIX
|
||||||
<button id="editBookmarkPanelDoneButton"
|
<button id="editBookmarkPanelDoneButton"
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
* been performed by the dialog.
|
* been performed by the dialog.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* import-globals-from editBookmarkOverlay.js */
|
/* import-globals-from editBookmark.js */
|
||||||
/* import-globals-from controller.js */
|
/* import-globals-from controller.js */
|
||||||
|
|
||||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
|
@ -5,12 +5,10 @@
|
|||||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||||
|
|
||||||
<?xml-stylesheet href="chrome://global/skin/"?>
|
<?xml-stylesheet href="chrome://global/skin/"?>
|
||||||
<?xml-stylesheet href="chrome://browser/skin/places/editBookmarkOverlay.css"?>
|
<?xml-stylesheet href="chrome://browser/skin/places/editBookmark.css"?>
|
||||||
<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
|
<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
|
||||||
<?xml-stylesheet href="chrome://browser/content/places/places.css"?>
|
<?xml-stylesheet href="chrome://browser/content/places/places.css"?>
|
||||||
|
|
||||||
<?xul-overlay href="chrome://browser/content/places/editBookmarkOverlay.xul"?>
|
|
||||||
|
|
||||||
<!DOCTYPE dialog [
|
<!DOCTYPE dialog [
|
||||||
<!ENTITY % editBookmarkOverlayDTD SYSTEM "chrome://browser/locale/places/editBookmarkOverlay.dtd">
|
<!ENTITY % editBookmarkOverlayDTD SYSTEM "chrome://browser/locale/places/editBookmarkOverlay.dtd">
|
||||||
%editBookmarkOverlayDTD;
|
%editBookmarkOverlayDTD;
|
||||||
@ -33,7 +31,7 @@
|
|||||||
</stringbundleset>
|
</stringbundleset>
|
||||||
|
|
||||||
<script type="application/javascript"
|
<script type="application/javascript"
|
||||||
src="chrome://browser/content/places/editBookmarkOverlay.js"/>
|
src="chrome://browser/content/places/editBookmark.js"/>
|
||||||
<script type="application/javascript"
|
<script type="application/javascript"
|
||||||
src="chrome://browser/content/places/bookmarkProperties.js"/>
|
src="chrome://browser/content/places/bookmarkProperties.js"/>
|
||||||
<script type="application/javascript"
|
<script type="application/javascript"
|
||||||
@ -56,6 +54,6 @@
|
|||||||
"chrome://browser/content/places/controller.js");
|
"chrome://browser/content/places/controller.js");
|
||||||
]]></script>
|
]]></script>
|
||||||
|
|
||||||
<vbox id="editBookmarkPanelContent"/>
|
#include editBookmarkPanel.inc.xul
|
||||||
|
|
||||||
</dialog>
|
</dialog>
|
||||||
|
@ -1,188 +0,0 @@
|
|||||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
|
||||||
|
|
||||||
<!DOCTYPE overlay [
|
|
||||||
<!ENTITY % editBookmarkOverlayDTD SYSTEM "chrome://browser/locale/places/editBookmarkOverlay.dtd">
|
|
||||||
%editBookmarkOverlayDTD;
|
|
||||||
]>
|
|
||||||
|
|
||||||
<?xml-stylesheet href="chrome://browser/skin/places/editBookmarkOverlay.css"?>
|
|
||||||
<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
|
|
||||||
|
|
||||||
<overlay id="editBookmarkOverlay"
|
|
||||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
|
||||||
|
|
||||||
<vbox id="editBookmarkPanelContent" flex="1">
|
|
||||||
<hbox id="editBMPanel_selectionCount" pack="center">
|
|
||||||
<label id="editBMPanel_itemsCountText"/>
|
|
||||||
</hbox>
|
|
||||||
|
|
||||||
<grid id="editBookmarkPanelGrid" flex="1">
|
|
||||||
<columns id="editBMPanel_columns">
|
|
||||||
<column id="editBMPanel_labelColumn" />
|
|
||||||
<column flex="1" id="editBMPanel_editColumn" />
|
|
||||||
</columns>
|
|
||||||
<rows id="editBMPanel_rows">
|
|
||||||
<row id="editBMPanel_nameRow"
|
|
||||||
align="center"
|
|
||||||
collapsed="true">
|
|
||||||
<label value="&editBookmarkOverlay.name.label;"
|
|
||||||
class="editBMPanel_rowLabel"
|
|
||||||
accesskey="&editBookmarkOverlay.name.accesskey;"
|
|
||||||
control="editBMPanel_namePicker"/>
|
|
||||||
<textbox id="editBMPanel_namePicker"
|
|
||||||
onchange="gEditItemOverlay.onNamePickerChange().catch(Components.utils.reportError);"/>
|
|
||||||
</row>
|
|
||||||
|
|
||||||
<row id="editBMPanel_locationRow"
|
|
||||||
align="center"
|
|
||||||
collapsed="true">
|
|
||||||
<label value="&editBookmarkOverlay.location.label;"
|
|
||||||
class="editBMPanel_rowLabel"
|
|
||||||
accesskey="&editBookmarkOverlay.location.accesskey;"
|
|
||||||
control="editBMPanel_locationField"/>
|
|
||||||
<textbox id="editBMPanel_locationField"
|
|
||||||
class="uri-element"
|
|
||||||
onchange="gEditItemOverlay.onLocationFieldChange();"/>
|
|
||||||
</row>
|
|
||||||
|
|
||||||
<row id="editBMPanel_folderRow"
|
|
||||||
align="center"
|
|
||||||
collapsed="true">
|
|
||||||
<label value="&editBookmarkOverlay.folder.label;"
|
|
||||||
class="editBMPanel_rowLabel"
|
|
||||||
control="editBMPanel_folderMenuList"/>
|
|
||||||
<hbox flex="1" align="center">
|
|
||||||
<menulist id="editBMPanel_folderMenuList"
|
|
||||||
class="folder-icon"
|
|
||||||
flex="1"
|
|
||||||
oncommand="gEditItemOverlay.onFolderMenuListCommand(event).catch(Components.utils.reportError);">
|
|
||||||
<menupopup>
|
|
||||||
<!-- Static item for special folders -->
|
|
||||||
<menuitem id="editBMPanel_toolbarFolderItem"
|
|
||||||
class="menuitem-iconic folder-icon"/>
|
|
||||||
<menuitem id="editBMPanel_bmRootItem"
|
|
||||||
class="menuitem-iconic folder-icon"/>
|
|
||||||
<menuitem id="editBMPanel_unfiledRootItem"
|
|
||||||
class="menuitem-iconic folder-icon"/>
|
|
||||||
<menuseparator id="editBMPanel_chooseFolderSeparator"/>
|
|
||||||
<menuitem id="editBMPanel_chooseFolderMenuItem"
|
|
||||||
label="&editBookmarkOverlay.choose.label;"
|
|
||||||
class="menuitem-iconic folder-icon"/>
|
|
||||||
<menuseparator id="editBMPanel_foldersSeparator" hidden="true"/>
|
|
||||||
</menupopup>
|
|
||||||
</menulist>
|
|
||||||
<button id="editBMPanel_foldersExpander"
|
|
||||||
class="expander-down"
|
|
||||||
tooltiptext="&editBookmarkOverlay.foldersExpanderDown.tooltip;"
|
|
||||||
tooltiptextdown="&editBookmarkOverlay.foldersExpanderDown.tooltip;"
|
|
||||||
tooltiptextup="&editBookmarkOverlay.expanderUp.tooltip;"
|
|
||||||
oncommand="gEditItemOverlay.toggleFolderTreeVisibility();"/>
|
|
||||||
</hbox>
|
|
||||||
</row>
|
|
||||||
|
|
||||||
<row id="editBMPanel_folderTreeRow"
|
|
||||||
collapsed="true"
|
|
||||||
flex="1">
|
|
||||||
<spacer/>
|
|
||||||
<vbox flex="1">
|
|
||||||
<tree id="editBMPanel_folderTree"
|
|
||||||
flex="1"
|
|
||||||
class="placesTree"
|
|
||||||
type="places"
|
|
||||||
height="150"
|
|
||||||
minheight="150"
|
|
||||||
editable="true"
|
|
||||||
onselect="gEditItemOverlay.onFolderTreeSelect();"
|
|
||||||
disableUserActions="true"
|
|
||||||
hidecolumnpicker="true">
|
|
||||||
<treecols>
|
|
||||||
<treecol anonid="title" flex="1" primary="true" hideheader="true"/>
|
|
||||||
</treecols>
|
|
||||||
<treechildren flex="1"/>
|
|
||||||
</tree>
|
|
||||||
|
|
||||||
<hbox id="editBMPanel_newFolderBox">
|
|
||||||
<button label="&editBookmarkOverlay.newFolderButton.label;"
|
|
||||||
id="editBMPanel_newFolderButton"
|
|
||||||
accesskey="&editBookmarkOverlay.newFolderButton.accesskey;"
|
|
||||||
oncommand="gEditItemOverlay.newFolder().catch(Components.utils.reportError);"/>
|
|
||||||
</hbox>
|
|
||||||
</vbox>
|
|
||||||
</row>
|
|
||||||
|
|
||||||
<row id="editBMPanel_tagsRow"
|
|
||||||
align="center"
|
|
||||||
collapsed="true">
|
|
||||||
<label value="&editBookmarkOverlay.tags.label;"
|
|
||||||
class="editBMPanel_rowLabel"
|
|
||||||
accesskey="&editBookmarkOverlay.tags.accesskey;"
|
|
||||||
control="editBMPanel_tagsField"/>
|
|
||||||
<hbox flex="1" align="center">
|
|
||||||
<textbox id="editBMPanel_tagsField"
|
|
||||||
type="autocomplete"
|
|
||||||
flex="1"
|
|
||||||
autocompletesearch="places-tag-autocomplete"
|
|
||||||
autocompletepopup="PopupAutoComplete"
|
|
||||||
completedefaultindex="true"
|
|
||||||
tabscrolling="true"
|
|
||||||
placeholder="&editBookmarkOverlay.tagsEmptyDesc.label;"
|
|
||||||
onchange="gEditItemOverlay.onTagsFieldChange();"/>
|
|
||||||
<button id="editBMPanel_tagsSelectorExpander"
|
|
||||||
class="expander-down"
|
|
||||||
tooltiptext="&editBookmarkOverlay.tagsExpanderDown.tooltip;"
|
|
||||||
tooltiptextdown="&editBookmarkOverlay.tagsExpanderDown.tooltip;"
|
|
||||||
tooltiptextup="&editBookmarkOverlay.expanderUp.tooltip;"
|
|
||||||
oncommand="gEditItemOverlay.toggleTagsSelector();"/>
|
|
||||||
</hbox>
|
|
||||||
</row>
|
|
||||||
|
|
||||||
<row id="editBMPanel_tagsSelectorRow"
|
|
||||||
align="center"
|
|
||||||
collapsed="true">
|
|
||||||
<spacer/>
|
|
||||||
<listbox id="editBMPanel_tagsSelector"
|
|
||||||
height="150"/>
|
|
||||||
</row>
|
|
||||||
|
|
||||||
<row id="editBMPanel_keywordRow"
|
|
||||||
align="center"
|
|
||||||
collapsed="true">
|
|
||||||
<observes element="additionalInfoBroadcaster" attribute="hidden"/>
|
|
||||||
<label value="&editBookmarkOverlay.keyword.label;"
|
|
||||||
class="editBMPanel_rowLabel"
|
|
||||||
accesskey="&editBookmarkOverlay.keyword.accesskey;"
|
|
||||||
control="editBMPanel_keywordField"/>
|
|
||||||
<textbox id="editBMPanel_keywordField"
|
|
||||||
onchange="gEditItemOverlay.onKeywordFieldChange();"/>
|
|
||||||
</row>
|
|
||||||
|
|
||||||
<row id="editBMPanel_descriptionRow"
|
|
||||||
collapsed="true">
|
|
||||||
<observes element="additionalInfoBroadcaster" attribute="hidden"/>
|
|
||||||
<label value="&editBookmarkOverlay.description.label;"
|
|
||||||
class="editBMPanel_rowLabel"
|
|
||||||
accesskey="&editBookmarkOverlay.description.accesskey;"
|
|
||||||
control="editBMPanel_descriptionField"/>
|
|
||||||
<textbox id="editBMPanel_descriptionField"
|
|
||||||
multiline="true"
|
|
||||||
rows="4"
|
|
||||||
onchange="gEditItemOverlay.onDescriptionFieldChange();"/>
|
|
||||||
</row>
|
|
||||||
</rows>
|
|
||||||
</grid>
|
|
||||||
|
|
||||||
<checkbox id="editBMPanel_loadInSidebarCheckbox"
|
|
||||||
collapsed="true"
|
|
||||||
label="&editBookmarkOverlay.loadInSidebar.label;"
|
|
||||||
accesskey="&editBookmarkOverlay.loadInSidebar.accesskey;"
|
|
||||||
oncommand="gEditItemOverlay.onLoadInSidebarCheckboxCommand();">
|
|
||||||
<observes element="additionalInfoBroadcaster" attribute="hidden"/>
|
|
||||||
</checkbox>
|
|
||||||
|
|
||||||
<!-- If the ids are changing or additional fields are being added, be sure
|
|
||||||
to sync the values in places.js -->
|
|
||||||
<broadcaster id="additionalInfoBroadcaster"/>
|
|
||||||
</vbox>
|
|
||||||
</overlay>
|
|
172
browser/components/places/content/editBookmarkPanel.inc.xul
Normal file
172
browser/components/places/content/editBookmarkPanel.inc.xul
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
<vbox id="editBookmarkPanelContent" flex="1">
|
||||||
|
<hbox id="editBMPanel_selectionCount" pack="center">
|
||||||
|
<label id="editBMPanel_itemsCountText"/>
|
||||||
|
</hbox>
|
||||||
|
|
||||||
|
<grid id="editBookmarkPanelGrid" flex="1">
|
||||||
|
<columns id="editBMPanel_columns">
|
||||||
|
<column id="editBMPanel_labelColumn" />
|
||||||
|
<column flex="1" id="editBMPanel_editColumn" />
|
||||||
|
</columns>
|
||||||
|
<rows id="editBMPanel_rows">
|
||||||
|
<row id="editBMPanel_nameRow"
|
||||||
|
align="center"
|
||||||
|
collapsed="true">
|
||||||
|
<label value="&editBookmarkOverlay.name.label;"
|
||||||
|
class="editBMPanel_rowLabel"
|
||||||
|
accesskey="&editBookmarkOverlay.name.accesskey;"
|
||||||
|
control="editBMPanel_namePicker"/>
|
||||||
|
<textbox id="editBMPanel_namePicker"
|
||||||
|
onchange="gEditItemOverlay.onNamePickerChange().catch(Components.utils.reportError);"/>
|
||||||
|
</row>
|
||||||
|
|
||||||
|
<row id="editBMPanel_locationRow"
|
||||||
|
align="center"
|
||||||
|
collapsed="true">
|
||||||
|
<label value="&editBookmarkOverlay.location.label;"
|
||||||
|
class="editBMPanel_rowLabel"
|
||||||
|
accesskey="&editBookmarkOverlay.location.accesskey;"
|
||||||
|
control="editBMPanel_locationField"/>
|
||||||
|
<textbox id="editBMPanel_locationField"
|
||||||
|
class="uri-element"
|
||||||
|
onchange="gEditItemOverlay.onLocationFieldChange();"/>
|
||||||
|
</row>
|
||||||
|
|
||||||
|
<row id="editBMPanel_folderRow"
|
||||||
|
align="center"
|
||||||
|
collapsed="true">
|
||||||
|
<label value="&editBookmarkOverlay.folder.label;"
|
||||||
|
class="editBMPanel_rowLabel"
|
||||||
|
control="editBMPanel_folderMenuList"/>
|
||||||
|
<hbox flex="1" align="center">
|
||||||
|
<menulist id="editBMPanel_folderMenuList"
|
||||||
|
class="folder-icon"
|
||||||
|
flex="1"
|
||||||
|
oncommand="gEditItemOverlay.onFolderMenuListCommand(event).catch(Components.utils.reportError);">
|
||||||
|
<menupopup>
|
||||||
|
<!-- Static item for special folders -->
|
||||||
|
<menuitem id="editBMPanel_toolbarFolderItem"
|
||||||
|
class="menuitem-iconic folder-icon"/>
|
||||||
|
<menuitem id="editBMPanel_bmRootItem"
|
||||||
|
class="menuitem-iconic folder-icon"/>
|
||||||
|
<menuitem id="editBMPanel_unfiledRootItem"
|
||||||
|
class="menuitem-iconic folder-icon"/>
|
||||||
|
<menuseparator id="editBMPanel_chooseFolderSeparator"/>
|
||||||
|
<menuitem id="editBMPanel_chooseFolderMenuItem"
|
||||||
|
label="&editBookmarkOverlay.choose.label;"
|
||||||
|
class="menuitem-iconic folder-icon"/>
|
||||||
|
<menuseparator id="editBMPanel_foldersSeparator" hidden="true"/>
|
||||||
|
</menupopup>
|
||||||
|
</menulist>
|
||||||
|
<button id="editBMPanel_foldersExpander"
|
||||||
|
class="expander-down"
|
||||||
|
tooltiptext="&editBookmarkOverlay.foldersExpanderDown.tooltip;"
|
||||||
|
tooltiptextdown="&editBookmarkOverlay.foldersExpanderDown.tooltip;"
|
||||||
|
tooltiptextup="&editBookmarkOverlay.expanderUp.tooltip;"
|
||||||
|
oncommand="gEditItemOverlay.toggleFolderTreeVisibility();"/>
|
||||||
|
</hbox>
|
||||||
|
</row>
|
||||||
|
|
||||||
|
<row id="editBMPanel_folderTreeRow"
|
||||||
|
collapsed="true"
|
||||||
|
flex="1">
|
||||||
|
<spacer/>
|
||||||
|
<vbox flex="1">
|
||||||
|
<tree id="editBMPanel_folderTree"
|
||||||
|
flex="1"
|
||||||
|
class="placesTree"
|
||||||
|
type="places"
|
||||||
|
height="150"
|
||||||
|
minheight="150"
|
||||||
|
editable="true"
|
||||||
|
onselect="gEditItemOverlay.onFolderTreeSelect();"
|
||||||
|
disableUserActions="true"
|
||||||
|
hidecolumnpicker="true">
|
||||||
|
<treecols>
|
||||||
|
<treecol anonid="title" flex="1" primary="true" hideheader="true"/>
|
||||||
|
</treecols>
|
||||||
|
<treechildren flex="1"/>
|
||||||
|
</tree>
|
||||||
|
|
||||||
|
<hbox id="editBMPanel_newFolderBox">
|
||||||
|
<button label="&editBookmarkOverlay.newFolderButton.label;"
|
||||||
|
id="editBMPanel_newFolderButton"
|
||||||
|
accesskey="&editBookmarkOverlay.newFolderButton.accesskey;"
|
||||||
|
oncommand="gEditItemOverlay.newFolder().catch(Components.utils.reportError);"/>
|
||||||
|
</hbox>
|
||||||
|
</vbox>
|
||||||
|
</row>
|
||||||
|
|
||||||
|
<row id="editBMPanel_tagsRow"
|
||||||
|
align="center"
|
||||||
|
collapsed="true">
|
||||||
|
<label value="&editBookmarkOverlay.tags.label;"
|
||||||
|
class="editBMPanel_rowLabel"
|
||||||
|
accesskey="&editBookmarkOverlay.tags.accesskey;"
|
||||||
|
control="editBMPanel_tagsField"/>
|
||||||
|
<hbox flex="1" align="center">
|
||||||
|
<textbox id="editBMPanel_tagsField"
|
||||||
|
type="autocomplete"
|
||||||
|
flex="1"
|
||||||
|
autocompletesearch="places-tag-autocomplete"
|
||||||
|
autocompletepopup="PopupAutoComplete"
|
||||||
|
completedefaultindex="true"
|
||||||
|
tabscrolling="true"
|
||||||
|
placeholder="&editBookmarkOverlay.tagsEmptyDesc.label;"
|
||||||
|
onchange="gEditItemOverlay.onTagsFieldChange();"/>
|
||||||
|
<button id="editBMPanel_tagsSelectorExpander"
|
||||||
|
class="expander-down"
|
||||||
|
tooltiptext="&editBookmarkOverlay.tagsExpanderDown.tooltip;"
|
||||||
|
tooltiptextdown="&editBookmarkOverlay.tagsExpanderDown.tooltip;"
|
||||||
|
tooltiptextup="&editBookmarkOverlay.expanderUp.tooltip;"
|
||||||
|
oncommand="gEditItemOverlay.toggleTagsSelector();"/>
|
||||||
|
</hbox>
|
||||||
|
</row>
|
||||||
|
|
||||||
|
<row id="editBMPanel_tagsSelectorRow"
|
||||||
|
align="center"
|
||||||
|
collapsed="true">
|
||||||
|
<spacer/>
|
||||||
|
<listbox id="editBMPanel_tagsSelector"
|
||||||
|
height="150"/>
|
||||||
|
</row>
|
||||||
|
|
||||||
|
<row id="editBMPanel_keywordRow"
|
||||||
|
align="center"
|
||||||
|
collapsed="true">
|
||||||
|
<observes element="additionalInfoBroadcaster" attribute="hidden"/>
|
||||||
|
<label value="&editBookmarkOverlay.keyword.label;"
|
||||||
|
class="editBMPanel_rowLabel"
|
||||||
|
accesskey="&editBookmarkOverlay.keyword.accesskey;"
|
||||||
|
control="editBMPanel_keywordField"/>
|
||||||
|
<textbox id="editBMPanel_keywordField"
|
||||||
|
onchange="gEditItemOverlay.onKeywordFieldChange();"/>
|
||||||
|
</row>
|
||||||
|
|
||||||
|
<row id="editBMPanel_descriptionRow"
|
||||||
|
collapsed="true">
|
||||||
|
<observes element="additionalInfoBroadcaster" attribute="hidden"/>
|
||||||
|
<label value="&editBookmarkOverlay.description.label;"
|
||||||
|
class="editBMPanel_rowLabel"
|
||||||
|
accesskey="&editBookmarkOverlay.description.accesskey;"
|
||||||
|
control="editBMPanel_descriptionField"/>
|
||||||
|
<textbox id="editBMPanel_descriptionField"
|
||||||
|
multiline="true"
|
||||||
|
rows="4"
|
||||||
|
onchange="gEditItemOverlay.onDescriptionFieldChange();"/>
|
||||||
|
</row>
|
||||||
|
</rows>
|
||||||
|
</grid>
|
||||||
|
|
||||||
|
<checkbox id="editBMPanel_loadInSidebarCheckbox"
|
||||||
|
collapsed="true"
|
||||||
|
label="&editBookmarkOverlay.loadInSidebar.label;"
|
||||||
|
accesskey="&editBookmarkOverlay.loadInSidebar.accesskey;"
|
||||||
|
oncommand="gEditItemOverlay.onLoadInSidebarCheckboxCommand();">
|
||||||
|
<observes element="additionalInfoBroadcaster" attribute="hidden"/>
|
||||||
|
</checkbox>
|
||||||
|
|
||||||
|
<!-- If the ids are changing or additional fields are being added, be sure
|
||||||
|
to sync the values in places.js -->
|
||||||
|
<broadcaster id="additionalInfoBroadcaster"/>
|
||||||
|
</vbox>
|
@ -3,7 +3,7 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
/* import-globals-from editBookmarkOverlay.js */
|
/* import-globals-from editBookmark.js */
|
||||||
// Via downloadsViewOverlay.xul -> allDownloadsViewOverlay.xul
|
// Via downloadsViewOverlay.xul -> allDownloadsViewOverlay.xul
|
||||||
/* import-globals-from ../../../../toolkit/content/contentAreaUtils.js */
|
/* import-globals-from ../../../../toolkit/content/contentAreaUtils.js */
|
||||||
/* import-globals-from ../PlacesUIUtils.jsm */
|
/* import-globals-from ../PlacesUIUtils.jsm */
|
||||||
@ -28,7 +28,7 @@ const HISTORY_LIBRARY_SEARCH_TELEMETRY = "PLACES_HISTORY_LIBRARY_SEARCH_TIME_MS"
|
|||||||
var PlacesOrganizer = {
|
var PlacesOrganizer = {
|
||||||
_places: null,
|
_places: null,
|
||||||
|
|
||||||
// IDs of fields from editBookmarkOverlay that should be hidden when infoBox
|
// IDs of fields from editBookmark that should be hidden when infoBox
|
||||||
// is minimal. IDs should be kept in sync with the IDs of the elements
|
// is minimal. IDs should be kept in sync with the IDs of the elements
|
||||||
// observing additionalInfoBroadcaster.
|
// observing additionalInfoBroadcaster.
|
||||||
_additionalInfoFields: [
|
_additionalInfoFields: [
|
||||||
|
@ -10,8 +10,7 @@
|
|||||||
<?xml-stylesheet href="chrome://global/skin/"?>
|
<?xml-stylesheet href="chrome://global/skin/"?>
|
||||||
<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
|
<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
|
||||||
<?xml-stylesheet href="chrome://browser/skin/places/organizer.css"?>
|
<?xml-stylesheet href="chrome://browser/skin/places/organizer.css"?>
|
||||||
|
<?xml-stylesheet href="chrome://browser/skin/places/editBookmark.css"?>
|
||||||
<?xul-overlay href="chrome://browser/content/places/editBookmarkOverlay.xul"?>
|
|
||||||
|
|
||||||
#ifdef XP_MACOSX
|
#ifdef XP_MACOSX
|
||||||
<?xul-overlay href="chrome://browser/content/macBrowserOverlay.xul"?>
|
<?xul-overlay href="chrome://browser/content/macBrowserOverlay.xul"?>
|
||||||
@ -24,6 +23,8 @@
|
|||||||
%editMenuOverlayDTD;
|
%editMenuOverlayDTD;
|
||||||
<!ENTITY % browserDTD SYSTEM "chrome://browser/locale/browser.dtd">
|
<!ENTITY % browserDTD SYSTEM "chrome://browser/locale/browser.dtd">
|
||||||
%browserDTD;
|
%browserDTD;
|
||||||
|
<!ENTITY % editBookmarkOverlayDTD SYSTEM "chrome://browser/locale/places/editBookmarkOverlay.dtd">
|
||||||
|
%editBookmarkOverlayDTD;
|
||||||
#ifdef XP_MACOSX
|
#ifdef XP_MACOSX
|
||||||
<!ENTITY % baseMenuOverlayDTD SYSTEM "chrome://browser/locale/baseMenuOverlay.dtd">
|
<!ENTITY % baseMenuOverlayDTD SYSTEM "chrome://browser/locale/baseMenuOverlay.dtd">
|
||||||
%baseMenuOverlayDTD;
|
%baseMenuOverlayDTD;
|
||||||
@ -47,7 +48,7 @@
|
|||||||
#ifndef XP_MACOSX
|
#ifndef XP_MACOSX
|
||||||
<!-- On Mac, these are included via macBrowserOverlay.xul -> browser.js -> defineLazyScriptGetter -->
|
<!-- On Mac, these are included via macBrowserOverlay.xul -> browser.js -> defineLazyScriptGetter -->
|
||||||
<script type="application/javascript"
|
<script type="application/javascript"
|
||||||
src="chrome://browser/content/places/editBookmarkOverlay.js"/>
|
src="chrome://browser/content/places/editBookmark.js"/>
|
||||||
<script type="application/javascript"
|
<script type="application/javascript"
|
||||||
src="chrome://global/content/globalOverlay.js"/>
|
src="chrome://global/content/globalOverlay.js"/>
|
||||||
<script type="application/javascript"
|
<script type="application/javascript"
|
||||||
@ -427,7 +428,7 @@
|
|||||||
<spacer flex="3"/>
|
<spacer flex="3"/>
|
||||||
</vbox>
|
</vbox>
|
||||||
<vbox id="infoBox" minimal="true">
|
<vbox id="infoBox" minimal="true">
|
||||||
<vbox id="editBookmarkPanelContent" flex="1"/>
|
#include editBookmarkPanel.inc.xul
|
||||||
<hbox id="infoBoxExpanderWrapper" align="center">
|
<hbox id="infoBoxExpanderWrapper" align="center">
|
||||||
|
|
||||||
<button type="image" id="infoBoxExpander"
|
<button type="image" id="infoBoxExpander"
|
||||||
|
@ -6,12 +6,12 @@ browser.jar:
|
|||||||
% overlay chrome://browser/content/places/places.xul chrome://browser/content/places/downloadsViewOverlay.xul
|
% overlay chrome://browser/content/places/places.xul chrome://browser/content/places/downloadsViewOverlay.xul
|
||||||
# Provide another URI for the bookmarkProperties dialog so we can persist the
|
# Provide another URI for the bookmarkProperties dialog so we can persist the
|
||||||
# attributes separately
|
# attributes separately
|
||||||
content/browser/places/bookmarkProperties2.xul (content/bookmarkProperties.xul)
|
* content/browser/places/bookmarkProperties2.xul (content/bookmarkProperties.xul)
|
||||||
* content/browser/places/places.xul (content/places.xul)
|
* content/browser/places/places.xul (content/places.xul)
|
||||||
content/browser/places/places.js (content/places.js)
|
content/browser/places/places.js (content/places.js)
|
||||||
content/browser/places/places.css (content/places.css)
|
content/browser/places/places.css (content/places.css)
|
||||||
content/browser/places/organizer.css (content/organizer.css)
|
content/browser/places/organizer.css (content/organizer.css)
|
||||||
content/browser/places/bookmarkProperties.xul (content/bookmarkProperties.xul)
|
* content/browser/places/bookmarkProperties.xul (content/bookmarkProperties.xul)
|
||||||
content/browser/places/bookmarkProperties.js (content/bookmarkProperties.js)
|
content/browser/places/bookmarkProperties.js (content/bookmarkProperties.js)
|
||||||
content/browser/places/menu.xml (content/menu.xml)
|
content/browser/places/menu.xml (content/menu.xml)
|
||||||
content/browser/places/tree.xml (content/tree.xml)
|
content/browser/places/tree.xml (content/tree.xml)
|
||||||
@ -26,6 +26,5 @@ browser.jar:
|
|||||||
* content/browser/bookmarks/bookmarksPanel.xul (content/bookmarksPanel.xul)
|
* content/browser/bookmarks/bookmarksPanel.xul (content/bookmarksPanel.xul)
|
||||||
content/browser/bookmarks/bookmarksPanel.js (content/bookmarksPanel.js)
|
content/browser/bookmarks/bookmarksPanel.js (content/bookmarksPanel.js)
|
||||||
content/browser/bookmarks/sidebarUtils.js (content/sidebarUtils.js)
|
content/browser/bookmarks/sidebarUtils.js (content/sidebarUtils.js)
|
||||||
content/browser/places/editBookmarkOverlay.xul (content/editBookmarkOverlay.xul)
|
content/browser/places/editBookmark.js (content/editBookmark.js)
|
||||||
content/browser/places/editBookmarkOverlay.js (content/editBookmarkOverlay.js)
|
|
||||||
* content/browser/places/downloadsViewOverlay.xul (content/downloadsViewOverlay.xul)
|
* content/browser/places/downloadsViewOverlay.xul (content/downloadsViewOverlay.xul)
|
||||||
|
@ -99,6 +99,11 @@ skip-if = os == "mac" && debug # bug 1400323
|
|||||||
[browser_toolbar_overflow.js]
|
[browser_toolbar_overflow.js]
|
||||||
[browser_toolbarbutton_menu_context.js]
|
[browser_toolbarbutton_menu_context.js]
|
||||||
[browser_views_iconsupdate.js]
|
[browser_views_iconsupdate.js]
|
||||||
|
[browser_bug485100-change-case-loses-tag.js]
|
||||||
|
[browser_editBookmark_tags_liveUpdate.js]
|
||||||
|
[browser_bug427633_no_newfolder_if_noip.js]
|
||||||
|
[browser_editBookmark_keywords.js]
|
||||||
|
[browser_bug631374_tags_selector_scroll.js]
|
||||||
support-files =
|
support-files =
|
||||||
favicon-normal16.png
|
favicon-normal16.png
|
||||||
[browser_views_liveupdate.js]
|
[browser_views_liveupdate.js]
|
||||||
|
@ -0,0 +1,44 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bug 427633 - Disable creating a New Folder in the bookmarks dialogs if
|
||||||
|
* insertionPoint is invalid.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const TEST_URL = "about:buildconfig";
|
||||||
|
|
||||||
|
add_task(async function() {
|
||||||
|
let tab = await BrowserTestUtils.openNewForegroundTab({
|
||||||
|
gBrowser,
|
||||||
|
opening: TEST_URL,
|
||||||
|
waitForStateStop: true
|
||||||
|
});
|
||||||
|
|
||||||
|
registerCleanupFunction(async () => {
|
||||||
|
bookmarkPanel.removeAttribute("animate");
|
||||||
|
await BrowserTestUtils.removeTab(tab);
|
||||||
|
await PlacesUtils.bookmarks.eraseEverything();
|
||||||
|
});
|
||||||
|
|
||||||
|
let bookmarkPanel = document.getElementById("editBookmarkPanel");
|
||||||
|
bookmarkPanel.setAttribute("animate", false);
|
||||||
|
|
||||||
|
let shownPromise = promisePopupShown(bookmarkPanel);
|
||||||
|
|
||||||
|
let bookmarkStar = BookmarkingUI.star;
|
||||||
|
bookmarkStar.click();
|
||||||
|
|
||||||
|
await shownPromise;
|
||||||
|
|
||||||
|
ok(gEditItemOverlay, "gEditItemOverlay is in context");
|
||||||
|
ok(gEditItemOverlay.initialized, "gEditItemOverlay is initialized");
|
||||||
|
|
||||||
|
window.gEditItemOverlay.toggleFolderTreeVisibility();
|
||||||
|
|
||||||
|
let tree = gEditItemOverlay._element("folderTree");
|
||||||
|
|
||||||
|
tree.view.selection.clearSelection();
|
||||||
|
ok(document.getElementById("editBMPanel_newFolderButton").disabled,
|
||||||
|
"New folder button is disabled if there's no selection");
|
||||||
|
|
||||||
|
});
|
@ -0,0 +1,48 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
add_task(async function() {
|
||||||
|
let testTag = "foo";
|
||||||
|
let testTagUpper = "Foo";
|
||||||
|
let testURI = Services.io.newURI("http://www.example.com/");
|
||||||
|
|
||||||
|
// Add a bookmark.
|
||||||
|
let bm = await PlacesUtils.bookmarks.insert({
|
||||||
|
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
|
||||||
|
index: PlacesUtils.bookmarks.DEFAULT_INDEX,
|
||||||
|
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
|
||||||
|
title: "mozilla",
|
||||||
|
url: testURI
|
||||||
|
});
|
||||||
|
|
||||||
|
// Init panel
|
||||||
|
ok(gEditItemOverlay, "gEditItemOverlay is in context");
|
||||||
|
let node = await PlacesUIUtils.promiseNodeLikeFromFetchInfo(bm);
|
||||||
|
gEditItemOverlay.initPanel({ node });
|
||||||
|
|
||||||
|
// add a tag
|
||||||
|
document.getElementById("editBMPanel_tagsField").value = testTag;
|
||||||
|
let promiseNotification = PlacesTestUtils.waitForNotification(
|
||||||
|
"onItemChanged", (id, property) => property == "tags");
|
||||||
|
gEditItemOverlay.onTagsFieldChange();
|
||||||
|
await promiseNotification;
|
||||||
|
|
||||||
|
// test that the tag has been added in the backend
|
||||||
|
is(PlacesUtils.tagging.getTagsForURI(testURI)[0], testTag, "tags match");
|
||||||
|
|
||||||
|
// change the tag
|
||||||
|
document.getElementById("editBMPanel_tagsField").value = testTagUpper;
|
||||||
|
// The old sync API doesn't notify a tags change, and fixing it would be
|
||||||
|
// quite complex, so we just wait for a title change until tags are
|
||||||
|
// refactored.
|
||||||
|
promiseNotification = PlacesTestUtils.waitForNotification(
|
||||||
|
"onItemChanged", (id, property) => property == "title");
|
||||||
|
gEditItemOverlay.onTagsFieldChange();
|
||||||
|
await promiseNotification;
|
||||||
|
|
||||||
|
// test that the tag has been added in the backend
|
||||||
|
is(PlacesUtils.tagging.getTagsForURI(testURI)[0], testTagUpper, "tags match");
|
||||||
|
|
||||||
|
// Cleanup.
|
||||||
|
PlacesUtils.tagging.untagURI(testURI, [testTag]);
|
||||||
|
await PlacesUtils.bookmarks.remove(bm.guid);
|
||||||
|
});
|
@ -0,0 +1,150 @@
|
|||||||
|
/**
|
||||||
|
* This test checks that editing tags doesn't scroll the tags selector
|
||||||
|
* listbox to wrong positions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const TEST_URL = "about:buildconfig";
|
||||||
|
|
||||||
|
add_task(async function() {
|
||||||
|
await PlacesUtils.bookmarks.eraseEverything();
|
||||||
|
let tags = ["a", "b", "c", "d", "e", "f", "g",
|
||||||
|
"h", "i", "l", "m", "n", "o", "p"];
|
||||||
|
|
||||||
|
// Add a bookmark and tag it.
|
||||||
|
let uri1 = Services.io.newURI(TEST_URL);
|
||||||
|
let bm1 = await PlacesUtils.bookmarks.insert({
|
||||||
|
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
|
||||||
|
title: "mozilla",
|
||||||
|
url: uri1.spec
|
||||||
|
});
|
||||||
|
PlacesUtils.tagging.tagURI(uri1, tags);
|
||||||
|
|
||||||
|
// Add a second bookmark so that tags won't disappear when unchecked.
|
||||||
|
let uri2 = Services.io.newURI("http://www2.mozilla.org/");
|
||||||
|
let bm2 = await PlacesUtils.bookmarks.insert({
|
||||||
|
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
|
||||||
|
title: "mozilla",
|
||||||
|
url: uri2.spec
|
||||||
|
});
|
||||||
|
PlacesUtils.tagging.tagURI(uri2, tags);
|
||||||
|
|
||||||
|
let tab = await BrowserTestUtils.openNewForegroundTab({
|
||||||
|
gBrowser,
|
||||||
|
opening: TEST_URL,
|
||||||
|
waitForStateStop: true
|
||||||
|
});
|
||||||
|
|
||||||
|
registerCleanupFunction(async () => {
|
||||||
|
bookmarkPanel.removeAttribute("animate");
|
||||||
|
await BrowserTestUtils.removeTab(tab);
|
||||||
|
await PlacesUtils.bookmarks.eraseEverything();
|
||||||
|
});
|
||||||
|
|
||||||
|
let bookmarkPanel = document.getElementById("editBookmarkPanel");
|
||||||
|
bookmarkPanel.setAttribute("animate", false);
|
||||||
|
let shownPromise = promisePopupShown(bookmarkPanel);
|
||||||
|
|
||||||
|
let bookmarkStar = BookmarkingUI.star;
|
||||||
|
bookmarkStar.click();
|
||||||
|
|
||||||
|
await shownPromise;
|
||||||
|
|
||||||
|
// Init panel.
|
||||||
|
ok(gEditItemOverlay, "gEditItemOverlay is in context");
|
||||||
|
ok(gEditItemOverlay.initialized, "gEditItemOverlay is initialized");
|
||||||
|
|
||||||
|
await openTagSelector();
|
||||||
|
let tagsSelector = document.getElementById("editBMPanel_tagsSelector");
|
||||||
|
|
||||||
|
// Go by two so there is some untouched tag in the middle.
|
||||||
|
for (let i = 8; i < tags.length; i += 2) {
|
||||||
|
tagsSelector.selectedIndex = i;
|
||||||
|
let listItem = tagsSelector.selectedItem;
|
||||||
|
isnot(listItem, null, "Valid listItem found");
|
||||||
|
|
||||||
|
tagsSelector.ensureElementIsVisible(listItem);
|
||||||
|
let visibleIndex = tagsSelector.getIndexOfFirstVisibleRow();
|
||||||
|
|
||||||
|
ok(listItem.checked, "Item is checked " + i);
|
||||||
|
let selectedTag = listItem.label;
|
||||||
|
|
||||||
|
// Uncheck the tag.
|
||||||
|
let promiseNotification = PlacesTestUtils.waitForNotification(
|
||||||
|
"onItemChanged", (id, property) => property == "tags");
|
||||||
|
listItem.checked = false;
|
||||||
|
await promiseNotification;
|
||||||
|
is(visibleIndex, tagsSelector.getIndexOfFirstVisibleRow(),
|
||||||
|
"Scroll position did not change");
|
||||||
|
|
||||||
|
// The listbox is rebuilt, so we have to get the new element.
|
||||||
|
let newItem = tagsSelector.selectedItem;
|
||||||
|
isnot(newItem, null, "Valid new listItem found");
|
||||||
|
ok(!newItem.checked, "New listItem is unchecked " + i);
|
||||||
|
is(newItem.label, selectedTag, "Correct tag is still selected");
|
||||||
|
|
||||||
|
// Check the tag.
|
||||||
|
promiseNotification = PlacesTestUtils.waitForNotification(
|
||||||
|
"onItemChanged", (id, property) => property == "tags");
|
||||||
|
newItem.checked = true;
|
||||||
|
await promiseNotification;
|
||||||
|
is(visibleIndex, tagsSelector.getIndexOfFirstVisibleRow(),
|
||||||
|
"Scroll position did not change");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove the second bookmark, then nuke some of the tags.
|
||||||
|
await PlacesUtils.bookmarks.remove(bm2);
|
||||||
|
|
||||||
|
// Doing this backwords tests more interesting paths.
|
||||||
|
for (let i = tags.length - 1; i >= 0 ; i -= 2) {
|
||||||
|
tagsSelector.selectedIndex = i;
|
||||||
|
let listItem = tagsSelector.selectedItem;
|
||||||
|
isnot(listItem, null, "Valid listItem found");
|
||||||
|
|
||||||
|
tagsSelector.ensureElementIsVisible(listItem);
|
||||||
|
let firstVisibleTag = tags[tagsSelector.getIndexOfFirstVisibleRow()];
|
||||||
|
|
||||||
|
ok(listItem.checked, "Item is checked " + i);
|
||||||
|
|
||||||
|
// Uncheck the tag.
|
||||||
|
let promiseNotification = PlacesTestUtils.waitForNotification(
|
||||||
|
"onItemChanged", (id, property) => property == "tags");
|
||||||
|
listItem.checked = false;
|
||||||
|
await promiseNotification;
|
||||||
|
|
||||||
|
// Ensure the first visible tag is still visible in the list.
|
||||||
|
let firstVisibleIndex = tagsSelector.getIndexOfFirstVisibleRow();
|
||||||
|
let lastVisibleIndex = firstVisibleIndex + tagsSelector.getNumberOfVisibleRows() - 1;
|
||||||
|
let expectedTagIndex = tags.indexOf(firstVisibleTag);
|
||||||
|
ok(expectedTagIndex >= firstVisibleIndex &&
|
||||||
|
expectedTagIndex <= lastVisibleIndex,
|
||||||
|
"Scroll position is correct");
|
||||||
|
|
||||||
|
// The listbox is rebuilt, so we have to get the new element.
|
||||||
|
let newItem = tagsSelector.selectedItem;
|
||||||
|
isnot(newItem, null, "Valid new listItem found");
|
||||||
|
ok(newItem.checked, "New listItem is checked " + i);
|
||||||
|
is(tagsSelector.selectedItem.label,
|
||||||
|
tags[Math.min(i + 1, tags.length - 2)],
|
||||||
|
"The next tag is now selected");
|
||||||
|
}
|
||||||
|
|
||||||
|
let hiddenPromise = promisePopupHidden(bookmarkPanel);
|
||||||
|
let doneButton = document.getElementById("editBookmarkPanelDoneButton");
|
||||||
|
doneButton.click();
|
||||||
|
await hiddenPromise;
|
||||||
|
// Cleanup.
|
||||||
|
await PlacesUtils.bookmarks.remove(bm1);
|
||||||
|
});
|
||||||
|
|
||||||
|
function openTagSelector() {
|
||||||
|
// Wait for the tags selector to be open.
|
||||||
|
let promise = new Promise(resolve => {
|
||||||
|
let row = document.getElementById("editBMPanel_tagsSelectorRow");
|
||||||
|
row.addEventListener("DOMAttrModified", function onAttrModified() {
|
||||||
|
resolve();
|
||||||
|
}, {once: true});
|
||||||
|
});
|
||||||
|
// Open the tags selector.
|
||||||
|
document.getElementById("editBMPanel_tagsSelectorExpander").doCommand();
|
||||||
|
return promise;
|
||||||
|
}
|
@ -0,0 +1,74 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
const TEST_URL = "about:blank";
|
||||||
|
|
||||||
|
add_task(async function() {
|
||||||
|
function promiseOnItemChanged() {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
PlacesUtils.bookmarks.addObserver({
|
||||||
|
onBeginUpdateBatch() {},
|
||||||
|
onEndUpdateBatch() {},
|
||||||
|
onItemAdded() {},
|
||||||
|
onItemRemoved() {},
|
||||||
|
onItemVisited() {},
|
||||||
|
onItemMoved() {},
|
||||||
|
onItemChanged(id, property, isAnno, value) {
|
||||||
|
PlacesUtils.bookmarks.removeObserver(this);
|
||||||
|
resolve({ property, value });
|
||||||
|
},
|
||||||
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsINavBookmarkObserver])
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
let tab = await BrowserTestUtils.openNewForegroundTab({
|
||||||
|
gBrowser,
|
||||||
|
opening: TEST_URL,
|
||||||
|
waitForStateStop: true
|
||||||
|
});
|
||||||
|
|
||||||
|
let library = await promiseLibrary("UnfiledBookmarks");
|
||||||
|
registerCleanupFunction(async () => {
|
||||||
|
await promiseLibraryClosed(library);
|
||||||
|
await PlacesUtils.bookmarks.eraseEverything();
|
||||||
|
await BrowserTestUtils.removeTab(tab);
|
||||||
|
});
|
||||||
|
|
||||||
|
let keywordField = library.document.getElementById("editBMPanel_keywordField");
|
||||||
|
|
||||||
|
for (let i = 0; i < 2; ++i) {
|
||||||
|
let bm = await PlacesUtils.bookmarks.insert({
|
||||||
|
url: `http://www.test${i}.me/`,
|
||||||
|
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
|
});
|
||||||
|
|
||||||
|
let node = library.ContentTree.view.view.nodeForTreeIndex(i);
|
||||||
|
is(node.bookmarkGuid, bm.guid, "Found the expected bookmark");
|
||||||
|
// Select the bookmark.
|
||||||
|
library.ContentTree.view.selectNode(node);
|
||||||
|
synthesizeClickOnSelectedTreeCell(library.ContentTree.view);
|
||||||
|
|
||||||
|
// Expand the additional info for the first bookmark.
|
||||||
|
if (i === 0) {
|
||||||
|
library.document.getElementById("infoBoxExpander").click();
|
||||||
|
}
|
||||||
|
|
||||||
|
is(library.document.getElementById("editBMPanel_keywordField").value, "",
|
||||||
|
"The keyword field should be empty");
|
||||||
|
info("Add a keyword to the bookmark");
|
||||||
|
let promise = promiseOnItemChanged();
|
||||||
|
keywordField.focus();
|
||||||
|
keywordField.value = "kw";
|
||||||
|
EventUtils.sendString(i.toString(), library);
|
||||||
|
keywordField.blur();
|
||||||
|
let {property, value} = await promise;
|
||||||
|
is(property, "keyword", "The keyword should have been changed");
|
||||||
|
|
||||||
|
is(value, `kw${i}`, "The new keyword value is correct");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < 2; ++i) {
|
||||||
|
let entry = await PlacesUtils.keywords.fetch({ url: `http://www.test${i}.me/` });
|
||||||
|
is(entry.keyword, `kw${i}`, `The keyword for http://www.test${i}.me/ is correct`);
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,174 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
function checkTagsSelector(aAvailableTags, aCheckedTags) {
|
||||||
|
is(PlacesUtils.tagging.allTags.length, aAvailableTags.length,
|
||||||
|
"tagging service is in sync.");
|
||||||
|
let tagsSelector = document.getElementById("editBMPanel_tagsSelector");
|
||||||
|
let children = tagsSelector.childNodes;
|
||||||
|
is(children.length, aAvailableTags.length,
|
||||||
|
"Found expected number of tags in the tags selector");
|
||||||
|
|
||||||
|
Array.prototype.forEach.call(children, function(aChild) {
|
||||||
|
let tag = aChild.getAttribute("label");
|
||||||
|
ok(true, "Found tag '" + tag + "' in the selector");
|
||||||
|
ok(aAvailableTags.includes(tag), "Found expected tag");
|
||||||
|
let checked = aChild.getAttribute("checked") == "true";
|
||||||
|
is(checked, aCheckedTags.includes(tag),
|
||||||
|
"Tag is correctly marked");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
add_task(async function() {
|
||||||
|
const TEST_URI = Services.io.newURI("http://www.test.me/");
|
||||||
|
const TEST_URI2 = Services.io.newURI("http://www.test.again.me/");
|
||||||
|
const TEST_TAG = "test-tag";
|
||||||
|
|
||||||
|
ok(gEditItemOverlay, "Sanity check: gEditItemOverlay is in context");
|
||||||
|
|
||||||
|
// Open the tags selector.
|
||||||
|
document.getElementById("editBMPanel_tagsSelectorRow").collapsed = false;
|
||||||
|
|
||||||
|
// Add a bookmark.
|
||||||
|
let bm = await PlacesUtils.bookmarks.insert({
|
||||||
|
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
|
index: PlacesUtils.bookmarks.DEFAULT_INDEX,
|
||||||
|
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
|
||||||
|
url: TEST_URI.spec,
|
||||||
|
title: "test.me"
|
||||||
|
});
|
||||||
|
|
||||||
|
// Init panel.
|
||||||
|
let node = await PlacesUIUtils.promiseNodeLikeFromFetchInfo(bm);
|
||||||
|
gEditItemOverlay.initPanel({ node });
|
||||||
|
|
||||||
|
// Add a tag.
|
||||||
|
PlacesUtils.tagging.tagURI(TEST_URI, [TEST_TAG]);
|
||||||
|
|
||||||
|
is(PlacesUtils.tagging.getTagsForURI(TEST_URI)[0], TEST_TAG,
|
||||||
|
"Correctly added tag to a single bookmark");
|
||||||
|
await BrowserTestUtils.waitForCondition(
|
||||||
|
() => document.getElementById("editBMPanel_tagsField").value == TEST_TAG,
|
||||||
|
"Editing a single bookmark shows the added tag.");
|
||||||
|
checkTagsSelector([TEST_TAG], [TEST_TAG]);
|
||||||
|
|
||||||
|
// Remove tag.
|
||||||
|
PlacesUtils.tagging.untagURI(TEST_URI, [TEST_TAG]);
|
||||||
|
is(PlacesUtils.tagging.getTagsForURI(TEST_URI)[0], undefined,
|
||||||
|
"The tag has been removed");
|
||||||
|
await BrowserTestUtils.waitForCondition(
|
||||||
|
() => document.getElementById("editBMPanel_tagsField").value == "",
|
||||||
|
"Editing a single bookmark should not show any tag");
|
||||||
|
checkTagsSelector([], []);
|
||||||
|
|
||||||
|
// Add a second bookmark.
|
||||||
|
let bm2 = await PlacesUtils.bookmarks.insert({
|
||||||
|
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
|
index: PlacesUtils.bookmarks.DEFAULT_INDEX,
|
||||||
|
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
|
||||||
|
title: "test.again.me",
|
||||||
|
url: TEST_URI2.spec
|
||||||
|
});
|
||||||
|
|
||||||
|
// Init panel with multiple uris.
|
||||||
|
gEditItemOverlay.initPanel({ uris: [TEST_URI, TEST_URI2] });
|
||||||
|
|
||||||
|
// Add a tag to the first uri.
|
||||||
|
PlacesUtils.tagging.tagURI(TEST_URI, [TEST_TAG]);
|
||||||
|
is(PlacesUtils.tagging.getTagsForURI(TEST_URI)[0], TEST_TAG,
|
||||||
|
"Correctly added a tag to the first bookmark.");
|
||||||
|
await BrowserTestUtils.waitForCondition(
|
||||||
|
() => document.getElementById("editBMPanel_tagsField").value == "",
|
||||||
|
"Editing multiple bookmarks without matching tags should not show any tag.");
|
||||||
|
checkTagsSelector([TEST_TAG], []);
|
||||||
|
|
||||||
|
// Add a tag to the second uri.
|
||||||
|
PlacesUtils.tagging.tagURI(TEST_URI2, [TEST_TAG]);
|
||||||
|
is(PlacesUtils.tagging.getTagsForURI(TEST_URI2)[0], TEST_TAG,
|
||||||
|
"Correctly added a tag to the second bookmark.");
|
||||||
|
await BrowserTestUtils.waitForCondition(
|
||||||
|
() => document.getElementById("editBMPanel_tagsField").value == TEST_TAG,
|
||||||
|
"Editing multiple bookmarks should show matching tags.");
|
||||||
|
checkTagsSelector([TEST_TAG], [TEST_TAG]);
|
||||||
|
|
||||||
|
// Remove tag from the first bookmark.
|
||||||
|
PlacesUtils.tagging.untagURI(TEST_URI, [TEST_TAG]);
|
||||||
|
is(PlacesUtils.tagging.getTagsForURI(TEST_URI)[0], undefined,
|
||||||
|
"Correctly removed tag from the first bookmark.");
|
||||||
|
await BrowserTestUtils.waitForCondition(
|
||||||
|
() => document.getElementById("editBMPanel_tagsField").value == "",
|
||||||
|
"Editing multiple bookmarks without matching tags should not show any tag.");
|
||||||
|
checkTagsSelector([TEST_TAG], []);
|
||||||
|
|
||||||
|
// Remove tag from the second bookmark.
|
||||||
|
PlacesUtils.tagging.untagURI(TEST_URI2, [TEST_TAG]);
|
||||||
|
is(PlacesUtils.tagging.getTagsForURI(TEST_URI2)[0], undefined,
|
||||||
|
"Correctly removed tag from the second bookmark.");
|
||||||
|
await BrowserTestUtils.waitForCondition(
|
||||||
|
() => document.getElementById("editBMPanel_tagsField").value == "",
|
||||||
|
"Editing multiple bookmarks without matching tags should not show any tag.");
|
||||||
|
checkTagsSelector([], []);
|
||||||
|
|
||||||
|
// Init panel with a nsIURI entry.
|
||||||
|
gEditItemOverlay.initPanel({ uris: [TEST_URI] });
|
||||||
|
|
||||||
|
// Add a tag.
|
||||||
|
PlacesUtils.tagging.tagURI(TEST_URI, [TEST_TAG]);
|
||||||
|
is(PlacesUtils.tagging.getTagsForURI(TEST_URI)[0], TEST_TAG,
|
||||||
|
"Correctly added tag to the first entry.");
|
||||||
|
await BrowserTestUtils.waitForCondition(
|
||||||
|
() => document.getElementById("editBMPanel_tagsField").value == TEST_TAG,
|
||||||
|
"Editing a single nsIURI entry shows the added tag.");
|
||||||
|
checkTagsSelector([TEST_TAG], [TEST_TAG]);
|
||||||
|
|
||||||
|
// Remove tag.
|
||||||
|
PlacesUtils.tagging.untagURI(TEST_URI, [TEST_TAG]);
|
||||||
|
is(PlacesUtils.tagging.getTagsForURI(TEST_URI)[0], undefined,
|
||||||
|
"Correctly removed tag from the nsIURI entry.");
|
||||||
|
await BrowserTestUtils.waitForCondition(
|
||||||
|
() => document.getElementById("editBMPanel_tagsField").value == "",
|
||||||
|
"Editing a single nsIURI entry should not show any tag.");
|
||||||
|
checkTagsSelector([], []);
|
||||||
|
|
||||||
|
// Init panel with multiple nsIURI entries.
|
||||||
|
gEditItemOverlay.initPanel({ uris: [TEST_URI, TEST_URI2] });
|
||||||
|
|
||||||
|
// Add a tag to the first entry.
|
||||||
|
PlacesUtils.tagging.tagURI(TEST_URI, [TEST_TAG]);
|
||||||
|
is(PlacesUtils.tagging.getTagsForURI(TEST_URI)[0], TEST_TAG,
|
||||||
|
"Tag correctly added.");
|
||||||
|
await BrowserTestUtils.waitForCondition(
|
||||||
|
() => document.getElementById("editBMPanel_tagsField").value == "",
|
||||||
|
"Editing multiple nsIURIs without matching tags should not show any tag.");
|
||||||
|
checkTagsSelector([TEST_TAG], []);
|
||||||
|
|
||||||
|
// Add a tag to the second entry.
|
||||||
|
PlacesUtils.tagging.tagURI(TEST_URI2, [TEST_TAG]);
|
||||||
|
is(PlacesUtils.tagging.getTagsForURI(TEST_URI2)[0], TEST_TAG,
|
||||||
|
"Tag correctly added.");
|
||||||
|
await BrowserTestUtils.waitForCondition(
|
||||||
|
() => document.getElementById("editBMPanel_tagsField").value == TEST_TAG,
|
||||||
|
"Editing multiple nsIURIs should show matching tags.");
|
||||||
|
checkTagsSelector([TEST_TAG], [TEST_TAG]);
|
||||||
|
|
||||||
|
// Remove tag from the first entry.
|
||||||
|
PlacesUtils.tagging.untagURI(TEST_URI, [TEST_TAG]);
|
||||||
|
is(PlacesUtils.tagging.getTagsForURI(TEST_URI)[0], undefined,
|
||||||
|
"Correctly removed tag from the first entry.");
|
||||||
|
await BrowserTestUtils.waitForCondition(
|
||||||
|
() => document.getElementById("editBMPanel_tagsField").value == "",
|
||||||
|
"Editing multiple nsIURIs without matching tags should not show any tag.");
|
||||||
|
checkTagsSelector([TEST_TAG], []);
|
||||||
|
|
||||||
|
// Remove tag from the second entry.
|
||||||
|
PlacesUtils.tagging.untagURI(TEST_URI2, [TEST_TAG]);
|
||||||
|
is(PlacesUtils.tagging.getTagsForURI(TEST_URI2)[0], undefined,
|
||||||
|
"Correctly removed tag from the second entry.");
|
||||||
|
await BrowserTestUtils.waitForCondition(
|
||||||
|
() => document.getElementById("editBMPanel_tagsField").value == "",
|
||||||
|
"Editing multiple nsIURIs without matching tags should not show any tag.");
|
||||||
|
checkTagsSelector([], []);
|
||||||
|
|
||||||
|
// Cleanup.
|
||||||
|
await PlacesUtils.bookmarks.remove(bm.guid);
|
||||||
|
await PlacesUtils.bookmarks.remove(bm2.guid);
|
||||||
|
});
|
@ -3,12 +3,7 @@ support-files = head.js
|
|||||||
|
|
||||||
[test_0_bug510634.xul]
|
[test_0_bug510634.xul]
|
||||||
[test_bug1163447_selectItems_through_shortcut.xul]
|
[test_bug1163447_selectItems_through_shortcut.xul]
|
||||||
[test_bug427633_no_newfolder_if_noip.xul]
|
|
||||||
[test_bug485100-change-case-loses-tag.xul]
|
|
||||||
[test_bug549192.xul]
|
[test_bug549192.xul]
|
||||||
[test_bug549491.xul]
|
[test_bug549491.xul]
|
||||||
[test_bug631374_tags_selector_scroll.xul]
|
|
||||||
[test_editBookmarkOverlay_keywords.xul]
|
|
||||||
[test_editBookmarkOverlay_tags_liveUpdate.xul]
|
|
||||||
[test_selectItems_on_nested_tree.xul]
|
[test_selectItems_on_nested_tree.xul]
|
||||||
[test_treeview_date.xul]
|
[test_treeview_date.xul]
|
@ -1,92 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
|
|
||||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
|
||||||
|
|
||||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
|
||||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
|
||||||
type="text/css"?>
|
|
||||||
|
|
||||||
<?xml-stylesheet href="chrome://browser/skin/places/editBookmarkOverlay.css"?>
|
|
||||||
<?xml-stylesheet href="chrome://browser/content/places/places.css"?>
|
|
||||||
<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
|
|
||||||
|
|
||||||
<?xul-overlay href="chrome://browser/content/places/editBookmarkOverlay.xul"?>
|
|
||||||
|
|
||||||
<!DOCTYPE window [
|
|
||||||
<!ENTITY % editBookmarkOverlayDTD SYSTEM "chrome://browser/locale/places/editBookmarkOverlay.dtd">
|
|
||||||
%editBookmarkOverlayDTD;
|
|
||||||
]>
|
|
||||||
|
|
||||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
|
||||||
title="Bug 427633 - Disable creating a New Folder in the bookmarks dialogs if insertionPoint is invalid"
|
|
||||||
onload="runTest();">
|
|
||||||
|
|
||||||
<script type="application/javascript"
|
|
||||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
|
||||||
<script type="application/javascript"
|
|
||||||
src="chrome://browser/content/places/editBookmarkOverlay.js"/>
|
|
||||||
<script type="application/javascript" src="head.js" />
|
|
||||||
|
|
||||||
|
|
||||||
<body xmlns="http://www.w3.org/1999/xhtml" />
|
|
||||||
|
|
||||||
<vbox id="editBookmarkPanelContent"/>
|
|
||||||
|
|
||||||
<script type="application/javascript">
|
|
||||||
<![CDATA[
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Bug 427633 - Disable creating a New Folder in the bookmarks dialogs if
|
|
||||||
* insertionPoint is invalid.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function runTest() {
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
|
||||||
|
|
||||||
(async function() {
|
|
||||||
// Add a bookmark.
|
|
||||||
let bm = await PlacesUtils.bookmarks.insert({
|
|
||||||
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
|
|
||||||
url: "http://www.example.com/",
|
|
||||||
index: PlacesUtils.bookmarks.DEFAULT_INDEX,
|
|
||||||
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
|
|
||||||
title: "mozilla"
|
|
||||||
});
|
|
||||||
|
|
||||||
// Init panel.
|
|
||||||
ok(gEditItemOverlay, "gEditItemOverlay is in context");
|
|
||||||
let node = await PlacesUIUtils.promiseNodeLikeFromFetchInfo(bm);
|
|
||||||
gEditItemOverlay.initPanel({ node });
|
|
||||||
ok(gEditItemOverlay.initialized, "gEditItemOverlay is initialized");
|
|
||||||
|
|
||||||
let tree = gEditItemOverlay._element("folderTree");
|
|
||||||
await openFolderTree(tree);
|
|
||||||
|
|
||||||
tree.view.selection.clearSelection();
|
|
||||||
ok(document.getElementById("editBMPanel_newFolderButton").disabled,
|
|
||||||
"New folder button is disabled if there's no selection");
|
|
||||||
|
|
||||||
// Cleanup.
|
|
||||||
await PlacesUtils.bookmarks.remove(bm.guid);
|
|
||||||
})().then(() => SimpleTest.finish());
|
|
||||||
}
|
|
||||||
|
|
||||||
function openFolderTree(tree) {
|
|
||||||
return new Promise(resolve => {
|
|
||||||
tree.addEventListener("DOMAttrModified", function onAttrModified(event) {
|
|
||||||
if (event.attrName == "place") {
|
|
||||||
tree.removeEventListener("DOMAttrModified", onAttrModified);
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Open the folder tree.
|
|
||||||
document.getElementById("editBMPanel_foldersExpander").doCommand();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
]]>
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</window>
|
|
@ -1,90 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
|
|
||||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
|
||||||
|
|
||||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
|
||||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
|
||||||
type="text/css"?>
|
|
||||||
|
|
||||||
<?xml-stylesheet href="chrome://browser/skin/places/editBookmarkOverlay.css"?>
|
|
||||||
<?xml-stylesheet href="chrome://browser/content/places/places.css"?>
|
|
||||||
<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
|
|
||||||
|
|
||||||
<?xul-overlay href="chrome://browser/content/places/editBookmarkOverlay.xul"?>
|
|
||||||
|
|
||||||
<!DOCTYPE window [
|
|
||||||
<!ENTITY % editBookmarkOverlayDTD SYSTEM "chrome://browser/locale/places/editBookmarkOverlay.dtd">
|
|
||||||
%editBookmarkOverlayDTD;
|
|
||||||
]>
|
|
||||||
|
|
||||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
|
||||||
title="485100: Exchanging a letter of a tag name with its big/small equivalent removes tag from bookmark"
|
|
||||||
onload="runTest();">
|
|
||||||
|
|
||||||
<script type="application/javascript"
|
|
||||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
|
||||||
<script type="application/javascript"
|
|
||||||
src="chrome://browser/content/places/editBookmarkOverlay.js"/>
|
|
||||||
<script type="application/javascript" src="head.js" />
|
|
||||||
|
|
||||||
<body xmlns="http://www.w3.org/1999/xhtml" />
|
|
||||||
|
|
||||||
<vbox id="editBookmarkPanelContent"/>
|
|
||||||
|
|
||||||
<script type="application/javascript">
|
|
||||||
<![CDATA[
|
|
||||||
function runTest() {
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
|
||||||
(async function() {
|
|
||||||
let testTag = "foo";
|
|
||||||
let testTagUpper = "Foo";
|
|
||||||
let testURI = Services.io.newURI("http://www.example.com/");
|
|
||||||
|
|
||||||
// Add a bookmark.
|
|
||||||
let bm = await PlacesUtils.bookmarks.insert({
|
|
||||||
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
|
|
||||||
index: PlacesUtils.bookmarks.DEFAULT_INDEX,
|
|
||||||
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
|
|
||||||
title: "mozilla",
|
|
||||||
url: testURI
|
|
||||||
});
|
|
||||||
|
|
||||||
// Init panel
|
|
||||||
ok(gEditItemOverlay, "gEditItemOverlay is in context");
|
|
||||||
let node = await PlacesUIUtils.promiseNodeLikeFromFetchInfo(bm);
|
|
||||||
gEditItemOverlay.initPanel({ node });
|
|
||||||
|
|
||||||
// add a tag
|
|
||||||
document.getElementById("editBMPanel_tagsField").value = testTag;
|
|
||||||
let promiseNotification = PlacesTestUtils.waitForNotification(
|
|
||||||
"onItemChanged", (id, property) => property == "tags");
|
|
||||||
gEditItemOverlay.onTagsFieldChange();
|
|
||||||
await promiseNotification;
|
|
||||||
|
|
||||||
// test that the tag has been added in the backend
|
|
||||||
is(PlacesUtils.tagging.getTagsForURI(testURI)[0], testTag, "tags match");
|
|
||||||
|
|
||||||
// change the tag
|
|
||||||
document.getElementById("editBMPanel_tagsField").value = testTagUpper;
|
|
||||||
// The old sync API doesn't notify a tags change, and fixing it would be
|
|
||||||
// quite complex, so we just wait for a title change until tags are
|
|
||||||
// refactored.
|
|
||||||
promiseNotification = PlacesTestUtils.waitForNotification(
|
|
||||||
"onItemChanged", (id, property) => property == "title");
|
|
||||||
gEditItemOverlay.onTagsFieldChange();
|
|
||||||
await promiseNotification;
|
|
||||||
|
|
||||||
// test that the tag has been added in the backend
|
|
||||||
is(PlacesUtils.tagging.getTagsForURI(testURI)[0], testTagUpper, "tags match");
|
|
||||||
|
|
||||||
// Cleanup.
|
|
||||||
PlacesUtils.tagging.untagURI(testURI, [testTag]);
|
|
||||||
await PlacesUtils.bookmarks.remove(bm.guid);
|
|
||||||
})().then(() => SimpleTest.finish());
|
|
||||||
}
|
|
||||||
]]>
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</window>
|
|
@ -1,170 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
|
|
||||||
<!-- Any copyright is dedicated to the Public Domain.
|
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ -->
|
|
||||||
|
|
||||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
|
||||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
|
||||||
type="text/css"?>
|
|
||||||
|
|
||||||
<?xml-stylesheet href="chrome://browser/skin/places/editBookmarkOverlay.css"?>
|
|
||||||
<?xml-stylesheet href="chrome://browser/content/places/places.css"?>
|
|
||||||
<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
|
|
||||||
|
|
||||||
<?xul-overlay href="chrome://browser/content/places/editBookmarkOverlay.xul"?>
|
|
||||||
|
|
||||||
<!DOCTYPE window [
|
|
||||||
<!ENTITY % editBookmarkOverlayDTD SYSTEM "chrome://browser/locale/places/editBookmarkOverlay.dtd">
|
|
||||||
%editBookmarkOverlayDTD;
|
|
||||||
]>
|
|
||||||
|
|
||||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
|
||||||
title="Bug 631374 - Editing tags in the selector scrolls up the listbox"
|
|
||||||
onload="runTest();">
|
|
||||||
|
|
||||||
<script type="application/javascript"
|
|
||||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
|
||||||
<script type="application/javascript"
|
|
||||||
src="chrome://browser/content/places/editBookmarkOverlay.js"/>
|
|
||||||
<script type="application/javascript" src="head.js" />
|
|
||||||
|
|
||||||
<body xmlns="http://www.w3.org/1999/xhtml" />
|
|
||||||
|
|
||||||
<vbox id="editBookmarkPanelContent"/>
|
|
||||||
|
|
||||||
<script type="application/javascript">
|
|
||||||
<![CDATA[
|
|
||||||
/**
|
|
||||||
* This test checks that editing tags doesn't scroll the tags selector
|
|
||||||
* listbox to wrong positions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function runTest() {
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
|
||||||
(async function() {
|
|
||||||
await PlacesUtils.bookmarks.eraseEverything();
|
|
||||||
let tags = ["a", "b", "c", "d", "e", "f", "g",
|
|
||||||
"h", "i", "l", "m", "n", "o", "p"];
|
|
||||||
|
|
||||||
// Add a bookmark and tag it.
|
|
||||||
let uri1 = Services.io.newURI("http://www1.mozilla.org/");
|
|
||||||
let bm1 = await PlacesUtils.bookmarks.insert({
|
|
||||||
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
|
|
||||||
title: "mozilla",
|
|
||||||
url: uri1.spec
|
|
||||||
});
|
|
||||||
PlacesUtils.tagging.tagURI(uri1, tags);
|
|
||||||
|
|
||||||
// Add a second bookmark so that tags won't disappear when unchecked.
|
|
||||||
let uri2 = Services.io.newURI("http://www2.mozilla.org/");
|
|
||||||
let bm2 = await PlacesUtils.bookmarks.insert({
|
|
||||||
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
|
|
||||||
title: "mozilla",
|
|
||||||
url: uri2.spec
|
|
||||||
});
|
|
||||||
PlacesUtils.tagging.tagURI(uri2, tags);
|
|
||||||
|
|
||||||
// Init panel.
|
|
||||||
ok(gEditItemOverlay, "gEditItemOverlay is in context");
|
|
||||||
let node1 = await PlacesUIUtils.promiseNodeLikeFromFetchInfo(bm1);
|
|
||||||
gEditItemOverlay.initPanel({ node: node1 });
|
|
||||||
ok(gEditItemOverlay.initialized, "gEditItemOverlay is initialized");
|
|
||||||
|
|
||||||
await openTagSelector();
|
|
||||||
let tagsSelector = document.getElementById("editBMPanel_tagsSelector");
|
|
||||||
|
|
||||||
// Go by two so there is some untouched tag in the middle.
|
|
||||||
for (let i = 8; i < tags.length; i += 2) {
|
|
||||||
tagsSelector.selectedIndex = i;
|
|
||||||
let listItem = tagsSelector.selectedItem;
|
|
||||||
isnot(listItem, null, "Valid listItem found");
|
|
||||||
|
|
||||||
tagsSelector.ensureElementIsVisible(listItem);
|
|
||||||
let visibleIndex = tagsSelector.getIndexOfFirstVisibleRow();
|
|
||||||
|
|
||||||
ok(listItem.checked, "Item is checked " + i);
|
|
||||||
let selectedTag = listItem.label;
|
|
||||||
|
|
||||||
// Uncheck the tag.
|
|
||||||
let promiseNotification = PlacesTestUtils.waitForNotification(
|
|
||||||
"onItemChanged", (id, property) => property == "tags");
|
|
||||||
listItem.checked = false;
|
|
||||||
await promiseNotification;
|
|
||||||
is(visibleIndex, tagsSelector.getIndexOfFirstVisibleRow(),
|
|
||||||
"Scroll position did not change");
|
|
||||||
|
|
||||||
// The listbox is rebuilt, so we have to get the new element.
|
|
||||||
let newItem = tagsSelector.selectedItem;
|
|
||||||
isnot(newItem, null, "Valid new listItem found");
|
|
||||||
ok(!newItem.checked, "New listItem is unchecked " + i);
|
|
||||||
is(newItem.label, selectedTag, "Correct tag is still selected");
|
|
||||||
|
|
||||||
// Check the tag.
|
|
||||||
promiseNotification = PlacesTestUtils.waitForNotification(
|
|
||||||
"onItemChanged", (id, property) => property == "tags");
|
|
||||||
newItem.checked = true;
|
|
||||||
await promiseNotification;
|
|
||||||
is(visibleIndex, tagsSelector.getIndexOfFirstVisibleRow(),
|
|
||||||
"Scroll position did not change");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove the second bookmark, then nuke some of the tags.
|
|
||||||
await PlacesUtils.bookmarks.remove(bm2);
|
|
||||||
|
|
||||||
// Doing this backwords tests more interesting paths.
|
|
||||||
for (let i = tags.length - 1; i >= 0 ; i -= 2) {
|
|
||||||
tagsSelector.selectedIndex = i;
|
|
||||||
let listItem = tagsSelector.selectedItem;
|
|
||||||
isnot(listItem, null, "Valid listItem found");
|
|
||||||
|
|
||||||
tagsSelector.ensureElementIsVisible(listItem);
|
|
||||||
let firstVisibleTag = tags[tagsSelector.getIndexOfFirstVisibleRow()];
|
|
||||||
|
|
||||||
ok(listItem.checked, "Item is checked " + i);
|
|
||||||
let selectedTag = listItem.label;
|
|
||||||
|
|
||||||
// Uncheck the tag.
|
|
||||||
let promiseNotification = PlacesTestUtils.waitForNotification(
|
|
||||||
"onItemChanged", (id, property) => property == "tags");
|
|
||||||
listItem.checked = false;
|
|
||||||
await promiseNotification;
|
|
||||||
|
|
||||||
// Ensure the first visible tag is still visible in the list.
|
|
||||||
let firstVisibleIndex = tagsSelector.getIndexOfFirstVisibleRow();
|
|
||||||
let lastVisibleIndex = firstVisibleIndex + tagsSelector.getNumberOfVisibleRows() -1;
|
|
||||||
let expectedTagIndex = tags.indexOf(firstVisibleTag);
|
|
||||||
ok(expectedTagIndex >= firstVisibleIndex &&
|
|
||||||
expectedTagIndex <= lastVisibleIndex,
|
|
||||||
"Scroll position is correct");
|
|
||||||
|
|
||||||
// The listbox is rebuilt, so we have to get the new element.
|
|
||||||
let newItem = tagsSelector.selectedItem;
|
|
||||||
isnot(newItem, null, "Valid new listItem found");
|
|
||||||
ok(newItem.checked, "New listItem is checked " + i);
|
|
||||||
is(tagsSelector.selectedItem.label,
|
|
||||||
tags[Math.min(i + 1, tags.length - 2)],
|
|
||||||
"The next tag is now selected");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cleanup.
|
|
||||||
await PlacesUtils.bookmarks.remove(bm1);
|
|
||||||
})().catch(ex => ok(false, "test failed: " + ex)).then(SimpleTest.finish);
|
|
||||||
}
|
|
||||||
|
|
||||||
function openTagSelector() {
|
|
||||||
// Wait for the tags selector to be open.
|
|
||||||
let promise = new Promise(resolve => {
|
|
||||||
let row = document.getElementById("editBMPanel_tagsSelectorRow");
|
|
||||||
row.addEventListener("DOMAttrModified", function onAttrModified() {
|
|
||||||
row.removeEventListener("DOMAttrModified", onAttrModified);
|
|
||||||
resolve();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
// Open the tags selector.
|
|
||||||
document.getElementById("editBMPanel_tagsSelectorExpander").doCommand();
|
|
||||||
return promise;
|
|
||||||
}
|
|
||||||
]]>
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</window>
|
|
@ -1,100 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
|
|
||||||
<!-- Any copyright is dedicated to the Public Domain.
|
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ -->
|
|
||||||
|
|
||||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
|
||||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
|
||||||
type="text/css"?>
|
|
||||||
|
|
||||||
<?xml-stylesheet href="chrome://browser/skin/places/editBookmarkOverlay.css"?>
|
|
||||||
<?xml-stylesheet href="chrome://browser/content/places/places.css"?>
|
|
||||||
<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
|
|
||||||
|
|
||||||
<?xul-overlay href="chrome://browser/content/places/editBookmarkOverlay.xul"?>
|
|
||||||
|
|
||||||
<!DOCTYPE window [
|
|
||||||
<!ENTITY % editBookmarkOverlayDTD SYSTEM "chrome://browser/locale/places/editBookmarkOverlay.dtd">
|
|
||||||
%editBookmarkOverlayDTD;
|
|
||||||
]>
|
|
||||||
|
|
||||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
|
||||||
title="Bug 1343256 - Bookmark keywords disappear from one bookmark when adding a keyword to another bookmark"
|
|
||||||
onload="runTest();">
|
|
||||||
|
|
||||||
<script type="application/javascript"
|
|
||||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
|
||||||
<script type="application/javascript"
|
|
||||||
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
|
|
||||||
<script type="application/javascript"
|
|
||||||
src="chrome://browser/content/places/editBookmarkOverlay.js"/>
|
|
||||||
<script type="application/javascript" src="head.js" />
|
|
||||||
|
|
||||||
|
|
||||||
<body xmlns="http://www.w3.org/1999/xhtml" />
|
|
||||||
|
|
||||||
<vbox id="editBookmarkPanelContent"/>
|
|
||||||
|
|
||||||
<script type="application/javascript">
|
|
||||||
<![CDATA[
|
|
||||||
function runTest() {
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
|
||||||
(test.bind(this))()
|
|
||||||
.catch(ex => ok(false, ex))
|
|
||||||
.then(() => PlacesUtils.bookmarks.eraseEverything())
|
|
||||||
.then(SimpleTest.finish);
|
|
||||||
}
|
|
||||||
|
|
||||||
function promiseOnItemChanged() {
|
|
||||||
return new Promise(resolve => {
|
|
||||||
PlacesUtils.bookmarks.addObserver({
|
|
||||||
onBeginUpdateBatch() {},
|
|
||||||
onEndUpdateBatch() {},
|
|
||||||
onItemAdded() {},
|
|
||||||
onItemRemoved() {},
|
|
||||||
onItemVisited() {},
|
|
||||||
onItemMoved() {},
|
|
||||||
onItemChanged(id, property, isAnno, value) {
|
|
||||||
PlacesUtils.bookmarks.removeObserver(this);
|
|
||||||
resolve({ property, value });
|
|
||||||
},
|
|
||||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsINavBookmarkObserver])
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async function test() {
|
|
||||||
ok(gEditItemOverlay, "Sanity check: gEditItemOverlay is in context");
|
|
||||||
let keywordField = document.getElementById("editBMPanel_keywordField");
|
|
||||||
|
|
||||||
for (let i = 0; i < 2; ++i) {
|
|
||||||
let bm = await PlacesUtils.bookmarks.insert({
|
|
||||||
url: `http://www.test${i}.me/`,
|
|
||||||
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
|
||||||
});
|
|
||||||
info(`Init panel on bookmark #${i+1}`);
|
|
||||||
let node = await PlacesUIUtils.promiseNodeLikeFromFetchInfo(bm);
|
|
||||||
gEditItemOverlay.initPanel({ node });
|
|
||||||
is(document.getElementById("editBMPanel_keywordField").value, "",
|
|
||||||
"The keyword field should be empty");
|
|
||||||
info("Add a keyword to the bookmark");
|
|
||||||
let promise = promiseOnItemChanged();
|
|
||||||
keywordField.focus();
|
|
||||||
keywordField.value = "kw";
|
|
||||||
sendString(i.toString());
|
|
||||||
synthesizeKey("KEY_Enter");
|
|
||||||
keywordField.blur();
|
|
||||||
let {property, value} = await promise;
|
|
||||||
is(property, "keyword", "The keyword should have been changed");
|
|
||||||
is(value, `kw${i}`, "The new keyword value is correct");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < 2; ++i) {
|
|
||||||
let entry = await PlacesUtils.keywords.fetch({ url: `http://www.test${i}.me/` });
|
|
||||||
is(entry.keyword, `kw${i}`, `The keyword for http://www.test${i}.me/ is correct`);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
]]>
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</window>
|
|
@ -1,216 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
|
|
||||||
<!-- Any copyright is dedicated to the Public Domain.
|
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ -->
|
|
||||||
|
|
||||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
|
||||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
|
||||||
type="text/css"?>
|
|
||||||
|
|
||||||
<?xml-stylesheet href="chrome://browser/skin/places/editBookmarkOverlay.css"?>
|
|
||||||
<?xml-stylesheet href="chrome://browser/content/places/places.css"?>
|
|
||||||
<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
|
|
||||||
|
|
||||||
<?xul-overlay href="chrome://browser/content/places/editBookmarkOverlay.xul"?>
|
|
||||||
|
|
||||||
<!DOCTYPE window [
|
|
||||||
<!ENTITY % editBookmarkOverlayDTD SYSTEM "chrome://browser/locale/places/editBookmarkOverlay.dtd">
|
|
||||||
%editBookmarkOverlayDTD;
|
|
||||||
]>
|
|
||||||
|
|
||||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
|
||||||
title="485100: Exchanging a letter of a tag name with its big/small equivalent removes tag from bookmark"
|
|
||||||
onload="runTest();">
|
|
||||||
|
|
||||||
<script type="application/javascript"
|
|
||||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
|
||||||
<script type="application/javascript"
|
|
||||||
src="chrome://browser/content/places/editBookmarkOverlay.js"/>
|
|
||||||
<script type="application/javascript" src="head.js" />
|
|
||||||
|
|
||||||
<body xmlns="http://www.w3.org/1999/xhtml" />
|
|
||||||
|
|
||||||
<vbox id="editBookmarkPanelContent"/>
|
|
||||||
|
|
||||||
<script type="application/javascript">
|
|
||||||
<![CDATA[
|
|
||||||
function checkTagsSelector(aAvailableTags, aCheckedTags) {
|
|
||||||
is(PlacesUtils.tagging.allTags.length, aAvailableTags.length,
|
|
||||||
"tagging service is in sync.");
|
|
||||||
let tagsSelector = document.getElementById("editBMPanel_tagsSelector");
|
|
||||||
let children = tagsSelector.childNodes;
|
|
||||||
is(children.length, aAvailableTags.length,
|
|
||||||
"Found expected number of tags in the tags selector");
|
|
||||||
|
|
||||||
Array.prototype.forEach.call(children, function (aChild) {
|
|
||||||
let tag = aChild.getAttribute("label");
|
|
||||||
ok(true, "Found tag '" + tag + "' in the selector");
|
|
||||||
ok(aAvailableTags.includes(tag), "Found expected tag");
|
|
||||||
let checked = aChild.getAttribute("checked") == "true";
|
|
||||||
is(checked, aCheckedTags.includes(tag),
|
|
||||||
"Tag is correctly marked");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function runTest() {
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
|
||||||
|
|
||||||
(async function() {
|
|
||||||
const TEST_URI = Services.io.newURI("http://www.test.me/");
|
|
||||||
const TEST_URI2 = Services.io.newURI("http://www.test.again.me/");
|
|
||||||
const TEST_TAG = "test-tag";
|
|
||||||
|
|
||||||
ok(gEditItemOverlay, "Sanity check: gEditItemOverlay is in context");
|
|
||||||
|
|
||||||
// Open the tags selector.
|
|
||||||
document.getElementById("editBMPanel_tagsSelectorRow").collapsed = false;
|
|
||||||
|
|
||||||
// Add a bookmark.
|
|
||||||
let bm = await PlacesUtils.bookmarks.insert({
|
|
||||||
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
|
||||||
index: PlacesUtils.bookmarks.DEFAULT_INDEX,
|
|
||||||
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
|
|
||||||
url: TEST_URI.spec,
|
|
||||||
title: "test.me"
|
|
||||||
});
|
|
||||||
|
|
||||||
// Init panel.
|
|
||||||
let node = await PlacesUIUtils.promiseNodeLikeFromFetchInfo(bm);
|
|
||||||
gEditItemOverlay.initPanel({ node });
|
|
||||||
|
|
||||||
// Add a tag.
|
|
||||||
PlacesUtils.tagging.tagURI(TEST_URI, [TEST_TAG]);
|
|
||||||
|
|
||||||
is(PlacesUtils.tagging.getTagsForURI(TEST_URI)[0], TEST_TAG,
|
|
||||||
"Correctly added tag to a single bookmark");
|
|
||||||
await BrowserTestUtils.waitForCondition(
|
|
||||||
() => document.getElementById("editBMPanel_tagsField").value == TEST_TAG,
|
|
||||||
"Editing a single bookmark shows the added tag.");
|
|
||||||
checkTagsSelector([TEST_TAG], [TEST_TAG]);
|
|
||||||
|
|
||||||
// Remove tag.
|
|
||||||
PlacesUtils.tagging.untagURI(TEST_URI, [TEST_TAG]);
|
|
||||||
is(PlacesUtils.tagging.getTagsForURI(TEST_URI)[0], undefined,
|
|
||||||
"The tag has been removed");
|
|
||||||
await BrowserTestUtils.waitForCondition(
|
|
||||||
() => document.getElementById("editBMPanel_tagsField").value == "",
|
|
||||||
"Editing a single bookmark should not show any tag");
|
|
||||||
checkTagsSelector([], []);
|
|
||||||
|
|
||||||
// Add a second bookmark.
|
|
||||||
let bm2 = await PlacesUtils.bookmarks.insert({
|
|
||||||
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
|
||||||
index: PlacesUtils.bookmarks.DEFAULT_INDEX,
|
|
||||||
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
|
|
||||||
title: "test.again.me",
|
|
||||||
url: TEST_URI2.spec
|
|
||||||
});
|
|
||||||
|
|
||||||
// Init panel with multiple uris.
|
|
||||||
gEditItemOverlay.initPanel({ uris: [TEST_URI, TEST_URI2] });
|
|
||||||
|
|
||||||
// Add a tag to the first uri.
|
|
||||||
PlacesUtils.tagging.tagURI(TEST_URI, [TEST_TAG]);
|
|
||||||
is(PlacesUtils.tagging.getTagsForURI(TEST_URI)[0], TEST_TAG,
|
|
||||||
"Correctly added a tag to the first bookmark.");
|
|
||||||
await BrowserTestUtils.waitForCondition(
|
|
||||||
() => document.getElementById("editBMPanel_tagsField").value == "",
|
|
||||||
"Editing multiple bookmarks without matching tags should not show any tag.");
|
|
||||||
checkTagsSelector([TEST_TAG], []);
|
|
||||||
|
|
||||||
// Add a tag to the second uri.
|
|
||||||
PlacesUtils.tagging.tagURI(TEST_URI2, [TEST_TAG]);
|
|
||||||
is(PlacesUtils.tagging.getTagsForURI(TEST_URI2)[0], TEST_TAG,
|
|
||||||
"Correctly added a tag to the second bookmark.");
|
|
||||||
await BrowserTestUtils.waitForCondition(
|
|
||||||
() => document.getElementById("editBMPanel_tagsField").value == TEST_TAG,
|
|
||||||
"Editing multiple bookmarks should show matching tags.");
|
|
||||||
checkTagsSelector([TEST_TAG], [TEST_TAG]);
|
|
||||||
|
|
||||||
// Remove tag from the first bookmark.
|
|
||||||
PlacesUtils.tagging.untagURI(TEST_URI, [TEST_TAG]);
|
|
||||||
is(PlacesUtils.tagging.getTagsForURI(TEST_URI)[0], undefined,
|
|
||||||
"Correctly removed tag from the first bookmark.");
|
|
||||||
await BrowserTestUtils.waitForCondition(
|
|
||||||
() => document.getElementById("editBMPanel_tagsField").value == "",
|
|
||||||
"Editing multiple bookmarks without matching tags should not show any tag.");
|
|
||||||
checkTagsSelector([TEST_TAG], []);
|
|
||||||
|
|
||||||
// Remove tag from the second bookmark.
|
|
||||||
PlacesUtils.tagging.untagURI(TEST_URI2, [TEST_TAG]);
|
|
||||||
is(PlacesUtils.tagging.getTagsForURI(TEST_URI2)[0], undefined,
|
|
||||||
"Correctly removed tag from the second bookmark.");
|
|
||||||
await BrowserTestUtils.waitForCondition(
|
|
||||||
() => document.getElementById("editBMPanel_tagsField").value == "",
|
|
||||||
"Editing multiple bookmarks without matching tags should not show any tag.");
|
|
||||||
checkTagsSelector([], []);
|
|
||||||
|
|
||||||
// Init panel with a nsIURI entry.
|
|
||||||
gEditItemOverlay.initPanel({ uris: [TEST_URI] });
|
|
||||||
|
|
||||||
// Add a tag.
|
|
||||||
PlacesUtils.tagging.tagURI(TEST_URI, [TEST_TAG]);
|
|
||||||
is(PlacesUtils.tagging.getTagsForURI(TEST_URI)[0], TEST_TAG,
|
|
||||||
"Correctly added tag to the first entry.");
|
|
||||||
await BrowserTestUtils.waitForCondition(
|
|
||||||
() => document.getElementById("editBMPanel_tagsField").value == TEST_TAG,
|
|
||||||
"Editing a single nsIURI entry shows the added tag.");
|
|
||||||
checkTagsSelector([TEST_TAG], [TEST_TAG]);
|
|
||||||
|
|
||||||
// Remove tag.
|
|
||||||
PlacesUtils.tagging.untagURI(TEST_URI, [TEST_TAG]);
|
|
||||||
is(PlacesUtils.tagging.getTagsForURI(TEST_URI)[0], undefined,
|
|
||||||
"Correctly removed tag from the nsIURI entry.");
|
|
||||||
await BrowserTestUtils.waitForCondition(
|
|
||||||
() => document.getElementById("editBMPanel_tagsField").value == "",
|
|
||||||
"Editing a single nsIURI entry should not show any tag.");
|
|
||||||
checkTagsSelector([], []);
|
|
||||||
|
|
||||||
// Init panel with multiple nsIURI entries.
|
|
||||||
gEditItemOverlay.initPanel({ uris: [TEST_URI, TEST_URI2] });
|
|
||||||
|
|
||||||
// Add a tag to the first entry.
|
|
||||||
PlacesUtils.tagging.tagURI(TEST_URI, [TEST_TAG]);
|
|
||||||
is(PlacesUtils.tagging.getTagsForURI(TEST_URI)[0], TEST_TAG,
|
|
||||||
"Tag correctly added.");
|
|
||||||
await BrowserTestUtils.waitForCondition(
|
|
||||||
() => document.getElementById("editBMPanel_tagsField").value == "",
|
|
||||||
"Editing multiple nsIURIs without matching tags should not show any tag.");
|
|
||||||
checkTagsSelector([TEST_TAG], []);
|
|
||||||
|
|
||||||
// Add a tag to the second entry.
|
|
||||||
PlacesUtils.tagging.tagURI(TEST_URI2, [TEST_TAG]);
|
|
||||||
is(PlacesUtils.tagging.getTagsForURI(TEST_URI2)[0], TEST_TAG,
|
|
||||||
"Tag correctly added.");
|
|
||||||
await BrowserTestUtils.waitForCondition(
|
|
||||||
() => document.getElementById("editBMPanel_tagsField").value == TEST_TAG,
|
|
||||||
"Editing multiple nsIURIs should show matching tags.");
|
|
||||||
checkTagsSelector([TEST_TAG], [TEST_TAG]);
|
|
||||||
|
|
||||||
// Remove tag from the first entry.
|
|
||||||
PlacesUtils.tagging.untagURI(TEST_URI, [TEST_TAG]);
|
|
||||||
is(PlacesUtils.tagging.getTagsForURI(TEST_URI)[0], undefined,
|
|
||||||
"Correctly removed tag from the first entry.");
|
|
||||||
await BrowserTestUtils.waitForCondition(
|
|
||||||
() => document.getElementById("editBMPanel_tagsField").value == "",
|
|
||||||
"Editing multiple nsIURIs without matching tags should not show any tag.");
|
|
||||||
checkTagsSelector([TEST_TAG], []);
|
|
||||||
|
|
||||||
// Remove tag from the second entry.
|
|
||||||
PlacesUtils.tagging.untagURI(TEST_URI2, [TEST_TAG]);
|
|
||||||
is(PlacesUtils.tagging.getTagsForURI(TEST_URI2)[0], undefined,
|
|
||||||
"Correctly removed tag from the second entry.");
|
|
||||||
await BrowserTestUtils.waitForCondition(
|
|
||||||
() => document.getElementById("editBMPanel_tagsField").value == "",
|
|
||||||
"Editing multiple nsIURIs without matching tags should not show any tag.");
|
|
||||||
checkTagsSelector([], []);
|
|
||||||
|
|
||||||
// Cleanup.
|
|
||||||
await PlacesUtils.bookmarks.remove(bm.guid);
|
|
||||||
await PlacesUtils.bookmarks.remove(bm2.guid);
|
|
||||||
})().then(SimpleTest.finish);
|
|
||||||
}
|
|
||||||
]]>
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</window>
|
|
@ -34,7 +34,7 @@ browser.jar:
|
|||||||
skin/classic/browser/places/bookmarksMenu.png (places/bookmarksMenu.png)
|
skin/classic/browser/places/bookmarksMenu.png (places/bookmarksMenu.png)
|
||||||
skin/classic/browser/places/bookmarksToolbar.png (places/bookmarksToolbar.png)
|
skin/classic/browser/places/bookmarksToolbar.png (places/bookmarksToolbar.png)
|
||||||
skin/classic/browser/places/bookmarks-menu-arrow.png (places/bookmarks-menu-arrow.png)
|
skin/classic/browser/places/bookmarks-menu-arrow.png (places/bookmarks-menu-arrow.png)
|
||||||
* skin/classic/browser/places/editBookmarkOverlay.css (places/editBookmarkOverlay.css)
|
* skin/classic/browser/places/editBookmark.css (places/editBookmark.css)
|
||||||
skin/classic/browser/places/livemark-item.png (places/livemark-item.png)
|
skin/classic/browser/places/livemark-item.png (places/livemark-item.png)
|
||||||
* skin/classic/browser/places/places.css (places/places.css)
|
* skin/classic/browser/places/places.css (places/places.css)
|
||||||
skin/classic/browser/places/organizer.css (places/organizer.css)
|
skin/classic/browser/places/organizer.css (places/organizer.css)
|
||||||
|
@ -452,10 +452,10 @@ html|input.urlbar-input {
|
|||||||
margin-inline-start: 8px;
|
margin-inline-start: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The following elements come from editBookmarkOverlay.xul. Styling that's
|
/* The following elements come from editBookmarkPanel.inc.xul. Styling that's
|
||||||
specific to the editBookmarkPanel should be in browser.css. Styling that
|
specific to the editBookmarkPanel should be in browser.css. Styling that
|
||||||
should be shared by all editBookmarkOverlay.xul consumers should be in
|
should be shared by all editBookmarkPanel.inc.xul consumers should be in
|
||||||
editBookmarkOverlay.css. */
|
editBookmark.css. */
|
||||||
|
|
||||||
#editBMPanel_newFolderBox {
|
#editBMPanel_newFolderBox {
|
||||||
background: linear-gradient(#fff, #f2f2f2);
|
background: linear-gradient(#fff, #f2f2f2);
|
||||||
|
@ -43,7 +43,7 @@ browser.jar:
|
|||||||
skin/classic/browser/places/bookmarksToolbar@2x.png (places/bookmarksToolbar@2x.png)
|
skin/classic/browser/places/bookmarksToolbar@2x.png (places/bookmarksToolbar@2x.png)
|
||||||
skin/classic/browser/places/toolbar.png (places/toolbar.png)
|
skin/classic/browser/places/toolbar.png (places/toolbar.png)
|
||||||
skin/classic/browser/places/toolbarDropMarker.png (places/toolbarDropMarker.png)
|
skin/classic/browser/places/toolbarDropMarker.png (places/toolbarDropMarker.png)
|
||||||
skin/classic/browser/places/editBookmarkOverlay.css (places/editBookmarkOverlay.css)
|
skin/classic/browser/places/editBookmark.css (places/editBookmark.css)
|
||||||
skin/classic/browser/places/unfiledBookmarks.png (places/unfiledBookmarks.png)
|
skin/classic/browser/places/unfiledBookmarks.png (places/unfiledBookmarks.png)
|
||||||
skin/classic/browser/places/unfiledBookmarks@2x.png (places/unfiledBookmarks@2x.png)
|
skin/classic/browser/places/unfiledBookmarks@2x.png (places/unfiledBookmarks@2x.png)
|
||||||
skin/classic/browser/places/tag.png (places/tag.png)
|
skin/classic/browser/places/tag.png (places/tag.png)
|
||||||
|
@ -36,7 +36,7 @@ browser.jar:
|
|||||||
skin/classic/browser/places/bookmarksMenu.png (places/bookmarksMenu.png)
|
skin/classic/browser/places/bookmarksMenu.png (places/bookmarksMenu.png)
|
||||||
skin/classic/browser/places/bookmarksToolbar.png (places/bookmarksToolbar.png)
|
skin/classic/browser/places/bookmarksToolbar.png (places/bookmarksToolbar.png)
|
||||||
skin/classic/browser/places/toolbarDropMarker.png (places/toolbarDropMarker.png)
|
skin/classic/browser/places/toolbarDropMarker.png (places/toolbarDropMarker.png)
|
||||||
skin/classic/browser/places/editBookmarkOverlay.css (places/editBookmarkOverlay.css)
|
skin/classic/browser/places/editBookmark.css (places/editBookmark.css)
|
||||||
skin/classic/browser/places/libraryToolbar.png (places/libraryToolbar.png)
|
skin/classic/browser/places/libraryToolbar.png (places/libraryToolbar.png)
|
||||||
skin/classic/browser/places/tag.png (places/tag.png)
|
skin/classic/browser/places/tag.png (places/tag.png)
|
||||||
skin/classic/browser/places/allBookmarks.png (places/allBookmarks.png)
|
skin/classic/browser/places/allBookmarks.png (places/allBookmarks.png)
|
||||||
|
@ -25,7 +25,7 @@ const rootDir = helpers.rootDir;
|
|||||||
const EXTRA_SCRIPTS = [
|
const EXTRA_SCRIPTS = [
|
||||||
"browser/base/content/nsContextMenu.js",
|
"browser/base/content/nsContextMenu.js",
|
||||||
"toolkit/content/contentAreaUtils.js",
|
"toolkit/content/contentAreaUtils.js",
|
||||||
"browser/components/places/content/editBookmarkOverlay.js",
|
"browser/components/places/content/editBookmark.js",
|
||||||
"browser/components/downloads/content/downloads.js",
|
"browser/components/downloads/content/downloads.js",
|
||||||
"browser/components/downloads/content/indicator.js",
|
"browser/components/downloads/content/indicator.js",
|
||||||
// Via editMenuCommands.inc.xul
|
// Via editMenuCommands.inc.xul
|
||||||
|
Loading…
Reference in New Issue
Block a user