mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 757284: Restore Blob.mozSlice, with a deprecation warning. r=sicking
This commit is contained in:
parent
94b4b87db8
commit
574f66348d
@ -46,3 +46,4 @@ DEPRECATED_OPERATION(MozBeforePaint)
|
||||
DEPRECATED_OPERATION(MozBlobBuilder)
|
||||
DEPRECATED_OPERATION(DOMExceptionCode)
|
||||
DEPRECATED_OPERATION(MutationEvent)
|
||||
DEPRECATED_OPERATION(MozSlice)
|
||||
|
@ -28,7 +28,7 @@ interface nsIURI;
|
||||
interface nsIPrincipal;
|
||||
interface nsIDOMBlob;
|
||||
|
||||
[scriptable, builtinclass, uuid(f62c6887-e3bc-495a-802c-287e12e969a0)]
|
||||
[scriptable, builtinclass, uuid(16e3f8d1-7f31-48cc-93f5-9c931a977cf6)]
|
||||
interface nsIDOMBlob : nsISupports
|
||||
{
|
||||
readonly attribute unsigned long long size;
|
||||
@ -43,6 +43,11 @@ interface nsIDOMBlob : nsISupports
|
||||
[optional] in long long end,
|
||||
[optional] in DOMString contentType);
|
||||
|
||||
[optional_argc,implicit_jscontext]
|
||||
nsIDOMBlob mozSlice([optional] in long long start,
|
||||
[optional] in long long end,
|
||||
[optional] in DOMString contentType);
|
||||
|
||||
// Get internal id of stored file. Returns -1 if it is not a stored file.
|
||||
// Intended only for testing. It can be called on any thread.
|
||||
[notxpcom] long long getFileId();
|
||||
@ -56,7 +61,7 @@ interface nsIDOMBlob : nsISupports
|
||||
[notxpcom] FileInfo getFileInfo(in FileManager aFileManager);
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(eee028d1-8ce9-4c6c-b9ce-d89b656e1e17)]
|
||||
[scriptable, builtinclass, uuid(cddf6087-0e83-4e1f-91b3-4861d5d4c53f)]
|
||||
interface nsIDOMFile : nsIDOMBlob
|
||||
{
|
||||
readonly attribute DOMString name;
|
||||
|
@ -236,6 +236,30 @@ nsDOMFileBase::Slice(PRInt64 aStart, PRInt64 aEnd,
|
||||
return *aBlob ? NS_OK : NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMFileBase::MozSlice(PRInt64 aStart, PRInt64 aEnd,
|
||||
const nsAString& aContentType,
|
||||
JSContext* aCx,
|
||||
PRUint8 optional_argc,
|
||||
nsIDOMBlob **aBlob)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsIScriptGlobalObject* sgo = nsJSUtils::GetDynamicScriptGlobal(aCx);
|
||||
if (sgo) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(sgo);
|
||||
if (window) {
|
||||
nsCOMPtr<nsIDocument> document =
|
||||
do_QueryInterface(window->GetExtantDocument());
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eMozSlice);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Slice(aStart, aEnd, aContentType, optional_argc, aBlob);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMFileBase::GetInternalStream(nsIInputStream **aStream)
|
||||
{
|
||||
|
@ -204,6 +204,11 @@ function testSlice(file, size, type, contents, fileType) {
|
||||
var slice = file.slice(0, size);
|
||||
ok(slice instanceof Blob, fileType + " fullsize slice is a Blob");
|
||||
ok(!(slice instanceof File), fileType + " fullsize slice is not a File");
|
||||
|
||||
// Test that mozSlice works still.
|
||||
slice = file.mozSlice(0, size);
|
||||
ok(slice instanceof Blob, fileType + " fullsize slice is a Blob");
|
||||
ok(!(slice instanceof File), fileType + " fullsize slice is not a File");
|
||||
|
||||
slice = file.slice(0, 1234);
|
||||
ok(slice instanceof Blob, fileType + " sized slice is a Blob");
|
||||
|
@ -122,3 +122,5 @@ MozBlobBuilderWarning=Use of MozBlobBuilder is deprecated. Use Blob constructor
|
||||
DOMExceptionCodeWarning=Use of DOMException's code attribute is deprecated. Use name instead.
|
||||
# LOCALIZATION NOTE: Do not translate "Mutation Event" and "MutationObserver"
|
||||
MutationEventWarning=Use of Mutation Events is deprecated. Use MutationObserver instead.
|
||||
# LOCALIZATION NOTE: Do not translate "Blob", "mozSlice", or "slice"
|
||||
MozSliceWarning=Use of mozSlice on the Blob object is deprecated. Use slice instead.
|
||||
|
Loading…
Reference in New Issue
Block a user