Skip to content

refactor: be more precise when creating api::WebContents - #23128

Merged
nornagon merged 3 commits into
masterfrom
precise-webcontents-wrapper-creation
Apr 23, 2021
Merged

nornagon merged 3 commits into
masterfrom
precise-webcontents-wrapper-creation

Conversation

@nornagon

@nornagon nornagon commented Apr 15, 2020 •

Copy link
Copy Markdown
Contributor

Description of Change

This removes one usage of GetWebContentsFromProcessID, which is important as there can potentially be several WebContents relating to a given process ID.

Previously, we were using RenderProcessReady to be a "backstop" for catching certain unusual paths for creation of WebContents instances. In particular, the WebContents that are created for devtools, and those that are created for guest views (specifically, mime viewer guest views, i.e. for the pdfium pdf viewer).

This PR shifts the creation of the api::WebContents wrapper for devtools to be explicitly created at the same time as the devtools content::WebContents, and similarly for extension background pages and mime view handlers (i.e. pdf viewer guest views).

Checklist

Release Notes

Notes: none

@electron-cation electron-cation Bot added new-pr 🌱 PR opened recently and removed new-pr 🌱 PR opened recently labels Apr 15, 2020
zcbenz
zcbenz previously requested changes Apr 27, 2020

@zcbenz zcbenz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are tests failing:

Unhandled exception in main spec runner: AssertionError: expected 9 to equal 10
    at Immediate.<anonymous> (/home/builduser/project/src/electron/spec-main/api-app-spec.ts:410:39)
    at processImmediate (internal/timers.js:456:21) {
  message: 'expected 9 to equal 10',
  showDiff: true,
  actual: 9,
  expected: 10
}
not ok 23 app module BrowserWindow events should emit web-contents-created event when a webContents is created
  AssertionError: expected 9 to equal 10
      at Immediate.<anonymous> (electron/spec-main/api-app-spec.ts:410:39)
      at processImmediate (internal/timers.js:456:21)

@zcbenz zcbenz added the wip ⚒ label Jul 21, 2020
@nornagon
nornagon force-pushed the precise-webcontents-wrapper-creation branch from 1255241 to 3821a85 Compare April 21, 2021 21:22
@nornagon nornagon added the semver/patch backwards-compatible bug fixes label Apr 21, 2021
@nornagon nornagon removed the wip ⚒ label Apr 22, 2021
@nornagon
nornagon requested review from deepak1556 and zcbenz April 22, 2021 22:08
@nornagon
nornagon dismissed zcbenz’s stale review April 23, 2021 01:00

tests are now fixed

@nornagon
nornagon merged commit dc7fa1d into master Apr 23, 2021
@release-clerk

release-clerk Bot commented Apr 23, 2021

Copy link
Copy Markdown

No Release Notes

@nornagon
nornagon deleted the precise-webcontents-wrapper-creation branch April 23, 2021 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants