Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/service-worker/worker/src/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ export class Adapter {
* Extract the pathname of a URL.
*/
parseUrl(url: string, relativeTo?: string): {origin: string, path: string, search: string} {
const parsed = new URL(url, relativeTo);
// Workaround a Safari bug, see
// https://github.com/angular/angular/issues/31061#issuecomment-503637978
const parsed = !relativeTo ? new URL(url) : new URL(url, relativeTo);
return {origin: parsed.origin, path: parsed.pathname, search: parsed.search};
}

Expand Down
2 changes: 1 addition & 1 deletion packages/service-worker/worker/testing/scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export class SwTestHarness implements ServiceWorkerGlobalScope, Adapter, Context

parseUrl(url: string, relativeTo?: string): {origin: string, path: string, search: string} {
const parsedUrl: URL = (typeof URL === 'function') ?
new URL(url, relativeTo) :
(!relativeTo ? new URL(url) : new URL(url, relativeTo)) :
require('url').parse(require('url').resolve(relativeTo || '', url));

return {
Expand Down