diff --git a/goldens/public-api/core/errors.api.md b/goldens/public-api/core/errors.api.md
index c344beb6cb8..56bb883d919 100644
--- a/goldens/public-api/core/errors.api.md
+++ b/goldens/public-api/core/errors.api.md
@@ -58,10 +58,6 @@ export const enum RuntimeErrorCode {
// (undocumented)
HOST_DIRECTIVE_UNRESOLVABLE = 307,
// (undocumented)
- HTML_SANITIZATION_CLOBBERED = 921,
- // (undocumented)
- HTML_SANITIZATION_UNSTABLE = 920,
- // (undocumented)
HYDRATION_MISSING_NODE = -502,
// (undocumented)
HYDRATION_MISSING_SIBLINGS = -501,
@@ -176,8 +172,6 @@ export const enum RuntimeErrorCode {
// (undocumented)
RUNTIME_DEPS_ORPHAN_COMPONENT = 981,
// (undocumented)
- SANITIZATION_BYPASS_TYPE_MISMATCH = 922,
- // (undocumented)
SIGNAL_WRITE_FROM_ILLEGAL_CONTEXT = 600,
// (undocumented)
TEMPLATE_STRUCTURE_ERROR = 305,
diff --git a/packages/core/src/errors.ts b/packages/core/src/errors.ts
index 5e1130ab360..3cba1178a71 100644
--- a/packages/core/src/errors.ts
+++ b/packages/core/src/errors.ts
@@ -135,9 +135,6 @@ export const enum RuntimeErrorCode {
NO_COMPONENT_FACTORY_FOUND = 917,
EXTERNAL_RESOURCE_LOADING_FAILED = 918,
DEF_TYPE_UNDEFINED = -919,
- HTML_SANITIZATION_UNSTABLE = 920,
- HTML_SANITIZATION_CLOBBERED = 921,
- SANITIZATION_BYPASS_TYPE_MISMATCH = 922,
// Signal integration errors
REQUIRED_INPUT_NO_VALUE = -950,
diff --git a/packages/core/src/sanitization/bypass.ts b/packages/core/src/sanitization/bypass.ts
index e8e689de0e3..0926d9e9c7f 100644
--- a/packages/core/src/sanitization/bypass.ts
+++ b/packages/core/src/sanitization/bypass.ts
@@ -7,7 +7,6 @@
*/
import {XSS_SECURITY_URL} from '../error_details_base_url';
-import {RuntimeError, RuntimeErrorCode} from '../errors';
export const enum BypassType {
Url = 'URL',
@@ -129,10 +128,7 @@ export function allowSanitizationBypassAndThrow(value: any, type: BypassType): b
if (actualType != null && actualType !== type) {
// Allow ResourceURLs in URL contexts, they are strictly more trusted.
if (actualType === BypassType.ResourceUrl && type === BypassType.Url) return true;
- throw new RuntimeError(
- RuntimeErrorCode.SANITIZATION_BYPASS_TYPE_MISMATCH,
- ngDevMode && `Required a safe ${type}, got a ${actualType} (see ${XSS_SECURITY_URL})`,
- );
+ throw new Error(`Required a safe ${type}, got a ${actualType} (see ${XSS_SECURITY_URL})`);
}
return actualType === type;
}
diff --git a/packages/core/src/sanitization/html_sanitizer.ts b/packages/core/src/sanitization/html_sanitizer.ts
index 26c3de73765..e2f5a72bedb 100644
--- a/packages/core/src/sanitization/html_sanitizer.ts
+++ b/packages/core/src/sanitization/html_sanitizer.ts
@@ -7,7 +7,6 @@
*/
import {XSS_SECURITY_URL} from '../error_details_base_url';
-import {RuntimeError, RuntimeErrorCode} from '../errors';
import {TrustedHTML} from '../util/security/trusted_type_defs';
import {trustedHTMLFromString} from '../util/security/trusted_types';
@@ -263,10 +262,8 @@ export function getNodeName(node: Node): string {
}
function clobberedElementError(node: Node) {
- return new RuntimeError(
- RuntimeErrorCode.HTML_SANITIZATION_CLOBBERED,
- ngDevMode &&
- `Failed to sanitize html because the element is clobbered: ${(node as Element).outerHTML}`,
+ return new Error(
+ `Failed to sanitize html because the element is clobbered: ${(node as Element).outerHTML}`,
);
}
@@ -317,10 +314,7 @@ export function _sanitizeHtml(defaultDoc: any, unsafeHtmlInput: string): Trusted
do {
if (mXSSAttempts === 0) {
- throw new RuntimeError(
- RuntimeErrorCode.HTML_SANITIZATION_UNSTABLE,
- ngDevMode && 'Failed to sanitize html because the input is unstable',
- );
+ throw new Error('Failed to sanitize html because the input is unstable');
}
mXSSAttempts--;
diff --git a/packages/core/test/sanitization/html_sanitizer_spec.ts b/packages/core/test/sanitization/html_sanitizer_spec.ts
index 108a465d395..4a729b4cc54 100644
--- a/packages/core/test/sanitization/html_sanitizer_spec.ts
+++ b/packages/core/test/sanitization/html_sanitizer_spec.ts
@@ -254,12 +254,9 @@ describe('HTML sanitizer', () => {
// depending on a platform.
if (isBrowser) {
// Running in a real browser
- expect(nextSibling).toThrowError(
- /Failed to sanitize html because the element is clobbered: /,
- );
- expect(firstChild).toThrowError(
- /Failed to sanitize html because the element is clobbered: