chore: rename nativeRequire to potentiallyRemoteRequire (#15971)
This commit is contained in:
parent
442c1b22e3
commit
177091ca6f
4 changed files with 9 additions and 9 deletions
|
@ -6,10 +6,10 @@
|
||||||
// Does not implement predefined messages:
|
// Does not implement predefined messages:
|
||||||
// https://developer.chrome.com/extensions/i18n#overview-predefined
|
// https://developer.chrome.com/extensions/i18n#overview-predefined
|
||||||
|
|
||||||
const { nativeRequire } = require('@electron/internal/renderer/remote')
|
const { potentiallyRemoteRequire } = require('@electron/internal/renderer/remote')
|
||||||
const ipcRenderer = require('@electron/internal/renderer/ipc-renderer-internal')
|
const ipcRenderer = require('@electron/internal/renderer/ipc-renderer-internal')
|
||||||
const fs = nativeRequire('fs')
|
const fs = potentiallyRemoteRequire('fs')
|
||||||
const path = nativeRequire('path')
|
const path = potentiallyRemoteRequire('path')
|
||||||
|
|
||||||
let metadata
|
let metadata
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const { getRemote, nativeRequire } = require('@electron/internal/renderer/remote')
|
const { getRemote, potentiallyRemoteRequire } = require('@electron/internal/renderer/remote')
|
||||||
const fs = nativeRequire('fs')
|
const fs = potentiallyRemoteRequire('fs')
|
||||||
const path = nativeRequire('path')
|
const path = potentiallyRemoteRequire('path')
|
||||||
const app = getRemote('app')
|
const app = getRemote('app')
|
||||||
|
|
||||||
const getChromeStoragePath = (storageType, extensionId) => {
|
const getChromeStoragePath = (storageType, extensionId) => {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const { getRemote, nativeRequire } = require('@electron/internal/renderer/remote')
|
const { getRemote, potentiallyRemoteRequire } = require('@electron/internal/renderer/remote')
|
||||||
|
|
||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
// Use menu API to show context menu.
|
// Use menu API to show context menu.
|
||||||
|
@ -126,7 +126,7 @@ const showFileChooserDialog = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const pathToHtml5FileObject = function (path) {
|
const pathToHtml5FileObject = function (path) {
|
||||||
const fs = nativeRequire('fs')
|
const fs = potentiallyRemoteRequire('fs')
|
||||||
const blob = new Blob([fs.readFileSync(path)])
|
const blob = new Blob([fs.readFileSync(path)])
|
||||||
blob.name = path
|
blob.name = path
|
||||||
return blob
|
return blob
|
||||||
|
|
|
@ -16,7 +16,7 @@ exports.getRemoteFor = function (usage) {
|
||||||
return remote
|
return remote
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.nativeRequire = function (name) {
|
exports.potentiallyRemoteRequire = function (name) {
|
||||||
if (process.sandboxed) {
|
if (process.sandboxed) {
|
||||||
return exports.getRemoteFor(name).require(name)
|
return exports.getRemoteFor(name).require(name)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue