Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Commit

Permalink
Localize variables.
Browse files Browse the repository at this point in the history
This is to avoid adding a onError handler to the page that exists in the
outer scope.

https://code.google.com/p/phantomjs/issues/detail?id=166
  • Loading branch information
jonleighton authored and ariya committed Jun 16, 2012
1 parent a61d5e5 commit d2290a6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions test/webpage-spec.js
Expand Up @@ -313,7 +313,7 @@ describe("WebPage object", function() {
it("reports unhandled errors", function() {
var lastError = null;

page = new require('webpage').create();
var page = new require('webpage').create();
page.onError = function(e) { lastError = e; };

runs(function() {
Expand Down Expand Up @@ -341,8 +341,7 @@ describe("WebPage object", function() {
it("doesn't report handled errors", function() {
var hadError = false;
var caughtError = false;

page = new require('webpage').create();
var page = require('webpage').create();

runs(function() {
page.onError = function() { hadError = true; };
Expand Down

0 comments on commit d2290a6

Please sign in to comment.