Make CJS_Result::Error() return const-ref.
No need to construct a new WideString.
Change-Id: I73c955166fd8ecfbdaaefe9ba2de3252117d1860
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/87830
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fxjs/cjs_result.h b/fxjs/cjs_result.h
index 9d007b5..d2265ac 100644
--- a/fxjs/cjs_result.h
+++ b/fxjs/cjs_result.h
@@ -39,7 +39,7 @@
~CJS_Result();
bool HasError() const { return error_.has_value(); }
- WideString Error() const { return error_.value(); }
+ const WideString& Error() const { return error_.value(); }
bool HasReturn() const { return !return_.IsEmpty(); }
v8::Local<v8::Value> Return() const { return return_; }