#388: M1354564
This commit is contained in:
parent
b9509fba4d
commit
d375d57d33
|
@ -1008,6 +1008,8 @@
|
||||||
var newBrowser = this.getBrowserAtIndex(this.tabContainer.selectedIndex);
|
var newBrowser = this.getBrowserAtIndex(this.tabContainer.selectedIndex);
|
||||||
if (this.mCurrentBrowser == newBrowser && !aForceUpdate)
|
if (this.mCurrentBrowser == newBrowser && !aForceUpdate)
|
||||||
return;
|
return;
|
||||||
|
if (!aForceUpdate)
|
||||||
|
document.commandDispatcher.lock();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (!aForceUpdate) {
|
if (!aForceUpdate) {
|
||||||
|
@ -1204,6 +1206,8 @@
|
||||||
this.tabContainer._setPositionalAttributes();
|
this.tabContainer._setPositionalAttributes();
|
||||||
|
|
||||||
//if (!gMultiProcessBrowser) {
|
//if (!gMultiProcessBrowser) {
|
||||||
|
document.commandDispatcher.unlock();
|
||||||
|
|
||||||
let event = new CustomEvent("TabSwitchDone", {
|
let event = new CustomEvent("TabSwitchDone", {
|
||||||
bubbles: true,
|
bubbles: true,
|
||||||
cancelable: true
|
cancelable: true
|
||||||
|
@ -3203,6 +3207,8 @@ let remote = false;
|
||||||
fromBrowser.setAttribute("type", "content-targetable");
|
fromBrowser.setAttribute("type", "content-targetable");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.commandDispatcher.unlock();
|
||||||
|
|
||||||
let event = new CustomEvent("TabSwitchDone", {
|
let event = new CustomEvent("TabSwitchDone", {
|
||||||
bubbles: true,
|
bubbles: true,
|
||||||
cancelable: true
|
cancelable: true
|
||||||
|
|
|
@ -31,4 +31,9 @@ interface nsIDOMXULCommandDispatcher : nsISupports
|
||||||
void rewindFocus();
|
void rewindFocus();
|
||||||
void advanceFocusIntoSubtree(in nsIDOMElement elt);
|
void advanceFocusIntoSubtree(in nsIDOMElement elt);
|
||||||
attribute boolean suppressFocusScroll;
|
attribute boolean suppressFocusScroll;
|
||||||
|
|
||||||
|
// When locked, command updating is batched until unlocked. Always ensure that
|
||||||
|
// lock and unlock is called in a pair.
|
||||||
|
void lock();
|
||||||
|
void unlock();
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,7 +42,7 @@ static LazyLogModule gCommandLog("nsXULCommandDispatcher");
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
nsXULCommandDispatcher::nsXULCommandDispatcher(nsIDocument* aDocument)
|
nsXULCommandDispatcher::nsXULCommandDispatcher(nsIDocument* aDocument)
|
||||||
: mDocument(aDocument), mUpdaters(nullptr)
|
: mDocument(aDocument), mUpdaters(nullptr), mLocked(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,6 +351,14 @@ nsXULCommandDispatcher::RemoveCommandUpdater(nsIDOMElement* aElement)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsXULCommandDispatcher::UpdateCommands(const nsAString& aEventName)
|
nsXULCommandDispatcher::UpdateCommands(const nsAString& aEventName)
|
||||||
{
|
{
|
||||||
|
if (mLocked) {
|
||||||
|
if (!mPendingUpdates.Contains(aEventName)) {
|
||||||
|
mPendingUpdates.AppendElement(aEventName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
nsAutoString id;
|
nsAutoString id;
|
||||||
nsCOMPtr<nsIDOMElement> element;
|
nsCOMPtr<nsIDOMElement> element;
|
||||||
GetFocusedElement(getter_AddRefs(element));
|
GetFocusedElement(getter_AddRefs(element));
|
||||||
|
@ -458,3 +466,30 @@ nsXULCommandDispatcher::SetSuppressFocusScroll(bool aSuppressFocusScroll)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsXULCommandDispatcher::Lock()
|
||||||
|
{
|
||||||
|
// Since locking is used only as a performance optimization, we don't worry
|
||||||
|
// about nested lock calls. If that does happen, it just means we will unlock
|
||||||
|
// and process updates earlier.
|
||||||
|
mLocked = true;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsXULCommandDispatcher::Unlock()
|
||||||
|
{
|
||||||
|
if (mLocked) {
|
||||||
|
mLocked = false;
|
||||||
|
|
||||||
|
// Handle any pending updates one at a time. In the unlikely case where a
|
||||||
|
// lock is added during the update, break out.
|
||||||
|
while (!mLocked && mPendingUpdates.Length() > 0) {
|
||||||
|
nsString name = mPendingUpdates.ElementAt(0);
|
||||||
|
mPendingUpdates.RemoveElementAt(0);
|
||||||
|
UpdateCommands(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
|
@ -68,6 +68,9 @@ protected:
|
||||||
|
|
||||||
bool Matches(const nsString& aList,
|
bool Matches(const nsString& aList,
|
||||||
const nsAString& aElement);
|
const nsAString& aElement);
|
||||||
|
|
||||||
|
bool mLocked;
|
||||||
|
nsTArray<nsString> mPendingUpdates;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // nsXULCommandDispatcher_h__
|
#endif // nsXULCommandDispatcher_h__
|
||||||
|
|
Loading…
Reference in New Issue