Closed Bug 764540 Opened 12 years ago Closed 12 years ago

browser_tabfocus.js is racy

Categories

(Firefox :: General, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: smaug, Assigned: smaug)

References

Details

Attachments

(2 files)

Attached patch patchSplinter Review
(If I've understood this correctly) The test works fine if browser1 is loaded before browser2, but if that is not the case pageshow of the browser1 ends up triggering _browser_tabfocus_navigation_test_eventOccured because the load event listener adds listener for pageshow. Before Bug 734015 browser1 is always loaded before browser2. But once we start to slow down bg tab loading, the order may change. https://tbpl.mozilla.org/?tree=Try&rev=8795f1d322f8 (Bug 734015 + this one)
Attachment #632839 - Flags: review?
Attachment #632839 - Flags: review? → review?(enndeakin)
Comment on attachment 632839 [details] [diff] [review] patch So the idea is the let load/pageshow events to be handled before actually starting the test. Hopefully tryserver looks good :)
(In reply to Olli Pettay [:smaug] from comment #1) > So the idea is the let load/pageshow events to be handled before actually > starting the test. In that case you should use executeSoon(_run_focus_tests).
Doesn't really matter.
(In reply to Olli Pettay [:smaug] from comment #3) > Doesn't really matter. When you have to use setTimeout (i.e. executeSoon doesn't work for what you're trying to do), there's probably something wrong with your test. Therefore it's our policy for browser chrome tests to use executeSoon instead of setTimeout whenever possible.
executeSoon would work, but the test uses already setTimeout and it really doesn't matter which one to use in this case, so I prefer consistency.
And based on the the tryserver the patch does actually fix the problem :)
(In reply to Olli Pettay [:smaug] from comment #5) > executeSoon would work, but the test uses already setTimeout We should fix that. (Not necessarily here.) > and it really doesn't matter which one to use in this case, I know setTimeout works. This isn't the point. The point is that we have a policy that allows us to distinguish legitimate timeouts from suspicious ones. > so I prefer consistency. Temporary inconsistency is ok in this case.
Attached patch with executeSoonSplinter Review
Ok, I'm not a browser/ peer. If there is such policy, then there is.
Attachment #633107 - Flags: review?(dao)
Attachment #632839 - Flags: review?(enndeakin)
Attachment #633107 - Flags: review?(dao) → review+
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: