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

Comments

Projects
None yet
1 participant
@neocotic
Member

neocotic commented May 18, 2012

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

This comment has been minimized.

Show comment
Hide comment
@neocotic

neocotic May 21, 2012

Member

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()
Member

neocotic commented May 21, 2012

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

This comment has been minimized.

Show comment
Hide comment
@neocotic

neocotic May 22, 2012

Member

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.

Member

neocotic commented May 22, 2012

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