Closed Bug 1009938 Opened 11 years ago Closed 11 years ago

getTabBrowser(...) is null error on startup

Categories

(Add-on SDK Graveyard :: General, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: kevink9876543, Assigned: kevink9876543)

References

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (X11; Linux i686; rv:32.0) Gecko/20100101 Firefox/32.0 SeaMonkey/2.29a1 (Beta/Release) Build ID: 20140513192647 Steps to reproduce: run SeaMonkey built from c-c rev d7b54421771a / m-c rev e5f321740d10 Actual results: In the Error Console: Error: getTabBrowser(...) is null Source File: resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/tabs/utils.js Line: 69 The following patch fixes it, but I'm not sure if it's an actual solution: diff --git a/addon-sdk/source/lib/sdk/tabs/utils.js b/addon-sdk/source/lib/sdk/tabs/utils.js --- a/addon-sdk/source/lib/sdk/tabs/utils.js +++ b/addon-sdk/source/lib/sdk/tabs/utils.js @@ -61,7 +61,7 @@ exports.activateTab = activateTab; function getTabBrowser(window) { - return window.gBrowser; + return window.gBrowser || window.getBrowser(); } exports.getTabBrowser = getTabBrowser; Expected results: The above error sholdn't happen.
Apparently, reproducing the error message from a clean profile requires Scriptish (I have 0.1.12) installed from AMO and the Scriptish toolbar button placed on any browser toolbar at time of browser startup. Also, that error does not occur on SeaMonkey build from c-c rev 4fc074034d47 / m-c rev 135afc151b75 .
> - return window.gBrowser; > + return window.gBrowser || window.getBrowser(); window.gBrowser works in Firefox because gBrowser is a smart/lazy getter. Firefox has a backwards compatible shim so getBrowser() will continue to work. In SeaMonkey gBrowser is just a normal global variable that is initialized the first time getBrowser() is called. I'll move this bug to the SDK product (if I can find out where it is)
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Linux → All
Product: SeaMonkey → Add-on SDK
Hardware: x86 → All
Version: Trunk → unspecified
(In reply to Philip Chee from comment #2) > In SeaMonkey gBrowser is just a normal global variable that is initialized > the first time getBrowser() is called. That is why I'm not completely ignoring gBrowser. Figured it would be more efficient to use the stored value of gBrowser when available, rather than calling getBrowser every time. So should I submit the above changeset for review?
i think it's likely we will accept this patch. you can find instructions for contributing here: https://github.com/mozilla/addon-sdk/wiki/contribute and feel free to ask if something is not clear.
Attached patch patchSplinter Review
Unfortunately I don't have time to set up / deal with another account or learn git right now, but here's the patch in case someone else can submit it as a pull request.
Zombie, can you deal with making sure the patch gets dealt with?
Flags: needinfo?(tomica+amo)
Priority: -- → P1
sure thing. also, i'm gonna take this down to P2, as: 1) it happens only in SeaMonkey 2) STR from comment 1 requires installing another addon
Flags: needinfo?(tomica+amo)
Priority: P1 → P2
Matteo, i'm not clear if this patch would require a test, and if we can even write a test for SeaMonkey.. or can we just merged this as is? (current tests are passing)
Attachment #8427245 - Flags: review?(zer0)
Attachment #8427245 - Flags: review?(zer0) → review+
Commits pushed to master at https://github.com/mozilla/addon-sdk https://github.com/mozilla/addon-sdk/commit/641847e874991dc7ce5b8a50e4bd76a07be260f4 bug 1009938 - gBrowser null in SeaMonkey https://github.com/mozilla/addon-sdk/commit/bd97140cd8bad66fd47dccdd045a477bb7636059 Merge pull request #1495 from zombie/1009938-gBrowser-null bug 1009938 - getTabBrowser() null in SeaMonkey, r=@ZER0
Assignee: nobody → kevink9876543
thanks for fixing this Kevin. if you wish to contribute more, here is a guide, and some good first bugs: https://github.com/mozilla/addon-sdk/wiki/contribute https://bugzilla.mozilla.org/buglist.cgi?status_whiteboard=[good+first+bug]&product=Add-on+SDK
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
(In reply to Tomislav Jovanovic [:zombie] from comment #11) > thanks for fixing this Kevin. You're welcome. When should I expect this change to land in m-c?
we uplift weekly, but i don't know the exact day, so.. by the end of the week?
Blocks: 1023661
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: