瀏覽代碼

Relaunch run on webkit1 if webkit2 fails

Gaël Métais 9 年之前
父節點
當前提交
c54cf5a2ba
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      lib/tools/phantomas/phantomasWrapper.js

+ 9 - 0
lib/tools/phantomas/phantomasWrapper.js

@@ -112,8 +112,17 @@ var PhantomasWrapper = function() {
 
         // It's time to launch the test!!!
         var triesNumber = 2;
+        var currentTry = 0;
 
         async.retry(triesNumber, function(cb) {
+
+            currentTry ++;
+            // Fix for https://github.com/gmetais/YellowLabTools/issues/114
+            if (currentTry === 2 && options.engine === 'webkit2') {
+                debug('Launching a second try with the old webkit v1 engine');
+                options.engine = 'webkit';
+            }
+
             var process = phantomas(task.url, options, function(err, json, results) {
                 var errorCode = err ? parseInt(err.message, 10) : null;