tmpvar/jsdom — pull request #520 by fgalassi (2012-10-19 08:50:45+00:00)
Title: Skip external resources

Right now loading scripts and frames is an all or nothing affair. I needed to skip just certain scripts (advertising, etc...) so i implemented a feature called SkipExternalResources which takes urls of resources that should not be downloaded/processed. I needed regular expressions for convenience so i modified hasFeature() to support arrays of mixed strings/regexes. If it's a string it uses ===, if it's a regex it tries to match.
This gives people ability to say SkipExternalResources: /http:\/\/bad.domain/ to skip everything coming from that domain.

Notice: I hope you like this, but even if you don't, you should cherry pick the first commit which is a fix of a broken test (passing by coincidence). The problem is that tests in test/jsdom/index not specifying a url to jsdom(), through the weird algorithm based on the modules hierarchy to fill in the missing url, end up having test/level2/html as url. Then relative urls are resolved the wrong way and that particular test passes because it checks a script is not executed when in fact it's not even found.