|
@@ -12,6 +12,9 @@ const path = require('path')
|
|
|
const url = require('url')
|
|
|
const util = require('util')
|
|
|
|
|
|
+const readFile = util.promisify(fs.readFile)
|
|
|
+const writeFile = util.promisify(fs.writeFile)
|
|
|
+
|
|
|
// Mapping between extensionId(hostname) and manifest.
|
|
|
const manifestMap = {} // extensionId => manifest
|
|
|
const manifestNameMap = {} // name => manifest
|
|
@@ -232,9 +235,9 @@ const getMessagesPath = (extensionId) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-ipcMainUtils.handle('CHROME_GET_MESSAGES', function (event, extensionId) {
|
|
|
+ipcMainUtils.handle('CHROME_GET_MESSAGES', async function (event, extensionId) {
|
|
|
const messagesPath = getMessagesPath(extensionId)
|
|
|
- return fs.readFileSync(messagesPath)
|
|
|
+ return readFile(messagesPath)
|
|
|
})
|
|
|
|
|
|
const validStorageTypes = new Set(['sync', 'local'])
|
|
@@ -267,9 +270,6 @@ const mkdirp = util.promisify((dir, callback) => {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
-const readFile = util.promisify(fs.readFile)
|
|
|
-const writeFile = util.promisify(fs.writeFile)
|
|
|
-
|
|
|
ipcMainUtils.handle('CHROME_STORAGE_READ', async function (event, storageType, extensionId) {
|
|
|
const filePath = getChromeStoragePath(storageType, extensionId)
|
|
|
|