Bug 1150247 - Check if value is function before binding. r=ato

Rather than attempting to bind non-functions and catching the exception this
explicitly checks if it is a function. This helps reduce memory consumption
needed for the exception stack traces. Realistically that will go away when GC
is run, but it throws off memory measurments prior to that.
This commit is contained in:
Eric Rahm 2015-04-01 18:58:21 -07:00
parent 4c1d59941c
commit 34d7a9d2f5

View File

@ -830,9 +830,9 @@ GeckoDriver.prototype.createExecuteSandbox = function(win, mn, sp) {
sb.testUtils = utils;
mn.exports.forEach(function(fn) {
try {
if (typeof mn[fn] === 'function') {
sb[fn] = mn[fn].bind(mn);
} catch(e) {
} else {
sb[fn] = mn[fn];
}
});