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
e50fddfd
...
e50fddfdf8870452ff1ffb36c5251aad5044e673
authored
2013-01-06 10:11:12 +0100
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fixes #343 - better script checks
1 parent
0125701f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
3 deletions
bin/bootstrap.js
bin/bootstrap.js
View file @
e50fddf
...
...
@@ -39,7 +39,15 @@ if (phantom.version.major === 1 && phantom.version.minor < 7) {
console
.
error
(
'CasperJS needs at least PhantomJS v1.7 or later.'
);
phantom
.
exit
(
1
);
}
else
{
bootstrap
(
window
);
try
{
bootstrap
(
window
);
}
catch
(
e
)
{
console
.
error
(
e
);
(
e
.
stackArray
||
[]).
forEach
(
function
(
entry
)
{
console
.
error
(
' In '
+
entry
.
sourceURL
+
':'
+
entry
.
line
);
});
phantom
.
exit
(
1
);
}
}
// Polyfills
...
...
@@ -136,7 +144,11 @@ function patchRequire(require, requireDirs) {
var
scriptCode
=
fs
.
read
(
file
);
if
(
/
\.
coffee$/i
.
test
(
file
))
{
/*global CoffeeScript*/
scriptCode
=
CoffeeScript
.
compile
(
scriptCode
);
try
{
scriptCode
=
CoffeeScript
.
compile
(
scriptCode
);
}
catch
(
e
)
{
throw
new
Error
(
'Unable to compile coffeescript:'
+
e
);
}
}
return
scriptCode
;
})(
file
);
...
...
@@ -328,7 +340,15 @@ function bootstrap(global) {
phantom
.
casperArgs
.
drop
(
phantom
.
casperScript
);
// passed casperjs script execution
phantom
.
injectJs
(
phantom
.
casperScript
);
var
injected
=
false
;
try
{
injected
=
phantom
.
injectJs
(
phantom
.
casperScript
);
}
catch
(
e
)
{
throw
new
global
.
CasperError
(
'Error loading script '
+
phantom
.
casperScript
+
': '
+
e
);
}
if
(
!
injected
)
{
throw
new
global
.
CasperError
(
'Unable to load script '
+
phantom
.
casperScript
+
'; check file syntax'
);
}
};
if
(
!
phantom
.
casperLoaded
)
{
...
...
Please
register
or
sign in
to post a comment