Skip to content

Platform.global implementation breaks Chrome Apps CSP #25

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

Closed
AshleyGrant opened this issue Jun 8, 2017 · 7 comments
Closed

Platform.global implementation breaks Chrome Apps CSP #25

AshleyGrant opened this issue Jun 8, 2017 · 7 comments
Labels

Comments

@AshleyGrant
Copy link
Contributor

I'm submitting a bug report

  • Library Version:
    1.3.0

Please tell us about your environment:

  • Operating System:
    all

  • Node Version:
    n/a

  • NPM Version:
    n/a

  • JSPM OR Webpack AND Version
    n/a

  • Browser:
    Chrome Web Apps

  • Language:
    all

Current behavior:
According to paulmillr/es6-shim#301 and https://github.com/tc39/proposal-global, our current implementation for finding the global will fail when run in Chrome Web Apps due to a CSP issue.

Expected/desired behavior:
For it to work in all possible environments

es6-shim uses the following:
var getGlobal = function () {
// the only reliable means to get the global object is
// Function('return this')()
// However, this causes CSP violations in Chrome apps.
if (typeof self !== 'undefined') { return self; }
if (typeof window !== 'undefined') { return window; }
if (typeof global !== 'undefined') { return global; }
throw new Error('unable to locate global object');
};

(pulled from https://github.com/tc39/proposal-global )

  • What is the motivation / use case for changing the behavior?
    Allow Aurelia to work everywhere possible
@EisenbergEffect
Copy link
Contributor

@AshleyGrant Can you submit a PR?

@Alexander-Taran
Copy link
Contributor

seems kinda done

if (typeof self !== 'undefined') {

@EisenbergEffect
Copy link
Contributor

@AshleyGrant Can you confirm and close if we're good?

@AshleyGrant
Copy link
Contributor Author

Looks like it is missing

if (typeof window !== 'undefined') { return window; }

@EisenbergEffect
Copy link
Contributor

Who wants to submit a PR?

@EisenbergEffect
Copy link
Contributor

No PR after a year, so closing.

@AshleyGrant
Copy link
Contributor Author

Given that Chrome Web Apps have been deprecated, I don't see any reason to fix this, so I'm fine with the closure.

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

No branches or pull requests

3 participants