feat: add chrome.runtime.getManifest (#16891)

* feat: add chrome.runtime.getManifest

* Add test for chrome.runtime.getManifest

* Use IPC utils for getManifest internals
This commit is contained in:
Samuel Maddock 2019-02-13 12:16:12 -05:00 committed by John Kleinschmidt
parent 46f818b0c3
commit 8f6a543398
5 changed files with 89 additions and 0 deletions

View file

@ -1,6 +1,7 @@
'use strict'
const ipcRenderer = require('@electron/internal/renderer/ipc-renderer-internal')
const ipcRendererUtils = require('@electron/internal/renderer/ipc-renderer-internal-utils')
const Event = require('@electron/internal/renderer/extensions/event')
const url = require('url')
@ -93,6 +94,11 @@ exports.injectTo = function (extensionId, isBackgroundPage, context) {
})
},
getManifest: function () {
const manifest = ipcRendererUtils.invokeSync('CHROME_EXTENSION_MANIFEST', extensionId)
return manifest
},
connect (...args) {
if (isBackgroundPage) {
console.error('chrome.runtime.connect is not supported in background page')