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
--- 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.