Skip to content

Instantly share code, notes, and snippets.

@guysmoilov
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guysmoilov/63812908330ec5a0aa9e to your computer and use it in GitHub Desktop.
Save guysmoilov/63812908330ec5a0aa9e to your computer and use it in GitHub Desktop.
Meteor browser policy supporting tests
laxBrowserPolicy = ->
BrowserPolicy.content.allowOriginForAll "localhost:*"
BrowserPolicy.content.allowConnectOrigin "ws://localhost:*"
BrowserPolicy.content.allowConnectOrigin "http://localhost:*"
Meteor.startup ->
BrowserPolicy.content.disallowInlineScripts()
BrowserPolicy.content.disallowInlineStyles()
BrowserPolicy.content.disallowEval()
if process.env.IS_MIRROR
console.log "WARNING!!! Setting lax browser policy for mirror"
laxBrowserPolicy()
BrowserPolicy.framing.allowAll()
else if process.env.NODE_ENV is 'development'
console.log "WARNING!!! Setting lax browser policy for development environment"
laxBrowserPolicy()
BrowserPolicy.content.allowFrameOrigin 'http://localhost:*' # This allows client integration tests to run in an iframe inside our dev browser
BrowserPolicy.framing.disallow()
else
console.log "Setting strict browser policy for production"
BrowserPolicy.framing.disallow()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment