mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-14 22:13:31 +00:00
Bug 1017613 - Part 3 - fetch() IDL and stubs. r=baku
--HG-- extra : transplant_source : %B3%0A%E7%17m%5C%A5%DF%F4%1A%90Z%CF%B7%E2Y%CA%1E%21w
This commit is contained in:
parent
8f0bb32f46
commit
6e8e93e87a
@ -187,6 +187,7 @@
|
||||
#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"
|
||||
|
||||
@ -6370,6 +6371,14 @@ 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,8 +38,10 @@
|
||||
#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"
|
||||
@ -107,6 +109,7 @@ class MediaQueryList;
|
||||
class MozSelfSupport;
|
||||
class Navigator;
|
||||
class OwningExternalOrWindowProxy;
|
||||
class Promise;
|
||||
class Selection;
|
||||
class SpeechSynthesis;
|
||||
class WakeLock;
|
||||
@ -850,6 +853,9 @@ 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);
|
||||
|
@ -27,3 +27,10 @@ interface Body {
|
||||
[Throws]
|
||||
Promise<ScalarValueString> text();
|
||||
};
|
||||
|
||||
[NoInterfaceObject, Exposed=(Window,Worker)]
|
||||
interface GlobalFetch {
|
||||
[Throws, Func="mozilla::dom::Headers::PrefEnabled"]
|
||||
Promise<Response> fetch(RequestInfo input, optional RequestInit init);
|
||||
};
|
||||
|
||||
|
@ -465,3 +465,4 @@ interface ChromeWindow {
|
||||
};
|
||||
|
||||
Window implements ChromeWindow;
|
||||
Window implements GlobalFetch;
|
||||
|
@ -38,6 +38,7 @@ partial interface WorkerGlobalScope {
|
||||
|
||||
WorkerGlobalScope implements WindowTimers;
|
||||
WorkerGlobalScope implements WindowBase64;
|
||||
WorkerGlobalScope implements GlobalFetch;
|
||||
|
||||
// Not implemented yet: bug 1072107.
|
||||
// WorkerGlobalScope implements FontFaceSource;
|
||||
|
@ -303,6 +303,14 @@ 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,6 +8,9 @@
|
||||
|
||||
#include "Workers.h"
|
||||
#include "mozilla/DOMEventTargetHelper.h"
|
||||
#include "mozilla/dom/Headers.h"
|
||||
#include "mozilla/dom/RequestBinding.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -120,6 +123,9 @@ 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
|
||||
|
@ -7,5 +7,6 @@ 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…
x
Reference in New Issue
Block a user