Bug 1336018 - Get rid of objectURLOptions dictionary in URL.createObjectURL, r=smaug

This commit is contained in:
Andrea Marchesini 2017-02-03 08:28:52 +01:00
Родитель 2134b5e0e7
Коммит 899a146699
4 изменённых файлов: 18 добавлений и 38 удалений

Просмотреть файл

@ -47,8 +47,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=882653
[ '(new TextDecoder).decode(new Uint8Array(), 5)',
"Argument 2 of TextDecoder.decode can't be converted to a dictionary.",
"primitive passed for a dictionary" ],
[ 'URL.createObjectURL(null, null)',
"Argument 1 is not valid for any of the 2-argument overloads of URL.createObjectURL.",
[ 'URL.createObjectURL(null)',
"Argument 1 is not valid for any of the 1-argument overloads of URL.createObjectURL.",
"overload resolution failure" ],
[ 'document.createElement("select").add({})',
"Argument 1 of HTMLSelectElement.add could not be converted to any of: HTMLOptionElement, HTMLOptGroupElement.",

Просмотреть файл

@ -80,8 +80,7 @@ public:
static void
CreateObjectURL(const GlobalObject& aGlobal, Blob& aBlob,
const objectURLOptions& aOptions, nsAString& aResult,
ErrorResult& aRv)
nsAString& aResult, ErrorResult& aRv)
{
MOZ_ASSERT(NS_IsMainThread());
CreateObjectURLInternal(aGlobal, aBlob.Impl(), aResult, aRv);
@ -89,8 +88,7 @@ public:
static void
CreateObjectURL(const GlobalObject& aGlobal, DOMMediaStream& aStream,
const objectURLOptions& aOptions, nsAString& aResult,
ErrorResult& aRv)
nsAString& aResult, ErrorResult& aRv)
{
MOZ_ASSERT(NS_IsMainThread());
CreateObjectURLInternal(aGlobal, &aStream, aResult, aRv);
@ -98,8 +96,7 @@ public:
static void
CreateObjectURL(const GlobalObject& aGlobal, MediaSource& aSource,
const objectURLOptions& aOptions, nsAString& aResult,
ErrorResult& aRv);
nsAString& aResult, ErrorResult& aRv);
static void
RevokeObjectURL(const GlobalObject& aGlobal, const nsAString& aURL,
@ -257,7 +254,6 @@ URLMainThread::Constructor(nsISupports* aParent, const nsAString& aURL,
/* static */ void
URLMainThread::CreateObjectURL(const GlobalObject& aGlobal,
MediaSource& aSource,
const objectURLOptions& aOptions,
nsAString& aResult, ErrorResult& aRv)
{
MOZ_ASSERT(NS_IsMainThread());
@ -654,7 +650,6 @@ public:
static void
CreateObjectURL(const GlobalObject& aGlobal, Blob& aBlob,
const mozilla::dom::objectURLOptions& aOptions,
nsAString& aResult, mozilla::ErrorResult& aRv);
static void
@ -755,7 +750,6 @@ private:
public:
CreateURLRunnable(WorkerPrivate* aWorkerPrivate, BlobImpl* aBlobImpl,
const objectURLOptions& aOptions,
nsAString& aURL)
: WorkerMainThreadRunnable(aWorkerPrivate,
NS_LITERAL_CSTRING("URL :: CreateURL"))
@ -1297,7 +1291,6 @@ URLWorker::Constructor(const GlobalObject& aGlobal, const nsAString& aURL,
/* static */ void
URLWorker::CreateObjectURL(const GlobalObject& aGlobal, Blob& aBlob,
const mozilla::dom::objectURLOptions& aOptions,
nsAString& aResult, mozilla::ErrorResult& aRv)
{
JSContext* cx = aGlobal.Context();
@ -1312,7 +1305,7 @@ URLWorker::CreateObjectURL(const GlobalObject& aGlobal, Blob& aBlob,
}
RefPtr<CreateURLRunnable> runnable =
new CreateURLRunnable(workerPrivate, blobImpl, aOptions, aResult);
new CreateURLRunnable(workerPrivate, blobImpl, aResult);
runnable->Dispatch(Terminating, aRv);
if (NS_WARN_IF(aRv.Failed())) {
@ -1720,33 +1713,29 @@ URL::WorkerConstructor(const GlobalObject& aGlobal, const nsAString& aURL,
void
URL::CreateObjectURL(const GlobalObject& aGlobal, Blob& aBlob,
const objectURLOptions& aOptions, nsAString& aResult,
ErrorResult& aRv)
nsAString& aResult, ErrorResult& aRv)
{
if (NS_IsMainThread()) {
URLMainThread::CreateObjectURL(aGlobal, aBlob, aOptions, aResult, aRv);
URLMainThread::CreateObjectURL(aGlobal, aBlob, aResult, aRv);
} else {
URLWorker::CreateObjectURL(aGlobal, aBlob, aOptions, aResult, aRv);
URLWorker::CreateObjectURL(aGlobal, aBlob, aResult, aRv);
}
}
void
URL::CreateObjectURL(const GlobalObject& aGlobal, DOMMediaStream& aStream,
const objectURLOptions& aOptions, nsAString& aResult,
ErrorResult& aRv)
nsAString& aResult, ErrorResult& aRv)
{
MOZ_ASSERT(NS_IsMainThread());
URLMainThread::CreateObjectURL(aGlobal, aStream, aOptions, aResult, aRv);
URLMainThread::CreateObjectURL(aGlobal, aStream, aResult, aRv);
}
void
URL::CreateObjectURL(const GlobalObject& aGlobal, MediaSource& aSource,
const objectURLOptions& aOptions,
nsAString& aResult,
ErrorResult& aRv)
nsAString& aResult, ErrorResult& aRv)
{
MOZ_ASSERT(NS_IsMainThread());
URLMainThread::CreateObjectURL(aGlobal, aSource, aOptions, aResult, aRv);
URLMainThread::CreateObjectURL(aGlobal, aSource, aResult, aRv);
}
void

Просмотреть файл

@ -26,7 +26,6 @@ namespace dom {
class Blob;
class MediaSource;
class GlobalObject;
struct objectURLOptions;
class URL : public URLSearchParamsObserver
, public nsWrapperCache
@ -64,18 +63,15 @@ public:
static void
CreateObjectURL(const GlobalObject& aGlobal, Blob& aBlob,
const objectURLOptions& aOptions,
nsAString& aResult, ErrorResult& aRv);
static void
CreateObjectURL(const GlobalObject& aGlobal, DOMMediaStream& aStream,
const objectURLOptions& aOptions, nsAString& aResult,
ErrorResult& aRv);
nsAString& aResult, ErrorResult& aRv);
static void
CreateObjectURL(const GlobalObject& aGlobal, MediaSource& aSource,
const objectURLOptions& aOptions, nsAString& aResult,
ErrorResult& aRv);
nsAString& aResult, ErrorResult& aRv);
static void
RevokeObjectURL(const GlobalObject& aGlobal, const nsAString& aURL,

Просмотреть файл

@ -51,22 +51,17 @@ interface URL {
partial interface URL {
[Throws]
static DOMString createObjectURL(Blob blob, optional objectURLOptions options);
static DOMString createObjectURL(Blob blob);
[Throws]
static DOMString createObjectURL(MediaStream stream, optional objectURLOptions options);
static DOMString createObjectURL(MediaStream stream);
[Throws]
static void revokeObjectURL(DOMString url);
[ChromeOnly, Throws]
static boolean isValidURL(DOMString url);
};
dictionary objectURLOptions
{
/* boolean autoRevoke = true; */ /* not supported yet */
};
// https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html
partial interface URL {
[Throws]
static DOMString? createObjectURL(MediaSource source, optional objectURLOptions options);
static DOMString? createObjectURL(MediaSource source);
};