From 338c67e4209b5ea37fa3c35610a3fc05bf285e36 Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Mon, 18 May 2015 14:51:54 +0100 Subject: [PATCH] Bug 1163388 - patch 1 - make nsIDOMFile an empty interface, r=ehsan --- dom/archivereader/ArchiveRequest.cpp | 10 +--- dom/base/File.cpp | 57 +++---------------- dom/base/File.h | 9 ++- dom/base/MultipartBlobImpl.cpp | 3 +- dom/base/nsDOMWindowUtils.cpp | 15 +++-- dom/base/nsIDOMFile.idl | 17 +----- .../bluedroid/BluetoothOppManager.cpp | 2 +- dom/bluetooth/bluetooth1/BluetoothService.h | 6 +- .../ipc/BluetoothServiceChildProcess.cpp | 2 +- .../ipc/BluetoothServiceChildProcess.h | 2 +- dom/bluetooth/bluez/BluetoothDBusService.cpp | 2 +- dom/bluetooth/bluez/BluetoothDBusService.h | 2 +- dom/bluetooth/bluez/BluetoothOppManager.cpp | 17 +++--- dom/bluetooth/bluez/BluetoothOppManager.h | 8 +-- dom/html/HTMLInputElement.cpp | 51 +++++++++++++---- dom/html/HTMLInputElement.h | 2 +- dom/html/nsFormSubmission.cpp | 12 ++-- dom/indexedDB/IDBObjectStore.cpp | 8 +-- dom/ipc/Blob.cpp | 10 ++-- dom/webidl/File.webidl | 4 +- dom/webidl/HTMLInputElement.webidl | 2 +- 21 files changed, 108 insertions(+), 133 deletions(-) diff --git a/dom/archivereader/ArchiveRequest.cpp b/dom/archivereader/ArchiveRequest.cpp index 6a857a17a3d4..b840a82b2d12 100644 --- a/dom/archivereader/ArchiveRequest.cpp +++ b/dom/archivereader/ArchiveRequest.cpp @@ -177,7 +177,6 @@ ArchiveRequest::GetFilenamesResult(JSContext* aCx, nsTArray>& aFileList) { JS::Rooted array(aCx, JS_NewArrayObject(aCx, aFileList.Length())); - nsresult rv; if (!array) { return NS_ERROR_OUT_OF_MEMORY; @@ -188,14 +187,12 @@ ArchiveRequest::GetFilenamesResult(JSContext* aCx, nsRefPtr file = aFileList[i]; nsString filename; - rv = file->GetName(filename); - NS_ENSURE_SUCCESS(rv, rv); + file->GetName(filename); str = JS_NewUCStringCopyZ(aCx, filename.get()); NS_ENSURE_TRUE(str, NS_ERROR_OUT_OF_MEMORY); - if (NS_FAILED(rv) || - !JS_DefineElement(aCx, array, i, str, JSPROP_ENUMERATE)) { + if (!JS_DefineElement(aCx, array, i, str, JSPROP_ENUMERATE)) { return NS_ERROR_FAILURE; } } @@ -217,8 +214,7 @@ ArchiveRequest::GetFileResult(JSContext* aCx, nsRefPtr file = aFileList[i]; nsString filename; - nsresult rv = file->GetName(filename); - NS_ENSURE_SUCCESS(rv, rv); + file->GetName(filename); if (filename == mFilename) { if (!ToJSValue(aCx, file, aValue)) { diff --git a/dom/base/File.cpp b/dom/base/File.cpp index a1df543dbf9a..2cb3bde2212b 100644 --- a/dom/base/File.cpp +++ b/dom/base/File.cpp @@ -553,17 +553,16 @@ File::WrapObject(JSContext* aCx, JS::Handle aGivenProto) return FileBinding::Wrap(aCx, this, aGivenProto); } -NS_IMETHODIMP +void File::GetName(nsAString& aFileName) { mImpl->GetName(aFileName); - return NS_OK; } -NS_IMETHODIMP -File::GetPath(nsAString& aPath) +void +File::GetPath(nsAString& aPath, ErrorResult& aRv) { - return mImpl->GetPath(aPath); + mImpl->GetPath(aPath, aRv); } Date @@ -583,53 +582,16 @@ File::GetLastModified(ErrorResult& aRv) return mImpl->GetLastModified(aRv); } -NS_IMETHODIMP -File::GetLastModifiedDate(JSContext* aCx, - JS::MutableHandle aDate) -{ - ErrorResult rv; - Date value = GetLastModifiedDate(rv); - if (rv.Failed()) { - return rv.StealNSResult(); - } - - if (!value.ToDateObject(aCx, aDate)) { - return NS_ERROR_OUT_OF_MEMORY; - } - - return NS_OK; -} - -NS_IMETHODIMP -File::GetMozFullPath(nsAString& aFileName) -{ - ErrorResult rv; - GetMozFullPath(aFileName, rv); - return rv.StealNSResult(); -} - void File::GetMozFullPath(nsAString& aFilename, ErrorResult& aRv) { mImpl->GetMozFullPath(aFilename, aRv); } -NS_IMETHODIMP -File::GetMozFullPathInternal(nsAString& aFileName) +void +File::GetMozFullPathInternal(nsAString& aFileName, ErrorResult& aRv) { - ErrorResult rv; - mImpl->GetMozFullPathInternal(aFileName, rv); - return rv.StealNSResult(); -} - -NS_IMETHODIMP -File::GetMozLastModifiedDate(int64_t* aDate) -{ - MOZ_ASSERT(aDate); - - ErrorResult rv; - *aDate = GetLastModified(rv); - return rv.StealNSResult(); + mImpl->GetMozFullPathInternal(aFileName, aRv); } // Makes sure that aStart and aEnd is less then or equal to aSize and greater @@ -817,12 +779,11 @@ BlobImplBase::GetName(nsAString& aName) aName = mName; } -nsresult -BlobImplBase::GetPath(nsAString& aPath) +void +BlobImplBase::GetPath(nsAString& aPath, ErrorResult& aRv) { NS_ASSERTION(mIsFile, "Should only be called on files"); aPath = mPath; - return NS_OK; } void diff --git a/dom/base/File.h b/dom/base/File.h index c77620871e23..a7ecd7fa1452 100644 --- a/dom/base/File.h +++ b/dom/base/File.h @@ -245,15 +245,18 @@ public: const ChromeFilePropertyBag& aBag, ErrorResult& aRv); - // XPCOM GetName is OK + void GetName(nsAString& aName); int64_t GetLastModified(ErrorResult& aRv); Date GetLastModifiedDate(ErrorResult& aRv); + void GetPath(nsAString& aName, ErrorResult& aRv); void GetMozFullPath(nsAString& aFilename, ErrorResult& aRv); + void GetMozFullPathInternal(nsAString& aName, ErrorResult& aRv); + protected: virtual bool HasFileInterface() const override { return true; } @@ -276,7 +279,7 @@ public: virtual void GetName(nsAString& aName) = 0; - virtual nsresult GetPath(nsAString& aName) = 0; + virtual void GetPath(nsAString& aName, ErrorResult& aRv) = 0; virtual int64_t GetLastModified(ErrorResult& aRv) = 0; @@ -404,7 +407,7 @@ public: virtual void GetName(nsAString& aName) override; - virtual nsresult GetPath(nsAString& aName) override; + virtual void GetPath(nsAString& aName, ErrorResult& aRv) override; virtual int64_t GetLastModified(ErrorResult& aRv) override; diff --git a/dom/base/MultipartBlobImpl.cpp b/dom/base/MultipartBlobImpl.cpp index 3fa6ffa0ccee..a98a3659d041 100644 --- a/dom/base/MultipartBlobImpl.cpp +++ b/dom/base/MultipartBlobImpl.cpp @@ -366,8 +366,7 @@ MultipartBlobImpl::InitializeChromeFile(nsPIDOMWindow* aWindow, } // Pre-cache modified date. - int64_t unusedDate; - aRv = blob->GetMozLastModifiedDate(&unusedDate); + blob->GetLastModified(aRv); if (NS_WARN_IF(aRv.Failed())) { return; } diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index c29abfe70562..24eb63b19b75 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -58,6 +58,7 @@ #include "nsIContentViewer.h" #include "mozilla/StyleAnimationValue.h" #include "mozilla/dom/File.h" +#include "mozilla/dom/FileBinding.h" #include "mozilla/dom/DOMRect.h" #include @@ -2858,15 +2859,13 @@ nsDOMWindowUtils::GetFilePath(JS::HandleValue aFile, JSContext* aCx, JSObject* obj = aFile.toObjectOrNull(); - nsISupports* nativeObj = - nsContentUtils::XPConnect()->GetNativeOfWrapper(aCx, obj); - - nsCOMPtr file = do_QueryInterface(nativeObj); - if (file) { + File* file = nullptr; + if (NS_SUCCEEDED(UNWRAP_OBJECT(File, obj, file))) { nsString filePath; - nsresult rv = file->GetMozFullPathInternal(filePath); - if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; + ErrorResult rv; + file->GetMozFullPathInternal(filePath, rv); + if (NS_WARN_IF(rv.Failed())) { + return rv.StealNSResult(); } _retval = filePath; diff --git a/dom/base/nsIDOMFile.idl b/dom/base/nsIDOMFile.idl index cc8507aa4094..f0f643a33be8 100644 --- a/dom/base/nsIDOMFile.idl +++ b/dom/base/nsIDOMFile.idl @@ -58,20 +58,9 @@ interface nsIDOMBlob : nsISupports // nsIDOMBlob to Blob safely. Our chain is: // - Blob -> nsIDOMBlob // - File -> nsIDOMFile and Blob -[scriptable, builtinclass, uuid(cc28cf12-f1d4-44ff-843f-9289aa14613b)] +[scriptable, builtinclass, uuid(26e292a6-f5aa-4560-b523-ae22a4c7dfca)] interface nsIDOMFile : nsISupports { - readonly attribute DOMString name; - - readonly attribute DOMString path; - - [implicit_jscontext] - readonly attribute jsval lastModifiedDate; - - readonly attribute DOMString mozFullPath; - - // This performs no security checks! - [noscript] readonly attribute DOMString mozFullPathInternal; - - [noscript] readonly attribute int64_t mozLastModifiedDate; + // Empty interface used by addons and some test to check if the object is a + // blob or file. This interface will be removed by bug 1163388 }; diff --git a/dom/bluetooth/bluedroid/BluetoothOppManager.cpp b/dom/bluetooth/bluedroid/BluetoothOppManager.cpp index 4a06324881a2..1d20800417e9 100644 --- a/dom/bluetooth/bluedroid/BluetoothOppManager.cpp +++ b/dom/bluetooth/bluedroid/BluetoothOppManager.cpp @@ -794,7 +794,7 @@ BluetoothOppManager::RetrieveSentFileName() { mFileName.Truncate(); - nsCOMPtr file = do_QueryInterface(mBlob); + nsRefPtr file = static_cast(mBlob.get()).ToFile(); if (file) { file->GetName(mFileName); } diff --git a/dom/bluetooth/bluetooth1/BluetoothService.h b/dom/bluetooth/bluetooth1/BluetoothService.h index 34681517b619..dbb0de23f335 100644 --- a/dom/bluetooth/bluetooth1/BluetoothService.h +++ b/dom/bluetooth/bluetooth1/BluetoothService.h @@ -11,15 +11,13 @@ #include "BluetoothProfileManagerBase.h" #include "nsAutoPtr.h" #include "nsClassHashtable.h" -#include "nsIDOMFile.h" #include "nsIObserver.h" #include "nsTObserverArray.h" #include "nsThreadUtils.h" -class nsIDOMBlob; - namespace mozilla { namespace dom { +class Blob; class BlobChild; class BlobParent; } @@ -241,7 +239,7 @@ public: virtual void SendFile(const nsAString& aDeviceAddress, - nsIDOMBlob* aBlob, + Blob* aBlob, BluetoothReplyRunnable* aRunnable) = 0; virtual void diff --git a/dom/bluetooth/bluetooth1/ipc/BluetoothServiceChildProcess.cpp b/dom/bluetooth/bluetooth1/ipc/BluetoothServiceChildProcess.cpp index 6fd807489515..1fcc1a116ef3 100644 --- a/dom/bluetooth/bluetooth1/ipc/BluetoothServiceChildProcess.cpp +++ b/dom/bluetooth/bluetooth1/ipc/BluetoothServiceChildProcess.cpp @@ -266,7 +266,7 @@ BluetoothServiceChildProcess::SendFile( void BluetoothServiceChildProcess::SendFile( const nsAString& aDeviceAddress, - nsIDOMBlob* aBlobChild, + Blob* aBlobChild, BluetoothReplyRunnable* aRunnable) { // Parent-process-only method diff --git a/dom/bluetooth/bluetooth1/ipc/BluetoothServiceChildProcess.h b/dom/bluetooth/bluetooth1/ipc/BluetoothServiceChildProcess.h index 712b14f607eb..db53344c985e 100644 --- a/dom/bluetooth/bluetooth1/ipc/BluetoothServiceChildProcess.h +++ b/dom/bluetooth/bluetooth1/ipc/BluetoothServiceChildProcess.h @@ -111,7 +111,7 @@ public: virtual void SendFile(const nsAString& aDeviceAddress, - nsIDOMBlob* aBlob, + Blob* aBlob, BluetoothReplyRunnable* aRunnable) override; virtual void diff --git a/dom/bluetooth/bluez/BluetoothDBusService.cpp b/dom/bluetooth/bluez/BluetoothDBusService.cpp index ab7b86d13fa4..a43887267f41 100644 --- a/dom/bluetooth/bluez/BluetoothDBusService.cpp +++ b/dom/bluetooth/bluez/BluetoothDBusService.cpp @@ -4161,7 +4161,7 @@ BluetoothDBusService::SendFile(const nsAString& aDeviceAddress, void BluetoothDBusService::SendFile(const nsAString& aDeviceAddress, - nsIDOMBlob* aBlob, + Blob* aBlob, BluetoothReplyRunnable* aRunnable) { MOZ_ASSERT(NS_IsMainThread()); diff --git a/dom/bluetooth/bluez/BluetoothDBusService.h b/dom/bluetooth/bluez/BluetoothDBusService.h index b4a9c00136ac..c52f39427715 100644 --- a/dom/bluetooth/bluez/BluetoothDBusService.h +++ b/dom/bluetooth/bluez/BluetoothDBusService.h @@ -174,7 +174,7 @@ public: virtual void SendFile(const nsAString& aDeviceAddress, - nsIDOMBlob* aBlob, + Blob* aBlob, BluetoothReplyRunnable* aRunnable) override; virtual void diff --git a/dom/bluetooth/bluez/BluetoothOppManager.cpp b/dom/bluetooth/bluez/BluetoothOppManager.cpp index e79069fe1071..a36be8386d59 100644 --- a/dom/bluetooth/bluez/BluetoothOppManager.cpp +++ b/dom/bluetooth/bluez/BluetoothOppManager.cpp @@ -73,16 +73,17 @@ namespace { static bool sInShutdown = false; } -class mozilla::dom::bluetooth::SendFileBatch { +class mozilla::dom::bluetooth::SendFileBatch +{ public: - SendFileBatch(const nsAString& aDeviceAddress, nsIDOMBlob* aBlob) + SendFileBatch(const nsAString& aDeviceAddress, Blob* aBlob) : mDeviceAddress(aDeviceAddress) { mBlobs.AppendElement(aBlob); } nsString mDeviceAddress; - nsCOMArray mBlobs; + nsTArray> mBlobs; }; NS_IMETHODIMP @@ -385,14 +386,14 @@ BluetoothOppManager::SendFile(const nsAString& aDeviceAddress, MOZ_ASSERT(NS_IsMainThread()); nsRefPtr impl = aActor->GetBlobImpl(); - nsCOMPtr blob = Blob::Create(nullptr, impl); + nsRefPtr blob = Blob::Create(nullptr, impl); - return SendFile(aDeviceAddress, blob.get()); + return SendFile(aDeviceAddress, blob); } bool BluetoothOppManager::SendFile(const nsAString& aDeviceAddress, - nsIDOMBlob* aBlob) + Blob* aBlob) { MOZ_ASSERT(NS_IsMainThread()); @@ -406,7 +407,7 @@ BluetoothOppManager::SendFile(const nsAString& aDeviceAddress, void BluetoothOppManager::AppendBlobToSend(const nsAString& aDeviceAddress, - nsIDOMBlob* aBlob) + Blob* aBlob) { MOZ_ASSERT(NS_IsMainThread()); @@ -766,7 +767,7 @@ BluetoothOppManager::RetrieveSentFileName() { mFileName.Truncate(); - nsCOMPtr file = do_QueryInterface(mBlob); + nsRefPtr file = mBlob->ToFile(); if (file) { file->GetName(mFileName); } diff --git a/dom/bluetooth/bluez/BluetoothOppManager.h b/dom/bluetooth/bluez/BluetoothOppManager.h index e0149f254d1d..f7cfe2afeb13 100644 --- a/dom/bluetooth/bluez/BluetoothOppManager.h +++ b/dom/bluetooth/bluez/BluetoothOppManager.h @@ -14,13 +14,13 @@ #include "mozilla/ipc/SocketBase.h" #include "nsCOMArray.h" -class nsIDOMBlob; class nsIOutputStream; class nsIInputStream; class nsIVolumeMountLock; namespace mozilla { namespace dom { +class Blob; class BlobParent; } } @@ -51,7 +51,7 @@ public: bool Listen(); bool SendFile(const nsAString& aDeviceAddress, BlobParent* aActor); - bool SendFile(const nsAString& aDeviceAddress, nsIDOMBlob* aBlob); + bool SendFile(const nsAString& aDeviceAddress, Blob* aBlob); bool StopSendingFile(); bool ConfirmReceivingFile(bool aConfirm); @@ -96,7 +96,7 @@ private: void NotifyAboutFileChange(); bool AcquireSdcardMountLock(); void SendObexData(uint8_t* aData, uint8_t aOpcode, int aSize); - void AppendBlobToSend(const nsAString& aDeviceAddress, nsIDOMBlob* aBlob); + void AppendBlobToSend(const nsAString& aDeviceAddress, Blob* aBlob); void DiscardBlobsToSend(); bool ProcessNextBatch(); void ConnectInternal(const nsAString& aDeviceAddress); @@ -193,7 +193,7 @@ private: nsAutoArrayPtr mReceivedDataBuffer; int mCurrentBlobIndex; - nsCOMPtr mBlob; + nsRefPtr mBlob; nsTArray mBatches; /** diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp index 2b2ebafdff26..a4404dd0f15f 100644 --- a/dom/html/HTMLInputElement.cpp +++ b/dom/html/HTMLInputElement.cpp @@ -493,18 +493,23 @@ NS_IMPL_ISUPPORTS(DirPickerRecursiveFileEnumerator, nsISimpleEnumerator) * where the file picker can create Blobs. */ static already_AddRefed -DOMFileToLocalFile(nsIDOMFile* aDomFile) +DOMFileToLocalFile(File* aDomFile) { nsString path; - nsresult rv = aDomFile->GetMozFullPathInternal(path); - if (NS_FAILED(rv) || path.IsEmpty()) { + ErrorResult rv; + aDomFile->GetMozFullPathInternal(path, rv); + if (rv.Failed() || path.IsEmpty()) { + rv.SuppressException(); return nullptr; } nsCOMPtr localFile; rv = NS_NewNativeLocalFile(NS_ConvertUTF16toUTF8(path), true, getter_AddRefs(localFile)); - NS_ENSURE_SUCCESS(rv, nullptr); + if (NS_WARN_IF(rv.Failed())) { + rv.SuppressException(); + return nullptr; + } return localFile.forget(); } @@ -969,7 +974,11 @@ HTMLInputElement::InitFilePicker(FilePickerType aType) aType != FILE_PICKER_DIRECTORY) { nsString path; - oldFiles[0]->GetMozFullPathInternal(path); + ErrorResult error; + oldFiles[0]->GetMozFullPathInternal(path, error); + if (NS_WARN_IF(error.Failed())) { + return error.StealNSResult(); + } nsCOMPtr localFile; rv = NS_NewLocalFile(path, false, getter_AddRefs(localFile)); @@ -1708,7 +1717,12 @@ HTMLInputElement::GetValueInternal(nsAString& aValue) const // XXX We'd love to assert that this can't happen, but some mochitests // use SpecialPowers to circumvent our more sane security model. if (!mFiles.IsEmpty()) { - return mFiles[0]->GetMozFullPath(aValue); + ErrorResult rv; + mFiles[0]->GetMozFullPath(aValue, rv); + if (NS_WARN_IF(rv.Failed())) { + return rv.StealNSResult(); + } + return NS_OK; } else { aValue.Truncate(); @@ -1716,8 +1730,10 @@ HTMLInputElement::GetValueInternal(nsAString& aValue) const #endif } else { // Just return the leaf name - if (mFiles.IsEmpty() || NS_FAILED(mFiles[0]->GetName(aValue))) { + if (mFiles.IsEmpty()) { aValue.Truncate(); + } else { + mFiles[0]->GetName(aValue); } } @@ -2307,11 +2323,16 @@ HTMLInputElement::FlushFrames() } void -HTMLInputElement::MozGetFileNameArray(nsTArray< nsString >& aArray) +HTMLInputElement::MozGetFileNameArray(nsTArray& aArray, + ErrorResult& aRv) { for (uint32_t i = 0; i < mFiles.Length(); i++) { nsString str; - mFiles[i]->GetMozFullPathInternal(str); + mFiles[i]->GetMozFullPathInternal(str, aRv); + if (NS_WARN_IF(aRv.Failed())) { + return; + } + aArray.AppendElement(str); } } @@ -2326,8 +2347,12 @@ HTMLInputElement::MozGetFileNameArray(uint32_t* aLength, char16_t*** aFileNames) return NS_ERROR_DOM_SECURITY_ERR; } + ErrorResult rv; nsTArray array; - MozGetFileNameArray(array); + MozGetFileNameArray(array, rv); + if (NS_WARN_IF(rv.Failed())) { + return rv.StealNSResult(); + } *aLength = array.Length(); char16_t** ret = @@ -2687,7 +2712,11 @@ HTMLInputElement::AfterSetFiles(bool aSetValueChanged) if (mFiles.IsEmpty()) { mFirstFilePath.Truncate(); } else { - mFiles[0]->GetMozFullPath(mFirstFilePath); + ErrorResult rv; + mFiles[0]->GetMozFullPath(mFirstFilePath, rv); + if (NS_WARN_IF(rv.Failed())) { + rv.SuppressException(); + } } #endif diff --git a/dom/html/HTMLInputElement.h b/dom/html/HTMLInputElement.h index 740c2bdf4663..7cc9649555ff 100644 --- a/dom/html/HTMLInputElement.h +++ b/dom/html/HTMLInputElement.h @@ -713,7 +713,7 @@ public: int32_t GetTextLength(ErrorResult& aRv); - void MozGetFileNameArray(nsTArray< nsString >& aFileNames); + void MozGetFileNameArray(nsTArray& aFileNames, ErrorResult& aRv); void MozSetFileNameArray(const Sequence< nsString >& aFileNames, ErrorResult& aRv); void MozSetFileArray(const Sequence>& aFiles); diff --git a/dom/html/nsFormSubmission.cpp b/dom/html/nsFormSubmission.cpp index 428d7e3456e9..31e2d5f0579e 100644 --- a/dom/html/nsFormSubmission.cpp +++ b/dom/html/nsFormSubmission.cpp @@ -451,15 +451,13 @@ nsFSMultipartFormData::AddNameFilePair(const nsAString& aName, nsCOMPtr fileStream; if (aFile) { nsAutoString filename16; - rv = aFile->GetName(filename16); - if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; - } + aFile->GetName(filename16); + ErrorResult error; nsAutoString filepath16; - rv = aFile->GetPath(filepath16); - if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; + aFile->GetPath(filepath16, error); + if (NS_WARN_IF(error.Failed())) { + return error.StealNSResult(); } if (!filepath16.IsEmpty()) { diff --git a/dom/indexedDB/IDBObjectStore.cpp b/dom/indexedDB/IDBObjectStore.cpp index ba64714f4eab..802f6f6e2729 100644 --- a/dom/indexedDB/IDBObjectStore.cpp +++ b/dom/indexedDB/IDBObjectStore.cpp @@ -334,14 +334,14 @@ StructuredCloneWriteCallback(JSContext* aCx, nsRefPtr file = blob->ToFile(); if (file) { - int64_t lastModifiedDate; - MOZ_ALWAYS_TRUE(NS_SUCCEEDED( - file->GetMozLastModifiedDate(&lastModifiedDate))); + ErrorResult rv; + int64_t lastModifiedDate = file->GetLastModified(rv); + MOZ_ALWAYS_TRUE(!rv.Failed()); lastModifiedDate = NativeEndian::swapToLittleEndian(lastModifiedDate); nsString name; - MOZ_ALWAYS_TRUE(NS_SUCCEEDED(file->GetName(name))); + file->GetName(name); NS_ConvertUTF16toUTF8 convName(name); uint32_t convNameLength = diff --git a/dom/ipc/Blob.cpp b/dom/ipc/Blob.cpp index e2584a8aa728..054d39bff12a 100644 --- a/dom/ipc/Blob.cpp +++ b/dom/ipc/Blob.cpp @@ -2064,8 +2064,8 @@ public: virtual void GetName(nsAString& aName) override; - virtual nsresult - GetPath(nsAString& aPath) override; + virtual void + GetPath(nsAString& aPath, ErrorResult& aRv) override; virtual int64_t GetLastModified(ErrorResult& aRv) override; @@ -2742,11 +2742,11 @@ RemoteBlobImpl::GetName(nsAString& aName) mBlobImpl->GetName(aName); } -nsresult +void BlobParent:: -RemoteBlobImpl::GetPath(nsAString& aPath) +RemoteBlobImpl::GetPath(nsAString& aPath, ErrorResult& aRv) { - return mBlobImpl->GetPath(aPath); + mBlobImpl->GetPath(aPath, aRv); } int64_t diff --git a/dom/webidl/File.webidl b/dom/webidl/File.webidl index fe2e83d09963..9a858e411863 100644 --- a/dom/webidl/File.webidl +++ b/dom/webidl/File.webidl @@ -45,6 +45,8 @@ partial interface File { readonly attribute Date lastModifiedDate; [GetterThrows, ChromeOnly] - readonly attribute DOMString mozFullPath; + readonly attribute DOMString path; + [GetterThrows, ChromeOnly] + readonly attribute DOMString mozFullPath; }; diff --git a/dom/webidl/HTMLInputElement.webidl b/dom/webidl/HTMLInputElement.webidl index 31c24fd61c5a..f80a4bec0a1c 100644 --- a/dom/webidl/HTMLInputElement.webidl +++ b/dom/webidl/HTMLInputElement.webidl @@ -148,7 +148,7 @@ partial interface HTMLInputElement { [GetterThrows] readonly attribute long textLength; - [ChromeOnly] + [Throws, ChromeOnly] sequence mozGetFileNameArray(); [ChromeOnly, Throws]