| Index: Source/modules/serviceworkers/Request.cpp
|
| diff --git a/Source/modules/serviceworkers/Request.cpp b/Source/modules/serviceworkers/Request.cpp
|
| index f615e919060e2dd72e79a3bb78d2faa3a72b1511..d8bcbf5fa35bb522709e850629602b72a06f74d4 100644
|
| --- a/Source/modules/serviceworkers/Request.cpp
|
| +++ b/Source/modules/serviceworkers/Request.cpp
|
| @@ -44,7 +44,7 @@ private:
|
| WebServiceWorkerRequest* m_webRequest;
|
| };
|
|
|
| -PassRefPtrWillBeRawPtr<Request> createRequestWithRequestData(PassRefPtrWillBeRawPtr<FetchRequestData> request, const RequestInit& init, FetchRequestData::Mode mode, FetchRequestData::Credentials credentials, ExceptionState& exceptionState)
|
| +Request* createRequestWithRequestData(FetchRequestData* request, const RequestInit& init, FetchRequestData::Mode mode, FetchRequestData::Credentials credentials, ExceptionState& exceptionState)
|
| {
|
| // "6. Let |mode| be |init|'s mode member if it is present, and
|
| // |fallbackMode| otherwise."
|
| @@ -83,11 +83,11 @@ PassRefPtrWillBeRawPtr<Request> createRequestWithRequestData(PassRefPtrWillBeRaw
|
| // "1. If |method| is not a useful method, throw a TypeError."
|
| if (!FetchUtils::isUsefulMethod(init.method)) {
|
| exceptionState.throwTypeError("'" + init.method + "' HTTP method is unsupported.");
|
| - return nullptr;
|
| + return 0;
|
| }
|
| if (!isValidHTTPToken(init.method)) {
|
| exceptionState.throwTypeError("'" + init.method + "' is not a valid HTTP method.");
|
| - return nullptr;
|
| + return 0;
|
| }
|
| // FIXME: "2. Add case correction as in XMLHttpRequest?"
|
| // "3. Set |request|'s method to |method|."
|
| @@ -95,14 +95,14 @@ PassRefPtrWillBeRawPtr<Request> createRequestWithRequestData(PassRefPtrWillBeRaw
|
| }
|
| // "11. Let |r| be a new Request object associated with |request|, Headers
|
| // object, and FetchBodyStream object."
|
| - RefPtrWillBeRawPtr<Request> r = Request::create(request);
|
| + Request* r = Request::create(request);
|
|
|
| // "12. Let |headers| be a copy of |r|'s Headers object."
|
| // "13. If |init|'s headers member is present, set |headers| to |init|'s
|
| // headers member."
|
| // We don't create a copy of r's Headers object when init's headers member
|
| // is present.
|
| - RefPtrWillBeRawPtr<Headers> headers = nullptr;
|
| + Headers* headers = 0;
|
| if (!init.headers && init.headersDictionary.isUndefinedOrNull()) {
|
| headers = r->headers()->createCopy();
|
| }
|
| @@ -115,7 +115,7 @@ PassRefPtrWillBeRawPtr<Request> createRequestWithRequestData(PassRefPtrWillBeRaw
|
| // TypeError."
|
| if (!FetchUtils::isSimpleMethod(r->request()->method())) {
|
| exceptionState.throwTypeError("'" + r->request()->method() + "' is unsupported in no-cors mode.");
|
| - return nullptr;
|
| + return 0;
|
| }
|
| // "Set |r|'s Headers object's guard to |request-no-CORS|.
|
| r->headers()->setGuard(Headers::RequestNoCORSGuard);
|
| @@ -129,10 +129,10 @@ PassRefPtrWillBeRawPtr<Request> createRequestWithRequestData(PassRefPtrWillBeRaw
|
| r->headers()->fillWith(init.headersDictionary, exceptionState);
|
| } else {
|
| ASSERT(headers);
|
| - r->headers()->fillWith(headers.get(), exceptionState);
|
| + r->headers()->fillWith(headers, exceptionState);
|
| }
|
| if (exceptionState.hadException())
|
| - return nullptr;
|
| + return 0;
|
| // "17. If |init|'s body member is present, run these substeps:"
|
| if (init.bodyBlobHandle) {
|
| // "1. Let |stream| and |Content-Type| be the result of extracting
|
| @@ -147,31 +147,28 @@ PassRefPtrWillBeRawPtr<Request> createRequestWithRequestData(PassRefPtrWillBeRaw
|
| r->headers()->append("Content-Type", init.bodyBlobHandle->type(), exceptionState);
|
| }
|
| if (exceptionState.hadException())
|
| - return nullptr;
|
| + return 0;
|
| }
|
| // "18. Set |r|'s FetchBodyStream object's MIME type to the result of
|
| // extracting a MIME type from |r|'s request's header list."
|
| // FIXME: We don't have MIME type in FetchBodyStream object yet.
|
|
|
| // "19. Return |r|."
|
| - return r.release();
|
| + return r;
|
| }
|
|
|
| -
|
| } // namespace
|
|
|
| -DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(Request);
|
| -
|
| -PassRefPtrWillBeRawPtr<Request> Request::create(ExecutionContext* context, const String& input, ExceptionState& exceptionState)
|
| +Request* Request::create(ExecutionContext* context, const String& input, ExceptionState& exceptionState)
|
| {
|
| return create(context, input, Dictionary(), exceptionState);
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<Request> Request::create(ExecutionContext* context, const String& input, const Dictionary& init, ExceptionState& exceptionState)
|
| +Request* Request::create(ExecutionContext* context, const String& input, const Dictionary& init, ExceptionState& exceptionState)
|
| {
|
| // "1. Let |request| be |input|'s associated request, if |input| is a
|
| // Request object, and a new request otherwise."
|
| - RefPtrWillBeRawPtr<FetchRequestData> request(FetchRequestData::create(context));
|
| + FetchRequestData* request(FetchRequestData::create(context));
|
| // "2. Set |request| to a restricted copy of itself."
|
| request = request->createRestrictedCopy(context, SecurityOrigin::create(context->url()));
|
| // "5. If |input| is a string, run these substeps:"
|
| @@ -181,41 +178,41 @@ PassRefPtrWillBeRawPtr<Request> Request::create(ExecutionContext* context, const
|
| // "2. If |parsedURL| is failure, throw a TypeError."
|
| if (!parsedURL.isValid()) {
|
| exceptionState.throwTypeError("Invalid URL");
|
| - return nullptr;
|
| + return 0;
|
| }
|
| // "3. Set |request|'s url to |parsedURL|."
|
| request->setURL(parsedURL);
|
| // "4. Set |fallbackMode| to CORS."
|
| // "5. Set |fallbackCredentials| to omit."
|
| - return createRequestWithRequestData(request.release(), RequestInit(context, init, exceptionState), FetchRequestData::CORSMode, FetchRequestData::OmitCredentials, exceptionState);
|
| + return createRequestWithRequestData(request, RequestInit(context, init, exceptionState), FetchRequestData::CORSMode, FetchRequestData::OmitCredentials, exceptionState);
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<Request> Request::create(ExecutionContext* context, Request* input, ExceptionState& exceptionState)
|
| +Request* Request::create(ExecutionContext* context, Request* input, ExceptionState& exceptionState)
|
| {
|
| return create(context, input, Dictionary(), exceptionState);
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<Request> Request::create(ExecutionContext* context, Request* input, const Dictionary& init, ExceptionState& exceptionState)
|
| +Request* Request::create(ExecutionContext* context, Request* input, const Dictionary& init, ExceptionState& exceptionState)
|
| {
|
| // "1. Let |request| be |input|'s associated request, if |input| is a
|
| // Request object, and a new request otherwise."
|
| // "2. Set |request| to a restricted copy of itself."
|
| - RefPtrWillBeRawPtr<FetchRequestData> request(input->request()->createRestrictedCopy(context, SecurityOrigin::create(context->url())));
|
| + FetchRequestData* request(input->request()->createRestrictedCopy(context, SecurityOrigin::create(context->url())));
|
| // "3. Let |fallbackMode| be null."
|
| // "4. Let |fallbackCredentials| be null."
|
| // Instead of using null as a special fallback value, just pass the current
|
| // mode and credentials; it has the same effect.
|
| const FetchRequestData::Mode currentMode = request->mode();
|
| const FetchRequestData::Credentials currentCredentials = request->credentials();
|
| - return createRequestWithRequestData(request.release(), RequestInit(context, init, exceptionState), currentMode, currentCredentials, exceptionState);
|
| + return createRequestWithRequestData(request, RequestInit(context, init, exceptionState), currentMode, currentCredentials, exceptionState);
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<Request> Request::create(PassRefPtrWillBeRawPtr<FetchRequestData> request)
|
| +Request* Request::create(FetchRequestData* request)
|
| {
|
| - return adoptRefWillBeNoop(new Request(request));
|
| + return new Request(request);
|
| }
|
|
|
| -Request::Request(PassRefPtrWillBeRawPtr<FetchRequestData> request)
|
| +Request::Request(FetchRequestData* request)
|
| : m_request(request)
|
| , m_headers(Headers::create(m_request->headerList()))
|
| {
|
| @@ -223,9 +220,9 @@ Request::Request(PassRefPtrWillBeRawPtr<FetchRequestData> request)
|
| ScriptWrappable::init(this);
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<Request> Request::create(const WebServiceWorkerRequest& webRequest)
|
| +Request* Request::create(const WebServiceWorkerRequest& webRequest)
|
| {
|
| - return adoptRefWillBeNoop(new Request(webRequest));
|
| + return new Request(webRequest);
|
| }
|
|
|
| Request::Request(const WebServiceWorkerRequest& webRequest)
|
| @@ -252,10 +249,10 @@ String Request::url() const
|
| return url;
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<FetchBodyStream> Request::body(ExecutionContext* context)
|
| +FetchBodyStream* Request::body(ExecutionContext* context)
|
| {
|
| if (!m_request->blobDataHandle())
|
| - return nullptr;
|
| + return 0;
|
| if (!m_fetchBodyStream)
|
| m_fetchBodyStream = FetchBodyStream::create(context, m_request->blobDataHandle());
|
| return m_fetchBodyStream;
|
|
|