Skip to content

Commit

Permalink
Catch sample script freakylike read exception, expose host to script
Browse files Browse the repository at this point in the history
  • Loading branch information
lwu committed Feb 13, 2007
1 parent b8f3cfc commit a66ce4e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion samples/freakylike.user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,15 @@ class FreakyLike < MouseHole::App
page.document = page_uri.open(options) { |f| f.read }

# http GET script_uri, and apply sandboxed script to document
script = script_uri.open(options) { |f| f.read }
begin
script = script_uri.open(options) { |f| puts f.inspect; f.read }
rescue
warn "Couldn't read #{script_uri}"
end

begin
code = %{
$host = #{marshal_dump(mH)}
page = MouseHole::Page.restore(#{marshal_dump(page.to_a)})
eval #{marshal_dump(script)}
s = ''
Expand Down

0 comments on commit a66ce4e

Please sign in to comment.