Skip to content

Commit

Permalink
Fix the usage of SubtleCrypto API on old Chrome (37, 38, 39). (#4357)
Browse files Browse the repository at this point in the history
  • Loading branch information
lannka committed Aug 3, 2016
1 parent fe63400 commit 05fe61b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion extensions/amp-analytics/0.1/crypto-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class Crypto {
sha384(input) {
if (this.subtle_) {
try {
return this.subtle_.digest('SHA-384',
return this.subtle_.digest({name: 'SHA-384'},
input instanceof Uint8Array ? input : str2ab(input))
// [].slice.call(Unit8Array) is a shim for Array.from(Unit8Array)
.then(buffer => [].slice.call(new Uint8Array(buffer)),
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-analytics/0.1/test/test-crypto-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ describe('crypto-impl', () => {

function isModernChrome() {
const platform = new Platform(window);
return platform.isChrome() && platform.getMajorVersion() >= 45;
return platform.isChrome() && platform.getMajorVersion() >= 37;
}

beforeEach(() => {
Expand Down

0 comments on commit 05fe61b

Please sign in to comment.