Skip to content

Commit

Permalink
fix: check process.isMainFrame in sandboxed_renderer/init.js (#16500)
Browse files Browse the repository at this point in the history
  • Loading branch information
miniak authored and codebytere committed Jan 24, 2019
1 parent e6952e2 commit fef262f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/renderer/web-view/web-view-init.js
Expand Up @@ -17,7 +17,7 @@ function handleFocusBlur (guestInstanceId) {
}

module.exports = function (contextIsolation, webviewTag, guestInstanceId) {
// Load webview tag implementation.
// Don't allow recursive `<webview>`.
if (webviewTag && guestInstanceId == null) {
const webViewImpl = require('@electron/internal/renderer/web-view/web-view-impl')
if (contextIsolation) {
Expand Down
8 changes: 6 additions & 2 deletions lib/sandboxed_renderer/init.js
Expand Up @@ -127,7 +127,9 @@ switch (window.location.protocol) {
const guestInstanceId = binding.guestInstanceId && parseInt(binding.guestInstanceId)

// Load webview tag implementation.
require('@electron/internal/renderer/web-view/web-view-init')(contextIsolation, isWebViewTagEnabled, guestInstanceId)
if (process.isMainFrame) {
require('@electron/internal/renderer/web-view/web-view-init')(contextIsolation, isWebViewTagEnabled, guestInstanceId)
}

const errorUtils = require('@electron/internal/common/error-utils')

Expand Down Expand Up @@ -176,4 +178,6 @@ try {
}

// Warn about security issues
require('@electron/internal/renderer/security-warnings')()
if (process.isMainFrame) {
require('@electron/internal/renderer/security-warnings')()
}

0 comments on commit fef262f

Please sign in to comment.