[tbb-commits] [tor-browser] 37/37: Bug 1727653 - wait for resize event before testing restoration of persisted sizes. r=niklas, a=RyanVM

gitolite role git at cupani.torproject.org
Wed Jun 22 18:27:46 UTC 2022


This is an automated email from the git hooks/post-receive script.

richard pushed a commit to branch tor-browser-91.11.0esr-11.5-1
in repository tor-browser.

commit 0516fde4797929eeb4032ea45766f02e43a7fb26
Author: Karl Tomlinson <karlt+ at karlt.net>
AuthorDate: Wed Jun 15 22:50:32 2022 +0000

    Bug 1727653 - wait for resize event before testing restoration of persisted sizes. r=niklas, a=RyanVM
    
    Differential Revision: https://phabricator.services.mozilla.com/D149329
---
 toolkit/content/tests/chrome/test_navigate_persist.html | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/toolkit/content/tests/chrome/test_navigate_persist.html b/toolkit/content/tests/chrome/test_navigate_persist.html
index 794422bfb793f..f7ee06e155906 100644
--- a/toolkit/content/tests/chrome/test_navigate_persist.html
+++ b/toolkit/content/tests/chrome/test_navigate_persist.html
@@ -25,15 +25,22 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1460639
       });
     }
 
-    function resize(win, size) {
-      let resizePromise = new Promise(resolve => {
-        if (win.outerWidth === size && win.outerHeight === size) {
+    function promiseMaybeResizeEvent(win, expectedSize) {
+      return new Promise(resolve => {
+        // If the size is already as expected, then there may be no resize
+        // event.
+        if (win.outerWidth === expectedSize
+            && win.outerHeight === expectedSize) {
           resolve();
         }
         win.addEventListener("resize", () => {
           resolve();
         }, {once: true});
       });
+    }
+
+    function resize(win, size) {
+      const resizePromise = promiseMaybeResizeEvent(win, size);
       win.resizeTo(size, size);
       return resizePromise;
     }
@@ -60,6 +67,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1460639
       isnot(win.outerHeight, PERSIST_SIZE, "Initial window height is not the persisted size");
 
       await navigateWindowTo(win, "window_navigate_persist.html");
+      await promiseMaybeResizeEvent(win, PERSIST_SIZE);
       is(win.outerWidth, PERSIST_SIZE, "Window width is persisted");
       is(win.outerHeight, PERSIST_SIZE, "Window height is persisted");
       win.close();

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list