Btw You need to add one line:
```
page.onResourceError = function(error) {
    page.resources[error.id] || (page.resources[error.id] = {});
```