fix(perf): support prod mode again
After splitting the facades into multiple modules, enabling prod mode for code had no effect for the compiler. Also in a change between RC1 and RC2 we created the `CompilerConfig` via a provider with `useValue` and not via a `useFactory`, which reads the prod mode too early. Closes #9318 Closes #8508 Closes #9318
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
import {ApplicationRef, DebugNode, NgZone, RootRenderer, getDebugNode} from '@angular/core';
|
||||
import {ApplicationRef, DebugNode, NgZone, RootRenderer, getDebugNode, isDevMode} from '@angular/core';
|
||||
|
||||
import {DebugDomRootRenderer} from '../../../core_private';
|
||||
import {assertionsEnabled} from '../../facade/lang';
|
||||
import {getDOM} from '../dom_adapter';
|
||||
import {DomRootRenderer} from '../dom_renderer';
|
||||
|
||||
@ -24,7 +23,7 @@ export function inspectNativeElement(element: any /** TODO #9100 */): DebugNode
|
||||
}
|
||||
|
||||
function _createConditionalRootRenderer(rootRenderer: any /** TODO #9100 */) {
|
||||
if (assertionsEnabled()) {
|
||||
if (isDevMode()) {
|
||||
return _createRootRenderer(rootRenderer);
|
||||
}
|
||||
return rootRenderer;
|
||||
|
@ -1,9 +1,11 @@
|
||||
import {isDevMode} from '@angular/core';
|
||||
|
||||
import {DomAdapter, getDOM} from '../dom/dom_adapter';
|
||||
import {assertionsEnabled} from '../facade/lang';
|
||||
|
||||
import {sanitizeUrl} from './url_sanitizer';
|
||||
|
||||
|
||||
|
||||
/** A <body> element that can be safely used to parse untrusted HTML. Lazily initialized below. */
|
||||
let inertElement: HTMLElement = null;
|
||||
/** Lazily initialized to make sure the DOM adapter gets set before use. */
|
||||
@ -256,7 +258,7 @@ export function sanitizeHtml(unsafeHtml: string): string {
|
||||
DOM.removeChild(parent, child);
|
||||
}
|
||||
|
||||
if (assertionsEnabled() && safeHtml !== unsafeHtml) {
|
||||
if (isDevMode() && safeHtml !== unsafeHtml) {
|
||||
DOM.log('WARNING: sanitizing HTML stripped some content.');
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
import {isDevMode} from '@angular/core';
|
||||
|
||||
import {getDOM} from '../dom/dom_adapter';
|
||||
import {assertionsEnabled} from '../facade/lang';
|
||||
|
||||
import {sanitizeUrl} from './url_sanitizer';
|
||||
|
||||
|
||||
/**
|
||||
* Regular expression for safe style values.
|
||||
*
|
||||
@ -81,7 +83,7 @@ export function sanitizeStyle(value: string): string {
|
||||
return value; // Safe style values.
|
||||
}
|
||||
|
||||
if (assertionsEnabled()) getDOM().log('WARNING: sanitizing unsafe style value ' + value);
|
||||
if (isDevMode()) getDOM().log('WARNING: sanitizing unsafe style value ' + value);
|
||||
|
||||
return 'unsafe';
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
import {isDevMode} from '@angular/core';
|
||||
|
||||
import {getDOM} from '../dom/dom_adapter';
|
||||
import {assertionsEnabled} from '../facade/lang';
|
||||
|
||||
|
||||
/**
|
||||
* A pattern that recognizes a commonly useful subset of URLs that are safe.
|
||||
@ -37,7 +39,7 @@ export function sanitizeUrl(url: string): string {
|
||||
url = String(url);
|
||||
if (url.match(SAFE_URL_PATTERN) || url.match(DATA_URL_PATTERN)) return url;
|
||||
|
||||
if (assertionsEnabled()) getDOM().log('WARNING: sanitizing unsafe URL value ' + url);
|
||||
if (isDevMode()) getDOM().log('WARNING: sanitizing unsafe URL value ' + url);
|
||||
|
||||
return 'unsafe:' + url;
|
||||
}
|
||||
|
Reference in New Issue
Block a user