forked from mirrors/gecko-dev
Bug 1462964: Remove obsolete nsIDOMBlob interface. r=bz
MozReview-Commit-ID: 2HIlaSrvfBe --HG-- extra : rebase_source : 944a6244dbfe1f0a37dd34a041d1329624a86f93 extra : histedit_source : d7859be664fed00f8504e40969480d3af3d674e7%2C4456b502db338bd06823654306e47c2583101396
This commit is contained in:
parent
6b12d08f7d
commit
8134b33e89
33 changed files with 71 additions and 73 deletions
|
|
@ -109,7 +109,7 @@ DataTransferItem::KindFromData(nsIVariant* aData)
|
||||||
nsresult rv = aData->GetAsISupports(getter_AddRefs(supports));
|
nsresult rv = aData->GetAsISupports(getter_AddRefs(supports));
|
||||||
if (NS_SUCCEEDED(rv) && supports) {
|
if (NS_SUCCEEDED(rv) && supports) {
|
||||||
// Check if we have one of the supported file data formats
|
// Check if we have one of the supported file data formats
|
||||||
if (nsCOMPtr<nsIDOMBlob>(do_QueryInterface(supports)) ||
|
if (RefPtr<Blob>(do_QueryObject(supports)) ||
|
||||||
nsCOMPtr<BlobImpl>(do_QueryInterface(supports)) ||
|
nsCOMPtr<BlobImpl>(do_QueryInterface(supports)) ||
|
||||||
nsCOMPtr<nsIFile>(do_QueryInterface(supports))) {
|
nsCOMPtr<nsIFile>(do_QueryInterface(supports))) {
|
||||||
return KIND_FILE;
|
return KIND_FILE;
|
||||||
|
|
@ -292,8 +292,7 @@ DataTransferItem::GetAsFile(nsIPrincipal& aSubjectPrincipal,
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nsCOMPtr<nsIDOMBlob> domBlob = do_QueryInterface(supports)) {
|
if (RefPtr<Blob> blob = do_QueryObject(supports)) {
|
||||||
Blob* blob = static_cast<Blob*>(domBlob.get());
|
|
||||||
mCachedFile = blob->ToFile();
|
mCachedFile = blob->ToFile();
|
||||||
} else if (nsCOMPtr<BlobImpl> blobImpl = do_QueryInterface(supports)) {
|
} else if (nsCOMPtr<BlobImpl> blobImpl = do_QueryInterface(supports)) {
|
||||||
MOZ_ASSERT(blobImpl->IsFile());
|
MOZ_ASSERT(blobImpl->IsFile());
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,12 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Blob)
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Blob)
|
||||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMBlob)
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIMutable)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMBlob)
|
// Alas, there is no helper macro for this.
|
||||||
|
if (aIID.Equals(NS_GET_IID(Blob))) {
|
||||||
|
*aInstancePtr = do_AddRef(this).take();
|
||||||
|
return NS_OK;
|
||||||
|
} else
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIMutable)
|
NS_INTERFACE_MAP_ENTRY(nsIMutable)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||||
NS_INTERFACE_MAP_END
|
NS_INTERFACE_MAP_END
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@
|
||||||
#include "mozilla/dom/BlobImpl.h"
|
#include "mozilla/dom/BlobImpl.h"
|
||||||
#include "nsCycleCollectionParticipant.h"
|
#include "nsCycleCollectionParticipant.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsIDOMBlob.h"
|
|
||||||
#include "nsIMutable.h"
|
#include "nsIMutable.h"
|
||||||
#include "nsWrapperCache.h"
|
#include "nsWrapperCache.h"
|
||||||
#include "nsWeakReference.h"
|
#include "nsWeakReference.h"
|
||||||
|
|
@ -27,17 +26,21 @@ struct BlobPropertyBag;
|
||||||
class File;
|
class File;
|
||||||
class OwningArrayBufferViewOrArrayBufferOrBlobOrUSVString;
|
class OwningArrayBufferViewOrArrayBufferOrBlobOrUSVString;
|
||||||
|
|
||||||
class Blob : public nsIDOMBlob
|
#define NS_DOM_BLOB_IID \
|
||||||
, public nsIMutable
|
{ 0x648c2a83, 0xbdb1, 0x4a7d, \
|
||||||
|
{ 0xb5, 0x0a, 0xca, 0xcd, 0x92, 0x87, 0x45, 0xc2 } }
|
||||||
|
|
||||||
|
|
||||||
|
class Blob : public nsIMutable
|
||||||
, public nsSupportsWeakReference
|
, public nsSupportsWeakReference
|
||||||
, public nsWrapperCache
|
, public nsWrapperCache
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NS_DECL_NSIDOMBLOB
|
|
||||||
NS_DECL_NSIMUTABLE
|
NS_DECL_NSIMUTABLE
|
||||||
|
|
||||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(Blob, nsIDOMBlob)
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(Blob, nsIMutable)
|
||||||
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_DOM_BLOB_IID)
|
||||||
|
|
||||||
typedef OwningArrayBufferViewOrArrayBufferOrBlobOrUSVString BlobPart;
|
typedef OwningArrayBufferViewOrArrayBufferOrBlobOrUSVString BlobPart;
|
||||||
|
|
||||||
|
|
@ -147,6 +150,8 @@ private:
|
||||||
nsCOMPtr<nsISupports> mParent;
|
nsCOMPtr<nsISupports> mParent;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NS_DEFINE_STATIC_IID_ACCESSOR(Blob, NS_DOM_BLOB_IID)
|
||||||
|
|
||||||
// Override BindingJSObjectMallocBytes for blobs to tell the JS GC how much
|
// Override BindingJSObjectMallocBytes for blobs to tell the JS GC how much
|
||||||
// memory is held live by the binding object.
|
// memory is held live by the binding object.
|
||||||
size_t BindingJSObjectMallocBytes(Blob* aBlob);
|
size_t BindingJSObjectMallocBytes(Blob* aBlob);
|
||||||
|
|
@ -154,4 +159,10 @@ size_t BindingJSObjectMallocBytes(Blob* aBlob);
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
|
inline nsISupports*
|
||||||
|
ToSupports(mozilla::dom::Blob* aBlob)
|
||||||
|
{
|
||||||
|
return static_cast<nsIMutable*>(aBlob);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // mozilla_dom_Blob_h
|
#endif // mozilla_dom_Blob_h
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,6 @@ with Files("**"):
|
||||||
|
|
||||||
DIRS += ['ipc']
|
DIRS += ['ipc']
|
||||||
|
|
||||||
XPIDL_SOURCES += [
|
|
||||||
'nsIDOMBlob.idl',
|
|
||||||
]
|
|
||||||
|
|
||||||
XPIDL_MODULE = 'dom_file'
|
|
||||||
|
|
||||||
EXPORTS += [
|
EXPORTS += [
|
||||||
'nsHostObjectProtocolHandler.h',
|
'nsHostObjectProtocolHandler.h',
|
||||||
'nsHostObjectURI.h',
|
'nsHostObjectURI.h',
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
#include "nsISupports.idl"
|
|
||||||
|
|
||||||
[scriptable, builtinclass, uuid(f344146a-ee1f-417e-8a68-6984ca56f0ae)]
|
|
||||||
interface nsIDOMBlob : nsISupports
|
|
||||||
{
|
|
||||||
// Just an empty interface.
|
|
||||||
};
|
|
||||||
|
|
@ -19,8 +19,10 @@
|
||||||
function childFrameScript() {
|
function childFrameScript() {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
Cu.importGlobalProperties(["Blob"]);
|
||||||
|
|
||||||
addMessageListener("test:ipcClonedMessage", function(message) {
|
addMessageListener("test:ipcClonedMessage", function(message) {
|
||||||
if (!(message.json instanceof Ci.nsIDOMBlob)) {
|
if (!Blob.isInstance(message.json)) {
|
||||||
sendAsyncMessage(message.name, message.json);
|
sendAsyncMessage(message.name, message.json);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
#include "mozilla/dom/WheelEventBinding.h"
|
#include "mozilla/dom/WheelEventBinding.h"
|
||||||
#include "nsAttrValueInlines.h"
|
#include "nsAttrValueInlines.h"
|
||||||
#include "nsCRTGlue.h"
|
#include "nsCRTGlue.h"
|
||||||
|
#include "nsQueryObject.h"
|
||||||
|
|
||||||
#include "nsITextControlElement.h"
|
#include "nsITextControlElement.h"
|
||||||
#include "nsIDOMNSEditableElement.h"
|
#include "nsIDOMNSEditableElement.h"
|
||||||
|
|
@ -508,7 +509,7 @@ HTMLInputElement::nsFilePickerShownCallback::Done(int16_t aResult)
|
||||||
|
|
||||||
while (NS_SUCCEEDED(iter->HasMoreElements(&hasMore)) && hasMore) {
|
while (NS_SUCCEEDED(iter->HasMoreElements(&hasMore)) && hasMore) {
|
||||||
iter->GetNext(getter_AddRefs(tmp));
|
iter->GetNext(getter_AddRefs(tmp));
|
||||||
nsCOMPtr<nsIDOMBlob> domBlob = do_QueryInterface(tmp);
|
RefPtr<Blob> domBlob = do_QueryObject(tmp);
|
||||||
MOZ_ASSERT(domBlob,
|
MOZ_ASSERT(domBlob,
|
||||||
"Null file object from FilePicker's file enumerator?");
|
"Null file object from FilePicker's file enumerator?");
|
||||||
if (!domBlob) {
|
if (!domBlob) {
|
||||||
|
|
@ -516,7 +517,7 @@ HTMLInputElement::nsFilePickerShownCallback::Done(int16_t aResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
OwningFileOrDirectory* element = newFilesOrDirectories.AppendElement();
|
OwningFileOrDirectory* element = newFilesOrDirectories.AppendElement();
|
||||||
element->SetAsFile() = static_cast<File*>(domBlob.get());
|
element->SetAsFile() = domBlob->ToFile();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MOZ_ASSERT(mode == static_cast<int16_t>(nsIFilePicker::modeOpen) ||
|
MOZ_ASSERT(mode == static_cast<int16_t>(nsIFilePicker::modeOpen) ||
|
||||||
|
|
@ -525,9 +526,9 @@ HTMLInputElement::nsFilePickerShownCallback::Done(int16_t aResult)
|
||||||
nsresult rv = mFilePicker->GetDomFileOrDirectory(getter_AddRefs(tmp));
|
nsresult rv = mFilePicker->GetDomFileOrDirectory(getter_AddRefs(tmp));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMBlob> blob = do_QueryInterface(tmp);
|
RefPtr<Blob> blob = do_QueryObject(tmp);
|
||||||
if (blob) {
|
if (blob) {
|
||||||
RefPtr<File> file = static_cast<Blob*>(blob.get())->ToFile();
|
RefPtr<File> file = blob->ToFile();
|
||||||
MOZ_ASSERT(file);
|
MOZ_ASSERT(file);
|
||||||
|
|
||||||
OwningFileOrDirectory* element = newFilesOrDirectories.AppendElement();
|
OwningFileOrDirectory* element = newFilesOrDirectories.AppendElement();
|
||||||
|
|
|
||||||
|
|
@ -915,8 +915,7 @@ IDBDatabase::GetOrCreateFileActorForBlob(Blob* aBlob)
|
||||||
// a) it is unique per blob, b) it is reference-counted so that we can
|
// a) it is unique per blob, b) it is reference-counted so that we can
|
||||||
// guarantee that it stays alive, and c) it doesn't hold the actual File
|
// guarantee that it stays alive, and c) it doesn't hold the actual File
|
||||||
// alive.
|
// alive.
|
||||||
nsCOMPtr<nsIDOMBlob> blob = aBlob;
|
nsCOMPtr<nsIWeakReference> weakRef = do_GetWeakReference(aBlob);
|
||||||
nsCOMPtr<nsIWeakReference> weakRef = do_GetWeakReference(blob);
|
|
||||||
MOZ_ASSERT(weakRef);
|
MOZ_ASSERT(weakRef);
|
||||||
|
|
||||||
PBackgroundIDBDatabaseFileChild* actor = nullptr;
|
PBackgroundIDBDatabaseFileChild* actor = nullptr;
|
||||||
|
|
|
||||||
|
|
@ -110,8 +110,8 @@ function verifyBuffers(buffer1, buffer2)
|
||||||
function verifyBlob(blob1, blob2, fileId, blobReadHandler)
|
function verifyBlob(blob1, blob2, fileId, blobReadHandler)
|
||||||
{
|
{
|
||||||
// eslint-disable-next-line mozilla/use-cc-etc
|
// eslint-disable-next-line mozilla/use-cc-etc
|
||||||
is(blob1 instanceof Components.interfaces.nsIDOMBlob, true,
|
is(SpecialPowers.wrap(Blob).isInstance(blob1), true,
|
||||||
"Instance of nsIDOMBlob");
|
"Instance of Blob");
|
||||||
is(blob1 instanceof File, blob2 instanceof File,
|
is(blob1 instanceof File, blob2 instanceof File,
|
||||||
"Instance of DOM File");
|
"Instance of DOM File");
|
||||||
is(blob1.size, blob2.size, "Correct size");
|
is(blob1.size, blob2.size, "Correct size");
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ function childFrameScript() {
|
||||||
const blobText = blobData.join("");
|
const blobText = blobData.join("");
|
||||||
const blobType = "text/plain";
|
const blobType = "text/plain";
|
||||||
|
|
||||||
Cu.importGlobalProperties(["indexedDB"]);
|
Cu.importGlobalProperties(["indexedDB", "Blob"]);
|
||||||
|
|
||||||
function info(msg) {
|
function info(msg) {
|
||||||
sendAsyncMessage(mmName, { op: "info", msg });
|
sendAsyncMessage(mmName, { op: "info", msg });
|
||||||
|
|
@ -66,7 +66,7 @@ function childFrameScript() {
|
||||||
|
|
||||||
let blob = message.data;
|
let blob = message.data;
|
||||||
|
|
||||||
ok(blob instanceof Ci.nsIDOMBlob, "Message manager sent a blob");
|
ok(Blob.isInstance(blob), "Message manager sent a blob");
|
||||||
is(blob.size, blobText.length, "Blob has correct length");
|
is(blob.size, blobText.length, "Blob has correct length");
|
||||||
is(blob.type, blobType, "Blob has correct type");
|
is(blob.type, blobType, "Blob has correct type");
|
||||||
|
|
||||||
|
|
@ -82,7 +82,7 @@ function childFrameScript() {
|
||||||
|
|
||||||
let slice = blob.slice(0, blobData[0].length, blobType);
|
let slice = blob.slice(0, blobData[0].length, blobType);
|
||||||
|
|
||||||
ok(slice instanceof Ci.nsIDOMBlob, "Slice returned a blob");
|
ok(Blob.isInstance(slice), "Slice returned a blob");
|
||||||
is(slice.size, blobData[0].length, "Slice has correct length");
|
is(slice.size, blobData[0].length, "Slice has correct length");
|
||||||
is(slice.type, blobType, "Slice has correct type");
|
is(slice.type, blobType, "Slice has correct type");
|
||||||
|
|
||||||
|
|
@ -143,7 +143,7 @@ function childFrameScript() {
|
||||||
|
|
||||||
blob = event.target.result;
|
blob = event.target.result;
|
||||||
|
|
||||||
ok(blob instanceof Ci.nsIDOMBlob, "Database gave us a blob");
|
ok(Blob.isInstance(blob), "Database gave us a blob");
|
||||||
is(blob.size, blobText.length, "Blob has correct length");
|
is(blob.size, blobText.length, "Blob has correct length");
|
||||||
is(blob.type, blobType, "Blob has correct type");
|
is(blob.type, blobType, "Blob has correct type");
|
||||||
|
|
||||||
|
|
@ -178,7 +178,7 @@ function childFrameScript() {
|
||||||
|
|
||||||
slice = event.target.result;
|
slice = event.target.result;
|
||||||
|
|
||||||
ok(slice instanceof Ci.nsIDOMBlob, "Database gave us a blob");
|
ok(Blob.isInstance(slice), "Database gave us a blob");
|
||||||
is(slice.size, blobData[0].length, "Slice has correct length");
|
is(slice.size, blobData[0].length, "Slice has correct length");
|
||||||
is(slice.type, blobType, "Slice has correct type");
|
is(slice.type, blobType, "Slice has correct type");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@ var { "classes": Cc, "interfaces": Ci, "utils": Cu } = Components;
|
||||||
|
|
||||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
|
Cu.importGlobalProperties(["Blob"]);
|
||||||
|
|
||||||
if (!("self" in this)) {
|
if (!("self" in this)) {
|
||||||
this.self = this;
|
this.self = this;
|
||||||
}
|
}
|
||||||
|
|
@ -426,7 +428,7 @@ function verifyBuffers(buffer1, buffer2)
|
||||||
|
|
||||||
function verifyBlob(blob1, blob2)
|
function verifyBlob(blob1, blob2)
|
||||||
{
|
{
|
||||||
is(blob1 instanceof Ci.nsIDOMBlob, true,
|
is(Blob.isInstance(blob1), true,
|
||||||
"Instance of nsIDOMBlob");
|
"Instance of nsIDOMBlob");
|
||||||
is(blob1 instanceof File, blob2 instanceof File,
|
is(blob1 instanceof File, blob2 instanceof File,
|
||||||
"Instance of DOM File");
|
"Instance of DOM File");
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
#include "domstubs.idl"
|
#include "domstubs.idl"
|
||||||
|
|
||||||
interface nsIControllers;
|
interface nsIControllers;
|
||||||
interface nsIDOMBlob;
|
|
||||||
interface nsIDOMOfflineResourceList;
|
interface nsIDOMOfflineResourceList;
|
||||||
interface nsIPrompt;
|
interface nsIPrompt;
|
||||||
interface nsIVariant;
|
interface nsIVariant;
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ function childFrameScript() {
|
||||||
|
|
||||||
let blob = message.data;
|
let blob = message.data;
|
||||||
|
|
||||||
ok(blob instanceof Ci.nsIDOMBlob, "Received a Blob");
|
ok(Blob.isInstance(blob), "Received a Blob");
|
||||||
is(blob.size, blobText.length, "Blob has correct length");
|
is(blob.size, blobText.length, "Blob has correct length");
|
||||||
is(blob.type, blobType, "Blob has correct type");
|
is(blob.type, blobType, "Blob has correct type");
|
||||||
|
|
||||||
|
|
@ -71,7 +71,7 @@ function childFrameScript() {
|
||||||
|
|
||||||
let slice = blob.slice(firstSliceStart, firstSliceEnd, blobType);
|
let slice = blob.slice(firstSliceStart, firstSliceEnd, blobType);
|
||||||
|
|
||||||
ok(slice instanceof Ci.nsIDOMBlob, "Slice returned a Blob");
|
ok(Blob.isInstance(slice), "Slice returned a Blob");
|
||||||
is(slice.size, blobData[2].length, "Slice has correct length");
|
is(slice.size, blobData[2].length, "Slice has correct length");
|
||||||
is(slice.type, blobType, "Slice has correct type");
|
is(slice.type, blobType, "Slice has correct type");
|
||||||
|
|
||||||
|
|
@ -90,7 +90,7 @@ function childFrameScript() {
|
||||||
|
|
||||||
slice = slice.slice(secondSliceStart, secondSliceEnd, blobType);
|
slice = slice.slice(secondSliceStart, secondSliceEnd, blobType);
|
||||||
|
|
||||||
ok(slice instanceof Ci.nsIDOMBlob, "Second slice returned a Blob");
|
ok(Blob.isInstance(slice), "Second slice returned a Blob");
|
||||||
is(slice.size, sliceText.length, "Second slice has correct length");
|
is(slice.size, sliceText.length, "Second slice has correct length");
|
||||||
is(slice.type, blobType, "Second slice has correct type");
|
is(slice.type, blobType, "Second slice has correct type");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ interface nsIGetUserMediaDevicesSuccessCallback : nsISupports
|
||||||
interface nsIDOMGetUserMediaSuccessCallback : nsISupports
|
interface nsIDOMGetUserMediaSuccessCallback : nsISupports
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* value must be a nsIDOMBlob if picture is true and a
|
* value must be a Blob if picture is true and a
|
||||||
* DOMLocalMediaStream if either audio or video are true.
|
* DOMLocalMediaStream if either audio or video are true.
|
||||||
*/
|
*/
|
||||||
void onSuccess(in nsISupports value);
|
void onSuccess(in nsISupports value);
|
||||||
|
|
|
||||||
|
|
@ -808,7 +808,7 @@ PresentationService::SendSessionBinaryMsg(const nsAString& aSessionId,
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PresentationService::SendSessionBlob(const nsAString& aSessionId,
|
PresentationService::SendSessionBlob(const nsAString& aSessionId,
|
||||||
uint8_t aRole,
|
uint8_t aRole,
|
||||||
nsIDOMBlob* aBlob)
|
Blob* aBlob)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
MOZ_ASSERT(!aSessionId.IsEmpty());
|
MOZ_ASSERT(!aSessionId.IsEmpty());
|
||||||
|
|
|
||||||
|
|
@ -291,7 +291,7 @@ PresentationSessionInfo::SendBinaryMsg(const nsACString& aData)
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
PresentationSessionInfo::SendBlob(nsIDOMBlob* aBlob)
|
PresentationSessionInfo::SendBlob(Blob* aBlob)
|
||||||
{
|
{
|
||||||
if (NS_WARN_IF(!IsSessionReady())) {
|
if (NS_WARN_IF(!IsSessionReady())) {
|
||||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ public:
|
||||||
|
|
||||||
nsresult SendBinaryMsg(const nsACString& aData);
|
nsresult SendBinaryMsg(const nsACString& aData);
|
||||||
|
|
||||||
nsresult SendBlob(nsIDOMBlob* aBlob);
|
nsresult SendBlob(Blob* aBlob);
|
||||||
|
|
||||||
nsresult Close(nsresult aReason,
|
nsresult Close(nsresult aReason,
|
||||||
uint32_t aState);
|
uint32_t aState);
|
||||||
|
|
|
||||||
|
|
@ -424,7 +424,7 @@ PresentationTCPSessionTransport::SendBinaryMsg(const nsACString& aData)
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PresentationTCPSessionTransport::SendBlob(nsIDOMBlob* aBlob)
|
PresentationTCPSessionTransport::SendBlob(Blob* aBlob)
|
||||||
{
|
{
|
||||||
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#include "nsISupports.idl"
|
#include "nsISupports.idl"
|
||||||
|
|
||||||
interface nsIDOMBlob;
|
|
||||||
interface nsIInputStream;
|
interface nsIInputStream;
|
||||||
interface nsIPresentationAvailabilityListener;
|
interface nsIPresentationAvailabilityListener;
|
||||||
interface nsIPresentationRespondingListener;
|
interface nsIPresentationRespondingListener;
|
||||||
|
|
@ -12,6 +11,7 @@ interface nsIPresentationSessionListener;
|
||||||
interface nsIPresentationTransportBuilderConstructor;
|
interface nsIPresentationTransportBuilderConstructor;
|
||||||
interface nsIPrincipal;
|
interface nsIPrincipal;
|
||||||
|
|
||||||
|
webidl Blob;
|
||||||
webidl EventTarget;
|
webidl EventTarget;
|
||||||
|
|
||||||
%{C++
|
%{C++
|
||||||
|
|
@ -120,7 +120,7 @@ interface nsIPresentationService : nsISupports
|
||||||
*/
|
*/
|
||||||
void sendSessionBlob(in DOMString sessionId,
|
void sendSessionBlob(in DOMString sessionId,
|
||||||
in uint8_t role,
|
in uint8_t role,
|
||||||
in nsIDOMBlob blob);
|
in Blob blob);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Close the session.
|
* Close the session.
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,11 @@
|
||||||
|
|
||||||
#include "nsISupports.idl"
|
#include "nsISupports.idl"
|
||||||
|
|
||||||
interface nsIDOMBlob;
|
|
||||||
interface nsIInputStream;
|
interface nsIInputStream;
|
||||||
interface nsINetAddr;
|
interface nsINetAddr;
|
||||||
|
|
||||||
|
webidl Blob;
|
||||||
|
|
||||||
%{C++
|
%{C++
|
||||||
#define PRESENTATION_TCP_SESSION_TRANSPORT_CONTRACTID \
|
#define PRESENTATION_TCP_SESSION_TRANSPORT_CONTRACTID \
|
||||||
"@mozilla.org/presentation/presentationtcpsessiontransport;1"
|
"@mozilla.org/presentation/presentationtcpsessiontransport;1"
|
||||||
|
|
@ -59,7 +60,7 @@ interface nsIPresentationSessionTransport : nsISupports
|
||||||
* Send the blob to the remote endpoint.
|
* Send the blob to the remote endpoint.
|
||||||
* @param blob: The input blob to be sent.
|
* @param blob: The input blob to be sent.
|
||||||
*/
|
*/
|
||||||
void sendBlob(in nsIDOMBlob blob);
|
void sendBlob(in Blob blob);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Close this session transport.
|
* Close this session transport.
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ PresentationSessionTransportIPC::SendBinaryMsg(const nsACString& aData)
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PresentationSessionTransportIPC::SendBlob(nsIDOMBlob* aBlob)
|
PresentationSessionTransportIPC::SendBlob(Blob* aBlob)
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ PresentationContentSessionInfo::SendBinaryMsg(const nsACString& aData)
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
PresentationContentSessionInfo::SendBlob(nsIDOMBlob* aBlob)
|
PresentationContentSessionInfo::SendBlob(Blob* aBlob)
|
||||||
{
|
{
|
||||||
if (NS_WARN_IF(!mTransport)) {
|
if (NS_WARN_IF(!mTransport)) {
|
||||||
return NS_ERROR_NOT_AVAILABLE;
|
return NS_ERROR_NOT_AVAILABLE;
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ public:
|
||||||
|
|
||||||
nsresult SendBinaryMsg(const nsACString& aData);
|
nsresult SendBinaryMsg(const nsACString& aData);
|
||||||
|
|
||||||
nsresult SendBlob(nsIDOMBlob* aBlob);
|
nsresult SendBlob(Blob* aBlob);
|
||||||
|
|
||||||
nsresult Close(nsresult aReason);
|
nsresult Close(nsresult aReason);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ PresentationIPCService::SendSessionBinaryMsg(const nsAString& aSessionId,
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PresentationIPCService::SendSessionBlob(const nsAString& aSessionId,
|
PresentationIPCService::SendSessionBlob(const nsAString& aSessionId,
|
||||||
uint8_t aRole,
|
uint8_t aRole,
|
||||||
nsIDOMBlob* aBlob)
|
Blob* aBlob)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
MOZ_ASSERT(!aSessionId.IsEmpty());
|
MOZ_ASSERT(!aSessionId.IsEmpty());
|
||||||
|
|
|
||||||
|
|
@ -1045,7 +1045,7 @@ HTMLEditor::InsertObject(const nsACString& aType,
|
||||||
nsCOMPtr<nsINode> node = do_QueryInterface(aDestinationNode);
|
nsCOMPtr<nsINode> node = do_QueryInterface(aDestinationNode);
|
||||||
MOZ_ASSERT(node);
|
MOZ_ASSERT(node);
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMBlob> domBlob = Blob::Create(node->GetOwnerGlobal(), blob);
|
RefPtr<Blob> domBlob = Blob::Create(node->GetOwnerGlobal(), blob);
|
||||||
NS_ENSURE_TRUE(domBlob, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(domBlob, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
return utils->SlurpBlob(domBlob, node->OwnerDoc()->GetWindow(), br);
|
return utils->SlurpBlob(domBlob, node->OwnerDoc()->GetWindow(), br);
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,10 @@
|
||||||
#include "nsISupports.idl"
|
#include "nsISupports.idl"
|
||||||
#include "domstubs.idl"
|
#include "domstubs.idl"
|
||||||
|
|
||||||
interface nsIDOMBlob;
|
|
||||||
interface mozIDOMWindowProxy;
|
interface mozIDOMWindowProxy;
|
||||||
|
|
||||||
|
webidl Blob;
|
||||||
|
|
||||||
[scriptable, builtinclass, uuid(eb8b8ad9-5d8f-43bd-8ce5-5b943c180d56)]
|
[scriptable, builtinclass, uuid(eb8b8ad9-5d8f-43bd-8ce5-5b943c180d56)]
|
||||||
interface nsIEditorBlobListener : nsISupports
|
interface nsIEditorBlobListener : nsISupports
|
||||||
{
|
{
|
||||||
|
|
@ -27,6 +28,6 @@ interface nsIEditorUtils : nsISupports
|
||||||
/**
|
/**
|
||||||
* Given a blob, returns the data from that blob, asynchronously.
|
* Given a blob, returns the data from that blob, asynchronously.
|
||||||
*/
|
*/
|
||||||
void slurpBlob(in nsIDOMBlob aBlob, in mozIDOMWindowProxy aScope,
|
void slurpBlob(in Blob aBlob, in mozIDOMWindowProxy aScope,
|
||||||
in nsIEditorBlobListener aListener);
|
in nsIEditorBlobListener aListener);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,6 @@
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "mozilla/ipc/Transport.h"
|
#include "mozilla/ipc/Transport.h"
|
||||||
|
|
||||||
class nsIDOMBlob;
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
if (a instanceof File)
|
if (a instanceof File)
|
||||||
return 'file';
|
return 'file';
|
||||||
|
|
||||||
if (a instanceof Ci.nsIDOMBlob)
|
if (a instanceof Blob)
|
||||||
return 'blob';
|
return 'blob';
|
||||||
|
|
||||||
if (TypedArrayThings.includes(a.constructor.name))
|
if (TypedArrayThings.includes(a.constructor.name))
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ BlobComponent.prototype =
|
||||||
var f1 = new Blob([testContent], {"type" : "text/xml"});
|
var f1 = new Blob([testContent], {"type" : "text/xml"});
|
||||||
|
|
||||||
// do some tests
|
// do some tests
|
||||||
Assert.ok(f1 instanceof Ci.nsIDOMBlob, "Should be a DOM Blob");
|
Assert.ok(f1 instanceof Blob, "Should be a DOM Blob");
|
||||||
|
|
||||||
Assert.ok(!(f1 instanceof File), "Should not be a DOM File");
|
Assert.ok(!(f1 instanceof File), "Should not be a DOM File");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ function run_test() {
|
||||||
var f1 = new Blob([testContent], {"type" : "text/xml"});
|
var f1 = new Blob([testContent], {"type" : "text/xml"});
|
||||||
|
|
||||||
// do some tests
|
// do some tests
|
||||||
Assert.ok(f1 instanceof Ci.nsIDOMBlob, "Should be a DOM Blob");
|
Assert.ok(f1 instanceof Blob, "Should be a DOM Blob");
|
||||||
|
|
||||||
Assert.ok(!(f1 instanceof File), "Should not be a DOM File");
|
Assert.ok(!(f1 instanceof File), "Should not be a DOM File");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ var PropertyListUtils = Object.freeze({
|
||||||
/**
|
/**
|
||||||
* Asynchronously reads a file as a property list.
|
* Asynchronously reads a file as a property list.
|
||||||
*
|
*
|
||||||
* @param aFile (nsIDOMBlob/nsIFile)
|
* @param aFile (Blob/nsIFile)
|
||||||
* the file to be read as a property list.
|
* the file to be read as a property list.
|
||||||
* @param aCallback
|
* @param aCallback
|
||||||
* If the property list is read successfully, aPropertyListRoot is set
|
* If the property list is read successfully, aPropertyListRoot is set
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,7 @@ LocalFileToDirectoryOrBlob(nsPIDOMWindowInner* aWindow,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMBlob> blob = File::CreateFromFile(aWindow, aFile);
|
*aResult = ToSupports(File::CreateFromFile(aWindow, aFile).take());
|
||||||
blob.forget(aResult);
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,7 @@ nsFilePickerProxy::GetDomFileOrDirectory(nsISupports** aValue)
|
||||||
MOZ_ASSERT(mFilesOrDirectories.Length() == 1);
|
MOZ_ASSERT(mFilesOrDirectories.Length() == 1);
|
||||||
|
|
||||||
if (mFilesOrDirectories[0].IsFile()) {
|
if (mFilesOrDirectories[0].IsFile()) {
|
||||||
nsCOMPtr<nsIDOMBlob> blob = mFilesOrDirectories[0].GetAsFile().get();
|
nsCOMPtr<nsISupports> blob = ToSupports(mFilesOrDirectories[0].GetAsFile());
|
||||||
blob.forget(aValue);
|
blob.forget(aValue);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -247,7 +247,7 @@ public:
|
||||||
uint32_t index = mIndex++;
|
uint32_t index = mIndex++;
|
||||||
|
|
||||||
if (mFilesOrDirectories[index].IsFile()) {
|
if (mFilesOrDirectories[index].IsFile()) {
|
||||||
nsCOMPtr<nsIDOMBlob> blob = mFilesOrDirectories[index].GetAsFile().get();
|
nsCOMPtr<nsISupports> blob = ToSupports(mFilesOrDirectories[index].GetAsFile());
|
||||||
blob.forget(aValue);
|
blob.forget(aValue);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue