fix crash when passing empty string to recording (#17698)
This commit is contained in:
parent
c4020308c9
commit
2b9bd0f56f
2 changed files with 7 additions and 2 deletions
|
@ -12,6 +12,7 @@
|
|||
#include "atom/common/promise_util.h"
|
||||
#include "base/bind.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "content/public/browser/tracing_controller.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
|
||||
|
@ -58,6 +59,11 @@ scoped_refptr<TracingController::TraceDataEndpoint> GetTraceDataEndpoint(
|
|||
const base::FilePath& path,
|
||||
const CompletionCallback& callback) {
|
||||
base::FilePath result_file_path = path;
|
||||
|
||||
// base::CreateTemporaryFile prevents blocking so we need to allow it
|
||||
// for now since offloading this to a different sequence would require
|
||||
// changing the api shape
|
||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||
if (result_file_path.empty() && !base::CreateTemporaryFile(&result_file_path))
|
||||
LOG(ERROR) << "Creating temporary file failed";
|
||||
|
||||
|
|
|
@ -214,8 +214,7 @@ describe('contentTracing', () => {
|
|||
expect(resultFilePath).to.be.a('string').and.be.equal(outputFilePath)
|
||||
})
|
||||
|
||||
// FIXME(alexeykuzmin): https://github.com/electron/electron/issues/16019
|
||||
xit('creates a temporary file when an empty string is passed', async function () {
|
||||
it('creates a temporary file when an empty string is passed', async function () {
|
||||
const resultFilePath = await record(/* options */ {}, /* outputFilePath */ '')
|
||||
expect(resultFilePath).to.be.a('string').that.is.not.empty()
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue