source: trip-planner-front/node_modules/@angular/common/esm2015/http/src/jsonp.js@ bdd6491

Last change on this file since bdd6491 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 27.6 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { DOCUMENT } from '@angular/common';
9import { Inject, Injectable } from '@angular/core';
10import { Observable } from 'rxjs';
11import { HttpErrorResponse, HttpEventType, HttpResponse } from './response';
12// Every request made through JSONP needs a callback name that's unique across the
13// whole page. Each request is assigned an id and the callback name is constructed
14// from that. The next id to be assigned is tracked in a global variable here that
15// is shared among all applications on the page.
16let nextRequestId = 0;
17// Error text given when a JSONP script is injected, but doesn't invoke the callback
18// passed in its URL.
19export const JSONP_ERR_NO_CALLBACK = 'JSONP injected script did not invoke callback.';
20// Error text given when a request is passed to the JsonpClientBackend that doesn't
21// have a request method JSONP.
22export const JSONP_ERR_WRONG_METHOD = 'JSONP requests must use JSONP request method.';
23export const JSONP_ERR_WRONG_RESPONSE_TYPE = 'JSONP requests must use Json response type.';
24/**
25 * DI token/abstract type representing a map of JSONP callbacks.
26 *
27 * In the browser, this should always be the `window` object.
28 *
29 *
30 */
31export class JsonpCallbackContext {
32}
33/**
34 * Processes an `HttpRequest` with the JSONP method,
35 * by performing JSONP style requests.
36 * @see `HttpHandler`
37 * @see `HttpXhrBackend`
38 *
39 * @publicApi
40 */
41export class JsonpClientBackend {
42 constructor(callbackMap, document) {
43 this.callbackMap = callbackMap;
44 this.document = document;
45 /**
46 * A resolved promise that can be used to schedule microtasks in the event handlers.
47 */
48 this.resolvedPromise = Promise.resolve();
49 }
50 /**
51 * Get the name of the next callback method, by incrementing the global `nextRequestId`.
52 */
53 nextCallback() {
54 return `ng_jsonp_callback_${nextRequestId++}`;
55 }
56 /**
57 * Processes a JSONP request and returns an event stream of the results.
58 * @param req The request object.
59 * @returns An observable of the response events.
60 *
61 */
62 handle(req) {
63 // Firstly, check both the method and response type. If either doesn't match
64 // then the request was improperly routed here and cannot be handled.
65 if (req.method !== 'JSONP') {
66 throw new Error(JSONP_ERR_WRONG_METHOD);
67 }
68 else if (req.responseType !== 'json') {
69 throw new Error(JSONP_ERR_WRONG_RESPONSE_TYPE);
70 }
71 // Everything else happens inside the Observable boundary.
72 return new Observable((observer) => {
73 // The first step to make a request is to generate the callback name, and replace the
74 // callback placeholder in the URL with the name. Care has to be taken here to ensure
75 // a trailing &, if matched, gets inserted back into the URL in the correct place.
76 const callback = this.nextCallback();
77 const url = req.urlWithParams.replace(/=JSONP_CALLBACK(&|$)/, `=${callback}$1`);
78 // Construct the <script> tag and point it at the URL.
79 const node = this.document.createElement('script');
80 node.src = url;
81 // A JSONP request requires waiting for multiple callbacks. These variables
82 // are closed over and track state across those callbacks.
83 // The response object, if one has been received, or null otherwise.
84 let body = null;
85 // Whether the response callback has been called.
86 let finished = false;
87 // Whether the request has been cancelled (and thus any other callbacks)
88 // should be ignored.
89 let cancelled = false;
90 // Set the response callback in this.callbackMap (which will be the window
91 // object in the browser. The script being loaded via the <script> tag will
92 // eventually call this callback.
93 this.callbackMap[callback] = (data) => {
94 // Data has been received from the JSONP script. Firstly, delete this callback.
95 delete this.callbackMap[callback];
96 // Next, make sure the request wasn't cancelled in the meantime.
97 if (cancelled) {
98 return;
99 }
100 // Set state to indicate data was received.
101 body = data;
102 finished = true;
103 };
104 // cleanup() is a utility closure that removes the <script> from the page and
105 // the response callback from the window. This logic is used in both the
106 // success, error, and cancellation paths, so it's extracted out for convenience.
107 const cleanup = () => {
108 // Remove the <script> tag if it's still on the page.
109 if (node.parentNode) {
110 node.parentNode.removeChild(node);
111 }
112 // Remove the response callback from the callbackMap (window object in the
113 // browser).
114 delete this.callbackMap[callback];
115 };
116 // onLoad() is the success callback which runs after the response callback
117 // if the JSONP script loads successfully. The event itself is unimportant.
118 // If something went wrong, onLoad() may run without the response callback
119 // having been invoked.
120 const onLoad = (event) => {
121 // Do nothing if the request has been cancelled.
122 if (cancelled) {
123 return;
124 }
125 // We wrap it in an extra Promise, to ensure the microtask
126 // is scheduled after the loaded endpoint has executed any potential microtask itself,
127 // which is not guaranteed in Internet Explorer and EdgeHTML. See issue #39496
128 this.resolvedPromise.then(() => {
129 // Cleanup the page.
130 cleanup();
131 // Check whether the response callback has run.
132 if (!finished) {
133 // It hasn't, something went wrong with the request. Return an error via
134 // the Observable error path. All JSONP errors have status 0.
135 observer.error(new HttpErrorResponse({
136 url,
137 status: 0,
138 statusText: 'JSONP Error',
139 error: new Error(JSONP_ERR_NO_CALLBACK),
140 }));
141 return;
142 }
143 // Success. body either contains the response body or null if none was
144 // returned.
145 observer.next(new HttpResponse({
146 body,
147 status: 200 /* Ok */,
148 statusText: 'OK',
149 url,
150 }));
151 // Complete the stream, the response is over.
152 observer.complete();
153 });
154 };
155 // onError() is the error callback, which runs if the script returned generates
156 // a Javascript error. It emits the error via the Observable error channel as
157 // a HttpErrorResponse.
158 const onError = (error) => {
159 // If the request was already cancelled, no need to emit anything.
160 if (cancelled) {
161 return;
162 }
163 cleanup();
164 // Wrap the error in a HttpErrorResponse.
165 observer.error(new HttpErrorResponse({
166 error,
167 status: 0,
168 statusText: 'JSONP Error',
169 url,
170 }));
171 };
172 // Subscribe to both the success (load) and error events on the <script> tag,
173 // and add it to the page.
174 node.addEventListener('load', onLoad);
175 node.addEventListener('error', onError);
176 this.document.body.appendChild(node);
177 // The request has now been successfully sent.
178 observer.next({ type: HttpEventType.Sent });
179 // Cancellation handler.
180 return () => {
181 // Track the cancellation so event listeners won't do anything even if already scheduled.
182 cancelled = true;
183 // Remove the event listeners so they won't run if the events later fire.
184 node.removeEventListener('load', onLoad);
185 node.removeEventListener('error', onError);
186 // And finally, clean up the page.
187 cleanup();
188 };
189 });
190 }
191}
192JsonpClientBackend.decorators = [
193 { type: Injectable }
194];
195JsonpClientBackend.ctorParameters = () => [
196 { type: JsonpCallbackContext },
197 { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
198];
199/**
200 * Identifies requests with the method JSONP and
201 * shifts them to the `JsonpClientBackend`.
202 *
203 * @see `HttpInterceptor`
204 *
205 * @publicApi
206 */
207export class JsonpInterceptor {
208 constructor(jsonp) {
209 this.jsonp = jsonp;
210 }
211 /**
212 * Identifies and handles a given JSONP request.
213 * @param req The outgoing request object to handle.
214 * @param next The next interceptor in the chain, or the backend
215 * if no interceptors remain in the chain.
216 * @returns An observable of the event stream.
217 */
218 intercept(req, next) {
219 if (req.method === 'JSONP') {
220 return this.jsonp.handle(req);
221 }
222 // Fall through for normal HTTP requests.
223 return next.handle(req);
224 }
225}
226JsonpInterceptor.decorators = [
227 { type: Injectable }
228];
229JsonpInterceptor.ctorParameters = () => [
230 { type: JsonpClientBackend }
231];
232//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoianNvbnAuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9jb21tb24vaHR0cC9zcmMvanNvbnAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT0FBTyxFQUFDLFFBQVEsRUFBQyxNQUFNLGlCQUFpQixDQUFDO0FBQ3pDLE9BQU8sRUFBQyxNQUFNLEVBQUUsVUFBVSxFQUFDLE1BQU0sZUFBZSxDQUFDO0FBQ2pELE9BQU8sRUFBQyxVQUFVLEVBQVcsTUFBTSxNQUFNLENBQUM7QUFJMUMsT0FBTyxFQUFDLGlCQUFpQixFQUFhLGFBQWEsRUFBRSxZQUFZLEVBQWlCLE1BQU0sWUFBWSxDQUFDO0FBR3JHLGtGQUFrRjtBQUNsRixrRkFBa0Y7QUFDbEYsa0ZBQWtGO0FBQ2xGLGdEQUFnRDtBQUNoRCxJQUFJLGFBQWEsR0FBVyxDQUFDLENBQUM7QUFFOUIsb0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