Last active
January 2, 2016 13:09
-
-
Save jleyba/8307735 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bot.inject.recompileFunction_ = function(fn, theWindow) { | |
if (goog.isString(fn)) { | |
try { | |
return new theWindow['Function'](fn); | |
} catch (ex) { | |
// Try to recover if in IE-quirks. | |
if (theWindow.execScript) { | |
theWindow.execScript('var __$$webdriver_fn$$__ = (function(){' + fn + '\n})'); | |
return theWindow['__$$webdriver_fn$$__']; | |
} | |
throw ex; | |
} | |
} | |
return theWindow == window ? fn : new theWindow['Function']( | |
'return (' + fn + ').apply(null,arguments);'); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment