Whitelisted 'features' obj in processArguments #459

Closed
wants to merge 1 commit into from

3 participants

@nym

Fix for bug that prevents script tags from loading in a jsdom.env that passes in a features object. Previously the features object was being thrown away because of processArguments' whitelist did not include 'features': true.

@nym nym Fix for bug that prevents script tags from loading in a jsdom.env tha…
…t passes in a features object. Previously the features object was being thrown away because of processArguments' whitelist did not include 'features': true.
dd5f54c
@tmpvar
Owner

needs a test, here's a starting point

var jsdom = require("jsdom");

jsdom.env("http://documentcloud.github.com/backbone/examples/todos/index.html",
  {
    features: {
      FetchExternalResources   : ['script', 'img', 'css', 'frame', 'link'],
      ProcessExternalResources : ['script', 'img', 'css', 'frame', 'link'],
      MutationEvents           : '2.0',
      QuerySelector            : false
    }
  },
  function(errors, window) {
    var document = window.document;

    setTimeout(function() {
      try {
          console.log("underscore loaded?");
          console.log(typeof(window._) !== 'undefined');
      } catch (e) {}
        try {
          console.log("jQuery loaded?");
          console.log(typeof(window.$) !== 'undefined');
      } catch (e) {}
    }, 5000);
  }
);
@nym
nym commented Mar 5, 2013

Hey @tmpvar I'm no longer working with jsdom and won't be writing the unit test. I suggest you accept/reject this pull request.

@domenic domenic closed this in f908866 Mar 10, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment