I have cicle (for) in which I open webpages in new pdf docs (getURL method) . After that I call trusted function and save doc. That's how it have to work. But in my case first of all executes trusted function in cycle. (I wrote app.alert() in trusted function to test) and after that begins to open my webpages in pdf.