Comparing two password-protected files - prompted *twice* to enter password for second file

I have two password-protected files A and B. I open file A (and am prompted to enter its password) and then select File | Compare Document and open file B. At this point I am prompted twice in succession to enter B’s password.

Is that a bug or is it expected behaviour?

Dependency tree for Bug 125674
Dependency tree for Bug 108914