Open Bug 1709944 Opened 3 years ago Updated 3 years ago

Move waitForDOMIfNeeded to more general place

Categories

(DevTools :: Netmonitor, enhancement, P3)

enhancement

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

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.

Component: General → Netmonitor

Thank you for the report Sebastian.

Severity: -- → S3
Priority: -- → P3

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.

You need to log in before you can comment on or make changes to this bug.