mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 00:35:44 +00:00
2b7c6b4c81
I rewrote BrowserUtils.addContentEventListener(), and that caused an intermittent failure in browser_bug343515.js. The use of addContentEventListener in the test is questionable, and the test as a whole is old, so I freshened it up. Instead of nShotsListener (and oneShotListener, which is a special case of that) which waits for a hard coded number of load events to fire to ensure that a page and its subframes are all loaded, I use BrowserTestUtils.browserLoaded(). Instead of waitForPageshow, which runs a script in the content process that waits for an event, it uses BrowserTestUtils.waitForContentEvent, which does the same thing in a hopefully more resilient fashion. The largest change in terms of number of characters changed is that I rewrote the test so that it is written inside of a single add_task async function, instead of being split into a chain of async functions. I also used await to flatten a lot of .then() chained things. I fixed up some variable shadowing. There was some trickiness around shadowed variable names being used as field names, so I introduced an intermediate 'data' variable to hold the structure. Finally, I call BrowserTestUtils.removeTab() instead of calling removeTab() directly on the browser. I figured that was probably better, though maybe it does not matter. I added a check after each step that the URI is correct, where missing, which would have caught a bug in an earlier version of this patch. Differential Revision: https://phabricator.services.mozilla.com/D51183 --HG-- extra : moz-landing-system : lando |
||
---|---|---|
.. | ||
base | ||
build | ||
resources/content | ||
shistory | ||
test | ||
moz.build |