From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samuel Attard <marshallofsound@electronjs.org>
Date: Tue, 13 Jun 2023 15:36:04 -0700
Subject: expose WebBlob::Path to allow embedders to get file paths

Used to replace the File.path augmentation Electron currently implements.  This is safer / more web-standard technique.

diff --git a/third_party/blink/public/web/web_blob.h b/third_party/blink/public/web/web_blob.h
index 384a59138db11ea38028f844dd67e328ebffbe7b..f153997c2afccef1fa1b64ee5f162c28a2d07e5d 100644
--- a/third_party/blink/public/web/web_blob.h
+++ b/third_party/blink/public/web/web_blob.h
@@ -67,6 +67,7 @@ class BLINK_EXPORT WebBlob {
   void Reset();
   void Assign(const WebBlob&);
   WebString Uuid();
+  std::string Path();
 
   bool IsNull() const { return private_.IsNull(); }
 
diff --git a/third_party/blink/renderer/core/exported/web_blob.cc b/third_party/blink/renderer/core/exported/web_blob.cc
index 0293e21ff874b0ea009f70820896612c1397b2b0..3eb262777b4b80e2fc74b8f4c840f7e25e68e08e 100644
--- a/third_party/blink/renderer/core/exported/web_blob.cc
+++ b/third_party/blink/renderer/core/exported/web_blob.cc
@@ -41,6 +41,7 @@
 #include "third_party/blink/renderer/core/execution_context/execution_context.h"
 #include "third_party/blink/renderer/core/fileapi/blob.h"
 #include "third_party/blink/renderer/core/fileapi/file_backed_blob_factory_dispatcher.h"
+#include "third_party/blink/renderer/core/fileapi/file.h"
 #include "third_party/blink/renderer/platform/blob/blob_data.h"
 #include "third_party/blink/renderer/platform/file_metadata.h"
 #include "third_party/blink/renderer/platform/heap/garbage_collected.h"
@@ -84,6 +85,14 @@ WebString WebBlob::Uuid() {
   return private_->Uuid();
 }
 
+std::string WebBlob::Path() {
+  if (!private_.Get())
+    return "";
+  if (private_->IsFile() && private_->HasBackingFile())
+    return To<File>(private_.Get())->GetPath().Utf8();
+  return "";
+}
+
 v8::Local<v8::Value> WebBlob::ToV8Value(v8::Isolate* isolate) {
   if (!private_.Get())
     return v8::Local<v8::Value>();
