From 76f4bd01eb6e9d31f39ec945a680528b8ec82323 Mon Sep 17 00:00:00 2001 From: Jhen Date: Thu, 30 Jun 2016 15:45:03 +0800 Subject: [PATCH] Support background.page in extension manifest --- lib/browser/chrome-extension.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/browser/chrome-extension.js b/lib/browser/chrome-extension.js index e3cd4540780e..68b86ee4983c 100644 --- a/lib/browser/chrome-extension.js +++ b/lib/browser/chrome-extension.js @@ -72,10 +72,15 @@ const backgroundPages = {} const startBackgroundPages = function (manifest) { if (backgroundPages[manifest.extensionId] || !manifest.background) return - const scripts = manifest.background.scripts.map((name) => { - return `` - }).join('') - const html = new Buffer(`${scripts}`) + let html + if (manifest.background.page) { + html = fs.readFileSync(path.join(manifest.srcDirectory, manifest.background.page)) + } else { + const scripts = manifest.background.scripts.map((name) => { + return `` + }).join('') + html = new Buffer(`${scripts}`) + } const contents = webContents.create({ isBackgroundPage: true,