Skip to content

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

Closed
H--o-l wants to merge 1 commit into
angular:masterfrom
H--o-l:fix/service-worker-safari-v8
Closed

H--o-l wants to merge 1 commit into
angular:masterfrom
H--o-l:fix/service-worker-safari-v8

Conversation

@H--o-l

@H--o-l H--o-l commented Jun 19, 2019

Copy link
Copy Markdown
Contributor

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 a team June 19, 2019 17:08
@H--o-l
H--o-l force-pushed the fix/service-worker-safari-v8 branch 3 times, most recently from 95e2166 to 1e6d482 Compare June 19, 2019 17:27
@kara kara added the area: service-worker Issues related to the @angular/service-worker package label Jun 19, 2019
@ngbot ngbot Bot added this to the needsTriage milestone Jun 19, 2019

@IgorMinar IgorMinar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@IgorMinar

IgorMinar commented Jun 20, 2019 •

Copy link
Copy Markdown
Contributor

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 fix/service-worker-safari-v8 branch from 1e6d482 to 55fe5b8 Compare June 20, 2019 07:48
@H--o-l

H--o-l commented Jun 20, 2019

Copy link
Copy Markdown
Contributor Author

@IgorMinar CI looks good now, thanks!

@gkalpak gkalpak added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews target: patch This PR is targeted for the next patch release type: bug/fix labels Jun 20, 2019

@gkalpak gkalpak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 fix/service-worker-safari-v8 branch from 55fe5b8 to 34d7dc5 Compare June 20, 2019 14:05
@H--o-l

H--o-l commented Jun 20, 2019

Copy link
Copy Markdown
Contributor Author

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

@gkalpak gkalpak left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

H--o-l commented Jun 20, 2019

Copy link
Copy Markdown
Contributor Author

^^ 🤞

@H--o-l

H--o-l commented Jun 24, 2019

Copy link
Copy Markdown
Contributor Author

@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

gkalpak commented Jun 24, 2019

Copy link
Copy Markdown
Member

@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

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 angular#31061
@H--o-l
H--o-l force-pushed the fix/service-worker-safari-v8 branch from 34d7dc5 to 36066a9 Compare June 24, 2019 15:03
@H--o-l

H--o-l commented Jun 24, 2019

Copy link
Copy Markdown
Contributor Author

@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 gkalpak added action: merge The PR is ready for merge by the caretaker and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Jun 24, 2019
@gkalpak

gkalpak commented Jun 24, 2019

Copy link
Copy Markdown
Member

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 pushed a commit that referenced this pull request Jun 24, 2019
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 fix/service-worker-safari-v8 branch June 24, 2019 22:13
@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Sep 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: service-worker Issues related to the @angular/service-worker package cla: yes target: patch This PR is targeted for the next patch release type: bug/fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Service worker registration failed in Safari angular 8

5 participants