CSP: Replace 'static_cast' with 'toDocument'.

This patch introduces a 'toDocument' helper that casts ExecutionContextClient
objects to Documents with appropriate checks, and migrates
ContentSecurityPolicy off of direct 'static_cast' usage. No web-visible
change, just refactoring for clarity/safety.

Review URL: https://codereview.chromium.org/134863007

git-svn-id: svn://svn.chromium.org/blink/trunk@166714 bbb929c8-8fbe-4397-9dbb-9b2b20218538