this is a slightly modified version of the file from bug 965711 (see 9e003439f5cd5fbcfac7dd5d56b0f74cfd740ede)