From 3a79eacb6f44eadb6c17d725755d4278f62993dc Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Fri, 31 Aug 2018 20:29:00 +0200 Subject: [PATCH] refactor: don't expose CallbacksRegistry as an internal module (#14389) --- filenames.gypi | 2 +- lib/common/api/module-list.js | 1 - lib/renderer/api/remote.js | 3 ++- lib/{common/api => renderer}/callbacks-registry.js | 0 lib/sandboxed_renderer/api/module-list.js | 5 ----- spec/api-callbacks-registry-spec.js | 2 +- 6 files changed, 4 insertions(+), 9 deletions(-) rename lib/{common/api => renderer}/callbacks-registry.js (100%) diff --git a/filenames.gypi b/filenames.gypi index 16aa91e680..a7563a699c 100644 --- a/filenames.gypi +++ b/filenames.gypi @@ -48,7 +48,6 @@ 'lib/browser/init.js', 'lib/browser/objects-registry.js', 'lib/browser/rpc-server.js', - 'lib/common/api/callbacks-registry.js', 'lib/common/api/clipboard.js', 'lib/common/api/crash-reporter.js', 'lib/common/api/deprecate.js', @@ -63,6 +62,7 @@ 'lib/common/init.js', 'lib/common/parse-features-string.js', 'lib/common/reset-search-paths.js', + 'lib/renderer/callbacks-registry.js', 'lib/renderer/chrome-api.js', 'lib/renderer/content-scripts-injector.js', 'lib/renderer/init.js', diff --git a/lib/common/api/module-list.js b/lib/common/api/module-list.js index 00c208c805..2353c4bd6b 100644 --- a/lib/common/api/module-list.js +++ b/lib/common/api/module-list.js @@ -5,7 +5,6 @@ module.exports = [ {name: 'nativeImage', file: 'native-image'}, {name: 'shell', file: 'shell'}, // The internal modules, invisible unless you know their names. - {name: 'CallbacksRegistry', file: 'callbacks-registry', private: true}, {name: 'deprecate', file: 'deprecate', private: true}, {name: 'deprecations', file: 'deprecations', private: true}, {name: 'isPromise', file: 'is-promise', private: true} diff --git a/lib/renderer/api/remote.js b/lib/renderer/api/remote.js index 1f974e946a..54f4b88e8f 100644 --- a/lib/renderer/api/remote.js +++ b/lib/renderer/api/remote.js @@ -1,9 +1,10 @@ 'use strict' const v8Util = process.atomBinding('v8_util') -const {ipcRenderer, isPromise, CallbacksRegistry} = require('electron') +const {ipcRenderer, isPromise} = require('electron') const resolvePromise = Promise.resolve.bind(Promise) +const CallbacksRegistry = require('../callbacks-registry') const bufferUtils = require('../../common/buffer-utils') const callbacksRegistry = new CallbacksRegistry() diff --git a/lib/common/api/callbacks-registry.js b/lib/renderer/callbacks-registry.js similarity index 100% rename from lib/common/api/callbacks-registry.js rename to lib/renderer/callbacks-registry.js diff --git a/lib/sandboxed_renderer/api/module-list.js b/lib/sandboxed_renderer/api/module-list.js index 845cb1d406..7f982f946e 100644 --- a/lib/sandboxed_renderer/api/module-list.js +++ b/lib/sandboxed_renderer/api/module-list.js @@ -1,11 +1,6 @@ const features = process.atomBinding('features') module.exports = [ - { - name: 'CallbacksRegistry', - load: () => require('../../common/api/callbacks-registry'), - private: true - }, { name: 'crashReporter', load: () => require('../../common/api/crash-reporter') diff --git a/spec/api-callbacks-registry-spec.js b/spec/api-callbacks-registry-spec.js index e478e49d1a..fadf2f4ad4 100644 --- a/spec/api-callbacks-registry-spec.js +++ b/spec/api-callbacks-registry-spec.js @@ -4,7 +4,7 @@ const dirtyChai = require('dirty-chai') const {expect} = chai chai.use(dirtyChai) -const {CallbacksRegistry} = require('electron') +const CallbacksRegistry = require('../lib/renderer/callbacks-registry') describe('CallbacksRegistry module', () => { let registry = null