Skip to content

Instantly share code, notes, and snippets.

@herberthamaral
Created January 13, 2012 16:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save herberthamaral/1607387 to your computer and use it in GitHub Desktop.
Save herberthamaral/1607387 to your computer and use it in GitHub Desktop.
storage_flood
// função pra floodar o localStorage, com o intuito de saber se o browser simplesmesnte lança uma
// exception quando o storage está cheio ou se o browser pergunta se o user deseja expandir o
// espaço disponível para o localStorage
function flood(){
for(i=0;i<5*1024*1024;i++) {
window.localStorage.setItem(Math.random().toString(), Math.random().toString())
}
}
@diegocaxito
Copy link

Chrome lança exception!!!

@herberthamaral
Copy link
Author

So o opera que não lança, pelos meus testes até agora. Ainda não consegui testar no safari.

@diegocaxito
Copy link

E pra variar o Firefox trava!!

@herberthamaral
Copy link
Author

Safari também lança exception...

@suissa
Copy link

suissa commented Jan 13, 2012

Vixiii q osso, mas ae Herbeth o Opera lança a pergunta neh?

@herberthamaral
Copy link
Author

herberthamaral commented Jan 13, 2012 via email

@herberthamaral
Copy link
Author

Ainda no Chrome 18... e o fdp ainda lança exception :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment