desktop-mode-cleanup.html (1646B)
1 <!DOCTYPE html> 2 <html class="reftest-wait"> 3 <!-- This reftest isn't really a test; it's really just a helper to do 4 some cleanup after its neighbor "desktop-mode.html" has finished. 5 --> 6 <script> 7 async function go() { 8 let win = SpecialPowers.wrap(window); 9 let origVal = await SpecialPowers.spawnChrome([win.browsingContext.id], 10 id => { 11 // Restore forceDesktopViewport to its default value (false), to clean up 12 // after the prior reftest, desktop-mode.html. 13 let ctx = BrowsingContext.get(id); 14 let origVal = ctx.forceDesktopViewport; 15 ctx.forceDesktopViewport = false; 16 return origVal; 17 }); 18 19 if (!origVal) { 20 // UNEXPECTED: if we get here, then forceDesktopViewport was somehow 21 // false (at its default value). We expect it to be 'true' when this 22 // reftest runs, because this reftest should be run immediately after 23 // 'desktop-mode.html' which sets forceDesktopViewport to true (and this 24 // reftest only exists to clean that up). 25 // 26 // NOTE: We could signal a test-failure in this circumstance, 27 // by e.g. setting the background to red... 28 // document.body.style.background = "red"; 29 // ...but that also makes this test trivially fail in 'test-verify' runs 30 // per bug 1915025 comment 17 through 19, so let's not do that for now. 31 // So for now, we handle this unexpected condition silently/gracefully. 32 // I'm leaving this (no-op) if-check in the test in case it's useful 33 // for debugging/logging at some point, though. 34 } 35 document.documentElement.classList.remove('reftest-wait'); 36 } 37 38 go(); 39 </script> 40 </html>