Browse Source

Use setTimeout instead of setImmediate in fixtures.

The setImmediate is implemented in node and may have unexpected affects.
Cheng Zhao 11 years ago
parent
commit
f17864372e

+ 2 - 2
spec/fixtures/api/beforeunload-false.html

@@ -2,9 +2,9 @@
 <body>
 <script type="text/javascript" charset="utf-8">
   window.onbeforeunload = function() {
-    setImmediate(function() {
+    setTimeout(function() {
       require('remote').getCurrentWindow().emit('onbeforeunload');
-    });
+    }, 0);
     return false;
   }
 </script>

+ 2 - 2
spec/fixtures/api/close-beforeunload-false.html

@@ -2,9 +2,9 @@
 <body>
 <script type="text/javascript" charset="utf-8">
   window.onbeforeunload = function() {
-    setImmediate(function() {
+    setTimeout(function() {
       require('remote').getCurrentWindow().emit('onbeforeunload');
-    });
+    }, 0);
     return false;
   }
   window.close();

+ 2 - 2
spec/fixtures/api/close-beforeunload-string.html

@@ -2,9 +2,9 @@
 <body>
 <script type="text/javascript" charset="utf-8">
   window.onbeforeunload = function() {
-    setImmediate(function() {
+    setTimeout(function() {
       require('remote').getCurrentWindow().emit('onbeforeunload');
-    });
+    }, 0);
     return 'string';
   }
   window.close();

+ 2 - 2
spec/fixtures/api/close-beforeunload-true.html

@@ -2,9 +2,9 @@
 <body>
 <script type="text/javascript" charset="utf-8">
   window.onbeforeunload = function() {
-    setImmediate(function() {
+    setTimeout(function() {
       require('remote').getCurrentWindow().emit('onbeforeunload');
-    });
+    }, 0);
     return true;
   }
   window.close();