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
d6ded5cb
...
d6ded5cb428a0d7847c1f5e97b8e5a704491eb8e
authored
2012-05-23 16:35:46 +0200
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'issue-114'
2 parents
dcba4fdb
2af64a19
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
modules/casper.js
modules/casper.js
View file @
d6ded5c
...
...
@@ -156,7 +156,6 @@ Casper.prototype.back = function back() {
* @return string Base64 encoded result
*/
Casper
.
prototype
.
base64encode
=
function
base64encode
(
url
,
method
,
data
)
{
this
.
injectClientUtils
();
return
this
.
evaluate
(
function
_evaluate
(
url
,
method
,
data
)
{
return
__utils__
.
getBase64
(
url
,
method
,
data
);
},
{
url
:
url
,
method
:
method
,
data
:
data
});
...
...
@@ -420,6 +419,9 @@ Casper.prototype.echo = function echo(text, style, pad) {
* @see WebPage#evaluate
*/
Casper
.
prototype
.
evaluate
=
function
evaluate
(
fn
,
context
)
{
// ensure client utils are always injected
this
.
injectClientUtils
();
// function processing
context
=
utils
.
isObject
(
context
)
?
context
:
{};
var
newFn
=
require
(
'injector'
).
create
(
fn
).
process
(
context
);
return
this
.
page
.
evaluate
(
newFn
);
...
...
@@ -628,7 +630,7 @@ Casper.prototype.getTitle = function getTitle() {
*
*/
Casper
.
prototype
.
injectClientUtils
=
function
injectClientUtils
()
{
var
clientUtilsInjected
=
this
.
evaluate
(
function
()
{
var
clientUtilsInjected
=
this
.
page
.
evaluate
(
function
()
{
return
typeof
__utils__
===
"object"
;
});
if
(
true
===
clientUtilsInjected
)
{
...
...
Please
register
or
sign in
to post a comment