Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
casperjs
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
8c5f4cb5
...
8c5f4cb5ada854c3e1fd374842413106f24b6035
authored
2011-12-27 22:48:32 +0100
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
sourceIds object is now attached to phantomjs object
1 parent
9fa750e8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
casperjs
casperjs
View file @
8c5f4cb
...
...
@@ -27,8 +27,6 @@
* DEALINGS IN THE SOFTWARE.
*
*/
var sourceIds = {};
if (!phantom.casperLoaded) {
// see http://semver.org/
phantom.casperVersion = {
...
...
@@ -73,8 +71,10 @@ if (!phantom.casperLoaded) {
phantom.injectJs(fs.pathJoin(phantom.casperPath, 'modules', 'vendors', 'coffee-script.js'));
// Adding built-in capabilities to phantom object
phantom.sourceIds = {};
phantom.getErrorMessage = function(e) {
return (e.fileName || sourceIds[e.sourceId]) + ':' + e.line + ' ' + e;
return (e.fileName ||
phantom.
sourceIds[e.sourceId]) + ':' + e.line + ' ' + e;
};
phantom.getScriptCode = function(file, onError) {
...
...
@@ -94,14 +94,14 @@ if (!phantom.casperLoaded) {
};
phantom.processScriptError = function(error, file, callback) {
if (!sourceIds.hasOwnProperty(error.sourceId)) {
sourceIds[error.sourceId] = file;
if (!
phantom.
sourceIds.hasOwnProperty(error.sourceId)) {
phantom.
sourceIds[error.sourceId] = file;
}
if (error.message === "__sourceId__") {
return;
}
if (typeof callback === "function") {
callback(error);
callback(error
, file
);
} else {
console.error(phantom.getErrorMessage(error));
phantom.exit(1);
...
...
Please
register
or
sign in
to post a comment