1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

WIP: indexdb is at an err state "provider is undefined"

This commit is contained in:
frankiebee 2017-03-23 11:41:32 -07:00
parent 45ab81fb45
commit 197e6e0b77
5 changed files with 26 additions and 13 deletions

View File

@ -11,7 +11,6 @@ module.exports = initializePopup
function initializePopup (connectionStream) {
// setup app
debugger
connectToAccountManager(connectionStream, setupApp)
}

View File

@ -51,19 +51,35 @@ module.exports = class IndexDbController extends EventEmitter {
return this.requestObjectStore(key)
.then((dataObject)=> {
return new Promise((resolve, reject) => {
const getRequest = dataObject.get(key)
getRequest.onsuccess = (event) => resolve(event.currentTarget.result)
getRequest.onerror = (event) => reject(event)
const getRequest = dataObject.get(key)
getRequest.onsuccess = (event) => {
const serialized = event.currentTarget.result
try {
console.log('serialized:',serialized)
const state = serialized ? JSON.parse(serialized) : {}
resolve(state)
} catch (err) {
reject(err)
}
}
getRequest.onerror = (event) => reject(event)
})
})
})
}
put (key, store) {
put (key, state) {
return this.requestObjectStore(key, 'readwrite')
.then((dataObject)=> {
const putRequest = dataObject.put(store)
putRequest.onsuccess = (event) => Promise.resolve(event.currentTarget.result)
putRequest.onerror = (event) => Promise.reject(event)
return new Promise((resolve, reject) => {
try {
const serialized = JSON.stringify(state)
const putRequest = dataObject.put(serialized)
putRequest.onsuccess = (event) => resolve(event.currentTarget.result)
putRequest.onerror = (event) => reject(event)
} catch (err) {
reject(err)
}
})
})
}

View File

@ -5,7 +5,6 @@ module.exports = setupIframe
function setupIframe(opts) {
debugger
opts = opts || {}
var frame = Iframe({
src: opts.zeroClientProvider || 'https://zero.metamask.io/',

View File

@ -141,8 +141,8 @@ function setupController (initState, client) {
// storeTransform(versionifyData),
// diskStore
// )
controller.store.subscribe((store) => {
dbController.put('dataStore', store)
controller.store.subscribe((state) => {
dbController.put('dataStore', state)
// .then((event) => {debugger})
// .catch((err) => {debugger})
})

View File

@ -14,7 +14,6 @@ log.setLevel(debugMode ? 'debug' : 'warn')
function launchApp (opts) {
var accountManager = opts.accountManager
actions._setBackgroundConnection(accountManager)
debugger
// check if we are unlocked first
accountManager.getState(function (err, metamaskState) {
if (err) throw err