mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 16:25:38 +00:00
Back out 3 changesets (bug 1017613) for build bustage
CLOSED TREE Backed out changeset 77b599edbab4 (bug 1017613) Backed out changeset f048600cf938 (bug 1017613) Backed out changeset 083a2fb884ed (bug 1017613)
This commit is contained in:
parent
f8fdaf03f2
commit
39082e7a18
@ -187,7 +187,6 @@
|
||||
#include "mozilla/dom/MessagePort.h"
|
||||
#include "mozilla/dom/MessagePortBinding.h"
|
||||
#include "mozilla/dom/indexedDB/IDBFactory.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
|
||||
#include "mozilla/dom/StructuredCloneTags.h"
|
||||
|
||||
@ -6371,14 +6370,6 @@ nsGlobalWindow::Confirm(const nsAString& aString, bool* aReturn)
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
already_AddRefed<Promise>
|
||||
nsGlobalWindow::Fetch(const RequestOrScalarValueString& aInput,
|
||||
const RequestInit& aInit, ErrorResult& aRv)
|
||||
{
|
||||
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindow::Prompt(const nsAString& aMessage, const nsAString& aInitial,
|
||||
nsAString& aReturn, ErrorResult& aError)
|
||||
|
@ -38,10 +38,8 @@
|
||||
#include "nsSize.h"
|
||||
#include "mozFlushType.h"
|
||||
#include "prclist.h"
|
||||
#include "mozilla/dom/RequestBinding.h"
|
||||
#include "mozilla/dom/StorageEvent.h"
|
||||
#include "mozilla/dom/StorageEventBinding.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
#include "nsFrameMessageManager.h"
|
||||
#include "mozilla/LinkedList.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
@ -109,7 +107,6 @@ class MediaQueryList;
|
||||
class MozSelfSupport;
|
||||
class Navigator;
|
||||
class OwningExternalOrWindowProxy;
|
||||
class Promise;
|
||||
class Selection;
|
||||
class SpeechSynthesis;
|
||||
class WakeLock;
|
||||
@ -853,9 +850,6 @@ public:
|
||||
void Alert(mozilla::ErrorResult& aError);
|
||||
void Alert(const nsAString& aMessage, mozilla::ErrorResult& aError);
|
||||
bool Confirm(const nsAString& aMessage, mozilla::ErrorResult& aError);
|
||||
already_AddRefed<mozilla::dom::Promise> Fetch(const mozilla::dom::RequestOrScalarValueString& aInput,
|
||||
const mozilla::dom::RequestInit& aInit,
|
||||
mozilla::ErrorResult& aRv);
|
||||
void Prompt(const nsAString& aMessage, const nsAString& aInitial,
|
||||
nsAString& aReturn, mozilla::ErrorResult& aError);
|
||||
void Print(mozilla::ErrorResult& aError);
|
||||
|
@ -883,14 +883,6 @@ DOMInterfaces = {
|
||||
'nativeType': 'nsDOMCSSRect',
|
||||
},
|
||||
|
||||
'Request': {
|
||||
'binaryNames': { 'headers': 'headers_' },
|
||||
},
|
||||
|
||||
'Response': {
|
||||
'binaryNames': { 'headers': 'headers_' },
|
||||
},
|
||||
|
||||
'RGBColor': {
|
||||
'nativeType': 'nsDOMCSSRGBColor',
|
||||
},
|
||||
|
@ -1,113 +0,0 @@
|
||||
/* -*- Mode: C++; 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 "Request.h"
|
||||
|
||||
#include "nsDOMString.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
||||
#include "mozilla/dom/Promise.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(Request)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(Request)
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Request, mOwner, mHeaders)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Request)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
Request::Request(nsISupports* aOwner)
|
||||
: mOwner(aOwner)
|
||||
, mHeaders(new Headers(aOwner))
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
Request::~Request()
|
||||
{
|
||||
}
|
||||
|
||||
/*static*/ already_AddRefed<Request>
|
||||
Request::Constructor(const GlobalObject& global,
|
||||
const RequestOrScalarValueString& aInput,
|
||||
const RequestInit& aInit, ErrorResult& rv)
|
||||
{
|
||||
nsRefPtr<Request> request = new Request(global.GetAsSupports());
|
||||
return request.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<Request>
|
||||
Request::Clone() const
|
||||
{
|
||||
nsRefPtr<Request> request = new Request(mOwner);
|
||||
return request.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<Promise>
|
||||
Request::ArrayBuffer(ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetParentObject());
|
||||
MOZ_ASSERT(global);
|
||||
nsRefPtr<Promise> promise = Promise::Create(global, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
promise->MaybeReject(NS_ERROR_NOT_AVAILABLE);
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<Promise>
|
||||
Request::Blob(ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetParentObject());
|
||||
MOZ_ASSERT(global);
|
||||
nsRefPtr<Promise> promise = Promise::Create(global, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
promise->MaybeReject(NS_ERROR_NOT_AVAILABLE);
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<Promise>
|
||||
Request::Json(ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetParentObject());
|
||||
MOZ_ASSERT(global);
|
||||
nsRefPtr<Promise> promise = Promise::Create(global, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
promise->MaybeReject(NS_ERROR_NOT_AVAILABLE);
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<Promise>
|
||||
Request::Text(ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetParentObject());
|
||||
MOZ_ASSERT(global);
|
||||
nsRefPtr<Promise> promise = Promise::Create(global, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
promise->MaybeReject(NS_ERROR_NOT_AVAILABLE);
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
bool
|
||||
Request::BodyUsed()
|
||||
{
|
||||
return false;
|
||||
}
|
@ -1,106 +0,0 @@
|
||||
/* -*- Mode: C++; 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/. */
|
||||
|
||||
#ifndef mozilla_dom_Request_h
|
||||
#define mozilla_dom_Request_h
|
||||
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
#include "mozilla/dom/RequestBinding.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
|
||||
|
||||
class nsPIDOMWindow;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class Promise;
|
||||
|
||||
class Request MOZ_FINAL : public nsISupports
|
||||
, public nsWrapperCache
|
||||
{
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Request)
|
||||
|
||||
public:
|
||||
Request(nsISupports* aOwner);
|
||||
|
||||
JSObject*
|
||||
WrapObject(JSContext* aCx)
|
||||
{
|
||||
return RequestBinding::Wrap(aCx, this);
|
||||
}
|
||||
|
||||
void
|
||||
GetUrl(DOMString& aUrl) const
|
||||
{
|
||||
aUrl.AsAString() = EmptyString();
|
||||
}
|
||||
|
||||
void
|
||||
GetMethod(nsCString& aMethod) const
|
||||
{
|
||||
aMethod = EmptyCString();
|
||||
}
|
||||
|
||||
RequestMode
|
||||
Mode() const
|
||||
{
|
||||
return RequestMode::Same_origin;
|
||||
}
|
||||
|
||||
RequestCredentials
|
||||
Credentials() const
|
||||
{
|
||||
return RequestCredentials::Omit;
|
||||
}
|
||||
|
||||
void
|
||||
GetReferrer(DOMString& aReferrer) const
|
||||
{
|
||||
aReferrer.AsAString() = EmptyString();
|
||||
}
|
||||
|
||||
Headers* Headers_() const { return mHeaders; }
|
||||
|
||||
static already_AddRefed<Request>
|
||||
Constructor(const GlobalObject& aGlobal, const RequestOrScalarValueString& aInput,
|
||||
const RequestInit& aInit, ErrorResult& rv);
|
||||
|
||||
nsISupports* GetParentObject() const
|
||||
{
|
||||
return mOwner;
|
||||
}
|
||||
|
||||
already_AddRefed<Request>
|
||||
Clone() const;
|
||||
|
||||
already_AddRefed<Promise>
|
||||
ArrayBuffer(ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<Promise>
|
||||
Blob(ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<Promise>
|
||||
Json(ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<Promise>
|
||||
Text(ErrorResult& aRv);
|
||||
|
||||
bool
|
||||
BodyUsed();
|
||||
private:
|
||||
~Request();
|
||||
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
nsRefPtr<Headers> mHeaders;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_Request_h
|
@ -1,134 +0,0 @@
|
||||
/* -*- Mode: C++; 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 "Response.h"
|
||||
#include "nsDOMString.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
|
||||
#include "mozilla/ErrorResult.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(Response)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(Response)
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Response, mOwner)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Response)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
Response::Response(nsISupports* aOwner)
|
||||
: mOwner(aOwner)
|
||||
, mHeaders(new Headers(aOwner))
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
Response::~Response()
|
||||
{
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<Response>
|
||||
Response::Error(const GlobalObject& aGlobal)
|
||||
{
|
||||
ErrorResult result;
|
||||
ResponseInit init;
|
||||
init.mStatus = 0;
|
||||
Optional<ArrayBufferOrArrayBufferViewOrScalarValueStringOrURLSearchParams> body;
|
||||
nsRefPtr<Response> r = Response::Constructor(aGlobal, body, init, result);
|
||||
return r.forget();
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<Response>
|
||||
Response::Redirect(const GlobalObject& aGlobal, const nsAString& aUrl,
|
||||
uint16_t aStatus)
|
||||
{
|
||||
ErrorResult result;
|
||||
ResponseInit init;
|
||||
Optional<ArrayBufferOrArrayBufferViewOrScalarValueStringOrURLSearchParams> body;
|
||||
nsRefPtr<Response> r = Response::Constructor(aGlobal, body, init, result);
|
||||
return r.forget();
|
||||
}
|
||||
|
||||
/*static*/ already_AddRefed<Response>
|
||||
Response::Constructor(const GlobalObject& global,
|
||||
const Optional<ArrayBufferOrArrayBufferViewOrScalarValueStringOrURLSearchParams>& aBody,
|
||||
const ResponseInit& aInit, ErrorResult& rv)
|
||||
{
|
||||
nsRefPtr<Response> response = new Response(global.GetAsSupports());
|
||||
return response.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<Response>
|
||||
Response::Clone()
|
||||
{
|
||||
nsRefPtr<Response> response = new Response(mOwner);
|
||||
return response.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<Promise>
|
||||
Response::ArrayBuffer(ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetParentObject());
|
||||
MOZ_ASSERT(global);
|
||||
nsRefPtr<Promise> promise = Promise::Create(global, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
promise->MaybeReject(NS_ERROR_NOT_AVAILABLE);
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<Promise>
|
||||
Response::Blob(ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetParentObject());
|
||||
MOZ_ASSERT(global);
|
||||
nsRefPtr<Promise> promise = Promise::Create(global, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
promise->MaybeReject(NS_ERROR_NOT_AVAILABLE);
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<Promise>
|
||||
Response::Json(ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetParentObject());
|
||||
MOZ_ASSERT(global);
|
||||
nsRefPtr<Promise> promise = Promise::Create(global, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
promise->MaybeReject(NS_ERROR_NOT_AVAILABLE);
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<Promise>
|
||||
Response::Text(ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetParentObject());
|
||||
MOZ_ASSERT(global);
|
||||
nsRefPtr<Promise> promise = Promise::Create(global, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
promise->MaybeReject(NS_ERROR_NOT_AVAILABLE);
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
bool
|
||||
Response::BodyUsed()
|
||||
{
|
||||
return false;
|
||||
}
|
@ -1,107 +0,0 @@
|
||||
/* -*- Mode: C++; 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/. */
|
||||
|
||||
#ifndef mozilla_dom_Response_h
|
||||
#define mozilla_dom_Response_h
|
||||
|
||||
#include "nsWrapperCache.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
|
||||
#include "mozilla/dom/ResponseBinding.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
|
||||
class nsPIDOMWindow;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class Headers;
|
||||
|
||||
class Response MOZ_FINAL : public nsISupports
|
||||
, public nsWrapperCache
|
||||
{
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Response)
|
||||
|
||||
public:
|
||||
Response(nsISupports* aOwner);
|
||||
|
||||
JSObject*
|
||||
WrapObject(JSContext* aCx)
|
||||
{
|
||||
return ResponseBinding::Wrap(aCx, this);
|
||||
}
|
||||
|
||||
ResponseType
|
||||
Type() const
|
||||
{
|
||||
return ResponseType::Error;
|
||||
}
|
||||
|
||||
void
|
||||
GetUrl(DOMString& aUrl) const
|
||||
{
|
||||
aUrl.AsAString() = EmptyString();
|
||||
}
|
||||
|
||||
uint16_t
|
||||
Status() const
|
||||
{
|
||||
return 400;
|
||||
}
|
||||
|
||||
void
|
||||
GetStatusText(nsCString& aStatusText) const
|
||||
{
|
||||
aStatusText = EmptyCString();
|
||||
}
|
||||
|
||||
Headers*
|
||||
Headers_() const { return mHeaders; }
|
||||
|
||||
static already_AddRefed<Response>
|
||||
Error(const GlobalObject& aGlobal);
|
||||
|
||||
static already_AddRefed<Response>
|
||||
Redirect(const GlobalObject& aGlobal, const nsAString& aUrl, uint16_t aStatus);
|
||||
|
||||
static already_AddRefed<Response>
|
||||
Constructor(const GlobalObject& aGlobal,
|
||||
const Optional<ArrayBufferOrArrayBufferViewOrScalarValueStringOrURLSearchParams>& aBody,
|
||||
const ResponseInit& aInit, ErrorResult& rv);
|
||||
|
||||
nsISupports* GetParentObject() const
|
||||
{
|
||||
return mOwner;
|
||||
}
|
||||
|
||||
already_AddRefed<Response>
|
||||
Clone();
|
||||
|
||||
already_AddRefed<Promise>
|
||||
ArrayBuffer(ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<Promise>
|
||||
Blob(ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<Promise>
|
||||
Json(ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<Promise>
|
||||
Text(ErrorResult& aRv);
|
||||
|
||||
bool
|
||||
BodyUsed();
|
||||
private:
|
||||
~Response();
|
||||
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
nsRefPtr<Headers> mHeaders;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_Response_h
|
@ -6,14 +6,10 @@
|
||||
|
||||
EXPORTS.mozilla.dom += [
|
||||
'Headers.h',
|
||||
'Request.h',
|
||||
'Response.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'Headers.cpp',
|
||||
'Request.cpp',
|
||||
'Response.cpp',
|
||||
]
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
|
@ -862,10 +862,6 @@ var interfaceNamesInGlobalScope =
|
||||
"RecordErrorEvent",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"Rect",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "Request", pref: "dom.fetch.enabled"},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "Response", pref: "dom.fetch.enabled"},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"RGBColor",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
|
@ -1,36 +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/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* http://fetch.spec.whatwg.org/
|
||||
*/
|
||||
|
||||
typedef object JSON;
|
||||
// FIXME(nsm): Bug 1071290: Blobs can't be passed as unions in workers.
|
||||
// FIXME(nsm): Bug 739173: FormData is not available in workers.
|
||||
// typedef (ArrayBuffer or ArrayBufferView or Blob or FormData or ScalarValueString or URLSearchParams) BodyInit;
|
||||
typedef (ArrayBuffer or ArrayBufferView or ScalarValueString or URLSearchParams) BodyInit;
|
||||
|
||||
[NoInterfaceObject, Exposed=(Window,Worker)]
|
||||
interface Body {
|
||||
readonly attribute boolean bodyUsed;
|
||||
[Throws]
|
||||
Promise<ArrayBuffer> arrayBuffer();
|
||||
[Throws]
|
||||
Promise<Blob> blob();
|
||||
// FIXME(nsm): Bug 739173 FormData is not supported in workers.
|
||||
// Promise<FormData> formData();
|
||||
[Throws]
|
||||
Promise<JSON> json();
|
||||
[Throws]
|
||||
Promise<ScalarValueString> text();
|
||||
};
|
||||
|
||||
[NoInterfaceObject, Exposed=(Window,Worker)]
|
||||
interface GlobalFetch {
|
||||
[Throws, Func="mozilla::dom::Headers::PrefEnabled"]
|
||||
Promise<Response> fetch(RequestInfo input, optional RequestInit init);
|
||||
};
|
||||
|
@ -1,38 +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/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* https://fetch.spec.whatwg.org/#request-class
|
||||
*/
|
||||
|
||||
typedef (Request or ScalarValueString) RequestInfo;
|
||||
|
||||
[Constructor(RequestInfo input, optional RequestInit init),
|
||||
Exposed=(Window,Worker),
|
||||
Func="mozilla::dom::Headers::PrefEnabled"]
|
||||
interface Request {
|
||||
readonly attribute ByteString method;
|
||||
readonly attribute ScalarValueString url;
|
||||
readonly attribute Headers headers;
|
||||
|
||||
readonly attribute DOMString referrer;
|
||||
readonly attribute RequestMode mode;
|
||||
readonly attribute RequestCredentials credentials;
|
||||
|
||||
Request clone();
|
||||
};
|
||||
|
||||
Request implements Body;
|
||||
|
||||
dictionary RequestInit {
|
||||
ByteString method;
|
||||
HeadersInit headers;
|
||||
BodyInit body;
|
||||
RequestMode mode;
|
||||
RequestCredentials credentials;
|
||||
};
|
||||
|
||||
enum RequestMode { "same-origin", "no-cors", "cors" };
|
||||
enum RequestCredentials { "omit", "same-origin", "include" };
|
@ -1,36 +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/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* https://fetch.spec.whatwg.org/#response-class
|
||||
*/
|
||||
|
||||
[Constructor(optional BodyInit body, optional ResponseInit init),
|
||||
Exposed=(Window,Worker),
|
||||
Func="mozilla::dom::Headers::PrefEnabled"]
|
||||
interface Response {
|
||||
static Response error();
|
||||
static Response redirect(ScalarValueString url, optional unsigned short status = 302);
|
||||
|
||||
readonly attribute ResponseType type;
|
||||
|
||||
readonly attribute ScalarValueString url;
|
||||
readonly attribute unsigned short status;
|
||||
readonly attribute ByteString statusText;
|
||||
readonly attribute Headers headers;
|
||||
|
||||
Response clone();
|
||||
};
|
||||
|
||||
Response implements Body;
|
||||
|
||||
dictionary ResponseInit {
|
||||
unsigned short status = 200;
|
||||
// WebIDL spec doesn't allow default values for ByteString.
|
||||
ByteString statusText;
|
||||
HeadersInit headers;
|
||||
};
|
||||
|
||||
enum ResponseType { "basic", "cors", "default", "error", "opaque" };
|
@ -465,4 +465,3 @@ interface ChromeWindow {
|
||||
};
|
||||
|
||||
Window implements ChromeWindow;
|
||||
Window implements GlobalFetch;
|
||||
|
@ -38,7 +38,6 @@ partial interface WorkerGlobalScope {
|
||||
|
||||
WorkerGlobalScope implements WindowTimers;
|
||||
WorkerGlobalScope implements WindowBase64;
|
||||
WorkerGlobalScope implements GlobalFetch;
|
||||
|
||||
// Not implemented yet: bug 1072107.
|
||||
// WorkerGlobalScope implements FontFaceSource;
|
||||
|
@ -124,7 +124,6 @@ WEBIDL_FILES = [
|
||||
'EventListener.webidl',
|
||||
'EventSource.webidl',
|
||||
'EventTarget.webidl',
|
||||
'Fetch.webidl',
|
||||
'File.webidl',
|
||||
'FileList.webidl',
|
||||
'FileMode.webidl',
|
||||
@ -327,10 +326,8 @@ WEBIDL_FILES = [
|
||||
'RadioNodeList.webidl',
|
||||
'Range.webidl',
|
||||
'Rect.webidl',
|
||||
'Request.webidl',
|
||||
'ResourceStats.webidl',
|
||||
'ResourceStatsManager.webidl',
|
||||
'Response.webidl',
|
||||
'RGBColor.webidl',
|
||||
'RTCConfiguration.webidl',
|
||||
'RTCIceCandidate.webidl',
|
||||
|
@ -303,14 +303,6 @@ WorkerGlobalScope::GetPerformance()
|
||||
return mPerformance;
|
||||
}
|
||||
|
||||
already_AddRefed<Promise>
|
||||
WorkerGlobalScope::Fetch(const RequestOrScalarValueString& aInput,
|
||||
const RequestInit& aInit, ErrorResult& aRv)
|
||||
{
|
||||
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope(WorkerPrivate* aWorkerPrivate)
|
||||
: WorkerGlobalScope(aWorkerPrivate)
|
||||
{
|
||||
|
@ -8,8 +8,6 @@
|
||||
|
||||
#include "Workers.h"
|
||||
#include "mozilla/DOMEventTargetHelper.h"
|
||||
#include "mozilla/dom/RequestBinding.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -122,9 +120,6 @@ public:
|
||||
Dump(const Optional<nsAString>& aString) const;
|
||||
|
||||
Performance* GetPerformance();
|
||||
|
||||
already_AddRefed<Promise>
|
||||
Fetch(const RequestOrScalarValueString& aInput, const RequestInit& aInit, ErrorResult& aRv);
|
||||
};
|
||||
|
||||
class DedicatedWorkerGlobalScope MOZ_FINAL : public WorkerGlobalScope
|
||||
|
@ -86,7 +86,6 @@ TEST_DIRS += [
|
||||
]
|
||||
|
||||
MOCHITEST_MANIFESTS += [
|
||||
'test/fetch/mochitest.ini',
|
||||
'test/mochitest.ini',
|
||||
'test/serviceworkers/mochitest.ini',
|
||||
]
|
||||
|
@ -1,5 +0,0 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
worker_interfaces.js
|
||||
|
||||
[test_interfaces.html]
|
@ -1,7 +0,0 @@
|
||||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
MOCHITEST_MANIFESTS += ['mochitest.ini']
|
@ -1,48 +0,0 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Bug 1017613 - Test fetch API interfaces</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test"></pre>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
function checkEnabled() {
|
||||
var worker = new Worker("worker_interfaces.js");
|
||||
worker.onmessage = function(event) {
|
||||
|
||||
if (event.data.type == 'finish') {
|
||||
SimpleTest.finish();
|
||||
} else if (event.data.type == 'status') {
|
||||
ok(event.data.status, event.data.msg);
|
||||
}
|
||||
}
|
||||
|
||||
worker.onerror = function(event) {
|
||||
ok(false, "Worker had an error: " + event.data);
|
||||
SimpleTest.finish();
|
||||
};
|
||||
|
||||
worker.postMessage(true);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
SpecialPowers.pushPrefEnv({"set": [
|
||||
["dom.fetch.enabled", true]
|
||||
]}, function() {
|
||||
checkEnabled();
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,12 +0,0 @@
|
||||
function ok(a, msg) {
|
||||
dump("OK: " + !!a + " => " + a + " " + msg + "\n");
|
||||
postMessage({type: 'status', status: !!a, msg: a + ": " + msg });
|
||||
}
|
||||
|
||||
onmessage = function() {
|
||||
ok(typeof Headers === "function", "Headers should be defined");
|
||||
ok(typeof Request === "function", "Request should be defined");
|
||||
ok(typeof Response === "function", "Response should be defined");
|
||||
ok(typeof fetch === "function", "fetch() should be defined");
|
||||
postMessage({ type: 'finish' });
|
||||
}
|
Loading…
Reference in New Issue
Block a user