Make nonceTools.getNonce robust to undefined document.querySelector().
Make nonceTools.getNonce robust to undefined document.querySelector().

This is the source of the errors like "[object Error]: TypeError: Object doesn't support property or method 'querySelector'", which are killing at least 30M ad queries per day.

We tried introducing tagging.common.util.getNonceSafely() which wraps getNonce() in a try..catch, but unwrapped uses of this method keep sneaking back into our code, e.g. through goog.dom.safe.setScriptSrc().

Tested:
  Added new unit test.

RELNOTES: n/a

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=201004254

teppeis/closure-library,google/closure-library,google/closure-library,teppeis/closure-library,lucidsoftware/closure-library,teppeis/closure-library,google/closure-library,teppeis/closure-library,lucidsoftware/closure-library,lucidsoftware/closure-library,google/closure-library,lucidsoftware/closure-library,google/closure-library