mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-23 23:57:31 +09:00
Issue #638 - Part 6: Fix up remaining references
- Refactor _tabAttrModified to accept two parameters - Modify consumers of _tabAttrModified to pass details - Add missing _soundPlayingAttrRemovalTimer field - Add missing checks for mute/unmute around the tab browser - Tab sound icon should inherit 'selected' attribute instead of 'visuallyselected'
This commit is contained in:
parent
b0beabea4c
commit
ec5d4d77e3
1 changed files with 54 additions and 12 deletions
|
|
@ -616,7 +616,7 @@
|
||||||
|
|
||||||
if (this.mTab.hasAttribute("busy")) {
|
if (this.mTab.hasAttribute("busy")) {
|
||||||
this.mTab.removeAttribute("busy");
|
this.mTab.removeAttribute("busy");
|
||||||
this.mTabBrowser._tabAttrModified(this.mTab);
|
this.mTabBrowser._tabAttrModified(this.mTab, ["busy"]);
|
||||||
if (!this.mTab.selected)
|
if (!this.mTab.selected)
|
||||||
this.mTab.setAttribute("unread", "true");
|
this.mTab.setAttribute("unread", "true");
|
||||||
}
|
}
|
||||||
|
|
@ -696,6 +696,19 @@
|
||||||
aLocation.spec != "about:blank"))
|
aLocation.spec != "about:blank"))
|
||||||
this.mBrowser.userTypedValue = null;
|
this.mBrowser.userTypedValue = null;
|
||||||
|
|
||||||
|
// If the browser was playing audio, we should remove the playing state.
|
||||||
|
if (this.mTab.hasAttribute("soundplaying") && !isSameDocument) {
|
||||||
|
clearTimeout(this.mTab._soundPlayingAttrRemovalTimer);
|
||||||
|
this.mTab._soundPlayingAttrRemovalTimer = 0;
|
||||||
|
this.mTab.removeAttribute("soundplaying");
|
||||||
|
this.mTabBrowser._tabAttrModified(this.mTab, ["soundplaying"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the browser was previously muted, we should restore the muted state.
|
||||||
|
if (this.mTab.hasAttribute("muted")) {
|
||||||
|
this.mTab.linkedBrowser.mute();
|
||||||
|
}
|
||||||
|
|
||||||
// Don't clear the favicon if this onLocationChange was
|
// Don't clear the favicon if this onLocationChange was
|
||||||
// triggered by a pushState or a replaceState. See bug 550565.
|
// triggered by a pushState or a replaceState. See bug 550565.
|
||||||
if (!gMultiProcessBrowser) {
|
if (!gMultiProcessBrowser) {
|
||||||
|
|
@ -804,7 +817,7 @@
|
||||||
aTab.setAttribute("image", sizedIconUrl);
|
aTab.setAttribute("image", sizedIconUrl);
|
||||||
else
|
else
|
||||||
aTab.removeAttribute("image");
|
aTab.removeAttribute("image");
|
||||||
this._tabAttrModified(aTab);
|
this._tabAttrModified(aTab, ["image"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._callProgressListeners(browser, "onLinkIconAvailable", [browser.mIconURL]);
|
this._callProgressListeners(browser, "onLinkIconAvailable", [browser.mIconURL]);
|
||||||
|
|
@ -1116,8 +1129,8 @@
|
||||||
});
|
});
|
||||||
this.mCurrentTab.dispatchEvent(event);
|
this.mCurrentTab.dispatchEvent(event);
|
||||||
|
|
||||||
this._tabAttrModified(oldTab);
|
this._tabAttrModified(oldTab, ["selected"]);
|
||||||
this._tabAttrModified(this.mCurrentTab);
|
this._tabAttrModified(this.mCurrentTab, ["selected"]);
|
||||||
|
|
||||||
// Adjust focus
|
// Adjust focus
|
||||||
oldBrowser._urlbarFocused = (gURLBar && gURLBar.focused);
|
oldBrowser._urlbarFocused = (gURLBar && gURLBar.focused);
|
||||||
|
|
@ -1187,14 +1200,18 @@
|
||||||
|
|
||||||
<method name="_tabAttrModified">
|
<method name="_tabAttrModified">
|
||||||
<parameter name="aTab"/>
|
<parameter name="aTab"/>
|
||||||
|
<parameter name="aChanged"/>
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
if (aTab.closing)
|
if (aTab.closing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// This event should be dispatched when any of these attributes change:
|
let event = new CustomEvent("TabAttrModified", {
|
||||||
// label, crop, busy, image, selected
|
bubbles: true,
|
||||||
var event = document.createEvent("Events");
|
cancelable: false,
|
||||||
event.initEvent("TabAttrModified", true, false);
|
detail: {
|
||||||
|
changed: aChanged,
|
||||||
|
}
|
||||||
|
});
|
||||||
aTab.dispatchEvent(event);
|
aTab.dispatchEvent(event);
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
@ -1205,7 +1222,7 @@
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
aTab.label = this.mStringBundle.getString("tabs.connecting");
|
aTab.label = this.mStringBundle.getString("tabs.connecting");
|
||||||
aTab.crop = "end";
|
aTab.crop = "end";
|
||||||
this._tabAttrModified(aTab);
|
this._tabAttrModified(aTab, ["label", "crop"]);
|
||||||
]]>
|
]]>
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
|
@ -1250,7 +1267,7 @@
|
||||||
|
|
||||||
aTab.label = title;
|
aTab.label = title;
|
||||||
aTab.crop = crop;
|
aTab.crop = crop;
|
||||||
this._tabAttrModified(aTab);
|
this._tabAttrModified(aTab, ["label", "crop"]);
|
||||||
|
|
||||||
if (aTab.selected)
|
if (aTab.selected)
|
||||||
this.updateTitlebar();
|
this.updateTitlebar();
|
||||||
|
|
@ -2239,6 +2256,14 @@
|
||||||
var remoteBrowser = aOtherTab.ownerDocument.defaultView.gBrowser;
|
var remoteBrowser = aOtherTab.ownerDocument.defaultView.gBrowser;
|
||||||
var isPending = aOtherTab.hasAttribute("pending");
|
var isPending = aOtherTab.hasAttribute("pending");
|
||||||
|
|
||||||
|
// Expedite the removal of the icon if it was already scheduled.
|
||||||
|
if (aOtherTab._soundPlayingAttrRemovalTimer) {
|
||||||
|
clearTimeout(aOtherTab._soundPlayingAttrRemovalTimer);
|
||||||
|
aOtherTab._soundPlayingAttrRemovalTimer = 0;
|
||||||
|
aOtherTab.removeAttribute("soundplaying");
|
||||||
|
remoteBrowser._tabAttrModified(aOtherTab, ["soundplaying"]);
|
||||||
|
}
|
||||||
|
|
||||||
// First, start teardown of the other browser. Make sure to not
|
// First, start teardown of the other browser. Make sure to not
|
||||||
// fire the beforeunload event in the process. Close the other
|
// fire the beforeunload event in the process. Close the other
|
||||||
// window if this was its last tab.
|
// window if this was its last tab.
|
||||||
|
|
@ -2248,6 +2273,18 @@
|
||||||
let ourBrowser = this.getBrowserForTab(aOurTab);
|
let ourBrowser = this.getBrowserForTab(aOurTab);
|
||||||
let otherBrowser = aOtherTab.linkedBrowser;
|
let otherBrowser = aOtherTab.linkedBrowser;
|
||||||
|
|
||||||
|
let modifiedAttrs = [];
|
||||||
|
if (aOtherTab.hasAttribute("muted")) {
|
||||||
|
aOurTab.setAttribute("muted", "true");
|
||||||
|
aOurTab.muteReason = aOtherTab.muteReason;
|
||||||
|
ourBrowser.mute();
|
||||||
|
modifiedAttrs.push("muted");
|
||||||
|
}
|
||||||
|
if (aOtherTab.hasAttribute("soundplaying")) {
|
||||||
|
aOurTab.setAttribute("soundplaying", "true");
|
||||||
|
modifiedAttrs.push("soundplaying");
|
||||||
|
}
|
||||||
|
|
||||||
// If the other tab is pending (i.e. has not been restored, yet)
|
// If the other tab is pending (i.e. has not been restored, yet)
|
||||||
// then do not switch docShells but retrieve the other tab's state
|
// then do not switch docShells but retrieve the other tab's state
|
||||||
// and apply it to our tab.
|
// and apply it to our tab.
|
||||||
|
|
@ -2266,7 +2303,7 @@
|
||||||
var isBusy = aOtherTab.hasAttribute("busy");
|
var isBusy = aOtherTab.hasAttribute("busy");
|
||||||
if (isBusy) {
|
if (isBusy) {
|
||||||
aOurTab.setAttribute("busy", "true");
|
aOurTab.setAttribute("busy", "true");
|
||||||
this._tabAttrModified(aOurTab);
|
modifiedAttrs.push("busy");
|
||||||
if (aOurTab.selected)
|
if (aOurTab.selected)
|
||||||
this.mIsBusy = true;
|
this.mIsBusy = true;
|
||||||
}
|
}
|
||||||
|
|
@ -2286,6 +2323,10 @@
|
||||||
// of replaceTabWithWindow), notify onLocationChange, etc.
|
// of replaceTabWithWindow), notify onLocationChange, etc.
|
||||||
if (aOurTab.selected)
|
if (aOurTab.selected)
|
||||||
this.updateCurrentBrowser(true);
|
this.updateCurrentBrowser(true);
|
||||||
|
|
||||||
|
if (modifiedAttrs.length) {
|
||||||
|
this._tabAttrModified(aOurTab, modifiedAttrs);
|
||||||
|
}
|
||||||
]]>
|
]]>
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
|
@ -3316,6 +3357,7 @@
|
||||||
]]>
|
]]>
|
||||||
</getter>
|
</getter>
|
||||||
</property>
|
</property>
|
||||||
|
<field name="_soundPlayingAttrRemovalTimer">0</field>
|
||||||
</implementation>
|
</implementation>
|
||||||
|
|
||||||
<handlers>
|
<handlers>
|
||||||
|
|
@ -4850,7 +4892,7 @@
|
||||||
xbl:inherits="value=label,crop,accesskey,fadein,pinned,selected"
|
xbl:inherits="value=label,crop,accesskey,fadein,pinned,selected"
|
||||||
class="tab-text tab-label"
|
class="tab-text tab-label"
|
||||||
role="presentation"/>
|
role="presentation"/>
|
||||||
<xul:image xbl:inherits="soundplaying,soundplaying-scheduledremoval,pinned,muted,blocked,selected=visuallyselected"
|
<xul:image xbl:inherits="soundplaying,soundplaying-scheduledremoval,pinned,muted,blocked,selected"
|
||||||
anonid="soundplaying-icon"
|
anonid="soundplaying-icon"
|
||||||
class="tab-icon-sound"
|
class="tab-icon-sound"
|
||||||
role="presentation"/>
|
role="presentation"/>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue