Skip to content

Commit

Permalink
limiting how much damage this extension can do
Browse files Browse the repository at this point in the history
  • Loading branch information
danielribeiro committed Dec 10, 2010
1 parent 7aa8d96 commit 3863249
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ end

desc "compile all coffeescripts and start watching them"
task :compile_watch do
compileAll
compileall
system "watchr", 'compileall.rb'
end

Expand All @@ -33,5 +33,5 @@ task :package do
require 'fileutils'
FileUtils.mkpath 'pkg'
compileall
system 'zip', *%w[-r pkg/powerhistory.xpi chrome install.rdf chrome]
system 'zip', *%w[-r pkg/powerhistory.xpi chrome.manifest chrome install.rdf chrome]
end
11 changes: 10 additions & 1 deletion chrome/content/pwbrowser.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ class PowerHistoryClass
@search() if event.keyCode == KEY_ENTER

constructor: ->
@visitedDomains = {}
@asyncCounter = new AsyncCounter()
@searchinput = ui.textbox()
@searchinput.addEventListener('keypress', ((e) => @handleKey(e)), true)
Expand Down Expand Up @@ -214,6 +215,7 @@ class PowerHistoryClass


clearContent: ->
@visitedDomains = {}
@asyncCounter.reset()
while @content.hasChildNodes()
@content.removeChild @content.firstChild
Expand Down Expand Up @@ -315,7 +317,14 @@ class PowerHistoryClass
uri = @ioService.newURI url, null, null
channel = @ioService.newChannelFromURI uri
listener = new StreamListener channel, callback
channel.asyncOpen listener, null
domain = url.split('/')[2]
unless @visitedDomains[domain]
@visitedDomains[domain] = true
channel.asyncOpen listener, null
return
setTimeout((-> channel.asyncOpen listener, null), 10000)
return


_stripHtml: (text) -> text.replace /<.*?>/g, ''

Expand Down
15 changes: 13 additions & 2 deletions chrome/content/pwbrowser.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3863249

Please sign in to comment.