Bug 1252750 - Part 1: Create a helper function on SpecialPowersAPI which creates a nested event queue and spins it for a bit. r=mrbkap
authorDoug Turner <dougt@mozilla.com>
Sat, 05 Mar 2016 00:05:00 -0500
changeset 286948 a9a28f53a959341f65f8f2dfb48250df7c8ef055
parent 286947 f4c263f7e968513fdcea038de28a83e1d1f6db89
child 286949 398a0e720ccf04f65c274eb82821def6f08e046b
push id18025
push userryanvm@gmail.com
push dateSun, 06 Mar 2016 20:04:05 +0000
treeherderfx-team@b6acf4d4fc20 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs1252750
milestone47.0a1
Bug 1252750 - Part 1: Create a helper function on SpecialPowersAPI which creates a nested event queue and spins it for a bit. r=mrbkap
testing/specialpowers/content/specialpowersAPI.js
--- a/testing/specialpowers/content/specialpowersAPI.js
+++ b/testing/specialpowers/content/specialpowersAPI.js
@@ -1566,25 +1566,30 @@ SpecialPowersAPI.prototype = {
       addCategoryEntry(category, entry, value, persists, replace);
   },
 
   deleteCategoryEntry: function(category, entry, persists) {
     Components.classes["@mozilla.org/categorymanager;1"].
       getService(Components.interfaces.nsICategoryManager).
       deleteCategoryEntry(category, entry, persists);
   },
-
   openDialog: function(win, args) {
     return win.openDialog.apply(win, args);
   },
+  // This is a blocking call which creates and spins a native event loop
+  spinEventLoop: function(win) {
+    // simply do a sync XHR back to our windows location.
+    var syncXHR = new win.XMLHttpRequest();
+    syncXHR.open('GET', win.location, false);
+    syncXHR.send();
+  },
 
   // :jdm gets credit for this.  ex: getPrivilegedProps(window, 'location.href');
   getPrivilegedProps: function(obj, props) {
     var parts = props.split('.');
-
     for (var i = 0; i < parts.length; i++) {
       var p = parts[i];
       if (obj[p]) {
         obj = obj[p];
       } else {
         return null;
       }
     }