Skip to content

Canceling an in-progress JSONP request causes "callback undefined" console error #34818

@eppsilon

Description

@eppsilon

🐞 bug report

Affected Package

@angular/common/http

Is this a regression?

No

Description

It looks like HttpClientJsonpModule deletes the JSONP callback function for a request immediately upon cancellation. If the request was still in progress, an error is logged in the console when it completes because the function doesn't exist.

This issue occurs when the time between requests is usually lower than the time a request takes to complete.

🔬 Minimal Reproduction

https://angular-c6oeqi.stackblitz.io
https://stackblitz.com/edit/angular-c6oeqi

🔥 Exception or Error


Uncaught ReferenceError: ng_jsonp_callback_16 is not defined

🌍 Your Environment

Can be reproduced with Angular 8 (see repro) ‼️


Angular CLI: 6.2.9
Node: 8.17.0
OS: darwin x64
Angular: 6.1.10
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic
... platform-server, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.8.9
@angular-devkit/build-angular     0.8.9
@angular-devkit/build-optimizer   0.8.9
@angular-devkit/build-webpack     0.8.9
@angular-devkit/core              0.8.9
@angular-devkit/schematics        0.8.9
@angular/cdk                      6.4.7
@angular/cli                      6.2.9
@angular/language-service         7.2.15
@ngtools/webpack                  6.2.9
@schematics/angular               0.8.9
@schematics/update                0.8.9
rxjs                              6.2.2
typescript                        2.9.2
webpack                           4.16.4

Anything else relevant?
No

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions