Closed Bug 404480 Opened 12 years ago Closed 12 years ago

Unable to Close Tabs when "Open Tabs Relative" code is active in userChrome.js


(Core :: JavaScript Engine, defect)

Not set





(Reporter: ronin.achilles, Unassigned)



(Keywords: regression)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9b2pre) Gecko/2007111923 Minefield/3.0b2pre
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9b2pre) Gecko/2007111923 Minefield/3.0b2pre

I use userChrome.js extension and have included the following code for "Tabs Open Relative" functionality (so basically open New Tabs or Links next to active tab):

/*::::::::::::::::::::::: Open Tabs Relative ::::::::::::::::::::::::*/

(function() {
getBrowser().__uc_addedTabs = 0;

eval("gBrowser.addTab = " + gBrowser.addTab.toString().replace(/\{/, "$& var __oldTabPos = this.mCurrentTab._tPos;").replace(/return /, "if (!blank) this.moveTabTo(t, __oldTabPos + 1 + this.__uc_addedTabs++); $&"));

eval("gBrowser.moveTabTo = " + gBrowser.moveTabTo.toString().replace(/{/, "$& if (aTab == this.mCurrentTab) this.__uc_addedTabs = 0;"));

eval("nsBrowserAccess.prototype.openURI = " + nsBrowserAccess.prototype.openURI.toString().replace(/(loadOneTab\()"about:blank"/, '$1"data:text/html,"'));

gBrowser.mTabContainer.addEventListener("select", function() { gBrowser.__uc_addedTabs = 0; }, false);

This was working perfectly well till yesterday. I downloaded the hourly after the landing of "New Left Pane for Places Organizer"; I believe a few other bugs were also landed between the previous nightly and this particular hourly.

On this hourly, if the code mentioned above is included in userChrome.js, I am not able to close tabs.

I see the following error in error console:

Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIWebProgress.removeProgressListener]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: chrome://browser/content/tabbrowser.xml :: removeTab :: line 1393"  data: no]

Not sure what went wrong.

Reproducible: Always

Steps to Reproduce:
Blocking Bug #387746. Am not sure if the regression is due to that bug, but seems most likely.
Blocks: 387746
Just looked for the regression range. Looks like it is Bug #398609 and build is: 20071119_0916_firefox-3.0b2pre.en-US.win32
Blocks: 398609
No longer blocks: 387746
Flags: blocking-firefox3?
Could you check on which line of the code the exception is thrown? 
Ever confirmed: true
(In reply to comment #3)
> Could you check on which line of the code the exception is thrown? 

I looked into tabbrowser.xml and given that the error is occuring near line 1392/1393 (from Error Console), the problems seems to be somewhere in the follwing code (this code is part of the removeTab method):

            // Remove the tab's filter and progress listener.
            const filter = this.mTabFilters[index];
            var oldBrowser = this.getBrowserAtIndex(index);
            this.mTabFilters.splice(index, 1);
            this.mTabListeners.splice(index, 1);
Now this problem occurs intermittently (starting 11/20 nightly). Will watch for a few builds and report back if the problem persists.
Since Build 20071119_0916_firefox-3.0b2pre.en-US.win32 (when Bug #398609 was checked in), another thing that broke is opening of links from external applications. But there are a lot of interdependencies as follows:

- In 1119_0916 build, if the code mentioned above is removed from userChrome.js, then links from external applications open correctly.
- As of today, 'Tab History' extension got busted ( If you disable the Tab History extension, links open fine again.

Am not sure what are the dependencies here, but all of them basically seem to have originated from Bug #398609. In addition, today's thread shows that a lot of other extensions have also been busted. ( Its possible that it could have been caused due to some additional check-ins, but surely a lot of them originated on 11/19.
I suspect that the regressions are covered by bug 404499 where the patch is waiting for a review/approval.
Depends on: 404499
Keywords: regression
OS: Windows Vista → All
Hardware: PC → All
Summary: Regression: Unable to Close Tabs when "Open Tabs Relative" code is active in userChrome.js → Unable to Close Tabs when "Open Tabs Relative" code is active in userChrome.js
Version: unspecified → Trunk
Igor: do you think this blocks? I'm not compelled by the specific use case reflected in comment 0, but if it's implying that there's a deeper problem in JS, we should probably block on it.
(In reply to comment #8)
> Igor: do you think this blocks? 

The bug 404499 definitely should block. If addressing that would not help this one, I will consider blocking this one.
--> Core::Javascript Engine
Assignee: nobody → general
Component: Tabbed Browser → JavaScript Engine
Flags: blocking-firefox3?
Product: Firefox → Core
QA Contact: tabbed.browser → general
transferring nomination; possibly to be fixed by bug 404499, but I think we should block on it just in case it isn't.
Flags: blocking1.9?
Post Bug #404499 landing, in the latest hourly, I *think* most of the problems I was facing with extensions and Javascript have been resolved. Keeping my fingers crossed. If things go well for a day or two, we can close this Bug.
K, minusing for now, renom if it isn't fixed.
Flags: blocking1.9? → blocking1.9-
Er, whoops, that was wrong of me. PLUSsing for now, please mark fixed if it turns out to be fixed. :)
Flags: blocking1.9- → blocking1.9+
Marking Fixed for now.
Closed: 12 years ago
Resolution: --- → FIXED
Duplicate of bug: 404499
You need to log in before you can comment on or make changes to this bug.