Closed
Bug 662152
Opened 13 years ago
Closed 13 years ago
window.setTimeout(gBrowser.addTab, time, URL) causes an error message "this.mCurrentTab is undefined"
Categories
(Firefox :: Tabbed Browser, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: vsemozhetbyt, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0 Build Identifier: Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0 "Error: this.mCurrentTab is undefined Source: chrome://browser/content/tabbrowser.xml String: 1188" Reproducible: Always Steps to Reproduce: For Example, try this in an extension or other test code: window.setTimeout(gBrowser.addTab, 1000, "http://www.google.com/"); Actual Results: Code with this call is broken. Expected Results: gBrowser should open the URL in a tab after the time delay.
Comment 1•13 years ago
|
||
> For Example, try this in an extension or other test code:
>
> window.setTimeout(gBrowser.addTab, 1000, "http://www.google.com/");
This code is just broken. Try gBrowser.addTab.bind(gBrowser) instead of gBrowser.addTab.
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
Reporter | ||
Comment 2•13 years ago
|
||
(In reply to comment #1) > This code is just broken. Try gBrowser.addTab.bind(gBrowser) instead of > gBrowser.addTab. Does you mean: window.setTimeout(gBrowser.addTab.bind(gBrowser), 1000, "http://www.google.com/"); ? This code open an empty tab with correct URL but without any content at all.
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
Comment 3•13 years ago
|
||
(In reply to comment #2) > (In reply to comment #1) > > This code is just broken. Try gBrowser.addTab.bind(gBrowser) instead of > > gBrowser.addTab. > > Does you mean: > > window.setTimeout(gBrowser.addTab.bind(gBrowser), 1000, > "http://www.google.com/"); > > ? This code open an empty tab with correct URL but without any content at > all. The problem here is that setTimout passes a second argument to addTab. This is bug 394769. I also filed bug 662155 on the fact that addTab fails silently here rather than reporting the error. As a workaround, you may use this: setTimout(function () { gBrowser.addTab("http://google.com"); }, 1000);
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago → 13 years ago
Resolution: --- → INVALID
Reporter | ||
Comment 4•13 years ago
|
||
(In reply to comment #3) > As a workaround, you may use this: > > setTimout(function () { > gBrowser.addTab("http://google.com"); > }, 1000); It works. Thank you very much for your time and explanation.
You need to log in
before you can comment on or make changes to this bug.
Description
•