function filterLeaks(ok, globals) {
    return globals.filter(function (key) {
      // Firefox and Chrome exposes iframes as index inside the window object
      if (/^\d+/.test(key)) {
        return false;
      }

      // in firefox
      // if runner runs in an iframe, this iframe's window.getInterface method
      // not init at first it is assigned in some seconds
      if (commonjsGlobal.navigator && /^getInterface/.test(key)) {
        return false;
      }

      // an iframe could be approached by window[iframeIndex]
      // in ie6,7,8 and opera, iframeIndex is enumerable, this could cause leak
      if (commonjsGlobal.navigator && /^\d+/.test(key)) {
        return false;
      }

      // Opera and IE expose global variables for HTML element IDs (issue #243)
      if (/^mocha-/.test(key)) {
        return false;
      }

      var matched = ok.filter(function (ok) {
        if (~ok.indexOf('*')) {
          return key.indexOf(ok.split('*')[0]) === 0;
        }
        return key === ok;
      });
      return !matched.length && (!commonjsGlobal.navigator || key !== 'onerror');
    });
  }
Filter leaks with the given globals flagged as `ok`.

@private
@param {Array} ok
@param {Array} globals
@return {Array}