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

Editor: Changed createObjectUrl to createBlobURL #10135

Merged
merged 2 commits into from
Sep 28, 2018

Conversation

gziolo
Copy link
Member

@gziolo gziolo commented Sep 24, 2018

Follow-up for the work started by @caxco93 in #7734.

Description

Changed createObjectUrl to createBlobURL from the @wordpress/editor package.

How has this been tested?

Included tests and manually

Types of changes

Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

@gziolo gziolo self-assigned this Sep 24, 2018
@gziolo gziolo requested review from aduth and a team September 24, 2018 09:33
@gziolo gziolo added the [Type] Code Quality Issues or PRs that relate to code quality label Sep 24, 2018
@@ -131,7 +132,7 @@ export function mediaUpload( {

// Set temporary URL to create placeholder media file, this is replaced
// with final file from media gallery when upload is `done` below
filesSet.push( { url: window.URL.createObjectURL( mediaFile ) } );
filesSet.push( { url: createBlobURL( mediaFile ) } );
Copy link
Member

Choose a reason for hiding this comment

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

Each call to createBlobURL should eventually have a revokeBlobURL to make sure the file used by the blob is removed from the memory when not need anymore. In this case, revokeBlobURL should be called as soon as createMediaFromFile finishes with success or fails.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added with 80ebf4a 👍

@gziolo gziolo added this to the 4.0 milestone Sep 25, 2018
Copy link
Member

@jorgefilipecosta jorgefilipecosta left a comment

Choose a reason for hiding this comment

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

I tested with successful uploads and uploads that should fail and in both cases, everything went as expected 👍

@gziolo gziolo merged commit 22534e8 into master Sep 28, 2018
@gziolo gziolo deleted the update/use-create-blob-url branch September 28, 2018 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants