mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
fix(CSP): update to the latest CSP api
window.SecurityPolicy.isActive() is now window.securityPolicy.isActive since this is available only in Chrome Canary which has already been updated, we can safely make this change without worrying about backwards compatilibty. Closes #1577
This commit is contained in:
parent
bd524fc4e5
commit
af7e0bd0a7
2 changed files with 4 additions and 4 deletions
|
|
@ -41,7 +41,7 @@ function $SnifferProvider() {
|
|||
|
||||
return eventSupport[event];
|
||||
},
|
||||
csp: document.SecurityPolicy ? document.SecurityPolicy.isActive() : false
|
||||
csp: document.securityPolicy ? document.securityPolicy.isActive : false
|
||||
};
|
||||
}];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,14 +82,14 @@ describe('$sniffer', function() {
|
|||
|
||||
|
||||
describe('csp', function() {
|
||||
it('should be false if document.SecurityPolicy.isActive not available', function() {
|
||||
it('should be false if document.securityPolicy.isActive not available', function() {
|
||||
expect(sniffer({}, {}).csp).toBe(false);
|
||||
});
|
||||
|
||||
|
||||
it('should use document.SecurityPolicy.isActive() if available', function() {
|
||||
it('should use document.securityPolicy.isActive if available', function() {
|
||||
var createDocumentWithCSP = function(csp) {
|
||||
return {SecurityPolicy: {isActive: function() {return csp;}}};
|
||||
return {securityPolicy: {isActive: csp}};
|
||||
};
|
||||
|
||||
expect(sniffer({}, createDocumentWithCSP(false)).csp).toBe(false);
|
||||
|
|
|
|||
Loading…
Reference in a new issue