Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove potential double free when managing WebContents #15280

Merged
merged 2 commits into from Oct 22, 2018

Conversation

Projects
None yet
3 participants
@zcbenz
Copy link
Member

commented Oct 19, 2018

Description of Change

When creating V8 wrapper for WebContents there is a short time that we have 2 unique_ptr pointing to the same memory.

This PR refactors the code to avoid doing that, and make our interface take unique_ptr as parameter to avoid that in future.

Checklist

  • PR description included and stakeholders cc'd
  • npm test passes
  • tests are changed or added
  • relevant documentation is changed or added
  • PR title follows semantic commit guidelines

Release Notes

Notes: Remove potential double free when managing WebContents

refactor: remove -new-contents-created event
Chromium expects us to take ownership of WebContents in AddNewContents,
we should not create V8 wrapper in WebContentsCreated, otherwise we
would have WebContents being managed by 2 unique_ptr at the same time.

@zcbenz zcbenz requested a review from as a code owner Oct 19, 2018

@zcbenz zcbenz force-pushed the fix-potential-double-free branch from a083378 to 2ea8d9e Oct 19, 2018

@deepak1556
Copy link
Member

left a comment

👍

// TODO(zcbenz): Make InitWithWebContents take unique_ptr.
// At the time of writing we are going through a refactoring and I don't want
// to make other people's work harder.
InitWithWebContents(owned_web_contents.release(), session->browser_context(),

This comment has been minimized.

Copy link
@deepak1556

deepak1556 Oct 22, 2018

Member

When fixing this, can you also move some of the CreateForWebContents there, would simply api layer.

@ckerr ckerr merged commit cb9be09 into master Oct 22, 2018

27 checks passed

Absolute Zero
Artifact Comparison No Changes
Details
Semantic Pull Request ready to be squashed
Details
WIP ready for review
Details
appveyor: win-ia32-debug AppVeyor build succeeded
Details
appveyor: win-ia32-testing AppVeyor build succeeded
Details
appveyor: win-ia32-testing-pr AppVeyor build succeeded
Details
appveyor: win-x64-debug AppVeyor build succeeded
Details
appveyor: win-x64-testing AppVeyor build succeeded
Details
appveyor: win-x64-testing-pr AppVeyor build succeeded
Details
ci/circleci: linux-arm-debug Your tests passed on CircleCI!
Details
ci/circleci: linux-arm-testing Your tests passed on CircleCI!
Details
ci/circleci: linux-arm64-debug Your tests passed on CircleCI!
Details
ci/circleci: linux-arm64-testing Your tests passed on CircleCI!
Details
ci/circleci: linux-checkout Your tests passed on CircleCI!
Details
ci/circleci: linux-ia32-debug Your tests passed on CircleCI!
Details
ci/circleci: linux-ia32-testing Your tests passed on CircleCI!
Details
ci/circleci: linux-ia32-testing-tests Your tests passed on CircleCI!
Details
ci/circleci: linux-x64-debug Your tests passed on CircleCI!
Details
ci/circleci: linux-x64-testing Your tests passed on CircleCI!
Details
ci/circleci: linux-x64-testing-tests Your tests passed on CircleCI!
Details
electron-arm-testing Build #20181019.26 succeeded
Details
electron-arm64-testing Build #20181019.26 succeeded
Details
electron-lint Build #20181019.25 succeeded
Details
electron-mas-testing Build #20181019.39 succeeded
Details
electron-osx-testing Build #20181019.40 succeeded
Details
release-notes Release notes found

@ckerr ckerr deleted the fix-potential-double-free branch Oct 22, 2018

@release-clerk

This comment has been minimized.

Copy link

commented Oct 22, 2018

Release Notes Persisted

Remove potential double free when managing WebContents

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.