Bug 1296175 - Remove broken timout code when pushing new permissions. r?ato draft
authorHenrik Skupin <mail@hskupin.info>
Mon, 05 Sep 2016 14:33:18 +0200
changeset 409880 211963a7a74a9e97bc40b4233410d736952ec95e
parent 409737 dbe4b47941c7b3d6298a0ead5e40dd828096c808
child 530458 9f62cce1ebe7182929aad08b40fd16450f3aec23
push id28598
push userbmo:hskupin@gmail.com
push dateMon, 05 Sep 2016 12:41:15 +0000
reviewersato
bugs1296175
milestone51.0a1
Bug 1296175 - Remove broken timout code when pushing new permissions. r?ato Because execute_async_script() has it's own timeout value, there shouldn't be another timeout check inside the script. Even with this check we return immediately now, which can cause test failures if setting the permission is delayed. MozReview-Commit-ID: Aqsbfc6Ayy6
testing/marionette/client/marionette_driver/marionette.py
--- a/testing/marionette/client/marionette_driver/marionette.py
+++ b/testing/marionette/client/marionette_driver/marionette.py
@@ -874,25 +874,23 @@ class Marionette(object):
                                                                                   null, null),
                                                                                   attrs);
                 Services.perms.addFromPrincipal(principal, perm.type, perm.action);
                 return true;
                 """, script_args=(perm,))
 
         with self.using_context("content"):
             self.execute_async_script("""
-                let start = new Date();
-                let end = new Date(start.valueOf() + 5000);
                 let wait = function() {
-                  let now = new Date();
-                  if (window.wrappedJSObject.permChanged || end >= now) {
+                  if (window.wrappedJSObject.permChanged) {
                     marionetteScriptFinished();
+                  } else {
+                    window.setTimeout(wait, 100);
                   }
-                };
-                window.setTimeout(wait, 100);
+                }();
                 """, sandbox="system")
 
     @contextmanager
     def using_permissions(self, perms):
         '''
         Sets permissions for code being executed in a `with` block,
         and restores them on exit.