Unresponsive script at chrome://browser/content/tabbrowser.xml in _endRemoveTab, unable or slow to close tabs




5 years ago
3 months ago


(Reporter: mconley, Unassigned)


({perf, regression})

33 Branch
Dependency tree / graph
Bug Flags:
firefox-backlog +

Firefox Tracking Flags

(firefox35 affected)


(Whiteboard: tabbrowser.xml line numbers vary (around 2000) - see comment 4)

+++ This bug was initially created as a clone of Bug #1041788 +++

Using 35.0a1 (2014-10-04)

Steps to reproduce:

1. Have many website tabs open.
2. click closing [x] on specific tab.

Actual results:

A slow script warning, which (once stopped) results in being unable to close individual tabs

Expected results:

tab should have closed on clicking the close button

Slow Script - chrome://browser/content/tabbrowser.xml:2029

2025  <method name="_endRemoveTab">
        <parameter name="aTab"/>
2029         if (!aTab || !aTab._endRemoveArgs)

            var [aCloseWindow, aNewTab] = aTab._endRemoveArgs;
            aTab._endRemoveArgs = null;

            if (this._windowIsClosing) {
              aCloseWindow = false;
              aNewTab = false;

            this._lastRelatedTab = null;

            // update the UI early for responsiveness
            aTab.collapsed = true;
2045        this._blurTab(aTab);

This is causing tabs to get stuck in between while moving, and slightly non responsive when closing the tab. After hitting debug script, tabs dont move at all.
I split this off from bug 1041788 since we'd already fixed this once, and I didn't want to re-open the whole thing.

Comment 2

4 years ago
Since there are tons of (still-not-marked-as-such) duplicates of this (or related) issues, I'll chime in here.

Recently (well, in november 2014, FF 33.1.1 on Win8.1 Pro x64) I noticed delays when closing tabs:

I click the X and nothing happens. Right click and "Close tab" also does not work.
I can use the rest of FF fine. There is no high CPU usage or anything strange.
After about 30 second the tab closes.
Sometimes I also can not switch tabs in that FF window, while other FF windows work fine.

Today I got an Unresponsive script warning, for : chrome://browser/content/tabbrowser.xml:2176

The content of that is:

            if (aCloseWindow) {
              this._windowIsClosing = true;
              while (this._removingTabs.length)
                this._endRemoveTab(this._removingTabs[0]); *** this is line 2176 ***
            } else if (!this._windowIsClosing) {

So it is the same thing thas was reported (and fixed) in the many other reports.

I have several FF windows open and closed one tab in a window with two tabs. The closed tab is the second one, in focus. Not sure what page it was displaying, because the tab title says "New Tab" and the URL bar "Search or enter address" (empty, in other words). This is the first thing I did in FF today since leaving the computer last night.

FF 37.0.1 on Win7/64

Note: The first issue I mentioned is probably unrelated, as it involves no CPU hogging or warning dialog.

Related reports (should be duped - the "orphans"):
bug 585813
bug 525545
bug 1143515
bug 1151403
bug 1041788


4 years ago
Duplicate of this bug: 1158529
(For later readers) See bug 1041788 comment 7 for instructions on finding the source code associated with the line number in the "Unresponsive script" error message.
Summary: Unable to close tab after slow script warning at chrome://browser/content/tabbrowser.xml:2029 → Unresponsive script at chrome://browser/content/tabbrowser.xml in _endRemoveTab, unable or slow to close tabs
Whiteboard: tabbrowser.xml line numbers vary (around 2000) - see comment 7


4 years ago
Whiteboard: tabbrowser.xml line numbers vary (around 2000) - see comment 7 → tabbrowser.xml line numbers vary (around 2000) - see comment 4


4 years ago
Duplicate of this bug: 1151403


4 years ago
Duplicate of this bug: 1143515

Comment 7

4 years ago
There was a thread about this issue on Reddit recently. At least one user has reported that setting the preference browser.tabs.closeWindowWithLastTab to false has made the freezes stop happening. This was suggested based on bug 104788 comment 13.

Flags: firefox-backlog?
Flags: firefox-backlog? → firefox-backlog+


3 years ago
Keywords: perf
I get this consistently. It seems to be in my profile, because deleting my profile dir and resyncing makes it happen again. I get this in line 2873, here:

// Remove the tab ...

It freezes here because there's no other tab to remove. What happens is this:

* I have a few tabs open.
* I close all the tabs but one (I press ctrl-w, but I don't think it matters).
* I close the last one. The browser window does not close, it stays open but the last tab disappears from the tab bar. The page keeps showing whatever was there previously.
* The browser frezes at that point.

There seems to be a "phantom tab" somewhere in my list of tabs, and it's choking Firefox. This gives me an idea, I will set Firefox to not remember my tabs when exiting, restart it and see if this goes away before setting it to remember the tabs again.
Alright, I found what's wrong with my case. When starting up the browser, KeeFox (an addon I have installed) opens a setup window. That window seems to be somehow created wrongly, because not only removing KeeFox fixes the bug, but also:

* Open the browser with the "open with a blank page" setting. The browser opens with a blank tab.
* A KeeFox tab opens. The browser now has two tabs.
* I press ctrl+W to close the KeeFox tab. The browser does not switch to the blank tab, the KeeFox tab disappears but the KeeFox page stays where it is. That seems to be when the phantom tab is created.
* After that, the browser is buggy.
Would other people in this thread happen to be using KeeFox, by any chance, or any other extension that launches a new tab at some point before this bug happens?

Comment 11

3 years ago
No, I don't think I was. I think my tabs were just ordinary ones.

Comment 12

3 years ago
some here, I didn't have KeeFox installed when I encountered the issue

Comment 13

3 years ago
Bug is still prevalent in version 46.
 closing tabs takes forever and makes Firefox unresponsive.
Is anybody here able to hit this reliably, or is it intermittent? info?
Flags: needinfo?(info)

Comment 15

3 years ago
:mconley I've never seen it again.
Clearing the needinfo and closing the bug as works-for-me per comment #15 and lack of response from the reporter. Please reopen if you can still reproduce this bug with up-to-date steps to reproduce.
Last Resolved: 3 years ago
Flags: needinfo?(info)
Resolution: --- → WORKSFORME

Comment 17

2 years ago
I get this bug pretty reliably when trying to watch twitch.tv video; though the time it takes to appear is pretty variable it may be linked to Adobe flash, i've tried the site with html 5 briefly since it came out and it doesnt seem to produce the same problem.

Comment 18

2 years ago
Ok confirmed, the html 5 beta on twitch doesnt stop the bug so its probably nothing to do with that. To clarify, i usually se firefox but recently ive been using chrome for twitch.tv and have never had a similar problem so im pretty sure its specific to firefox, my partner has never had the problem using chrome either.

Comment 19

2 years ago
Confirming the issue with twitch on a 64 bit Firefox 51.0.1 on Ubuntu.
Still an issue 32 bit firefox 52 windows 10
I can hit this reliably 100% of the time right now on OS X Sierra with build 55 with Tab Center from Test Pilot enabled.

I tried on a fresh profile and could reproduce the problem once I enabled Tab Center. I could not reproduce it without Tab Center.

The last time I hit the problem, I had to force-quit Nightly to get moving again. Here are my steps to reproduce:

I have about 10 windows open.

1) I create a new window with Cmd-n.
2) Add 5 tabs with Cmd-t repeatedly.
3) Close the window by clicking the native close window X circle.
4) Hit Cmd-shift-n to re-open the last closed window.
5) Close tabs one-by-one with Cmd-w.
6) When there are only two tabs remaining, closing the second-to-last causes a new tab to instantly get created and on the next Cmd-w I hit the hang.

Once the hang occurs, the parent process is using ~100% CPU. Some rough CPU-based sampling shows that DOMTokenListBinding is in most stacks collected. The top stack over a 5-second period is below.

  XUL`nsDOMMutationRecord::nsDOMMutationRecord(nsIAtom*, nsISupports*)+0xeb
  XUL`nsMutationReceiver::AttributeWillChange(nsIDocument*, mozilla::dom::Element*, int, nsIAtom*, int, nsAttrValue const*)+0x6c
  XUL`nsMutationReceiver::AttributeSetToCurrentValue(nsIDocument*, mozilla::dom::Element*, int, nsIAtom*)+0x1c
  XUL`nsNodeUtils::AttributeSetToCurrentValue(mozilla::dom::Element*, int, nsIAtom*)+0xab
  XUL`mozilla::dom::Element::SetAttr(int, nsIAtom*, nsIAtom*, nsAString const&, bool)+0xe1
  XUL`nsDOMTokenList::AddInternal(nsAttrValue const*, nsTArray<nsString> const&)+0x4ad
  XUL`nsDOMTokenList::Add(nsTArray<nsString> const&, mozilla::ErrorResult&)+0xd8
  XUL`mozilla::dom::DOMTokenListBinding::add(JSContext*, JS::Handle<JSObject*>, nsDOMTokenList*, JSJitMethodCallArgs const&)+0x174
  XUL`mozilla::dom::GenericBindingMethod(JSContext*, unsigned int, JS::Value*)+0x171
  XUL`js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct)+0x336
  XUL`js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>)+0x29
  XUL`js::Wrapper::call(JSContext*, JS::Handle<JSObject*>, JS::CallArgs const&) const+0x247
  XUL`js::CrossCompartmentWrapper::call(JSContext*, JS::Handle<JSObject*>, JS::CallArgs const&) const+0x10c
  XUL`js::Proxy::call(JSContext*, JS::Handle<JSObject*>, JS::CallArgs const&)+0xc8
  XUL`js::proxy_Call(JSContext*, unsigned int, JS::Value*)+0x67
  XUL`js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct)+0x610
  XUL`js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>)+0x29
  XUL`js::jit::InvokeFunction(JSContext*, JS::Handle<JSObject*>, bool, bool, unsigned int, JS::Value*, JS::MutableHandle<JS::Value>)+0x446

Collected with

  $ sudo dtrace -n 'profile-97/execname == "firefox"/{@a[ustack()]=count()}'

which interrupts every CPU 97 times a second and if "firefox" is running, collects a userland stack. On Ctrl-C, dumps the stacks and their counts.
Flags: needinfo?(mconley)
Sounds like an infinite loop that's maybe causing a mutation that triggers an observer which triggers a mutation, etc.

Erica, is there a mutation observer in Tab Center that might be causing this?
Flags: needinfo?(mconley) → needinfo?(ewright)
:mconley, :haik,  this is a known tab center bug in nightly, it has been fixed, and will be out with the new version.
Flags: needinfo?(ewright)

Comment 24

3 months ago

I just ditched Chrome browser last week due to its constantly freezing over multiple tabs. Just the first Monday, FF prompted me the same shock, it frozen for quite a long time before showing this dialog, "Unresponsive script at chrome://browser/content/tabbrowser.xml in _endRemoveTab, unable or slow to close tabs". Are you kidding me?

Luckily, for Chrome, it's a total frozen to death of the whole computer. FF provides me a chance to shut the script after a period of time. So still cheering if I'm not Stockholm Syndrome with these nonfunctional browsers.

You need to log in before you can comment on or make changes to this bug.