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

@ -0,0 +1,15 @@
/* global chrome */
const testMap = {
getManifest () {
const manifest = chrome.runtime.getManifest()
console.log(JSON.stringify(manifest))
}
}
const dispatchTest = (event) => {
const testName = event.data
const test = testMap[testName]
test()
}
window.addEventListener('message', dispatchTest, false)

View file

@ -0,0 +1,12 @@
{
"name": "chrome-api",
"version": "1.0",
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["main.js"],
"run_at": "document_start"
}
],
"manifest_version": 2
}