Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P5823
do-tool.js
Active
Public
Actions
Authored by
zhuyifei1999
on Jul 30 2017, 5:02 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F8908887: do-tool.js
Jul 30 2017, 5:02 PM
2017-07-30 17:02:23 (UTC+0)
Subscribers
None
var
page
=
require
(
'webpage'
).
create
(),
fs
=
require
(
'fs'
),
system
=
require
(
'system'
),
address
;
page
.
onError
=
function
(
msg
,
trace
)
{
var
msgStack
=
[
'ERROR: '
+
msg
];
if
(
trace
&&
trace
.
length
)
{
msgStack
.
push
(
'TRACE:'
);
trace
.
forEach
(
function
(
t
)
{
msgStack
.
push
(
' -> '
+
t
.
file
+
': '
+
t
.
line
+
(
t
.
function
?
' (in function "'
+
t
.
function
+
'")'
:
''
));
});
}
console
.
error
(
msgStack
.
join
(
'\n'
));
};
page
.
onResourceRequested
=
function
(
requestData
,
networkRequest
)
{
console
.
log
(
requestData
.
url
);
};
if
(
system
.
args
.
length
!=
2
)
{
console
.
log
(
'Usage ERROR'
);
phantom
.
exit
(
1
);
}
else
{
address
=
system
.
args
[
1
];
page
.
open
(
address
,
function
(
status
)
{
if
(
status
!==
'success'
)
{
console
.
log
(
'Unable to load the address!'
);
phantom
.
exit
(
1
);
}
else
{
window
.
setTimeout
(
function
()
{
phantom
.
exit
();
},
1000
);
}
});
}
Event Timeline
zhuyifei1999
created this paste.
Jul 30 2017, 5:02 PM
2017-07-30 17:02:23 (UTC+0)
zhuyifei1999
mentioned this in
T172065: Hunt for Toolforge tools that load resources from third party sites
.
Jul 30 2017, 5:41 PM
2017-07-30 17:41:32 (UTC+0)
Log In to Comment