Move waitForDOMIfNeeded to more general place
Categories
(DevTools :: Netmonitor, enhancement, P3)
Tracking
(Not tracked)
People
(Reporter: sebo, Unassigned)
References
(Blocks 1 open bug)
Details
The helper function waitForDOMIfNeeded
for tests is currently located in devtools/client/netmonitor/test/head.js and is used for different Netmonitor tests.
The function initially checks whether the elements to wait for already exist in the DOM and if not, it calls waitForDOM
. With that, it is a more stable version of waitForDOM
for cases in which the DOM could already exist.
Therefore, other test cases may also profit from using its functionality and it should be moved to a more general place, i.e. devtools/client/shared/test/shared-head.js.
Sebastian
Comment 1•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'DevTools::Netmonitor' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
Comment 2•3 years ago
|
||
Thank you for the report Sebastian.
Comment 3•3 years ago
|
||
Note that we have more generic "wait" helpers, eg waitFor https://searchfox.org/mozilla-central/source/devtools/client/shared/test/shared-head.js#691
waitForDOM is fragile by nature because it relies on mutation observers. Feel free to merge the waitForDOMIfNeeded
logic inside of waitForDOM
and migrate all usage of waitForDOMIfNeeded to waitForDOM, but I would avoid adding yet another waitFor* flavor in shared-head.
Description
•