Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(service-worker): registration failed on Safari #31140

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
5 participants
@H--o-l
Copy link
Contributor

commented Jun 19, 2019

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Service worker failed to register on Safari.

What is the new behavior?

Registered service worker.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

It's a regression of Angular v8, it was ok in v7.
Closes #31061

@H--o-l H--o-l requested a review from angular/fw-service-worker as a code owner Jun 19, 2019

@googlebot googlebot added the cla: yes label Jun 19, 2019

@H--o-l H--o-l force-pushed the H--o-l:fix/service-worker-safari-v8 branch 3 times, most recently from 95e2166 to 1e6d482 Jun 19, 2019

@ngbot ngbot bot added this to the needsTriage milestone Jun 19, 2019

@IgorMinar
Copy link
Member

left a comment

thanks!

@IgorMinar

This comment has been minimized.

Copy link
Member

commented Jun 20, 2019

I tried to rerun the CI as the errors that showed up seem no longer present on the lastest master. If that doesn't help @H--o-l can you please rebase your PR on top of the most recent master and forcepush to this branch?

git fetch upstream
git rebase upstream/master
git push --force-with-lease

thanks!

@H--o-l H--o-l force-pushed the H--o-l:fix/service-worker-safari-v8 branch from 1e6d482 to 55fe5b8 Jun 20, 2019

@H--o-l

This comment has been minimized.

Copy link
Contributor Author

commented Jun 20, 2019

@IgorMinar CI looks good now, thanks!

@gkalpak
Copy link
Member

left a comment

Thx, @H--o-l (both for the PR and for helping get to the bottom of it) 💯

A couple of suggestions (otherwise lgtm):

  • Could you, please, make the same change in worker/testing/scope.ts (just in case)?
  • Could you mention in the commit message that this was broken in commit b3dda0e?

@H--o-l H--o-l force-pushed the H--o-l:fix/service-worker-safari-v8 branch from 55fe5b8 to 34d7dc5 Jun 20, 2019

@H--o-l

This comment has been minimized.

Copy link
Contributor Author

commented Jun 20, 2019

@gkalpak I just amend the commit with both improvements. Don't hesitate to tell me if their is anything else.

@gkalpak
Copy link
Member

left a comment

LGTM 👍
Nit: In the commit message, you don't need [b3dda0e]: b3dda0e. Just use the first few digits of the SHA and GitHub will recognize it automatically and turn it into a link.

For future reference:
I don't think there a straight forward way to test this (given that URL is a built-in) and given how simple and non-controversial change this is, I think it is fine not having a test (famous last word 😁).

@H--o-l

This comment has been minimized.

Copy link
Contributor Author

commented Jun 20, 2019

^^ 🤞

@H--o-l

This comment has been minimized.

Copy link
Contributor Author

commented Jun 24, 2019

@IgorMinar @gkalpak Hello!
I'm not familiar with the PR workflow, do I need to do something on the PR for it to be merge-able?
Or you guys are on it?

@gkalpak

This comment has been minimized.

Copy link
Member

commented Jun 24, 2019

@H--o-l, can you please update the commit message to not contain [b3dda0e] and [b3dda0e]: b3dda0e but just b3dda0e (then ping me to mark the PR for merging)? I.e.:

fix(service-worker): registration failed on Safari

Since Angular v8, and commit b3dda0e, `parseUrl()` can be called without
`relativeTo`, thus `new URL()` can be called with `relativeTo = undefined`.

Safari does not like it and the service worker registration fails:
```js
new URL('https://angular.io/') // OK
new URL('https://angular.io/', undefined) // TypeError
```

Closes #31061

fix(service-worker): registration failed on Safari
Since Angular v8, and commit b3dda0e, `parseUrl()` can be called without
`relativeTo`, thus `new URL()` can be called with `relativeTo = undefined`.

Safari does not like it and the service worker registration fails:
```js
new URL('https://angular.io/') // OK
new URL('https://angular.io/', undefined) // TypeError
```

Closes #31061

@H--o-l H--o-l force-pushed the H--o-l:fix/service-worker-safari-v8 branch from 34d7dc5 to 36066a9 Jun 24, 2019

@H--o-l

This comment has been minimized.

Copy link
Contributor Author

commented Jun 24, 2019

@gkalpak Oh ok, since you accepted the PR in the same time you made the remark, I believed it was not mandatory.
I just fix the commit message and rebase the branch, thanks!

@gkalpak

This comment has been minimized.

Copy link
Member

commented Jun 24, 2019

Sorry for the confusion, @H--o-l. I approved it, but added the cleanup label; this was my (confusing) way of saying "This basically looks good to me, except for this one minor thing.".
I'll make sure I make that more explicit in the future.

I marked the PR for merging. Thx, again, for working on this ❤️

kara added a commit that referenced this pull request Jun 24, 2019

fix(service-worker): registration failed on Safari (#31140)
Since Angular v8, and commit b3dda0e, `parseUrl()` can be called without
`relativeTo`, thus `new URL()` can be called with `relativeTo = undefined`.

Safari does not like it and the service worker registration fails:
```js
new URL('https://angular.io/') // OK
new URL('https://angular.io/', undefined) // TypeError
```

Closes #31061

PR Close #31140

@kara kara closed this in a5dd4ed Jun 24, 2019

@H--o-l H--o-l deleted the H--o-l:fix/service-worker-safari-v8 branch Jun 24, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.