@@ -10,10 +10,10 @@ import {animate, AnimationBuilder, state, style, transition, trigger} from '@ang
1010import { DOCUMENT , isPlatformServer , PlatformLocation , ɵgetDOM as getDOM } from '@angular/common' ;
1111import { HTTP_INTERCEPTORS , HttpClient , HttpClientModule , HttpEvent , HttpHandler , HttpInterceptor , HttpRequest } from '@angular/common/http' ;
1212import { HttpClientTestingModule , HttpTestingController } from '@angular/common/http/testing' ;
13- import { ApplicationRef , CompilerFactory , Component , destroyPlatform , getPlatform , HostBinding , HostListener , importProvidersFrom , Inject , Injectable , Input , NgModule , NgZone , OnInit , PLATFORM_ID , PlatformRef , Type , ViewEncapsulation } from '@angular/core' ;
13+ import { ApplicationRef , CompilerFactory , Component , destroyPlatform , getPlatform , HostListener , Inject , Injectable , Input , NgModule , NgZone , PLATFORM_ID , PlatformRef , ViewEncapsulation } from '@angular/core' ;
1414import { inject , TestBed , waitForAsync } from '@angular/core/testing' ;
15- import { BrowserModule , makeStateKey , Title , TransferState } from '@angular/platform-browser' ;
16- import { BEFORE_APP_SERIALIZED , INITIAL_CONFIG , platformDynamicServer , PlatformState , renderModule , renderModuleFactory , ServerModule , ServerTransferStateModule } from '@angular/platform-server' ;
15+ import { BrowserModule , Title } from '@angular/platform-browser' ;
16+ import { BEFORE_APP_SERIALIZED , INITIAL_CONFIG , platformDynamicServer , PlatformState , renderModule , renderModuleFactory , ServerModule } from '@angular/platform-server' ;
1717import { Observable } from 'rxjs' ;
1818import { first } from 'rxjs/operators' ;
1919
@@ -389,19 +389,6 @@ const [MyHostComponentStandalone, _] = createFalseAttributesComponents(true);
389389class FalseAttributesModule {
390390}
391391
392- @Component ( { selector : 'app' , template : '<div [innerText]="foo"></div>' } )
393- class InnerTextComponent {
394- foo = 'Some text' ;
395- }
396-
397- @NgModule ( {
398- declarations : [ InnerTextComponent ] ,
399- bootstrap : [ InnerTextComponent ] ,
400- imports : [ ServerModule , BrowserModule . withServerTransition ( { appId : 'inner-text' } ) ]
401- } )
402- class InnerTextModule {
403- }
404-
405392function createMyInputComponent ( standalone : boolean ) {
406393 @Component ( {
407394 standalone,
@@ -449,47 +436,6 @@ const HTMLTypesAppStandalone = createHTMLTypesApp(true);
449436class HTMLTypesModule {
450437}
451438
452- const TEST_KEY = makeStateKey < number > ( 'test' ) ;
453- const STRING_KEY = makeStateKey < string > ( 'testString' ) ;
454-
455- @Component ( { selector : 'app' , template : 'Works!' } )
456- class TransferComponent {
457- constructor ( private transferStore : TransferState ) { }
458- ngOnInit ( ) {
459- this . transferStore . set ( TEST_KEY , 10 ) ;
460- }
461- }
462-
463- @Component ( { selector : 'esc-app' , template : 'Works!' } )
464- class EscapedComponent {
465- constructor ( private transferStore : TransferState ) { }
466- ngOnInit ( ) {
467- this . transferStore . set ( STRING_KEY , '</script><script>alert(\'Hello&\' + "World");' ) ;
468- }
469- }
470-
471- @NgModule ( {
472- bootstrap : [ TransferComponent ] ,
473- declarations : [ TransferComponent ] ,
474- imports : [
475- BrowserModule . withServerTransition ( { appId : 'transfer' } ) ,
476- ServerModule ,
477- ]
478- } )
479- class TransferStoreModule {
480- }
481-
482- @NgModule ( {
483- bootstrap : [ EscapedComponent ] ,
484- declarations : [ EscapedComponent ] ,
485- imports : [
486- BrowserModule . withServerTransition ( { appId : 'transfer' } ) ,
487- ServerModule ,
488- ]
489- } )
490- class EscapedTransferStoreModule {
491- }
492-
493439function createMyHiddenComponent ( standalone : boolean ) {
494440 @Component ( {
495441 standalone,
@@ -1310,50 +1256,5 @@ describe('platform-server integration', () => {
13101256 } ) ;
13111257 } ) ;
13121258 } ) ;
1313-
1314- describe ( 'ServerTransferStoreModule' , ( ) => {
1315- let called = false ;
1316- const defaultExpectedOutput =
1317- '<html><head></head><body><app ng-version="0.0.0-PLACEHOLDER" ng-server-context="other">Works!</app><script id="transfer-state" type="application/json">{&q;test&q;:10}</script></body></html>' ;
1318-
1319- beforeEach ( ( ) => {
1320- called = false ;
1321- } ) ;
1322- afterEach ( ( ) => {
1323- expect ( called ) . toBe ( true ) ;
1324- } ) ;
1325-
1326- it ( 'adds transfer script tag when using renderModule' , waitForAsync ( ( ) => {
1327- renderModule ( TransferStoreModule , { document : '<app></app>' } ) . then ( output => {
1328- expect ( output ) . toBe ( defaultExpectedOutput ) ;
1329- called = true ;
1330- } ) ;
1331- } ) ) ;
1332-
1333- it ( 'adds transfer script tag when using renderModuleFactory' ,
1334- waitForAsync ( inject ( [ PlatformRef ] , ( defaultPlatform : PlatformRef ) => {
1335- const compilerFactory : CompilerFactory =
1336- defaultPlatform . injector . get ( CompilerFactory , null ) ! ;
1337- const moduleFactory =
1338- compilerFactory . createCompiler ( ) . compileModuleSync ( TransferStoreModule ) ;
1339- renderModuleFactory ( moduleFactory , { document : '<app></app>' } ) . then ( output => {
1340- expect ( output ) . toBe ( defaultExpectedOutput ) ;
1341- called = true ;
1342- } ) ;
1343- } ) ) ) ;
1344-
1345- it ( 'cannot break out of <script> tag in serialized output' , waitForAsync ( ( ) => {
1346- renderModule ( EscapedTransferStoreModule , {
1347- document : '<esc-app></esc-app>'
1348- } ) . then ( output => {
1349- expect ( output ) . toBe (
1350- '<html><head></head><body><esc-app ng-version="0.0.0-PLACEHOLDER" ng-server-context="other">Works!</esc-app>' +
1351- '<script id="transfer-state" type="application/json">' +
1352- '{&q;testString&q;:&q;&l;/script&g;&l;script&g;' +
1353- 'alert(&s;Hello&a;&s; + \\&q;World\\&q;);&q;}</script></body></html>' ) ;
1354- called = true ;
1355- } ) ;
1356- } ) ) ;
1357- } ) ;
13581259} ) ;
13591260} ) ( ) ;
0 commit comments