Bug 1047483 - patch 5 - Remove 'name' in the FilePropertyBag dictionary, r=smaug
--- a/content/base/public/File.h
+++ b/content/base/public/File.h
@@ -50,16 +50,17 @@ NS_DEFINE_STATIC_IID_ACCESSOR(PIFileImpl
namespace mozilla {
namespace dom {
namespace indexedDB {
class FileInfo;
};
struct BlobPropertyBag;
+struct ChromeFilePropertyBag;
struct FilePropertyBag;
class FileImpl;
class File MOZ_FINAL : public nsIDOMFile
, public nsIXHRSendable
, public nsIMutable
, public nsSupportsWeakReference
, public nsWrapperCache
@@ -171,31 +172,31 @@ public:
const nsAString& aName,
const FilePropertyBag& aBag,
ErrorResult& aRv);
// File constructor - ChromeOnly
static already_AddRefed<File>
Constructor(const GlobalObject& aGlobal,
File& aData,
- const FilePropertyBag& aBag,
+ const ChromeFilePropertyBag& aBag,
ErrorResult& aRv);
// File constructor - ChromeOnly
static already_AddRefed<File>
Constructor(const GlobalObject& aGlobal,
const nsAString& aData,
- const FilePropertyBag& aBag,
+ const ChromeFilePropertyBag& aBag,
ErrorResult& aRv);
// File constructor - ChromeOnly
static already_AddRefed<File>
Constructor(const GlobalObject& aGlobal,
nsIFile* aData,
- const FilePropertyBag& aBag,
+ const ChromeFilePropertyBag& aBag,
ErrorResult& aRv);
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
uint64_t GetSize(ErrorResult& aRv);
// XPCOM GetType is OK
--- a/content/base/src/File.cpp
+++ b/content/base/src/File.cpp
@@ -627,17 +627,17 @@ File::Constructor(
nsRefPtr<File> file = new File(aGlobal.GetAsSupports(), impl);
return file.forget();
}
/* static */ already_AddRefed<File>
File::Constructor(const GlobalObject& aGlobal,
File& aData,
- const FilePropertyBag& aBag,
+ const ChromeFilePropertyBag& aBag,
ErrorResult& aRv)
{
if (!nsContentUtils::IsCallerChrome()) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
nsRefPtr<MultipartFileImpl> impl = new MultipartFileImpl(EmptyString());
@@ -649,17 +649,17 @@ File::Constructor(const GlobalObject& aG
nsRefPtr<File> domFile = new File(aGlobal.GetAsSupports(), impl);
return domFile.forget();
}
/* static */ already_AddRefed<File>
File::Constructor(const GlobalObject& aGlobal,
nsIFile* aData,
- const FilePropertyBag& aBag,
+ const ChromeFilePropertyBag& aBag,
ErrorResult& aRv)
{
if (!nsContentUtils::IsCallerChrome()) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.GetAsSupports());
@@ -673,17 +673,17 @@ File::Constructor(const GlobalObject& aG
nsRefPtr<File> domFile = new File(aGlobal.GetAsSupports(), impl);
return domFile.forget();
}
/* static */ already_AddRefed<File>
File::Constructor(const GlobalObject& aGlobal,
const nsAString& aData,
- const FilePropertyBag& aBag,
+ const ChromeFilePropertyBag& aBag,
ErrorResult& aRv)
{
if (!nsContentUtils::IsCallerChrome()) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.GetAsSupports());
--- a/content/base/src/MultipartFileImpl.cpp
+++ b/content/base/src/MultipartFileImpl.cpp
@@ -231,17 +231,17 @@ MultipartFileImpl::GetMozFullPathInterna
return;
}
blobImpl->GetMozFullPathInternal(aFilename, aRv);
}
void
MultipartFileImpl::InitializeChromeFile(File& aBlob,
- const FilePropertyBag& aBag,
+ const ChromeFilePropertyBag& aBag,
ErrorResult& aRv)
{
NS_ASSERTION(!mImmutable, "Something went wrong ...");
if (mImmutable) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return;
}
@@ -263,17 +263,17 @@ MultipartFileImpl::InitializeChromeFile(
mBlobImpls = blobSet.GetBlobImpls();
SetLengthAndModifiedDate();
}
void
MultipartFileImpl::InitializeChromeFile(nsPIDOMWindow* aWindow,
nsIFile* aFile,
- const FilePropertyBag& aBag,
+ const ChromeFilePropertyBag& aBag,
bool aIsFromNsIFile,
ErrorResult& aRv)
{
NS_ASSERTION(!mImmutable, "Something went wrong ...");
if (mImmutable) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return;
}
@@ -335,17 +335,17 @@ MultipartFileImpl::InitializeChromeFile(
mBlobImpls = blobSet.GetBlobImpls();
SetLengthAndModifiedDate();
}
void
MultipartFileImpl::InitializeChromeFile(nsPIDOMWindow* aWindow,
const nsAString& aData,
- const FilePropertyBag& aBag,
+ const ChromeFilePropertyBag& aBag,
ErrorResult& aRv)
{
nsCOMPtr<nsIFile> file;
aRv = NS_NewLocalFile(aData, false, getter_AddRefs(file));
if (NS_WARN_IF(aRv.Failed())) {
return;
}
--- a/content/base/src/MultipartFileImpl.h
+++ b/content/base/src/MultipartFileImpl.h
@@ -62,27 +62,27 @@ public:
void InitializeBlob(
JSContext* aCx,
const Sequence<OwningArrayBufferOrArrayBufferViewOrBlobOrString>& aData,
const nsAString& aContentType,
bool aNativeEOL,
ErrorResult& aRv);
void InitializeChromeFile(File& aData,
- const FilePropertyBag& aBag,
+ const ChromeFilePropertyBag& aBag,
ErrorResult& aRv);
void InitializeChromeFile(nsPIDOMWindow* aWindow,
const nsAString& aData,
- const FilePropertyBag& aBag,
+ const ChromeFilePropertyBag& aBag,
ErrorResult& aRv);
void InitializeChromeFile(nsPIDOMWindow* aWindow,
nsIFile* aData,
- const FilePropertyBag& aBag,
+ const ChromeFilePropertyBag& aBag,
bool aIsFromNsIFile,
ErrorResult& aRv);
virtual already_AddRefed<FileImpl>
CreateSlice(uint64_t aStart, uint64_t aLength,
const nsAString& aContentType,
ErrorResult& aRv) MOZ_OVERRIDE;
--- a/dom/webidl/File.webidl
+++ b/dom/webidl/File.webidl
@@ -5,39 +5,44 @@
*/
interface nsIFile;
[Constructor(sequence<(ArrayBuffer or ArrayBufferView or Blob or DOMString)> fileBits,
ScalarValueString fileName, optional FilePropertyBag options),
// These constructors are just for chrome callers:
- Constructor(Blob fileBits, optional FilePropertyBag options),
- Constructor(nsIFile fileBits, optional FilePropertyBag options),
- Constructor(ScalarValueString fileBits, optional FilePropertyBag options),
+ Constructor(Blob fileBits, optional ChromeFilePropertyBag options),
+ Constructor(nsIFile fileBits, optional ChromeFilePropertyBag options),
+ Constructor(ScalarValueString fileBits, optional ChromeFilePropertyBag options),
Exposed=(Window,Worker)]
interface File : Blob {
readonly attribute DOMString name;
[GetterThrows]
readonly attribute long long lastModified;
};
dictionary FilePropertyBag {
DOMString type = "";
- DOMString name = ""; // TODO: to remove!
long long lastModified;
};
+dictionary ChromeFilePropertyBag : FilePropertyBag {
+
+ DOMString name = "";
+
+};
+
// Mozilla extensions
partial interface File {
[GetterThrows]
readonly attribute Date lastModifiedDate;
[GetterThrows]
readonly attribute DOMString mozFullPath;