Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manifest version 2 and CSP #102

Closed
neocotic opened this issue May 18, 2012 · 2 comments
Closed

Manifest version 2 and CSP #102

neocotic opened this issue May 18, 2012 · 2 comments
Assignees
Milestone

Comments

@neocotic
Copy link
Member

Update the manifest to version 2 and raise the minimum Chrome version to 18 in order to be compatible with this change. Make all the necessary changes to the manifest to support the new version, including the updates to support the new default Content Security Policy. This change will mainly involve wrapping all CoffeeScript code in a DOM-ready wrapper function;

# With jQuery
$ ->
  # ...

# Without jQuery
document.addEventListener 'DOMContentLoaded', ->
  # ...

This adds no points to style but is the easiest/best way to implement this. All inline <script/> elements and event attributes (e.g. onload, onclick) will also need to be abstracted to the corresponding CoffeeScript file.

@ghost ghost assigned neocotic May 18, 2012
@neocotic
Copy link
Member Author

I've missed something obvious here. Since only the init() method of the page scripts (e.g. background, options, notification) need to be executed when the DOM is ready, then each script should now include it's own call to init(), wrapped in the appropriate event handler.

For simplicity, I'm tempted to create a new utils.ready(handler) method that binds the function argument to either DOMContentLoaded or $.ready depending on whether or not jQuery is available;

utils.ready = (handler) ->
  if jQuery?
    jQuery handler
  else
    document.addEventListener 'DOMContentLoaded', handler

For example, the script for the background page would now include the following at the end of it;

utils.ready ->
  ext.init()

@neocotic
Copy link
Member Author

I've had to add workaround fixes for the oauth2-extensions library and UserVoice widget. There's already a pull request for the first and I've made UserVoice aware of their compatibility and they're now looking into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant