Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit af7e0bd

Browse files
committed
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
1 parent bd524fc commit af7e0bd

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/ng/sniffer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function $SnifferProvider() {
4141

4242
return eventSupport[event];
4343
},
44-
csp: document.SecurityPolicy ? document.SecurityPolicy.isActive() : false
44+
csp: document.securityPolicy ? document.securityPolicy.isActive : false
4545
};
4646
}];
4747
}

test/ng/snifferSpec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,14 @@ describe('$sniffer', function() {
8282

8383

8484
describe('csp', function() {
85-
it('should be false if document.SecurityPolicy.isActive not available', function() {
85+
it('should be false if document.securityPolicy.isActive not available', function() {
8686
expect(sniffer({}, {}).csp).toBe(false);
8787
});
8888

8989

90-
it('should use document.SecurityPolicy.isActive() if available', function() {
90+
it('should use document.securityPolicy.isActive if available', function() {
9191
var createDocumentWithCSP = function(csp) {
92-
return {SecurityPolicy: {isActive: function() {return csp;}}};
92+
return {securityPolicy: {isActive: csp}};
9393
};
9494

9595
expect(sniffer({}, createDocumentWithCSP(false)).csp).toBe(false);

0 commit comments

Comments
 (0)