MCPcopy Index your code
hub / github.com/angular/angular / isSafeOriginChange

Function isSafeOriginChange

packages/platform-server/src/url.ts:138–153  ·  view source on GitHub ↗

* Checks if the origin has changed in a safe way. * * @param resolved The resolved URL. * @param origin The origin URL. * @param urlStr The URL string. * @param allowOriginChange Whether to allow origin changes. * @returns True if the origin has changed in a safe way, false otherwise.

(
  resolved: URL,
  origin: URL,
  urlStr: string,
  allowOriginChange: boolean,
)

Source from the content-addressed store, hash-verified

136 * @returns True if the origin has changed in a safe way, false otherwise.
137 */
138function isSafeOriginChange(
139 resolved: URL,
140 origin: URL,
141 urlStr: string,
142 allowOriginChange: boolean,
143): boolean {
144 if (origin.origin === resolved.origin) {
145 return true;
146 }
147
148 if (!allowOriginChange) {
149 return false;
150 }
151
152 return HTTP_OR_HTTPS_PROTOCOL_REGEX.test(urlStr);
153}

Callers 1

resolveUrlFunction · 0.85

Calls 1

testMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…