Bug 1247920 - Remove tabs' visibleLabel property and TabLabelModified event, backing out bug 943820. r=gijs

--HG--
extra : rebase_source : 5a1bb20f85ec61519bb17656b23c1c77af1d6844
This commit is contained in:
Dão Gottwald 2016-02-12 14:30:05 +01:00
Родитель 4fcd9ec87c
Коммит 121568462c
3 изменённых файлов: 8 добавлений и 132 удалений

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

@ -1787,6 +1787,13 @@
var uriIsAboutBlank = !aURI || aURI == "about:blank"; var uriIsAboutBlank = !aURI || aURI == "about:blank";
if (!aURI || isBlankPageURL(aURI)) {
t.setAttribute("label", this.mStringBundle.getString("tabs.emptyTabTitle"));
} else if (aURI.toLowerCase().startsWith("javascript:")) {
// This can go away when bug 672618 or bug 55696 are fixed.
t.setAttribute("label", aURI);
}
if (aUserContextId) if (aUserContextId)
t.setAttribute("usercontextid", aUserContextId); t.setAttribute("usercontextid", aUserContextId);
t.setAttribute("crop", "end"); t.setAttribute("crop", "end");
@ -1865,15 +1872,6 @@
this.mPanelContainer.appendChild(notificationbox); this.mPanelContainer.appendChild(notificationbox);
} }
// We've waited until the tab is in the DOM to set the label. This
// allows the TabLabelModified event to be properly dispatched.
if (!aURI || isBlankPageURL(aURI)) {
t.label = this.mStringBundle.getString("tabs.emptyTabTitle");
} else if (aURI.toLowerCase().startsWith("javascript:")) {
// This can go away when bug 672618 or bug 55696 are fixed.
t.label = aURI;
}
this.tabContainer.updateVisibility(); this.tabContainer.updateVisibility();
// wire up a progress listener for the new browser object. // wire up a progress listener for the new browser object.
@ -6031,8 +6029,7 @@
class="tab-icon-overlay" class="tab-icon-overlay"
role="presentation"/> role="presentation"/>
<xul:label flex="1" <xul:label flex="1"
anonid="tab-label" xbl:inherits="value=label,crop,accesskey,fadein,pinned,selected,visuallyselected,attention"
xbl:inherits="value=visibleLabel,crop,accesskey,fadein,pinned,selected,visuallyselected,attention"
class="tab-text tab-label" class="tab-text tab-label"
role="presentation"/> role="presentation"/>
<xul:image xbl:inherits="soundplaying,pinned,muted,visuallyselected" <xul:image xbl:inherits="soundplaying,pinned,muted,visuallyselected"
@ -6098,32 +6095,6 @@
</setter> </setter>
</property> </property>
<property name="label">
<getter>
return this.getAttribute("label");
</getter>
<setter>
this.setAttribute("label", val);
let event = new CustomEvent("TabLabelModified", {
bubbles: true,
cancelable: true
});
this.dispatchEvent(event);
// Let listeners prevent synchronizing the actual label to the
// visible label (allowing them to override the visible label).
if (!event.defaultPrevented)
this.visibleLabel = val;
</setter>
</property>
<property name="visibleLabel">
<getter>
return this.getAttribute("visibleLabel");
</getter>
<setter>
this.setAttribute("visibleLabel", val);
</setter>
</property>
<property name="pinned" readonly="true"> <property name="pinned" readonly="true">
<getter> <getter>
return this.getAttribute("pinned") == "true"; return this.getAttribute("pinned") == "true";

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

@ -491,7 +491,6 @@ skip-if = os == "linux" # Bug 1073339 - Investigate autocomplete test unreliabil
[browser_utilityOverlay.js] [browser_utilityOverlay.js]
[browser_viewSourceInTabOnViewSource.js] [browser_viewSourceInTabOnViewSource.js]
[browser_visibleFindSelection.js] [browser_visibleFindSelection.js]
[browser_visibleLabel.js]
[browser_visibleTabs.js] [browser_visibleTabs.js]
[browser_visibleTabs_bookmarkAllPages.js] [browser_visibleTabs_bookmarkAllPages.js]
skip-if = true # Bug 1005420 - fails intermittently. also with e10s enabled: bizarre problem with hidden tab having _mouseenter called, via _setPositionalAttributes, and tab not being found resulting in 'candidate is undefined' skip-if = true # Bug 1005420 - fails intermittently. also with e10s enabled: bizarre problem with hidden tab having _mouseenter called, via _setPositionalAttributes, and tab not being found resulting in 'candidate is undefined'

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

@ -1,94 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/* Tests:
* verify that the visibleLabel attribute works
* verify the TabLabelModified event works for both existing and new tabs
*/
function test() {
waitForExplicitFinish();
registerCleanupFunction(function() {
gBrowser.removeCurrentTab({animate: false});
});
let tab = gBrowser.selectedTab = gBrowser.addTab("about:blank",
{skipAnimation: true});
tab.linkedBrowser.addEventListener("load", function onLoad(event) {
event.currentTarget.removeEventListener("load", onLoad, true);
executeSoon(afterLoad);
}, true);
}
function afterLoad() {
let tab = gBrowser.selectedTab;
let xulLabel = document.getAnonymousElementByAttribute(tab, "anonid",
"tab-label");
// Verify we're starting out on the right foot
is(tab.label, "New Tab", "Initial tab label is default");
is(xulLabel.value, "New Tab", "Label element is default");
is(tab.visibleLabel, "New Tab", "visibleLabel is default");
// Check that a normal label setting works correctly
tab.label = "Hello, world!";
is(tab.label, "Hello, world!", "tab label attribute set via tab.label");
is(xulLabel.value, "Hello, world!", "xul:label set via tab.label");
is(tab.visibleLabel, "Hello, world!", "visibleLabel set via tab.label");
// Check that setting visibleLabel only affects the label element
tab.visibleLabel = "Goodnight, Irene";
is(tab.label, "Hello, world!", "Tab.label unaffected by visibleLabel setter");
is(xulLabel.value, "Goodnight, Irene",
"xul:label set by visibleLabel setter");
is(tab.visibleLabel, "Goodnight, Irene",
"visibleLabel attribute set by visibleLabel setter");
// Check that setting the label property hits everything
tab.label = "One more label";
is(tab.label, "One more label",
"Tab label set via label property after diverging from visibleLabel");
is(xulLabel.value, "One more label",
"xul:label set via label property after diverging from visibleLabel");
is(tab.visibleLabel, "One more label",
"visibleLabel set from label property after diverging from visibleLabel");
tab.addEventListener("TabLabelModified", overrideTabLabel, true);
tab.label = "This won't be the visibleLabel";
}
function overrideTabLabel(aEvent) {
aEvent.target.removeEventListener("TabLabelModified", overrideTabLabel, true);
aEvent.preventDefault();
aEvent.stopPropagation();
aEvent.target.visibleLabel = "Handler set this as the visible label";
executeSoon(checkTabLabelModified);
}
function checkTabLabelModified() {
let tab = gBrowser.selectedTab;
let xulLabel = document.getAnonymousElementByAttribute(tab, "anonid",
"tab-label");
is(tab.label, "This won't be the visibleLabel",
"Tab label set via label property that triggered event");
is(xulLabel.value, "Handler set this as the visible label",
"xul:label set by TabLabelModified handler");
is(tab.visibleLabel, "Handler set this as the visible label",
"visibleLabel set by TabLabelModified handler");
gBrowser.removeCurrentTab({animate: false});
executeSoon(checkTabLabelModifiedOnNewTab);
}
function checkTabLabelModifiedOnNewTab() {
gBrowser.tabContainer.addEventListener("TabLabelModified",
handleTabLabelModifiedOnNewTab, true);
let tab = gBrowser.selectedTab = gBrowser.addTab("about:blank",
{skipAnimation: true});
}
function handleTabLabelModifiedOnNewTab(aEvent) {
gBrowser.tabContainer.removeEventListener("TabLabelModified",
handleTabLabelModifiedOnNewTab, true);
ok(true, "Event received from new tab default being set");
executeSoon(finish);
}