From 2f26373dfecbedc704cf0c7227fc487e0ab7824d Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Fri, 28 May 2021 00:12:22 +0200 Subject: [googledrive] Context isolation support --- recipes/googledrive/package.json | 2 +- recipes/googledrive/webview-unsafe.js | 16 ++++++++++++++++ recipes/googledrive/webview.js | 23 +++++++---------------- 3 files changed, 24 insertions(+), 17 deletions(-) create mode 100644 recipes/googledrive/webview-unsafe.js diff --git a/recipes/googledrive/package.json b/recipes/googledrive/package.json index 20c2d39..725c25b 100644 --- a/recipes/googledrive/package.json +++ b/recipes/googledrive/package.json @@ -1,7 +1,7 @@ { "id": "googledrive", "name": "Google Drive", - "version": "1.0.7", + "version": "2.0.0", "description": "Google Drive", "main": "index.js", "author": "Djonathan Goulart", diff --git a/recipes/googledrive/webview-unsafe.js b/recipes/googledrive/webview-unsafe.js new file mode 100644 index 0000000..9198ac5 --- /dev/null +++ b/recipes/googledrive/webview-unsafe.js @@ -0,0 +1,16 @@ +const notImplemented = () => { + console.warn('chrome.runtime is not implemented'); +}; + +window.chrome = { + runtime: { + connect: () => ({ + onMessage: { + addListener: notImplemented, + removeListener: notImplemented, + }, + postMessage: notImplemented, + disconnect: notImplemented, + }), + }, +}; diff --git a/recipes/googledrive/webview.js b/recipes/googledrive/webview.js index 64a0219..1678825 100644 --- a/recipes/googledrive/webview.js +++ b/recipes/googledrive/webview.js @@ -1,16 +1,7 @@ -module.exports = (Franz, options) => { - window.chrome = { - runtime: { - connect: () => { - return { - onMessage: { - addListener: () => {console.warn('chrome.runtime is not implemented')}, - removeListener: () => {console.warn('chrome.runtime is not implemented')}, - }, - postMessage: () => {console.warn('chrome.runtime is not implemented')}, - disconnect: () => {console.warn('chrome.runtime is not implemented')}, - } - } - } - } -} \ No newline at end of file +"use strict"; + +const path = require('path'); + +module.exports = (Franz) => { + Franz.injectJSUnsafe(path.join(__dirname, 'webview-unsafe.js')); +}; -- cgit v1.2.3-54-g00ecf