Open
Bug 292236
Opened 20 years ago
Updated 16 years ago
Tabbrowser iterates through progress listeners in reverse order
Categories
(SeaMonkey :: Tabbed Browser, defect)
Tracking
(Not tracked)
NEW
People
(Reporter: WeirdAl, Unassigned)
References
()
Details
Attachments
(2 files, 3 obsolete files)
|
16.91 KB,
patch
|
neil
:
review+
jag+mozilla
:
superreview+
|
Details | Diff | Splinter Review |
|
1.53 KB,
patch
|
neil
:
review+
jag+mozilla
:
superreview+
|
Details | Diff | Splinter Review |
http://lxr.mozilla.org/seamonkey/source/xpfe/global/resources/content/bindings/tabbrowser.xml#196 The original progress listener order is from last to first. tabbrowser works from first to last. This caused a really lovely regression with our corporate product when I removed tabbrowser from the loop... Patch will be forthcoming.
| Reporter | ||
Comment 1•20 years ago
|
||
Attachment #182081 -
Flags: review?(bzbarsky)
| Reporter | ||
Comment 2•20 years ago
|
||
I missed one...
Attachment #182081 -
Attachment is obsolete: true
Attachment #182083 -
Flags: review?(bzbarsky)
| Reporter | ||
Updated•20 years ago
|
Attachment #182081 -
Flags: review?(bzbarsky)
Comment 3•20 years ago
|
||
I'm not a peer for either xpfe or toolkit; I suggest getting reviews from neil and mconnor.
| Reporter | ||
Updated•20 years ago
|
Attachment #182083 -
Flags: review?(bzbarsky) → review?(neil.parkwaycc.co.uk)
Comment 4•20 years ago
|
||
Comment on attachment 182083 [details] [diff] [review] Reverse order of tabbrowser progress listeners, to follow doc loader You missed one? More like six.
Attachment #182083 -
Flags: review?(neil.parkwaycc.co.uk) → review-
| Reporter | ||
Comment 5•20 years ago
|
||
... and six more makes a baker's dozen.
Attachment #182083 -
Attachment is obsolete: true
Attachment #182101 -
Flags: review?(neil.parkwaycc.co.uk)
Comment 6•20 years ago
|
||
Comment on attachment 182101 [details] [diff] [review] Reverse order of tabbrowser progress listeners, to follow doc loader r=me by code inspection. I wish the syntax for a downward-counting loop wasn't so ugly :-/
Attachment #182101 -
Flags: review?(neil.parkwaycc.co.uk) → review+
Comment 7•20 years ago
|
||
(In reply to comment #5) >... and six more makes a baker's dozen. A baker's dozen is 13, not 11 :-P
| Reporter | ||
Comment 8•20 years ago
|
||
Comment on attachment 182101 [details] [diff] [review] Reverse order of tabbrowser progress listeners, to follow doc loader Oh, I know perfectly well it's 13. 1 I filed the second patch for. 6 you claimed for one of the tabbrowser.xml files. I claim six more for the other.
Attachment #182101 -
Flags: superreview?(jag)
Comment 9•20 years ago
|
||
Hmm, ok, I see what you mean now. I guess it's a good thing to make tabbrowser do what nsDocLoader does, but I'm not sure we've ever guaranteed you can depend on the order of notification. I'm also not sure we want to start doing that.
Comment 10•20 years ago
|
||
Comment on attachment 182101 [details] [diff] [review] Reverse order of tabbrowser progress listeners, to follow doc loader That said, sr=jag Let's hope no one's depending on tabbrowser iterating from first to last.
Attachment #182101 -
Flags: superreview?(jag) → superreview+
| Reporter | ||
Comment 11•20 years ago
|
||
I've no plans to seek approval for checkin now -- but I'll ask someone to land this patch shortly after trunk thaws.
Comment 12•19 years ago
|
||
When should this patch be checked in? In the 1.9 cycle? When it is bit-rotten?
| Reporter | ||
Comment 13•19 years ago
|
||
I'm thinking 1.9 cycle -- it's just not important enough to justify for the 1.8 cycle this late in the game.
| Reporter | ||
Comment 14•19 years ago
|
||
Patch has bitrotted (grrr). Neil, please advise. In xpfe...tabbrowser, there
is:
for each (var p in this.mProgressListeners)
if (p && 'onLinkIconAvailable' in p)
p.onLinkIconAvailable(href);
This was revision 1.119. I really don't know which ordering will result from a
for...in search.
Other than that, here's the new patch.
Attachment #182101 -
Attachment is obsolete: true
Attachment #192604 -
Flags: review?(neil.parkwaycc.co.uk)
Comment 15•19 years ago
|
||
for..in has no defined ordering, I believe. In Spidermonkey, however, the order seems to be based on the last setting of each property - but I would not want to rely on anything as subtle as that!
Comment 16•19 years ago
|
||
Comment on attachment 192604 [details] [diff] [review] Reverse order of tabbrowser progress listeners, to follow doc loader As it happens, we only grow the array using push(), so the order we happen to enumerate is 0 up order. Oddly unshift() also enumerates in 0 up order...
Attachment #192604 -
Flags: review?(neil.parkwaycc.co.uk) → review+
| Reporter | ||
Comment 17•19 years ago
|
||
Comment on attachment 192604 [details] [diff] [review] Reverse order of tabbrowser progress listeners, to follow doc loader jag, do you want to carry over the sr, or actively re-sr this patch?
Attachment #192604 -
Flags: superreview?(jag)
Comment 18•19 years ago
|
||
Comment on attachment 192604 [details] [diff] [review] Reverse order of tabbrowser progress listeners, to follow doc loader Maybe I'm missing something, but I don't see the change for the |for each| line you asked about.
| Reporter | ||
Comment 19•19 years ago
|
||
You're not missing anything. It's not included in the diff, because I wasn't sure what we're supposed to do there.
| Reporter | ||
Comment 20•19 years ago
|
||
Neil and I discussed the for...each loop and realized it wasn't going to work.
Attachment #192610 -
Flags: superreview?(jag)
Attachment #192610 -
Flags: review?(neil.parkwaycc.co.uk)
Comment 21•19 years ago
|
||
Comment on attachment 192610 [details] [diff] [review] followup to attachment 192604 [details] [diff] [review] So what happened to my idea of unshifting the progress listeners into the array instead of pushing them?
Attachment #192610 -
Flags: review?(neil.parkwaycc.co.uk) → review+
| Reporter | ||
Comment 22•19 years ago
|
||
(In reply to comment #21) > So what happened to my idea of unshifting the progress listeners into the array > instead of pushing them? I'm not convinced it will produce the same results.
Comment 23•19 years ago
|
||
That for each simply iterates over the progress listeners. It replaced a 0..n-1 iteration. This bug is about reversing that iteration so we do the same as before tabbrowser. Therefore, can't we simply just do the n-1..0 iteration and be done? No trickery, no "what if this undefined order changes in the future", and best of all, it'll look just like all the other loops in this file.
| Reporter | ||
Comment 24•19 years ago
|
||
(In reply to comment #23) > That for each simply iterates over the progress listeners. It replaced a 0..n-1 > iteration. This bug is about reversing that iteration so we do the same as > before tabbrowser. Therefore, can't we simply just do the n-1..0 iteration and > be done? No trickery, no "what if this undefined order changes in the future", > and best of all, it'll look just like all the other loops in this file. jag, I thought the manual loops I gave did exactly that. :) That said, I realize now that Neil is right, according to xpcshell: js> var x = []; js> x.unshift("one"); 1 js> x.unshift("two"); 2 js> x two,one js> var y js> for (y in x) { dump(y + "\n") }; 0 1 js> for each (y in x) { dump(y + "\n") }; two one We really could go either way, with my patches as posted, or with the route Neil suggested (changing push to unshift in precisely two places). jag, if you want me to go that route, sr- both patches and it will be done.
Comment 25•19 years ago
|
||
Alex: oops, I missed the "Created an attachment" part, I thought you were just commenting on it. Neil, Alex: I don't care wether we |unshift| and |for each| or use |for n-1..0|, as long as we use it consistently. The only problem I have with |for each| is that there appears to be no guarantee about the order, while this bug is about iterating in a specific known order.
Comment 26•19 years ago
|
||
Comment on attachment 192610 [details] [diff] [review] followup to attachment 192604 [details] [diff] [review] So sr=jag, but ignore if Neil prefers |for each|, though I'd almost say we should change all the other iteration loops to |for each| in that case too.
Attachment #192610 -
Flags: superreview?(jag) → superreview+
Updated•19 years ago
|
Attachment #192604 -
Flags: superreview?(jag) → superreview+
Comment 27•19 years ago
|
||
Comment on attachment 192610 [details] [diff] [review] followup to attachment 192604 [details] [diff] [review] The one thing I don't like about this though is that you're reusing |i|. It works in this case because we return if we get a match in the outer loop, but this is code asking for subtle bugs if someone changes the flow.
| Reporter | ||
Comment 28•19 years ago
|
||
(In reply to comment #27) > (From update of attachment 192610 [details] [diff] [review] [edit]) > The one thing I don't like about this though is that you're reusing |i|. It > works in this case because we return if we get a match in the outer loop, but > this is code asking for subtle bugs if someone changes the flow. Zut! That should've been a "var j", not "i". Good catch, and I hope whoever checks it in (I don't have checkin privs) notes that.
Comment 29•19 years ago
|
||
Ok, so how about this solution: * Change the push into an unshift, which fixes all the 0 .. n loops * Change the foreach into an 0 .. n loop just to be quite safe
| Reporter | ||
Comment 30•19 years ago
|
||
Sounds perfectly reasonable; I'll get it done in the next 24 hours.
Comment 31•19 years ago
|
||
Strike my last comment. New idea: count down as before, but additionally tweak removeProgressListener to really remove it, thus saving on null checks (this optimization isn't safe with the existing count up loops, and don't ask me what happens to the for each loop...)
| Reporter | ||
Updated•18 years ago
|
Assignee: ajvincent → nobody
QA Contact: tabbed-browser
| Assignee | ||
Updated•16 years ago
|
Product: Core → SeaMonkey
You need to log in
before you can comment on or make changes to this bug.
Description
•