Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !2432

Determines whether PUBLIC_URL is same-origin before registering SW.

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/jeffposnick/check-public-url-origin into master May 31, 2017
  • Overview 7
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: jeffposnick

R: @Timer @gaearon FYI: @addyosmani

This is a bit more explicit than trying to use a regular expression. It uses the URL object inside of a block that first checks to see if navigator.serviceWorker is defined; URL should always exist in browsers that support service workers.

From testing locally, I saw scenarios in which process.env.PUBLIC_URL wasn't set at all (which contradicts what @Timer suggested in the issue).

The code in this PR should behave properly regardless of whether it's unset, whether it's set to a local path, or whether it's set to a full URL.

Fixes #2374 (closed)

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/jeffposnick/check-public-url-origin