From 67dfaada274f43d5df73c45238272fc2358d53aa Mon Sep 17 00:00:00 2001 From: Albert Gasset Date: Wed, 13 Mar 2019 10:00:57 +0100 Subject: [PATCH 1/2] MOBILE-2915 core: Inject CSS safely --- src/components/style/style.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/style/style.ts b/src/components/style/style.ts index a4420f6b9..b0790ca96 100644 --- a/src/components/style/style.ts +++ b/src/components/style/style.ts @@ -38,10 +38,12 @@ export class CoreStyleComponent implements OnChanges { * Component being changed. */ ngOnChanges(changes: { [name: string]: SimpleChange }): void { - const css = this.prefixCSS(this.css, this.prefix); - if (this.element && this.element.nativeElement) { - this.element.nativeElement.innerHTML = ''; + const style = document.createElement('style'); + style.innerText = this.prefixCSS(this.css, this.prefix); + + this.element.nativeElement.innerHTML = ''; + this.element.nativeElement.appendChild(style); } } From b5a75a4108191a0bf7aa640b959d990f6637a3dd Mon Sep 17 00:00:00 2001 From: Albert Gasset Date: Wed, 13 Mar 2019 16:47:27 +0100 Subject: [PATCH 2/2] MOBILE-2915 site: Don't clone errors, they might contain cyclic references --- src/classes/site.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/classes/site.ts b/src/classes/site.ts index 04d133a2c..acdde5a92 100644 --- a/src/classes/site.ts +++ b/src/classes/site.ts @@ -579,8 +579,6 @@ export class CoreSite { return this.ongoingRequests[cacheId].then((response) => { // Clone the data, this may prevent errors if in the callback the object is modified. return this.utils.clone(response); - }).catch((error) => { - return Promise.reject(this.utils.clone(error)); }); } @@ -701,8 +699,6 @@ export class CoreSite { return promise.then((response) => { // We pass back a clone of the original object, this may prevent errors if in the callback the object is modified. return this.utils.clone(response); - }).catch((error) => { - return Promise.reject(this.utils.clone(error)); }); }