aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers
diff options
context:
space:
mode:
authorbitpshr <mail@bitpshr.net>2018-10-30 06:44:04 +0800
committerDan Finlay <542863+danfinlay@users.noreply.github.com>2018-11-06 07:07:09 +0800
commitd4171ccea51db04aa40320de8770e22203d4d6c2 (patch)
treeab73afd0a1d33fba8dff335cdbb728d1f1a6d28b /app/scripts/controllers
parentcc1bab6ebbef8d8219f83039fdc3baca6de718fd (diff)
downloadtangerine-wallet-browser-d4171ccea51db04aa40320de8770e22203d4d6c2.tar
tangerine-wallet-browser-d4171ccea51db04aa40320de8770e22203d4d6c2.tar.gz
tangerine-wallet-browser-d4171ccea51db04aa40320de8770e22203d4d6c2.tar.bz2
tangerine-wallet-browser-d4171ccea51db04aa40320de8770e22203d4d6c2.tar.lz
tangerine-wallet-browser-d4171ccea51db04aa40320de8770e22203d4d6c2.tar.xz
tangerine-wallet-browser-d4171ccea51db04aa40320de8770e22203d4d6c2.tar.zst
tangerine-wallet-browser-d4171ccea51db04aa40320de8770e22203d4d6c2.zip
Disable approval caching
Diffstat (limited to 'app/scripts/controllers')
-rw-r--r--app/scripts/controllers/provider-approval.js20
1 files changed, 17 insertions, 3 deletions
diff --git a/app/scripts/controllers/provider-approval.js b/app/scripts/controllers/provider-approval.js
index 66017c58e..cbdebc3e3 100644
--- a/app/scripts/controllers/provider-approval.js
+++ b/app/scripts/controllers/provider-approval.js
@@ -5,6 +5,11 @@ const ObservableStore = require('obs-store')
*/
class ProviderApprovalController {
/**
+ * Determines if caching is enabled
+ */
+ caching = false
+
+ /**
* Creates a ProviderApprovalController
*
* @param {Object} [config] - Options to configure controller
@@ -44,7 +49,7 @@ class ProviderApprovalController {
*/
_handleProviderRequest (origin) {
this.store.updateState({ providerRequests: [{ origin }] })
- if (this.isApproved(origin)) {
+ if (this.isApproved(origin) && this.caching) {
this.approveProviderRequest(origin)
return
}
@@ -57,8 +62,9 @@ class ProviderApprovalController {
* @param {string} origin - Origin of the window
*/
_handleIsApproved (origin) {
- const isApproved = this.isApproved(origin)
- this.platform && this.platform.sendMessage({ action: 'answer-is-approved', isApproved }, { active: true })
+ const isApproved = this.isApproved(origin) && this.caching
+ const caching = this.caching
+ this.platform && this.platform.sendMessage({ action: 'answer-is-approved', isApproved, caching }, { active: true })
}
/**
@@ -125,6 +131,14 @@ class ProviderApprovalController {
const privacyMode = this.preferencesController.getFeatureFlags().privacyMode
return !privacyMode || this.approvedOrigins[origin]
}
+
+ /**
+ * Tells all tabs that MetaMask is now locked. This is primarily used to set
+ * internal flags in the contentscript and inpage script.
+ */
+ setLocked () {
+ this.platform.sendMessage({ action: 'metamask-set-locked' })
+ }
}
module.exports = ProviderApprovalController