Use range-based for with nsTObserverArray where easily possible
Categories
(Core :: XPCOM, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox79 | --- | fixed |
People
(Reporter: sg, Assigned: sg)
References
Details
Attachments
(19 files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review |
Assignee | ||
Comment 1•5 years ago
|
||
Depends on D79284
Updated•5 years ago
|
Assignee | ||
Comment 2•5 years ago
|
||
Depends on D79431
Assignee | ||
Comment 3•5 years ago
|
||
Depends on D79432
Assignee | ||
Comment 4•5 years ago
|
||
Depends on D79433
Assignee | ||
Comment 5•5 years ago
|
||
Depends on D79434
Assignee | ||
Comment 6•5 years ago
|
||
Depends on D79490
Assignee | ||
Comment 7•5 years ago
|
||
Depends on D79493
Assignee | ||
Comment 8•5 years ago
|
||
Depends on D79494
Assignee | ||
Comment 9•5 years ago
|
||
Depends on D79495
Assignee | ||
Comment 10•5 years ago
|
||
Depends on D79496
Assignee | ||
Comment 11•5 years ago
|
||
Depends on D79497
Assignee | ||
Comment 12•5 years ago
|
||
Depends on D79498
Assignee | ||
Comment 13•5 years ago
|
||
Depends on D79499
Assignee | ||
Comment 14•5 years ago
|
||
Depends on D79500
Assignee | ||
Comment 15•5 years ago
|
||
Depends on D79501
Assignee | ||
Comment 16•5 years ago
|
||
Depends on D79502
Assignee | ||
Comment 17•5 years ago
|
||
Depends on D79503
Assignee | ||
Comment 18•5 years ago
|
||
Depends on D79504
Assignee | ||
Comment 19•5 years ago
|
||
Depends on D79505
Comment 20•5 years ago
|
||
The bug could explain why? :)
Assignee | ||
Updated•5 years ago
|
Comment 21•5 years ago
|
||
Comment 22•5 years ago
|
||
bugherder |
Comment 23•5 years ago
|
||
Comment 24•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/e6239a2ea63d
https://hg.mozilla.org/mozilla-central/rev/9e423eab275c
https://hg.mozilla.org/mozilla-central/rev/ea0b74e44d75
https://hg.mozilla.org/mozilla-central/rev/c8ee4717dac6
https://hg.mozilla.org/mozilla-central/rev/91138138812e
https://hg.mozilla.org/mozilla-central/rev/490fa07526ce
https://hg.mozilla.org/mozilla-central/rev/346a1bc55d57
https://hg.mozilla.org/mozilla-central/rev/d091f09fb8ad
https://hg.mozilla.org/mozilla-central/rev/a3218470c558
https://hg.mozilla.org/mozilla-central/rev/756fe40189b7
Comment 25•5 years ago
|
||
Comment 26•5 years ago
|
||
bugherder |
Comment 27•5 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #20)
The bug could explain why? :)
Did this get answered somewhere? (I should have needinfo'ed previously when deciding to block on this, apologies.)
Comment 28•5 years ago
|
||
It wasn't answered and I commented my worry about this in
https://phabricator.services.mozilla.com/D79495
(but r+'ed anyhow)
Assignee | ||
Comment 29•5 years ago
|
||
smaug, while I somehow missed your question saw your comment on the patch, and I planned on responding to that, I somehow missed your comment here.
I am not sure: From my point of view, it is desirable to reduce custom (for/while) loops and in particular use range-based for because it is more expressive. While a custom (for/while) loop has several places where the iteration can be controlled, the range-based for syntax restricts this to the range clause. It is clear that the loop body has only access to the current item, and cannot modify the iterator. (I am not sure if I can add anything to the general reasons why range-based was introduced to the C++ standard).
I am not completely sure how this relates to your comment on the patch, and I would like to better understand that. In what sense does it hide how the iteration happens? Can you point me to some example where using range-based for caused a security issue?
Comment 30•5 years ago
|
||
I don't expect there to be security issues when dealing with nsTObserverArray, since that is designed to deal with mutations. But we've had
several security critical issues when some other data structure has been iterated using ranged-for and while iterating, something has modified the data structure. The issue there is that range-for hides what actually happens underneath, and in some sense it is too
handy way to iterate, so the patch author, nor the reviewer might not think about what happens if the data structure is modified.
(nsTArray should just crash safely these days, but even a safe crash is rather annoying for the user.)
Comment 31•5 years ago
|
||
Comment 32•5 years ago
|
||
bugherder |
Assignee | ||
Updated•5 years ago
|
Comment 33•5 years ago
|
||
Comment 34•5 years ago
|
||
Backed out for bustages on nsGlobalWindowInner.cpp
Backout link: https://hg.mozilla.org/integration/autoland/rev/324d5257f6f7cd287565dd822b13d3b5acc0ef14
Log link: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=307515741&repo=autoland&lineNumber=25276
Assignee | ||
Comment 35•5 years ago
|
||
(In reply to Narcis Beleuzu [:NarcisB] from comment #34)
Backed out for bustages on nsGlobalWindowInner.cpp
Backout link: https://hg.mozilla.org/integration/autoland/rev/324d5257f6f7cd287565dd822b13d3b5acc0ef14
Log link: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=307515741&repo=autoland&lineNumber=25276
Sorry for that, I resolved the bustage and updated the patch, and will re-land it.
Comment 36•5 years ago
|
||
Comment 37•5 years ago
|
||
bugherder |
Description
•