Skip to content

Commit

Permalink
Fix infinite loop when third-party cookies are disabled (Shopify#684)
Browse files Browse the repository at this point in the history
* Fix infinite loop when third-party cookies are disabled

* Resolve sqlite3 dependency
  • Loading branch information
nwtn committed Feb 6, 2019
1 parent f084904 commit 012b32b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions app/assets/javascripts/shopify_app/storage_access.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@
}

StorageAccessHelper.prototype.grantedStorageAccess = function() {
sessionStorage.setItem('shopify.granted_storage_access', true);
document.cookie = 'shopify.granted_storage_access=true';
this.redirectToAppHome();
try {
sessionStorage.setItem('shopify.granted_storage_access', true);
document.cookie = 'shopify.granted_storage_access=true';
this.redirectToAppHome();
} catch (error) {
console.warn('Third party cookies may be blocked.', error);
this.redirectToAppTLD(ACCESS_DENIED_STATUS);
}
}

StorageAccessHelper.prototype.handleRequestStorageAccess = function() {
Expand Down
2 changes: 1 addition & 1 deletion shopify_app.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Gem::Specification.new do |s|

s.add_development_dependency('rake')
s.add_development_dependency('byebug')
s.add_development_dependency('sqlite3')
s.add_development_dependency('sqlite3', '~> 1.3.6')
s.add_development_dependency('minitest')
s.add_development_dependency('mocha')

Expand Down

0 comments on commit 012b32b

Please sign in to comment.